Package to assess the pronounceability of English words and text.
Project description
PyRonounce
A Python package to assess the pronounceability of English words and text.
Overview
PyRonounce analyzes words to determine how difficult they are to pronounce based on various phonetic features. It can be used to:
- Evaluate how easy or difficult a word is to pronounce
- Analyze text to determine its overall pronounceability
- Extract detailed phonetic feature information
The package uses a machine learning model trained on English words of varying pronounceability difficulty.
Example
λ ~/ uvx pyronounce -d squirrel zeitgeist pencil deliberation
'squirrel' (/skwɝəl/): moderate (score: 0.52)
'zeitgeist' (/tsaɪtɡaɪst/): hard (score: 0.31)
'pencil' (/pɛnsəl/): easy (score: 0.68)
'deliberation' (/dɪlɪbɝeɪʃən/): moderate (score: 0.48)
Installation
You can install PyRonounce using pip:
pip install pyronounce
Or using UV for improved performance:
uv add pyronounce
To install from source:
git clone https://github.com/uyasarkocal/pyronounce.git
cd pyronounce
pip install -e .
Usage
Command Line
PyRonounce can be used from the command line to assess words or text:
# Assess individual words
pyronounce hello world
# Assess text
pyronounce -t "This is some text to analyze"
# Show detailed feature information
pyronounce -d complicated
# Output JSON
pyronounce -j antidisestablishmentarianism
# Read from stdin
echo "supercalifragilisticexpialidocious" | pyronounce
Python API
import pyronounce
# Assess a single word
result = pyronounce.assess_word("complicated")
print(f"Score: {result['score']}, Category: {result['category']}")
# Assess with detailed feature information
detailed = pyronounce.assess_word("complicated", detailed=True)
features = detailed['features']
# Assess a text
text_result = pyronounce.assess_text("This is a sample text to analyze")
print(f"Average score: {text_result['average_score']}")
print(f"Overall category: {text_result['overall_category']}")
Advanced Usage
You can create your own instance of the PronounceabilityAssessor class:
from pyronounce import PronounceabilityAssessor
# Create with default model
assessor = PronounceabilityAssessor()
# Create with custom model
custom_assessor = PronounceabilityAssessor(model_path="/path/to/model.pkl")
# Get feature importance
importance = assessor.get_feature_importance()
Features
PyRonounce evaluates words based on these phonetic features:
- Syllable count: Number of syllables
- Consonant clusters: Sequences of consonants without vowels
- Vowel ratio: Proportion of vowels to consonants
- Consonant complexity: Presence of complex consonants like fricatives
- Diphthongs: Two vowel sounds in one syllable
- Stress patterns: Placement of stress in the word
- Word length: Overall length consideration
- Unusual sounds: Phonemes not common in many languages
Difficulty Categories
Words are classified into these categories:
- Very Easy (score > 0.85)
- Easy (score > 0.65)
- Moderate (score > 0.45)
- Hard (score > 0.25)
- Very Hard (score <= 0.25)
License
This project is licensed under the MIT License - see the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyronounce-0.1.2.tar.gz.
File metadata
- Download URL: pyronounce-0.1.2.tar.gz
- Upload date:
- Size: 31.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.4.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e3d5e7ab40ceb0d5cf7ccdad5fc22478b303eaa0f741c12d1f0bccc442d26765
|
|
| MD5 |
cfa9f27293cd194ce5f293bb75ca181e
|
|
| BLAKE2b-256 |
de9605d3708abb2fd2d792e0fdb4079aade59d64de6bcc016724d96e38e9e2b8
|
File details
Details for the file pyronounce-0.1.2-py3-none-any.whl.
File metadata
- Download URL: pyronounce-0.1.2-py3-none-any.whl
- Upload date:
- Size: 13.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.4.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f8793b4ada28ba2c8486358f64e9a615ecb14285831572be03b2df6ab6157cc2
|
|
| MD5 |
eedec4ca10bdf00498d612c4f2ccb6ce
|
|
| BLAKE2b-256 |
252b4a3961ffc5247c79437b290246a5b3686f6842ca4114e9ae7deba018d1a1
|