friends:例句 only complete sentences (start-capital end-punct); unify header to 例句

This commit is contained in:
Lang
2026-10-15 01:14:48 +08:00
parent 40d05778b4
commit deb26621d2
3 changed files with 5 additions and 3 deletions
+4 -2
View File
@@ -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