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("shall I compare thee to a summer's day")
scan["meter"]["name"]  # 'iambic pentameter'
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.2.1.tar.gz (5.9 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.2.1-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.2.1.tar.gz.

File metadata

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

File hashes

Hashes for pyphonetik-0.2.1.tar.gz
Algorithm Hash digest
SHA256 d3121475c19fa2f32605f687696c44cc3aafb6038606c33f7236b0cbc59e4ba5
MD5 a61899538f9a3373381f8664861a4513
BLAKE2b-256 16fa9fe2c072db56e55af6ab06a643ef0659bd3720d24b7eaa7840bcbc8d452e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyphonetik-0.2.1-cp314-cp314-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 f6f232958e0d0cc92c934fbad46ff0f087fbc84d88de1b657536620cb1f36177
MD5 2fe998dd21714408b7a8764df612cc12
BLAKE2b-256 bca91118febb4d9afa52e0ec7a55b7d26f74ea6024b1b992490d6a72e333475b

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