from pygoruut.pygoruut import Pygoruut
pygoruut = Pygoruut()
print(str(pygoruut.phonemize(language="EnglishAmerican", sentence="fast racing car")))
# Prints: fˈæst ɹˈeɪsɪŋ kˈɑɹ
# Now, convert it back
print(str(pygoruut.phonemize(language="EnglishAmerican", sentence="fˈæst ɹˈeɪsɪŋ kˈɑɹ", is_reverse=True)))
# Prints: fast racing carℹ️ For English, we recommend using
EnglishBritishorEnglishAmericaninstead ofEnglish. These dialect-specific models use high-quality Kokoro Misaki dictionaries and produce better results, especially for reversing IPA back to text.
print(str(pygoruut.phonemize(language="Uyghur", sentence="قىزىل گۈل ئاتا")))
# Prints: qizil gyl ʔɑtɑ
# Now, convert it back
print(str(pygoruut.phonemize(language="Uyghur", sentence="qizil gyl ʔɑtɑ", is_reverse=True)))
# Prints: قىزىل گۈل ئاتاThe quality of translation varies across the 136 supported languages.
Use comma (,) separated languages in language. The first language is the preferred language:
print(pygoruut.phonemize(language="EnglishBritish,Slovak", sentence="hello world ahojte notindictionary!!!!"))
# Prints: həlˈoʊ wˈɜɹld aɦɔjcɛ ŋətandəktɪnˈɑːɪ!!!!print(str(pygoruut.phonemize(language="EnglishBritish", sentence="100 bottles")))
# Prints: wˈʌn hˈʌndɹəd bˈɒtəlzprint(str(pygoruut.phonemize(language="Hebrew3", sentence="השרים ביקשו מהשרים לפתוח את הדלתות של בית השרים.")))
# Prints: hasaʁˈim bikʃˈu mehasaʁˈim liftˈoaχ ʔˈet hadlatˈot ʃˈel bajˈit hasaʁˈim.print(str(pygoruut.phonemize(language="EnglishBritish", sentence="hello world!!!!", is_punct=False)))
# Prints: həlˈoʊ əɹldYou can pin a specific version. It will translate all words in the same way forever:
from pygoruut.pygoruut import Pygoruut
pygoruut = Pygoruut(version='v0.6.2')You can use an inference api. The model will not be downloaded:
from pygoruut.pygoruut import Pygoruut
pygoruut = Pygoruut(api='https://hashtron.cloud')Extra model can be loaded from a ZIP file manually. It extends a specific language.
from pygoruut.pygoruut import Pygoruut
pygoruut = Pygoruut(models={"Hebrew3": "/home/john/Downloads/hebrew3.zip"})To cache models in a user-specified directory:
from pygoruut.pygoruut import Pygoruut
pygoruut = Pygoruut(writeable_bin_dir='/home/john/')To cache in the user's home subdirectory .goruut:
from pygoruut.pygoruut import Pygoruut
pygoruut = Pygoruut(writeable_bin_dir='')