Skip to main content

Automatically convert plain text into phonemes (US English pronunciation) and syllabify

Project description

Syllabify

PyPI Python 3.x License

Automatically convert plain text into phonemes (US English pronunciation) and syllabify.

Modified from the repository set up by Andrew Caines with some key changes, itemised below:

  • Environment management using Poetry
  • Python 3.10+ compatibility
  • Easy to access class and function interfaces
  • Use up-to-date cmudict versioned by python-cmudict

Set up

Requires Python 3 (Anthony Evans used Python 2: if that's what you prefer, see his repo).

pip install syllabify

Usage

Package interface

from syllabify import syllabify
word = syllabify("linguistics")
print(word)
L IH0 NG {onset: L, nucleus: IH0, coda: NG}
G W IH1 {onset: GW, nucleus: IH1, coda: empty}
S T IH0 K S {onset: ST, nucleus: IH0, coda: KS}

You can get the onset, nucleus, and coda of each syllable:

from syllabify import syllabify

word = syllabify("linguistics")
for syllable in word.syllables:
    print(f"Onset: {syllable.onset}")
    print(f"Nucleus: {syllable.nucleus}")
    print(f"Coda: {syllable.coda}")
Onset: L
Nucleus: IH0
Coda: NG
Onset: GW
Nucleus: IH1
Coda: empty
Onset: ST
Nucleus: IH0
Coda: KS

Command line interface

One word at a time:

syllabify linguistics
📝 Input: linguistics
🔤 Syllabification:

LIH0NG [L.IH0.NG] | ˈGWIH1 [GW.IH1.∅] | STIH0KS [ST.IH0.KS]

📖 Legend:
  [onset.nucleus.coda] = syllable structure
  ∅ = empty position
  ˈ = primary stress
  ˌ = secondary stress
  | = syllable boundary

Or several (space-separated):

syllabify colorless green ideas
📝 Input: colorless green ideas
🔤 Syllabification:

  ˈKAH1 [K.AH1.∅] | LER0 [L.ER0.∅] | LAH0S [L.AH0.S]
  ˈGRIY1N [GR.IY1.N]
  AY0 [∅.AY0.∅] | ˈDIY1 [D.IY1.∅] | AH0Z [∅.AH0.Z]

📖 Legend:
  [onset.nucleus.coda] = syllable structure
  ∅ = empty position
  ˈ = primary stress
  ˌ = secondary stress
  | = syllable boundary

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

syllabify-0.5.0.tar.gz (12.9 kB view details)

Uploaded Source

Built Distribution

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

syllabify-0.5.0-py3-none-any.whl (14.4 kB view details)

Uploaded Python 3

File details

Details for the file syllabify-0.5.0.tar.gz.

File metadata

  • Download URL: syllabify-0.5.0.tar.gz
  • Upload date:
  • Size: 12.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for syllabify-0.5.0.tar.gz
Algorithm Hash digest
SHA256 d86fdbed2f2ed7d10f2461a89a4429bd8702b035fac2c6cf346e5ac133ee54f0
MD5 49195eefbff32e98141a057a673ede59
BLAKE2b-256 90f1d311fd065c48112debde303a9c3d3c9cfa4041dea306e960220d5a87721a

See more details on using hashes here.

Provenance

The following attestation bundles were made for syllabify-0.5.0.tar.gz:

Publisher: python-publish.yml on eoleedi/syllabify

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file syllabify-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: syllabify-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 14.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for syllabify-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fe3c82a11150ba4e6c190abb605946beefab709412e35a25b38eb2410615df13
MD5 b1f01518f1b7cb90651203d70022ccd9
BLAKE2b-256 1ae6b186df5957ac669fd0172582a5663f2a5fc71c944a9d55f91af64e631503

See more details on using hashes here.

Provenance

The following attestation bundles were made for syllabify-0.5.0-py3-none-any.whl:

Publisher: python-publish.yml on eoleedi/syllabify

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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