Skip to main content

JiWER

JiWER is a simple and fast python package to evaluate an automatic speech recognition system. It supports the following measures:

  1. word error rate (WER)
  2. match error rate (MER)
  3. word information lost (WIL)
  4. word information preserved (WIP)
  5. character error rate (CER)

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.

Documentation

For further info, see the documentation at jitsi.github.io/jiwer.

Installation

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

Usage

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)

A note on empty references

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

Licence

The jiwer package is released under the Apache License, Version 2.0 licence by 8x8.

For further information, see LICENCE.

Reference

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.

Metadata

Release files for jiwer 4.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for jiwer 4.0.0
File Size Uploaded
jiwer-4.0.0.tar.gz 28.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for jiwer 4.0.0
File Interpreter ABI Platform
jiwer-4.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 51.1 kB

Release files / jiwer-4.0.0.tar.gz

Download URL jiwer-4.0.0.tar.gz
Size 28.1 kB
Tags Source
SHA-256 checksum
How to use checksums
ae9c051469102a61ef0927100baeeb4546f78d180c9b0948281d08eaf44c191e
BLAKE2b-256 checksum
How to use checksums
121e963dfc249d5bbe88079b57a22556e981ddd9208e4b6116e48bdbfc01f26b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.5.26

Release files / jiwer-4.0.0-py3-none-any.whl

Download URL jiwer-4.0.0-py3-none-any.whl
Size 23.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7efaf0bd336b095d99ddef9dd67e1ee829d75d58aa2a81d9639870b01d6d95ea
BLAKE2b-256 checksum
How to use checksums
69c9172c525330c739a068c01050759a6f855ce16212db10a0359e690a03ac48
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.5.26

Release history Release notifications | RSS feed

This release

4.0.0 This release

2 release files

3.1.0

2 release files

3.0.5

2 release files

3.0.4

2 release files

3.0.3

2 release files

3.0.2

2 release files

3.0.1

2 release files

3.0.0

2 release files

2.6.0

2 release files

2.5.2

2 release files

2.5.1

2 release files

2.5.0

2 release files

2.4.0

2 release files

2.3.0

2 release files

2.2.1

2 release files

2.2.0

2 release files

2.1.0

2 release files

2.0.1

2 release files

2.0.0

2 release files

1.3.2

2 release files

1.3.1

2 release files

1.3

2 release files

1.2

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page