Skip to main content

A Python wrapper for the goruut phonemization tool

Project description

pygoruut

Getting started

from pygoruut.pygoruut import Pygoruut

pygoruut = Pygoruut()

print(str(pygoruut.phonemize(language="English", sentence="fast racing car")))

# Prints: fˈæst ɹˈeɪsɪŋ kˈɑɹ

# Now, convert it back

print(str(pygoruut.phonemize(language="English", sentence="fˈæst ɹˈeɪsɪŋ kˈɑɹ", is_reverse=True)))

# Prints: fast racing car

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 accros the 136 supported languages.

Advanced Use

Multi lingual sentences handling

Use comma (,) separated languages in language (the first language is the preferred language):

print(pygoruut.phonemize(language="English,Slovak", sentence="hello world ahojte notindictionary!!!!"))

# Prints: həlˈoʊ wəld aɦɔjcɛ nɔtɪndɪktˈɪoʊŋɑɹi!!!!

Numerics handling (English, Arabic)

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

# Prints: wæn ˈhʌndəd bˈɑtəlz

Homograph handling (English)

print(str(pygoruut.phonemize(language="English", sentence="He dove into the pool to join the dove")))

# Prints: hˈi 'doʊv ˈɪntu ðə pˈul tə dʒˈɔɪn ðə 'dʌv

No punctuation

' '.join([w.Phonetic for w in pygoruut.phonemize(language="English", sentence="hello world!!!!").Words])

Force a specific version

A certain version is frozen, it will translate all words in the same way forever

from pygoruut.pygoruut import Pygoruut

pygoruut = Pygoruut(version='v0.6.1')

Configure a model download directory for faster startup

For faster startup, the model can be cached in the user-provided directory

from pygoruut.pygoruut import Pygoruut

pygoruut = Pygoruut(writeable_bin_dir='/home/john/')

If you want to cache it in user's home subdir .goruut, use:

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.1.tar.gz (22.0 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.1-py3-none-any.whl (19.2 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for pygoruut-0.6.1.tar.gz
Algorithm Hash digest
SHA256 39048e61f13989a1456694d74361be06cad65c938905a815a92e63cc78dfd06e
MD5 948122a9ff217d34f3b04625856acb1d
BLAKE2b-256 03b8d8c4d4ec5165e11efbd3495d95b75432cce0bca8ee766eb0f2004bf71d5d

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for pygoruut-0.6.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a73a51df676bdecc1452f811f381d2f9f615d7d377a83a6f74079d7ea21ae63d
MD5 243cc6b743aa69712edf3c464a183c9e
BLAKE2b-256 9867ad11b520a2cb81f49465595ed6b99574f02589b92ed01d84b9eacd1a8d38

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