Skip to main content

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.

Installation

You can install PyRonounce using pip:

pip install pyronounce

Or using UV for improved performance:

uv pip install pyronounce

To install from source:

git clone https://github.com/yourusername/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)

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

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

pyronounce-0.1.1.tar.gz (29.0 kB view details)

Uploaded Source

Built Distribution

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

pyronounce-0.1.1-py3-none-any.whl (11.0 kB view details)

Uploaded Python 3

File details

Details for the file pyronounce-0.1.1.tar.gz.

File metadata

  • Download URL: pyronounce-0.1.1.tar.gz
  • Upload date:
  • Size: 29.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.4.20

File hashes

Hashes for pyronounce-0.1.1.tar.gz
Algorithm Hash digest
SHA256 9b7982e31f6f50b75e983400f2fd465b045c72d9dbd1545bad458297f96e90d9
MD5 23affa89082afa68000d39934cda8986
BLAKE2b-256 20990e787504a9e9242e5ea29debc263d8a3855b1abc39a8324ef1d516ebd52f

See more details on using hashes here.

File details

Details for the file pyronounce-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: pyronounce-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 11.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.4.20

File hashes

Hashes for pyronounce-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0fd006588c769b419168d7e6e45f9034d6d93d18b1c2f381f325e95ac1500ff4
MD5 3875d19e0746d6bc8b9971068cb16b14
BLAKE2b-256 51b85f2818df0e0b7fc28b83e5d72e9c149be36674e07887ec47f0124a0b56be

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