Word list export includes LT top replacement - helps separate typos from abbreviations
This commit is contained in:
1 parent
7df303ba0e
commit
35ca06dd6b
2 files changed
+10
-3
No files matched your search
@@ -422,11 +422,18 @@ def run_job(job_id: str, data: bytes, filename: str, use_llm: bool):
|
|||||||
for it in items:
|
for it in items:
|
||||||
counts[it["kind"]] = counts.get(it["kind"], 0) + 1
|
counts[it["kind"]] = counts.get(it["kind"], 0) + 1
|
||||||
frag_counts = Counter()
|
frag_counts = Counter()
|
||||||
|
frag_first_repl: dict = {}
|
||||||
for it in items:
|
for it in items:
|
||||||
frag = (it.get("fragment") or "").strip().lower()
|
frag = (it.get("fragment") or "").strip().lower()
|
||||||
if frag:
|
if frag:
|
||||||
frag_counts[frag] += 1
|
frag_counts[frag] += 1
|
||||||
fragments_top = [{"fragment": k, "count": v} for k, v in frag_counts.most_common(100)]
|
if frag not in frag_first_repl:
|
||||||
|
repls = it.get("replacements") or []
|
||||||
|
frag_first_repl[frag] = repls[0] if repls else ""
|
||||||
|
fragments_top = [
|
||||||
|
{"fragment": k, "count": v, "top_replacement": frag_first_repl.get(k, "")}
|
||||||
|
for k, v in frag_counts.most_common(100)
|
||||||
|
]
|
||||||
page_acc = 0
|
page_acc = 0
|
||||||
page_map = []
|
page_map = []
|
||||||
for p in paras:
|
for p in paras:
|
||||||
|
|||||||
+2
-2
@@ -182,9 +182,9 @@ function render(r) {
|
|||||||
document.querySelectorAll(".repl").forEach(b => b.onclick = () => { navigator.clipboard.writeText(b.dataset.t); b.title = "скопировано"; });
|
document.querySelectorAll(".repl").forEach(b => b.onclick = () => { navigator.clipboard.writeText(b.dataset.t); b.title = "скопировано"; });
|
||||||
const dl = $("dlw"); if (dl) dl.onclick = () => { window.location = "/api/report/" + jobId + "/docx"; };
|
const dl = $("dlw"); if (dl) dl.onclick = () => { window.location = "/api/report/" + jobId + "/docx"; };
|
||||||
const dl2 = $("dlw2"); if (dl2) dl2.onclick = () => {
|
const dl2 = $("dlw2"); if (dl2) dl2.onclick = () => {
|
||||||
const top = (lastReport.fragments_top || []).map(x => x.count + " " + x.fragment).join("\r\n");
|
const top = (lastReport.fragments_top || []).map(x => x.count + " " + x.fragment + (x.top_replacement ? " -> " + x.top_replacement.replace(/\s+/g, " ") : "")).join("\r\n");
|
||||||
const a = document.createElement("a");
|
const a = document.createElement("a");
|
||||||
a.href = URL.createObjectURL(new Blob(["сколько фрагмент\r\n" + top], {type: "text/plain;charset=utf-8"}));
|
a.href = URL.createObjectURL(new Blob(["сколько фрагмент -> подсказка\r\n" + top], {type: "text/plain;charset=utf-8"}));
|
||||||
a.download = "spisok_slov.txt";
|
a.download = "spisok_slov.txt";
|
||||||
a.click();
|
a.click();
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in new issue
Block a user