Skip to main content

Python bindings for the phonetik phonetic analysis engine.

Project description

pyphonetik

Python bindings for phonetik, a phonetic analysis engine for English. Rhyme detection, scansion, syllable counting, and phonetic comparison backed by a 126K-word embedded dictionary.

Install

pip install pyphonetik

Usage

from pyphonetik import Engine

p = Engine()

# Lookup
info = p.lookup("hello")
# {'word': 'HELLO', 'phonemes': ['HH', 'AH0', 'L', 'OW1'], 'syllable_count': 2, ...}

# Rhymes
p.perfect_rhymes("cat")  # [{'word': 'BAT', 'rhyme_type': 'perfect', ...}, ...]
p.slant_rhymes("love", 10)
p.near_rhymes("night", 10)
p.rhymes("cat", 50)  # all types, merged

# Scansion
scan = p.scan("uneasy lies the head that wears the crown")
scan["meter"]["name"]  # 'iambic pentameter'
scan["visual"]         # 'x / x / x / x / x /'

# Raw dictionary stress (no function word demotion)
raw = p.scan("uneasy lies the head that wears the crown", mode="dictionary")
scan["syllable_count"]  # 10

# Compare
p.compare("cat", "bat")
# {'similarity': 0.6667, 'rhyme_type': 'perfect', 'confidence': 1.0, ...}

# Utilities
p.syllable_count("beautiful")  # 3
p.contains("hello")  # True
p.word_count()  # 126052

Requirements

  • Python >= 3.9
  • No runtime dependencies. The dictionary is compiled into the binary.

License

MIT

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

pyphonetik-0.3.0.tar.gz (6.0 kB view details)

Uploaded Source

Built Distribution

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

pyphonetik-0.3.0-cp314-cp314-manylinux_2_34_x86_64.whl (1.9 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.34+ x86-64

File details

Details for the file pyphonetik-0.3.0.tar.gz.

File metadata

  • Download URL: pyphonetik-0.3.0.tar.gz
  • Upload date:
  • Size: 6.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.12.6

File hashes

Hashes for pyphonetik-0.3.0.tar.gz
Algorithm Hash digest
SHA256 5166925b0667e6cd6cdd9119645832b4995fe0037ff2009cf4c65d5a3c222d7d
MD5 52999a647ee1beacb13b942bf27f5469
BLAKE2b-256 2ccc5b474fd23aefc59046c4cb9c95c67015cddf72aff20f0b93a41e4d513805

See more details on using hashes here.

File details

Details for the file pyphonetik-0.3.0-cp314-cp314-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for pyphonetik-0.3.0-cp314-cp314-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 2db7a3138f40f3262ae14a426e3d39c4d2b38a115878da2ca94d6f526b915b5b
MD5 a1a7cd9010ece1b53cae9737413b0a52
BLAKE2b-256 ec83bb68fa44bcfe993dc2e049042bb4e8837ff8714c100060da452178dfda0d

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