kaldialign is a Python package that provides wrappers for Kaldi's core alignment and edit distance computation functions. It directly incorporates Kaldi's C++ code via pybind11 to ensure identical Word Error Rate (WER) and alignment results as Kaldi, addressing inconsistencies found in other Levenshtein implementations. Currently at version 0.9.3, it receives regular updates focusing on performance enhancements and broader platform compatibility through pre-built wheels.
pip install kaldialignVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates the core `align` and `edit_distance` functions, as well as the `bootstrap_wer_ci` method for calculating Word Error Rate confidence intervals. The `epsilon_symbol` for `align` must be a character not present in either sequence to represent insertions/deletions.
Choose an `epsilon` symbol (like `*` or `_`) that is unique and known not to exist in your reference or hypothesis sequences.
Be aware that the implementation is now C++-based. Rely on the provided Python interface for its functionality.
If `sclite`-style scoring is required, ensure your function call includes `sclite_mode=True`, e.g., `edit_distance(ref, hyp, sclite_mode=True)`.
For most users, `pip install kaldialign` should download a pre-built wheel, avoiding compilation. If building from source is necessary, ensure you have CMake and a C++ compiler (like GCC or Clang) installed and accessible in your system's PATH.
Try reinstalling the package in a clean virtual environment: `python -m venv .venv && source .venv/bin/activate && pip install --no-cache-dir kaldialign`. If errors persist, check the full installation log for compilation failures.
No dependency data recorded yet.