Jiwer

4.0.0 · active · verified Fri Apr 10

Jiwer is a simple and fast Python package designed to evaluate Automatic Speech Recognition (ASR) systems. It computes similarity measures such as Word Error Rate (WER), Match Error Rate (MER), Word Information Lost (WIL), Word Information Preserved (WIP), and Character Error Rate (CER). It uses RapidFuzz, which leverages C++ under the hood, for efficient minimum-edit distance calculations, making it faster than pure Python implementations. The current version is 4.0.0, released in June 2025, and it maintains an active development and release cadence.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to calculate the Word Error Rate (WER) for both single and multiple reference/hypothesis pairs using `jiwer.wer()`. It also shows how to use `jiwer.process_words()` to obtain a more detailed output, including various error measures and the alignment between the reference and hypothesis.

import jiwer

# Calculate Word Error Rate (WER) for single strings
reference_single = "hello world"
hypothesis_single = "hello duck"
error_single = jiwer.wer(reference_single, hypothesis_single)
print(f"WER (single): {error_single}")

# Calculate WER for multiple sentences (lists of strings)
references_multiple = ["hello world", "i like monthy python"]
hypotheses_multiple = ["hello duck", "i like python"]
error_multiple = jiwer.wer(references_multiple, hypotheses_multiple)
print(f"WER (multiple): {error_multiple}")

# Get detailed output including alignments and all measures
output_details = jiwer.process_words(reference_single, hypothesis_single)
print(f"\nDetailed output WER: {output_details.wer}")
print(f"Detailed output MER: {output_details.mer}")
print(f"Alignments: {output_details.alignments}")

view raw JSON →