From 4d618bd5b3dd351a83a120797639a6884a2049b2 Mon Sep 17 00:00:00 2001 From: admin Date: Thu, 28 May 2026 21:53:59 +0200 Subject: [PATCH] fix: prevent pronouns/function words from being detected as vocabulary MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - fuzzyMatch threshold 0.6 → 0.85 (man/Mann 0.75 now fails) - min token length 2 → 4 (excludes man, der, die, das, ich, wir...) Co-Authored-By: Claude Sonnet 4.6 --- src/pages/ContentCreation.jsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pages/ContentCreation.jsx b/src/pages/ContentCreation.jsx index eb36340..dbe640e 100644 --- a/src/pages/ContentCreation.jsx +++ b/src/pages/ContentCreation.jsx @@ -77,7 +77,7 @@ async function resolvePlaceholders(text, allObjects) { // ─── Fuzzy word matching ────────────────────────────────────────────────────── -function fuzzyMatch(token, wordTitle, threshold = 0.6) { +function fuzzyMatch(token, wordTitle, threshold = 0.85) { const t = token.toLowerCase(); const w = wordTitle.toLowerCase(); if (!t.startsWith(w) && !w.startsWith(t)) return false; @@ -234,7 +234,7 @@ function PairForm({ objectId, allObjects, onPairSaved }) { if (!allText.trim()) { setWordMap({}); return; } const t = setTimeout(async () => { try { - const tokens = [...new Set(allText.split(/[\s.,!?;:()\[\]"']+/).filter(w => w.length >= 2))]; + const tokens = [...new Set(allText.split(/[\s.,!?;:()\[\]"']+/).filter(w => w.length >= 4))]; if (!tokens.length) return; const results = await Promise.allSettled( tokens.map(async w => { @@ -532,7 +532,7 @@ function EditPairForm({ pair, allObjects, onSaved, onCancel, onDeleted }) { if (!allText.trim()) { setWordMap({}); return; } const t = setTimeout(async () => { try { - const tokens = [...new Set(allText.split(/[\s.,!?;:()\[\]"']+/).filter(w => w.length >= 2))]; + const tokens = [...new Set(allText.split(/[\s.,!?;:()\[\]"']+/).filter(w => w.length >= 4))]; if (!tokens.length) return; const results = await Promise.allSettled( tokens.map(async w => {