fix(tokenizer): prevent grammar tokens from borrowing known-word highlight via unrelated readings (#147)

This commit is contained in:
2026-07-07 23:57:47 -07:00
committed by GitHub
parent 0e254cbbef
commit 187f68e5b6
5 changed files with 87 additions and 1 deletions
+8 -1
View File
@@ -163,7 +163,14 @@ export class KnownWordCacheManager {
);
}
return this.readingCounts.has(convertKatakanaToHiragana(normalized));
// Reading-only fallback, except for single-kana text: particles and
// interjections (よ, ね, え…) would otherwise borrow the reading of an
// unrelated note (夜「よ」, 絵「え」) and count as known.
const hiragana = convertKatakanaToHiragana(normalized);
if ([...hiragana].length === 1) {
return false;
}
return this.readingCounts.has(hiragana);
}
refresh(force = false): Promise<void> {