ukr-tts / ipa_uk /test.py
tracert's picture
Upload 11 files
03979d4 verified
raw
history blame
1.15 kB
import phonemizer
import subprocess
from ipa_uk import ipa
import sys
# Run the chcp command to change the code page to UTF-8
#subprocess.run("chcp 65001", check=True, shell=True)
sys.stdout.reconfigure(encoding='utf-8')
# Define the input text
text = " Швеція. Червень. Церква. Духмяна м'ята. Вітаю, як ваші справи? У вас все гаразд? Я знаю про вас все, що ви тут робите. Але я розповім вам казку про сірого вовка який живе у лісі "
# Phonemize the text for Ukrainian language
phonemes1 = phonemizer.phonemize(text, language="uk", preserve_punctuation=True)
phonemes2 = ipa(check_accent=0, text=text)
# Print the phonemes
#print(phonemes1.encode('utf-8'))
print("Input text: ",text)
print("Output phonmizer: ",phonemes1)
print("Output ipa_uk : ",phonemes2)
# Specify the file path
file_path = "output2.txt"
# Open the file in write mode and write the phonemes
with open(file_path, 'w', encoding='utf-8') as file:
file.write(phonemes1)
file.write(phonemes2)