texterrors is a Python library and command-line tool designed to score ASR (Automatic Speech Recognition) or transcription output against a reference. It provides metrics such as Word Error Rate (WER) and Character Error Rate (CER), supports standard and character-aware alignment, generates detailed error reports, and can produce colored output for inspection. The library also features comparison of multiple hypothesis files, per-group metrics (e.g., per-speaker WER), keyword and OOV (Out-Of-Vocabulary) evaluation, oracle WER, and simple entity accuracy. It aims to be an easy-to-use, modify, and extend alternative to older tools like `sclite`. The current version is 1.1.6, and it receives active maintenance and frequent updates.
pip install texterrorsVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to use the `align_texts` function to calculate WER and CER programmatically. It takes tokenized reference and hypothesis lists and returns a detailed JSON object with various metrics. For more complex features such as colored output, per-group analysis, or simple entity accuracy, the `texterrors` command-line tool is often more convenient and directly supported.
Migrate any usage of `weighted WER` to use the new `simple entity accuracy` features if applicable, or remove the deprecated functionality.
Ensure your development environment has `nanobind` and `CMake` properly configured if building from source. For most users installing via `pip install texterrors`, pre-built wheels should handle this transparently.
Be aware of this difference when comparing results. If precise parity with traditional tools is required, ensure character-aware alignment is explicitly disabled, or understand the implications if it's enabled.
Pipe the output to `less -R` (e.g., `texterrors -c ref.txt hyp.txt | less -R`).
Always check the `--help` output for the correct input flags (`texterrors -h`) and use them as appropriate for your data format.
pip install texterrors
Ensure both `reference_file` and `hypothesis_file` have the exact same number of lines, corresponding to each utterance pair.
Pass the reference and hypothesis as lists containing the strings, even for a single utterance: `texterrors.wer(["hello world"], ["hallo world"])`.
Consult `texterrors --help` or the documentation for available arguments and correct spelling.
Specify the correct encoding using the `--encoding` argument in the command-line tool, e.g., `texterrors --encoding latin-1 ref.txt hyp.txt`.