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 uv
  • Python 3.10+ compatibility
  • Easy to access class and function interfaces
  • Use up-to-date cmudict versioned by python-cmudict

Credits: Many thanks for @cainesap's work on porting and fixes & the original author @anthonysgevans

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

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for syllabify-0.5.1.tar.gz
Algorithm Hash digest
SHA256 c2d98651f10732121f542a398103434d6583e2c528dc264d22180b438f736aae
MD5 6c90c32f32f23ad52229997b3686fa85
BLAKE2b-256 e11fcf9f93e3df67ce3e2a846ec60fbf424a6dfbe0caab339baa5f4fd3696ba5

See more details on using hashes here.

Provenance

The following attestation bundles were made for syllabify-0.5.1.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.1-py3-none-any.whl.

File metadata

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

File hashes

Hashes for syllabify-0.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ab51777465c9ac649e864bd5dd7f74dadaf2a82063ca5ed2e400f73bb53d7676
MD5 1f26c291c9c27ae6a6dbd3de4135e342
BLAKE2b-256 4fd7c8bf50261e805612b622b90e969002301b382a2b275738fb6049d7685b19

See more details on using hashes here.

Provenance

The following attestation bundles were made for syllabify-0.5.1-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