Fix japanese.py (#151)
* Fix japanese.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
@@ -67,6 +67,7 @@ for model in models:
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
def generate_audio(
|
||||
slices,
|
||||
sdp_ratio,
|
||||
@@ -97,6 +98,7 @@ def generate_audio(
|
||||
audio_list.append(silence) # 将静音添加到列表中
|
||||
return audio_list
|
||||
|
||||
|
||||
@app.route("/")
|
||||
def main():
|
||||
try:
|
||||
@@ -177,4 +179,4 @@ def main():
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
app.run(port=config.server_config.port,server_name="0.0.0.0")
|
||||
app.run(port=config.server_config.port, server_name="0.0.0.0")
|
||||
|
||||
@@ -54,7 +54,9 @@ def text2kata(text: str) -> str:
|
||||
|
||||
res = []
|
||||
for parts in parsed:
|
||||
word, yomi = replace_punctuation(parts["string"]), parts["pron"].replace("’", "")
|
||||
word, yomi = replace_punctuation(parts["string"]), parts["pron"].replace(
|
||||
"’", ""
|
||||
)
|
||||
if yomi:
|
||||
if re.match(_MARKS, yomi):
|
||||
if len(word) > 1:
|
||||
@@ -85,7 +87,9 @@ def text2sep_kata(text: str) -> (list, list):
|
||||
res = []
|
||||
sep = []
|
||||
for parts in parsed:
|
||||
word, yomi = replace_punctuation(parts["orig"]), parts["pron"].replace("’", "")
|
||||
word, yomi = replace_punctuation(parts["string"]), parts["pron"].replace(
|
||||
"’", ""
|
||||
)
|
||||
if yomi:
|
||||
if re.match(_MARKS, yomi):
|
||||
if len(word) > 1:
|
||||
@@ -361,16 +365,7 @@ def align_tones(phones, tones):
|
||||
return res
|
||||
|
||||
|
||||
import pykakasi
|
||||
|
||||
kks = pykakasi.kakasi()
|
||||
|
||||
|
||||
def g2p(norm_text):
|
||||
result = kks.convert(norm_text)
|
||||
norm_text = ""
|
||||
for i in result:
|
||||
norm_text += i["hira"]
|
||||
sep_text, sep_kata, acc = text2sep_kata(norm_text)
|
||||
sep_tokenized = [tokenizer.tokenize(i) for i in sep_text]
|
||||
sep_phonemes = handle_long([kata2phoneme(i) for i in sep_kata])
|
||||
|
||||
Reference in New Issue
Block a user