From 9934ab4251ccbd861b6767c855d33931fd122284 Mon Sep 17 00:00:00 2001 From: root Date: Sat, 16 Nov 2019 04:06:50 +0000 Subject: [PATCH] update --- story/utils.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/story/utils.py b/story/utils.py index c4daf0e..b965144 100644 --- a/story/utils.py +++ b/story/utils.py @@ -78,7 +78,9 @@ def cut_trailing_sentence(text): text = standardize_punctuation(text) last_punc = max(text.rfind('.'), text.rfind("!"), text.rfind("?")) - last_punc = min(text.rfind("<|endoftext|>"), last_punc) + et_token = text.rfind("<|endoftext|>") + if et_token != -1: + last_punc = min(last_punc, et_token) if last_punc > 0: text = text[0:last_punc+1]