skillfed

kaldialign

Kaldi alignment methods wrapped into Python

kaldialign v0.12.0 318.6K downloads/30d#7,651 on PyPI70
Permissive license Apache-2.0 Active released

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 kaldialign

uv

uv add kaldialign

poetry

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 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

Development Status :: 5 - Production/StableIntended Audience :: DevelopersOperating System :: OS IndependentProgramming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Topic :: Scientific/Engineering :: Artificial IntelligenceTopic :: Scientific/Engineering :: MathematicsTopic :: Software Development :: Libraries :: Python ModulesTopic :: Text Processing :: Linguistic

Tags

edit distance computationsequence alignmentword error rate WERLevenshtein distancespeech recognition scoringkaldi alignmentbatch error rate
speech-recognitionnlp-metricssequence-alignment

More Python Modules packages

Further reading