Skip to main content

A package to guess how pronounceable words are

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.0.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.0-py3-none-any.whl (11.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pyronounce-0.1.0.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.0.tar.gz
Algorithm Hash digest
SHA256 82fb9cf304ef9f0da8590d99a6853b603228b1fb5c94df870d677a34bb3e9715
MD5 298477b36086f412a142433a4ece8bf6
BLAKE2b-256 ab37d60b1abd50dece64a2b0337864be2082398aa88f4de0561013c29318ef7f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pyronounce-0.1.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bdca16809b82b7f423ac73620ac36e6d792e8715846542b6123a62ddc340dc69
MD5 0e0dfd368ad4b971074cc0c161ab0c40
BLAKE2b-256 7be1a2f5325ed7a7d95654d46baf54d30e418de63bd5bb7d08394ccfd166af78

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