Skip to main content

phonodist

Language-aware, explainable distance metrics for IPA pronunciations.

phonodist compares IPA with IPA. It does not perform grapheme-to-phoneme conversion or synthesize audio. Its feature metric combines Unicode-safe normalization, segment tokenization, PanPhon articulatory features, weighted alignment, and sparse language-specific equivalence rules.

Installation

python -m pip install phonodist

Quick start

from phonodist import pronunciation_distance

result = pronunciation_distance("p", "b")
print(result.distance)

The score is normalized to [0, 1]; alignment operations are available with explain=True. The bundled profile is de-DE; de and de_de are aliases. Use language=None for universal feature mode without language-specific profile rules.

Profile-aware example

from phonodist import pronunciation_distance

result = pronunciation_distance("n̩", "ən", language="de-DE", explain=True)

Structural comparison

compare_pronunciations provides the separate ipa-compare/1 structural diagnostic. It preserves primary and secondary stress as anchored events while embedding the segmental feature result.

from phonodist import compare_pronunciations

comparison = compare_pronunciations("wɪɹ", "wˈɪɹ")
assert comparison.classification == "stress_only"

This classifies supplied IPA; it does not determine which pronunciation is correct. See Structural IPA comparison.

CLI

phonodist compare de-DE 'n̩' 'ən' --explain
phonodist diff 'wɪɹ' 'wˈɪɹ' --explain

Use --json for structured output and phonodist --version to print the installed version. See the CLI reference for all options and error behavior.

Documentation

Scope and limitations

feature-align/1 ignores stress and reports a deterministic feature distance, not a calibrated model of human perceptual similarity. A zero score means equivalence under normalization and profile rules, not necessarily raw-string identity. PanPhon validates resulting segments; unsupported segments raise UnknownSegmentError. The separate ipa-compare/1 API preserves stress for structural diagnostics. Consumers should define their own thresholds.

Every result records metric/profile and PanPhon backend provenance. Metric-semantic changes require a metric version bump; language-specific rule or cost changes require a profile version bump.

Development

python -m pip install -e ".[dev]"
python -m pip install -r docs/requirements.txt
pytest --cov=phonodist --cov-report=term-missing
ruff check .
mypy phonodist
python docs/make.py html
python docs/make.py doctest
python -m build

Release publishing

Releases are built and published by the tag-triggered GitHub Actions workflow. The current PyPI publish job uses the PYPI_API_TOKEN Actions secret as API-token credentials; it is not configured for tokenless Trusted Publishing. See Releasing phonodist for release guidance.

License

Apache-2.0. PanPhon is an external MIT-licensed dependency and is not vendored here. PHOIBLE data is not bundled or copied into this package.

Metadata

Release files for phonodist 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for phonodist 0.1.2
File Size Uploaded
phonodist-0.1.2.tar.gz 43.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for phonodist 0.1.2
File Interpreter ABI Platform
phonodist-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 70.5 kB

Release files / phonodist-0.1.2.tar.gz

Download URL phonodist-0.1.2.tar.gz
Size 43.6 kB
Tags Source
SHA-256 checksum
How to use checksums
80c0834753be6bd6e26ba91c4220d649bddca6ef9c5df36220f90823c61d4502
BLAKE2b-256 checksum
How to use checksums
ce9b827cf9631165dfe184e8b3b57b3e9e81d40daaafe3ce277f2c0204fbac67
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / phonodist-0.1.2-py3-none-any.whl

Download URL phonodist-0.1.2-py3-none-any.whl
Size 26.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
172589de21bb5edcbc86b1052c38463aaf17dce8342dd67f9700cf4f9a46cf92
BLAKE2b-256 checksum
How to use checksums
e04cacd90a9de01f99e579d7d708d0bf713ec597b64e7be37aedcaf821db9d6f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page