diff --git a/VoPho/engine.py b/VoPho/engine.py index ef68b1a..478ad5d 100644 --- a/VoPho/engine.py +++ b/VoPho/engine.py @@ -110,10 +110,13 @@ def phonemize_for_language(self, text, lang): :param lang: The language ID for phonemization :return: Phonemized text, or original text wrapped in <??> tags if language is not supported """ - phonemizer = self.get_phonemizer(lang) - if phonemizer: - return phonemizer.phonemize(text) - return f"<??>{text}</??>" # Return original text if no phonemizer available + if lang != "phoneme": + phonemizer = self.get_phonemizer(lang) + if phonemizer: + return phonemizer.phonemize(text) + return f"<??>{text}</??>" # Return original text if no phonemizer available + else: + return text def phonemize(self, input_text, output_dict=False): """ diff --git a/VoPho/langtokenizers/multicoded.py b/VoPho/langtokenizers/multicoded.py index 21a53ce..cfd5ff7 100644 --- a/VoPho/langtokenizers/multicoded.py +++ b/VoPho/langtokenizers/multicoded.py @@ -33,6 +33,7 @@ 'mr': 'red', 'he': 'white', 'th': 'blue', + 'phoneme': 'blue', '??': 'red' } diff --git a/examples/phonemize_texts.py b/examples/phonemize_texts.py index 1f39c3c..75427ca 100644 --- a/examples/phonemize_texts.py +++ b/examples/phonemize_texts.py @@ -1,7 +1,7 @@ from VoPho.engine import Phonemizer from time import time -input_text = "I suppose i can, dont take my word for it though. 音素のテストを行うことは、発音の理解を深めるために重要です。" +input_text = "<phoneme>I suppose i can</phoneme>, dont take my word for it though. 音素のテストを行うことは、発音の理解を深めるために重要です。" engine = Phonemizer() start = time()