--- id: kaldialign version: "0.12.0" license: Apache-2.0 license_treatment: permissive maintenance: active --- # kaldialign — Kaldi alignment methods wrapped into Python License: permissive · Maintenance: active · Downloads: 318.6K/mo ## 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 above — 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 pip install kaldialign uv add kaldialign poetry add kaldialign ## Installing 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_current - Install friction: medium - Maintenance: active - Downloads: 318.6K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags edit distance computation, sequence alignment, word error rate WER, Levenshtein distance, speech recognition scoring, kaldi alignment, batch error rate, speech-recognition, nlp-metrics, sequence-alignment [View on SkillFed](https://skillfed.io/packages/kaldialign) · [View on PyPI](https://pypi.org/project/kaldialign/)