Fix ゃ ゅ ょ bug
This commit is contained in:
@@ -20,6 +20,7 @@ def hiragana2p(text: str) -> str:
|
|||||||
- avoid converting `o u` to `o o` (because the input is already actual `yomi`).
|
- avoid converting `o u` to `o o` (because the input is already actual `yomi`).
|
||||||
- avoid using `N` for `ん` (for compatibility)
|
- avoid using `N` for `ん` (for compatibility)
|
||||||
- use `v` for `ゔ` related text.
|
- use `v` for `ゔ` related text.
|
||||||
|
- add bare `ゃ` `ゅ` `ょ` to `y a` `y u` `y o` (for compatibility).
|
||||||
"""
|
"""
|
||||||
# 3文字以上からなる変換規則
|
# 3文字以上からなる変換規則
|
||||||
text = text.replace("う゛ぁ", " v a")
|
text = text.replace("う゛ぁ", " v a")
|
||||||
@@ -321,6 +322,11 @@ def hiragana2p(text: str) -> str:
|
|||||||
text = text.replace("ゎ", " w a")
|
text = text.replace("ゎ", " w a")
|
||||||
text = text.replace("ぉ", " o")
|
text = text.replace("ぉ", " o")
|
||||||
|
|
||||||
|
# ここまでに処理されていないゅ等もそのまま大文字扱い(追加)
|
||||||
|
text = text.replace("ゃ", " y a")
|
||||||
|
text = text.replace("ゅ", " y u")
|
||||||
|
text = text.replace("ょ", " y o")
|
||||||
|
|
||||||
# 長音の処理
|
# 長音の処理
|
||||||
# for (pattern, replace_str) in JULIUS_LONG_VOWEL:
|
# for (pattern, replace_str) in JULIUS_LONG_VOWEL:
|
||||||
# text = pattern.sub(replace_str, text)
|
# text = pattern.sub(replace_str, text)
|
||||||
@@ -409,6 +415,8 @@ def text2sep_kata(text: str):
|
|||||||
else:
|
else:
|
||||||
res.append(word)
|
res.append(word)
|
||||||
sep.append(word)
|
sep.append(word)
|
||||||
|
logger.debug(f"Text2sep_kata: {text} -> {res}")
|
||||||
|
logger.debug(f"get_accent: {parsed}")
|
||||||
return sep, res, get_accent(parsed)
|
return sep, res, get_accent(parsed)
|
||||||
|
|
||||||
|
|
||||||
@@ -676,6 +684,9 @@ def rearrange_tones(tones, phones):
|
|||||||
|
|
||||||
def g2p(norm_text):
|
def g2p(norm_text):
|
||||||
sep_text, sep_kata, acc = text2sep_kata(norm_text)
|
sep_text, sep_kata, acc = text2sep_kata(norm_text)
|
||||||
|
logger.debug(f"Sep_text: {sep_text}")
|
||||||
|
logger.debug(f"Sep_kata: {sep_kata}")
|
||||||
|
logger.debug(f"Acc: {acc}")
|
||||||
sep_tokenized = []
|
sep_tokenized = []
|
||||||
for i in sep_text:
|
for i in sep_text:
|
||||||
if i not in punctuation:
|
if i not in punctuation:
|
||||||
|
|||||||
Reference in New Issue
Block a user