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
- Getting started
- Python API
- CLI
- Metric v1
- Structural IPA comparison
- Language profiles
- Changelog
- Releasing phonodist
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)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| phonodist-0.1.2.tar.gz | 43.6 kB | Without provenance | Details for phonodist-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| phonodist-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for phonodist-0.1.2-py3-none-any.whl |
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
|
Security for phonodist 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.