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.2')

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.2.tar.gz (22.8 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.2-py3-none-any.whl (20.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pygoruut-0.6.2.tar.gz
  • Upload date:
  • Size: 22.8 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.2.tar.gz
Algorithm Hash digest
SHA256 183b6cbb931e762b54dce42f78c1233043780c5c79f2e526acb90bc00a2ed850
MD5 714a2f6ca2f01381e638d37a8396f3e1
BLAKE2b-256 789386bca1dae0e79812da2db850058217b9b75120c8adf3c1fb47a9030004a7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pygoruut-0.6.2-py3-none-any.whl
  • Upload date:
  • Size: 20.0 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 882fa54bff65c5fa4228d51d17cc1a4ce3198ae5ba83b0de79db5ae7bc5471fb
MD5 e2ba8dc49d627430358be86e528f36ad
BLAKE2b-256 0b6138b7bfa0300ba13d6313a49bdf6700d5abc82075a2c9d589d54e3b638956

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