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
+1 -1
View File
@@ -365,7 +365,7 @@ panel({
{ key: "status", label: "状态", order: ["new","learning","known"], def: "learning", fixed: true, names: { new: "未学", learning: "学习中", known: "已掌握" } },
],
fields: ["item", "meaning", "context"],
head: `<thead><tr><th>id</th><th>条目</th><th>等级</th><th>释义</th><th>上下文</th><th>状态</th></tr></thead><tbody>`,
head: `<thead><tr><th>id</th><th>条目</th><th>等级</th><th>释义</th><th>例句</th><th>状态</th></tr></thead><tbody>`,
row: i => `<tr><td class="mono idc">${esc(i.id)}</td><td><b>${esc(i.item)}</b></td><td>${esc(i.level)}</td><td>${esc(i.meaning)}</td><td class="muted">${esc(i.context)}</td><td>${badge(i.status)}</td></tr>`,
});
"""
+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
BIN
View File
Binary file not shown.