Fix v-related g2p bug
This commit is contained in:
@@ -19,16 +19,27 @@ def hiragana2p(text: str) -> str:
|
|||||||
- avoid using `:`, instead, `あーーー` -> `a a a a`.
|
- avoid using `:`, instead, `あーーー` -> `a a a a`.
|
||||||
- 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.
|
||||||
"""
|
"""
|
||||||
# 3文字以上からなる変換規則
|
# 3文字以上からなる変換規則
|
||||||
text = text.replace("う゛ぁ", " b a")
|
text = text.replace("う゛ぁ", " v a")
|
||||||
text = text.replace("う゛ぃ", " b i")
|
text = text.replace("う゛ぃ", " v i")
|
||||||
text = text.replace("う゛ぇ", " b e")
|
text = text.replace("う゛ぇ", " v e")
|
||||||
text = text.replace("う゛ぉ", " b o")
|
text = text.replace("う゛ぉ", " v o")
|
||||||
text = text.replace("う゛ゅ", " by u")
|
text = text.replace("う゛ゅ", " by u")
|
||||||
|
|
||||||
|
# ゔ等の処理を追加
|
||||||
|
text = text.replace("ゔぁ", " v a")
|
||||||
|
text = text.replace("ゔぃ", " v i")
|
||||||
|
text = text.replace("ゔぇ", " v e")
|
||||||
|
text = text.replace("ゔぉ", " v o")
|
||||||
|
text = text.replace("ゔゅ", " by u")
|
||||||
|
|
||||||
# 2文字からなる変換規則
|
# 2文字からなる変換規則
|
||||||
text = text.replace("ぅ゛", " b u")
|
text = text.replace("ぅ゛", " v u")
|
||||||
|
|
||||||
|
# ゔの処理を追加
|
||||||
|
text = text.replace("ゔ", " v u")
|
||||||
|
|
||||||
text = text.replace("あぁ", " a a")
|
text = text.replace("あぁ", " a a")
|
||||||
text = text.replace("いぃ", " i i")
|
text = text.replace("いぃ", " i i")
|
||||||
|
|||||||
Reference in New Issue
Block a user