Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mora_mapping.py にOpenJTalkに無いKanaを追加 #1473

Merged
merged 12 commits into from
Nov 15, 2024
48 changes: 48 additions & 0 deletions voicevox_engine/tts_pipeline/mora_mapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,19 +65,31 @@
"カ",
"ガ",
"キ",
"キィ",
"キェ",
"キャ",
"キュ",
"キョ",
"ギ",
"ギィ",
"ギェ",
"ギャ",
"ギュ",
"ギョ",
"ク",
"クヮ",
"クァ",
"クィ",
"クゥ",
"クェ",
"クォ",
"グ",
"グヮ",
"グァ",
"グィ",
"グゥ",
"グェ",
"グォ",
Hiroshiba marked this conversation as resolved.
Show resolved Hide resolved
"ケ",
"ゲ",
"コ",
Expand Down Expand Up @@ -110,6 +122,10 @@
"チュ",
"チョ",
"ヂ",
"ヂェ",
"ヂャ",
"ヂュ",
"ヂョ",
"ッ",
"ツ",
"ツァ",
Expand All @@ -119,6 +135,7 @@
"ヅ",
"テ",
"ティ",
"テェ",
"テャ",
"テュ",
"テョ",
Expand All @@ -134,6 +151,7 @@
"ドゥ",
"ナ",
"ニ",
"ニィ",
"ニェ",
"ニャ",
"ニュ",
Expand All @@ -145,16 +163,19 @@
"バ",
"パ",
"ヒ",
"ヒィ",
"ヒェ",
"ヒャ",
"ヒュ",
"ヒョ",
"ビ",
"ビィ",
"ビェ",
"ビャ",
"ビュ",
"ビョ",
"ピ",
"ピィ",
"ピェ",
"ピャ",
"ピュ",
Expand All @@ -174,6 +195,7 @@
"ポ",
"マ",
"ミ",
"ミィ",
"ミェ",
"ミャ",
"ミュ",
Expand All @@ -189,6 +211,7 @@
"ヨ",
"ラ",
"リ",
"リィ",
"リェ",
"リャ",
"リュ",
Expand All @@ -199,6 +222,7 @@
"ヮ",
"ワ",
"ヰ",
"ウゥ",
Hiroshiba marked this conversation as resolved.
Show resolved Hide resolved
"ヱ",
"ヲ",
"ン",
Expand Down Expand Up @@ -228,6 +252,7 @@
("リュ", "ry", "u"),
("リャ", "ry", "a"),
("リェ", "ry", "e"),
("リィ", "ry", "i"),
("リ", "r", "i"),
("ラ", "r", "a"),
("ヨ", "y", "o"),
Expand All @@ -240,6 +265,7 @@
("ミュ", "my", "u"),
("ミャ", "my", "a"),
("ミェ", "my", "e"),
("ミィ", "my", "i"),
("ミ", "m", "i"),
("マ", "m", "a"),
("ポ", "p", "o"),
Expand All @@ -259,16 +285,19 @@
("ピュ", "py", "u"),
("ピャ", "py", "a"),
("ピェ", "py", "e"),
("ピィ", "py", "i"),
("ピ", "p", "i"),
("ビョ", "by", "o"),
("ビュ", "by", "u"),
("ビャ", "by", "a"),
("ビェ", "by", "e"),
("ビィ", "by", "i"),
("ビ", "b", "i"),
("ヒョ", "hy", "o"),
("ヒュ", "hy", "u"),
("ヒャ", "hy", "a"),
("ヒェ", "hy", "e"),
("ヒィ", "hy", "i"),
("ヒ", "h", "i"),
("パ", "p", "a"),
("バ", "b", "a"),
Expand All @@ -280,6 +309,7 @@
("ニュ", "ny", "u"),
("ニャ", "ny", "a"),
("ニェ", "ny", "e"),
("ニィ", "ny", "i"),
("ニ", "n", "i"),
("ナ", "n", "a"),
("ドゥ", "d", "u"),
Expand All @@ -295,6 +325,7 @@
("テョ", "ty", "o"),
("テュ", "ty", "u"),
("テャ", "ty", "a"),
("テェ", "ty", "e"),
("ティ", "t", "i"),
("テ", "t", "e"),
("ツォ", "ts", "o"),
Expand Down Expand Up @@ -335,25 +366,36 @@
("ゲ", "g", "e"),
("ケ", "k", "e"),
("グヮ", "gw", "a"),
("グィ", "gw", "i"),
("グゥ", "gw", "u"),
("グェ", "gw", "e"),
("グォ", "gw", "o"),
("グ", "g", "u"),
("クヮ", "kw", "a"),
("クィ", "kw", "i"),
("クゥ", "kw", "u"),
("クェ", "kw", "e"),
("クォ", "kw", "o"),
("ク", "k", "u"),
Hiroshiba marked this conversation as resolved.
Show resolved Hide resolved
("ギョ", "gy", "o"),
("ギュ", "gy", "u"),
("ギャ", "gy", "a"),
("ギェ", "gy", "e"),
("ギィ", "gy", "i"),
("ギ", "g", "i"),
("キョ", "ky", "o"),
("キュ", "ky", "u"),
("キャ", "ky", "a"),
("キェ", "ky", "e"),
("キィ", "ky", "i"),
("キ", "k", "i"),
("ガ", "g", "a"),
("カ", "k", "a"),
("オ", None, "o"),
("エ", None, "e"),
("ウォ", "w", "o"),
("ウェ", "w", "e"),
("ウゥ", "w", "u"),
("ウィ", "w", "i"),
("ウ", None, "u"),
("イェ", "y", "e"),
Expand All @@ -379,6 +421,12 @@
("ゥ", None, "u"),
("ィ", None, "i"),
("ァ", None, "a"),
("ヂョ", "j", "o"),
("ヂュ", "j", "u"),
("ヂャ", "j", "a"),
("ヂェ", "j", "e"),
("グァ", "gw", "a"),
("クァ", "kw", "a"),
Hiroshiba marked this conversation as resolved.
Show resolved Hide resolved
]

# 「hi」→「ヒ」
Expand Down
8 changes: 5 additions & 3 deletions voicevox_engine/user_dict/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,12 @@ def check_is_katakana(cls, pronunciation: str) -> str:
def check_mora_count_and_accent_type(self) -> Self:
if self.mora_count is None:
rule_others = (
"[イ][ェ]|[ヴ][ャュョ]|[トド][ゥ]|[テデ][ィャュョ]|[デ][ェ]|[クグ][ヮ]"
"[イ][ェ]|[ヴ][ャュョ]|[ウクグトド][ゥ]|[テデ][ィェャュョ]|[クグ][ヮ]"
)
rule_line_i = "[キシチニヒミリギジビピ][ェャュョ]"
rule_line_u = "[ツフヴ][ァ]|[ウスツフヴズ][ィ]|[ウツフヴ][ェォ]"
rule_line_i = (
"[キシチニヒミリギジヂビピ][ェャュョ]|[キスニヒミリギズビピ][ィ]"
)
Hiroshiba marked this conversation as resolved.
Show resolved Hide resolved
rule_line_u = "[クツフヴグ][ァ]|[ウクスツフヴグズ][ィ]|[ウクツフヴグ][ェォ]"
rule_one_mora = "[ァ-ヴー]"
self.mora_count = len(
findall(
Expand Down