kaldialign
Kaldi alignment methods wrapped into Python
What it is and what it does
kaldialign wraps Kaldi's edit-distance and alignment algorithms directly into Python via pybind11, ensuring bit-for-bit compatibility with Kaldi's scoring. It exposes functions for computing edit distance (with insertion, deletion, substitution counts), sequence alignment, corpus-level error rates, and WER confidence intervals via bootstrapping. The package solves the problem of inconsistent Levenshtein implementations across tools by using Kaldi's proven code unchanged.
The library is designed for speech recognition and NLP workflows where WER measurement must match Kaldi's results exactly. It supports optional SCLITE-style weighting (insertion/deletion cost 3, substitution cost 4), compound word matching to handle transcription inconsistencies, and statistical confidence interval estimation. No external runtime dependencies are required; the package is self-contained after installation.
Use it for:
- Measure WER for speech recognition systems with guaranteed Kaldi compatibility.
- Align reference and hypothesis sequences to identify specific error types (insertions, deletions, substitutions).
- Compute corpus-level error statistics across batches of transcription pairs.
- Extract 95% confidence intervals for WER using bootstrapping to assess statistical significance.
- Handle compound word inconsistencies (e.g., 'white paper' vs 'whitepaper') at zero cost in error calculations.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Computes edit distance, alignment, and word error rate (WER) between sequences using Kaldi's original algorithms, with support for compound word matching and statistical confidence intervals.
Yes. The package is actively maintained, has no known vulnerabilities, supports current Python versions (3.10–3.14), and solves a specific, high-value problem: exact Kaldi-compatible WER scoring. Medium install friction is acceptable given prebuilt wheels for all major platforms. Use it if you need reproducible speech recognition metrics that match Kaldi exactly.
Install
kaldialign on PyPI
pip
pip install kaldialignuv
uv add kaldialignpoetry
poetry add kaldialignInstalling kaldialign
Before you install
Medium install friction due to compiled wheels; prebuilt binaries available for Python 3.10–3.14 on macOS, Linux, and Windows, but verbose installation flags recommended per documentation.
License in practice
Apache-2.0 permissive license allows commercial and private use with minimal restrictions; attribution required.
Quickstart
pip install kaldialign
from kaldialign import edit_distance
ref = ['a', 'b', 'c']
hyp = ['a', 's', 'x', 'c']
results = edit_distance(ref, hyp)
print(results) # {'ins': 1, 'del': 0, 'sub': 1, 'total': 2}
Verify before relying
- Whether pybind11 compilation is required when prebuilt wheels are unavailable for a specific platform.
- Performance characteristics (speed, memory) relative to other edit-distance libraries for large-scale batch processing.
Package facts
| License | Apache-2.0 (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | medium — platform-specific wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 60 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 318,565/month — #7,651 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: kaldialign-0.12.0-cp310-cp310-macosx_10_9_universal2.whl; kaldialign-0.12.0-cp310-cp310-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl; kaldialign-0.12.0-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl; kaldialign-0.12.0-cp310-cp310-win32.whl; kaldialign-0.12.0-cp310-cp310-win_amd64.whl; kaldialign-0.12.0-cp311-cp311-macosx_10_9_universal2.whl; kaldialign-0.12.0-cp311-cp311-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl; kaldialign-0.12.0-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl; kaldialign-0.12.0-cp311-cp311-win32.whl; kaldialign-0.12.0-cp311-cp311-win_amd64.whl; kaldialign-0.12.0-cp312-cp312-macosx_10_13_universal2.whl; kaldialign-0.12.0-cp312-cp312-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl; kaldialign-0.12.0-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl; kaldialign-0.12.0-cp312-cp312-win32.whl; kaldialign-0.12.0-cp312-cp312-win_amd64.whl; kaldialign-0.12.0-cp313-cp313-macosx_10_13_universal2.whl; kaldialign-0.12.0-cp313-cp313-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl; kaldialign-0.12.0-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl; kaldialign-0.12.0-cp313-cp313-win32.whl; kaldialign-0.12.0-cp313-cp313-win_amd64.whl
Keywords: natural language processing, speech recognition, machine learning
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
jiwerJiWER computes speech recognition evaluation…
permissive · top 5,000 on PyPI
texterrorsScores automatic speech recognition or…
permissive · top 5,000 on PyPI
nlptuttiMeasures Korean speech-to-text accuracy using…
permissive · top 15,000 on PyPI
editdistpyComputes Levenshtein and Damerau-Levenshtein…
permissive · top 15,000 on PyPI
edlibEdlib calculates edit distance (Levenshtein…
permissive · top 15,000 on PyPI
kaldifstPython wrapper for OpenFst and Kaldi…
permissive · top 15,000 on PyPI
editdistanceComputes the edit distance (Levenshtein…
permissive · top 5,000 on PyPI
kaldi-python-ioReads and writes Kaldi binary archives,…
permissive · top 15,000 on PyPI
fastdtwfastdtw computes approximate Dynamic Time…
permissive · top 15,000 on PyPI
kaldi-native-fbankExtracts Kaldi-compatible filterbank (fbank)…
permissive · top 15,000 on PyPI