Skip to content

Commit

Permalink
to_phoneme_data_list() の廃止 (#797)
Browse files Browse the repository at this point in the history
  • Loading branch information
tarepan authored Dec 1, 2023
1 parent c152b13 commit 95fc586
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 25 deletions.
5 changes: 0 additions & 5 deletions test/test_synthesis_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
pre_process,
split_mora,
to_flatten_moras,
to_phoneme_data_list,
unvoiced_mora_phoneme_list,
)

Expand Down Expand Up @@ -297,10 +296,6 @@ def test_to_flatten_moras(self):
+ self.accent_phrases_hello_hiho[1].moras,
)

def test_to_phoneme_data_list(self):
phoneme_data_list = to_phoneme_data_list(self.str_list_hello_hiho)
self.assertEqual(phoneme_data_list, self.phoneme_data_list_hello_hiho)

def test_split_mora(self):
consonant_phoneme_list, vowel_phoneme_list, vowel_indexes = split_mora(
self.phoneme_data_list_hello_hiho
Expand Down
24 changes: 4 additions & 20 deletions voicevox_engine/synthesis_engine/synthesis_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,25 +41,6 @@ def to_flatten_moras(accent_phrases: List[AccentPhrase]) -> List[Mora]:
)


def to_phoneme_data_list(phoneme_str_list: List[str]):
"""
phoneme文字列のリストを、OjtPhonemeクラスのリストに変換する
Parameters
----------
phoneme_str_list : List[str]
phoneme文字列のリスト
Returns
-------
phoneme_list : List[OjtPhoneme]
変換されたOjtPhonemeクラスのリスト
"""
phoneme_data_list = [
OjtPhoneme(phoneme=p, start=i, end=i + 1)
for i, p in enumerate(phoneme_str_list)
]
return phoneme_data_list


def split_mora(phoneme_list: List[OjtPhoneme]):
"""
OjtPhonemeのリストから、
Expand Down Expand Up @@ -121,7 +102,10 @@ def pre_process(
phoneme_str_list = list(chain.from_iterable(phoneme_each_mora))
phoneme_str_list = ["pau"] + phoneme_str_list + ["pau"]

phoneme_data_list = to_phoneme_data_list(phoneme_str_list)
phoneme_data_list = [
OjtPhoneme(phoneme=p, start=i, end=i + 1)
for i, p in enumerate(phoneme_str_list)
]

return flatten_moras, phoneme_data_list

Expand Down

0 comments on commit 95fc586

Please sign in to comment.