friends:例句 only complete sentences (start-capital end-punct); unify header to 例句
This commit is contained in:
@@ -365,7 +365,7 @@ panel({
|
|||||||
{ key: "status", label: "状态", order: ["new","learning","known"], def: "learning", fixed: true, names: { new: "未学", learning: "学习中", known: "已掌握" } },
|
{ key: "status", label: "状态", order: ["new","learning","known"], def: "learning", fixed: true, names: { new: "未学", learning: "学习中", known: "已掌握" } },
|
||||||
],
|
],
|
||||||
fields: ["item", "meaning", "context"],
|
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>`,
|
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>`,
|
||||||
});
|
});
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -43,8 +43,10 @@ def load_sentences() -> list[str]:
|
|||||||
d = re.sub(r"\[[^\]]*\]", " ", d)
|
d = re.sub(r"\[[^\]]*\]", " ", d)
|
||||||
d = re.sub(r"\([^)]*\)", " ", d)
|
d = re.sub(r"\([^)]*\)", " ", d)
|
||||||
d = re.sub(r"\s+", " ", d).strip()
|
d = re.sub(r"\s+", " ", d).strip()
|
||||||
if 4 <= len(d) <= 240:
|
cands = [d] if (d[:1].isupper() and d[-1:] in ".!?") else [s.strip() for s in re.findall(r"[^.!?]*[.!?]", d)]
|
||||||
out.append(d)
|
for s in cands:
|
||||||
|
if s[:1].isupper() and s[-1:] in ".!?" and 5 <= len(s.split()) <= 28:
|
||||||
|
out.append(s)
|
||||||
return out
|
return out
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
BIN
Binary file not shown.
Reference in New Issue
Block a user