From 3d434fd4c8b9321dfb1fdf014299d85165dc63b0 Mon Sep 17 00:00:00 2001 From: litagin02 Date: Fri, 2 Feb 2024 22:27:58 +0900 Subject: [PATCH] Fix -- bug --- text/japanese.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/text/japanese.py b/text/japanese.py index 970578b..77696c6 100644 --- a/text/japanese.py +++ b/text/japanese.py @@ -343,13 +343,14 @@ def text2sep_kata(norm_text: str) -> tuple[list[str], list[str]]: """ assert yomi != "", f"Empty yomi: {word}" if yomi == "、": - # wordは正規化されているので、`.`, `,`, `!`, `'`, `-`のいずれか + # wordは正規化されているので、`.`, `,`, `!`, `'`, `-`, `--` のいずれか if word not in ( ".", ",", "!", "'", "-", + "--", ): # ここはpyopenjtalkが読めない文字等のときに起こる raise ValueError(f"Cannot read: {word} in:\n{norm_text}") @@ -547,6 +548,8 @@ def kata2phoneme_list(text: str) -> list[str]: """ if text in punctuation: return [text] + elif text == "--": + return ["-", "-"] # `text`がカタカナ(`ー`含む)のみからなるかどうかをチェック if re.fullmatch(r"[\u30A0-\u30FF]+", text) is None: raise ValueError(f"Input must be katakana only: {text}")