
Product
Introducing the Alert Details Page: A Better Way to Explore Alerts
Socket's new Alert Details page is designed to surface more context, with a clearer layout, reachability dependency chains, and structured review.
jiwer
Advanced tools
JiWER is a simple and fast python package to evaluate an automatic speech recognition system. It supports the following measures:
These measures are computed with the use of the minimum-edit distance between one or more reference and hypothesis sentences. The minimum-edit distance is calculated using RapidFuzz, which uses C++ under the hood, and is therefore faster than a pure python implementation.
For further info, see the documentation at jitsi.github.io/jiwer.
You should be able to install this package using uv:
$ uv add jiwer
Or, if you prefer old-fashioned pip and you're using Python >= 3.8:
$ pip install jiwer
The most simple use-case is computing the word error rate between two strings:
from jiwer import wer
reference = "hello world"
hypothesis = "hello duck"
error = wer(reference, hypothesis)
There is undefined behaviour when you apply an empty reference and hypothesis pair to the WER formula, as you get a division by zero.
As of version 4.0, jiwer defines the behaviour as follows, and thereby also
lifts the requirement for reference strings to be non-empty.
This allows for testing whether models hallucinate on silent audio.
Note that usually, there are multiple reference and hypothesis pairs.
It now supported that one or more of these references are empty, but to test well,
most references should still be non-empty.
import jiwer
# when ref and hyp are both empty, there is no error as
# an ASR system correctly predicted silence/non-speech.
assert jiwer.wer('', '') == 0
assert jiwer.mer('', '') == 0
assert jiwer.wip('', '') == 1
assert jiwer.wil('', '') == 0
assert jiwer.cer('', '') == 0
When the hypothesis is non-empty, every word or character counts as an insertion:
import jiwer
assert jiwer.wer('', 'silence') == 1
assert jiwer.wer('', 'peaceful silence') == 2
assert jiwer.process_words('', 'now defined behaviour').insertions == 3
assert jiwer.cer('', 'a') == 1
assert jiwer.cer('', 'abcde') == 5
The jiwer package is released under the Apache License, Version 2.0 licence by 8x8.
For further information, see LICENCE.
For a comparison between WER, MER and WIL, see:
Morris, Andrew & Maier, Viktoria & Green, Phil. (2004). From WER and RIL to MER and WIL: improved evaluation measures for connected speech recognition.
FAQs
Evaluate your speech-to-text system with similarity measures such as word error rate (WER)
We found that jiwer demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket's new Alert Details page is designed to surface more context, with a clearer layout, reachability dependency chains, and structured review.

Product
Campaign-level threat intelligence in Socket now shows when active supply chain attacks affect your repositories and packages.

Research
Malicious PyPI package sympy-dev targets SymPy users, a Python symbolic math library with 85 million monthly downloads.