Skip to main content

Text-to-IPA converter and phonetic translator for Python, powered by the Goruut phonemization engine

Project description

pygoruut

Getting started

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 EnglishBritish or EnglishAmerican instead of English. These dialect-specific models use high-quality Kokoro Misaki dictionaries and produce better results, especially for reversing IPA back to text.


Uyghur language, our highest quality language

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.


Advanced Use

Multi-lingual sentence handling

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ˈɑːɪ!!!!

Numerics handling (English, Arabic)

print(str(pygoruut.phonemize(language="EnglishBritish", sentence="100 bottles")))

# Prints: wˈʌn hˈʌndɹəd bˈɒtəlz

Homograph handling (Hebrew3)

print(str(pygoruut.phonemize(language="Hebrew3", sentence="השרים ביקשו מהשרים לפתוח את הדלתות של בית השרים.")))

# Prints: hasaʁˈim bikʃˈu mehasaʁˈim liftˈoaχ ʔˈat hadlatˈot ʃˈel bˈet hasaʁˈim.

No punctuation

print(str(pygoruut.phonemize(language="EnglishBritish", sentence="hello world!!!!", is_punct=False)))

# Prints: həlˈəʊ wˈɜːld

Force a specific version

You 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')

Use an online inference api

You can use an inference api. The model will not be downloaded:

from pygoruut.pygoruut import Pygoruut

pygoruut = Pygoruut(api='https://hashtron.cloud')

Configure a model download directory for faster startup

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='')

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pygoruut-0.6.4.tar.gz (24.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pygoruut-0.6.4-py3-none-any.whl (21.3 kB view details)

Uploaded Python 3

File details

Details for the file pygoruut-0.6.4.tar.gz.

File metadata

  • Download URL: pygoruut-0.6.4.tar.gz
  • Upload date:
  • Size: 24.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.23

File hashes

Hashes for pygoruut-0.6.4.tar.gz
Algorithm Hash digest
SHA256 823a929644c4022c3f15e40f7d9fb75275a69fdf75a903087e988096ac57b276
MD5 69a2a204f832fd24b49a418aa83bf663
BLAKE2b-256 2acb3f6ee6e86b613c7a8291e57d20bb396794d10db82c891eefc0cf76d73d44

See more details on using hashes here.

File details

Details for the file pygoruut-0.6.4-py3-none-any.whl.

File metadata

  • Download URL: pygoruut-0.6.4-py3-none-any.whl
  • Upload date:
  • Size: 21.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.23

File hashes

Hashes for pygoruut-0.6.4-py3-none-any.whl
Algorithm Hash digest
SHA256 2491682aea2c52f0cb7c1d7925571084132bf764f2be9715182fc7c8f1e91f1c
MD5 4fe67184aea70df1cfe68003ead050e4
BLAKE2b-256 2a46535c776046e85b5ee02f9e52feec2fe73f13339181390cc5feeae0b41700

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page