feat: replace wanakana with english-to-kana 49K dictionary
- Vendor english-kana-matcher.js (english-to-kana, MIT, 49216 words) - Rewrite bridge: dictionary lookup + letter-by-letter fallback for OOV words - Convert English punctuation (,.!?) to Japanese pauses (、。) - Fix Chinese fullwidth comma being stripped by filter_kana - Preserve decimal points in numbers (3.5 -> スリーファイブ) - main.py now applies filter_kana (matches web UI behavior) - Remove wanakana dependency; rebuild portable zip (82.5 MB)
This commit is contained in:
+2
-2
@@ -16,7 +16,7 @@ _KANA_SAFE_RE = re.compile(
|
||||
r"\u3001\u3002\uFF01\uFF1F"
|
||||
r"\u300C\u300D"
|
||||
r"\u30FB\u3000"
|
||||
r"a-zA-Z0-9 ]"
|
||||
r"a-zA-Z0-9 ,.!?\uFF0C]"
|
||||
)
|
||||
|
||||
_CHINESE_DIGITS = ["零", "一", "二", "三", "四", "五", "六", "七", "八", "九"]
|
||||
@@ -85,7 +85,7 @@ def chinese_to_kana(text: str, convert_numbers: bool = True) -> str:
|
||||
else:
|
||||
result_parts.append(seg)
|
||||
result = "".join(result_parts)
|
||||
result = re.sub(r"(?<=\S) (?=\S)", "", result)
|
||||
result = re.sub(r"(?<=[^\x00-\x7F]) (?=[^\x00-\x7F])", "", result)
|
||||
return result
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user