Skip to main content

Lightweight International Phonetic Alphabet (IPA) phonemizer that uses libespeak-ng

Project description

eSpeak Phonemizer

Uses ctypes and libespeak-ng to transform text into IPA phonemes.

Installation

First, install libespeak-ng:

sudo apt-get install libespeak-ng1

Next, install espeak_phonemizer:

pip install espeak_phonemizer

If installation was successful, you should be able to run:

espeak-phonemizer --version

Basic Phonemization

Simply pass your text into the standard input of espeak-phonemizer:

echo 'This is a test.' | espeak-phonemizer -v en-us
ðɪs ɪz ɐ tˈɛst

Separators

Phoneme and word separators can be changed:

echo 'This is a test.' | espeak-phonemizer -v en-us -p '_' -w '#'
ð_ɪ_s#ɪ_z#ɐ#t_ˈɛ_s_t

Punctuation and Stress

Some punctuation can be kept (.,;:!?) in the output:

echo 'This: is, a, test.' | espeak-phonemizer -v en-us --keep-punctuation
ðˈɪs: ˈɪz, ˈeɪ, tˈɛst.

Stress markers can also be dropped:

echo 'This is a test.' | espeak-phonemizer -v en-us --no-stress
ðɪs ɪz ɐ tɛst

Delimited Input

The --csv flag enables delimited input with fields separated by a '|' (change with --csv-delimiter):

echo 's1|This is a test.' | espeak-phonemizer -v en-us --csv
s1|This is a test.|ðɪs ɪz ɐ tˈɛst

Phonemes are added as a final column, allowing you to pass arbitrary metadata through to the output.

Parallelize with GNU Parallel

parallel -a /path/to/input.csv --pipepart \
    espeak-phonemizer -v en-us --csv \
    > /path/to/output.csv

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

espeak_phonemizer-1.0.0.tar.gz (5.5 kB view details)

Uploaded Source

File details

Details for the file espeak_phonemizer-1.0.0.tar.gz.

File metadata

  • Download URL: espeak_phonemizer-1.0.0.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.10

File hashes

Hashes for espeak_phonemizer-1.0.0.tar.gz
Algorithm Hash digest
SHA256 a81f812b0204e05bab4c2af820239e4b4c53bf3fcd4f72b9903accfd646e0a86
MD5 00c762150585edba4fcf4176874c8f81
BLAKE2b-256 a43f4c60398b167f0926abbe81a1b2c9bf5bf7903065ce17a8bd01f6638dd9ee

See more details on using hashes here.

Provenance

Supported by

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