friends:例句 only complete sentences (start-capital end-punct); unify header to 例句
This commit is contained in:
@@ -43,8 +43,10 @@ def load_sentences() -> list[str]:
|
||||
d = re.sub(r"\[[^\]]*\]", " ", d)
|
||||
d = re.sub(r"\([^)]*\)", " ", d)
|
||||
d = re.sub(r"\s+", " ", d).strip()
|
||||
if 4 <= len(d) <= 240:
|
||||
out.append(d)
|
||||
cands = [d] if (d[:1].isupper() and d[-1:] in ".!?") else [s.strip() for s in re.findall(r"[^.!?]*[.!?]", d)]
|
||||
for s in cands:
|
||||
if s[:1].isupper() and s[-1:] in ".!?" and 5 <= len(s.split()) <= 28:
|
||||
out.append(s)
|
||||
return out
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user