Word Error Rate for Python
| Meta | |
| License | |
| Security | |
| Testing | |
| Package |
What is werpy?
werpy is an ultra-fast, lightweight Python package for calculating and analyzing Word Error Rate (WER) between two sets of text.
Built for flexibility and ease of use, it supports multiple input types such as strings, lists, and NumPy arrays. This makes it ideal for everything from quick experiments to large-scale evaluations.
With speed in mind at every scale, werpy harnesses the efficiency of C optimizations to accelerate processing, delivering ultra-fast results from small datasets to enterprise-level workloads.
It also comes packed with powerful features, including:
- 🔤 Built-in text normalization to handle data inconsistencies
- ⚙️ Customizable error penalties for insertions, deletions, and substitutions
- 📋 A detailed summary output for in-depth error analysis
werpy is a quality-focused package, built to production-grade standards for reliability and robustness.
Installation
You can install the latest werpy release from PyPI with pip or uv:
# Install werpy from PyPI
pip install werpy
# Or install with uv
uv pip install werpy
werpy accepts NumPy arrays of strings as inputs wherever it accepts a list.
Functions available in werpy
The following table provides an overview of the functions that can be used in werpy.
| Function | Description |
|---|---|
| normalize(text) | Preprocess input text to put it into Unicode Normalization Form C, remove ASCII and Unicode punctuation, remove duplicated spaces, leading/trailing blanks and convert all words to lowercase. |
| wer(reference, hypothesis) | Calculate the overall Word Error Rate for the entire reference and hypothesis texts. |
| wers(reference, hypothesis) | Calculates a list of the Word Error Rates for each of the reference and hypothesis texts. |
| werp(reference, hypothesis, insertions_weight=1, deletions_weight=1, substitutions_weight=1) | Calculates a weighted Word Error Rate for the entire reference and hypothesis texts. |
| werps(reference, hypothesis, insertions_weight=1, deletions_weight=1, substitutions_weight=1) | Calculates a list of weighted Word Error Rates for each of the reference and hypothesis texts. |
| summary(reference, hypothesis, *, output="pandas") | Provides a comprehensive breakdown of the calculated results including the WER, Levenshtein Distance and all the insertion, deletion and substitution errors. Returns a pandas DataFrame, a polars DataFrame with output="polars", or a list of dictionaries with output="records". |
| summaryp(reference, hypothesis, insertions_weight=1, deletions_weight=1, substitutions_weight=1, *, output="pandas") | Delivers an in-depth breakdown of the results, covering metrics like WER, Levenshtein Distance, and a detailed account of insertion, deletion, and substitution errors, inclusive of the weighted WER. Returns a pandas DataFrame, a polars DataFrame with output="polars", or a list of dictionaries with output="records". |
Usage
Import the werpy package
Python Code:
import werpy
Example 1 - Normalize a list of text
Python Code:
input_data = ["It's very popular in Antarctica.","The Sugar Bear character"]
reference = werpy.normalize(input_data)
print(reference)
Results Output:
['its very popular in antarctica', 'the sugar bear character']
Example 2 - Calculate the overall Word Error Rate on a set of strings
Python Code:
wer = werpy.wer('i love cold pizza', 'i love pizza')
print(wer)
Results Output:
0.25
Example 3 - Calculate the overall Word Error Rate on a set of lists
Python Code:
ref = ['i love cold pizza','the sugar bear character was popular']
hyp = ['i love pizza','the sugar bare character was popular']
wer = werpy.wer(ref, hyp)
print(wer)
Results Output:
0.2
Example 4 - Calculate the Word Error Rates for each set of texts
Python Code:
ref = ['no one else could claim that','she cited multiple reasons why']
hyp = ['no one else could claim that','she sighted multiple reasons why']
wers = werpy.wers(ref, hyp)
print(wers)
Results Output:
[0.0, 0.2]
Example 5 - Calculate the weighted Word Error Rates for the entire set of text
Python Code:
ref = ['it was beautiful and sunny today']
hyp = ['it was a beautiful and sunny day']
werp = werpy.werp(ref, hyp, insertions_weight=0.5, deletions_weight=0.5, substitutions_weight=1)
print(werp)
Results Output:
0.25
Example 6 - Calculate a list of weighted Word Error Rates for each of the reference and hypothesis texts
Python Code:
ref = ['it blocked sight lines of central park', 'her father was an alderman in the city government']
hyp = ['it blocked sightlines of central park', 'our father was an elder man in the city government']
werps = werpy.werps(ref, hyp, insertions_weight = 0.5, deletions_weight = 0.5, substitutions_weight = 1)
print(werps)
Results Output:
[0.21428571428571427, 0.2777777777777778]
Example 7 - Get the complete breakdown as a list of dictionaries
Python Code:
ref = ['it was beautiful and sunny today']
hyp = ['it was a beautiful and sunny day']
records = werpy.summary(ref, hyp, output="records")
print(records)
Results Output:
[{'wer': 0.3333333333333333, 'ld': 2, 'm': 6, 'insertions': 1, 'deletions': 0, 'substitutions': 1, 'inserted_words': ['a'], 'deleted_words': [], 'substituted_words': [('today', 'day')]}]
Examples 8, 9 and 10 use pandas and polars. If your project already has them installed, these examples work as they are. If not, install them with:
# Install pandas
uv pip install pandas
# Install polars
uv pip install polars
Example 8 - Provide a complete breakdown of the Word Error Rate calculations for each of the reference and hypothesis texts
Python Code:
ref = ['it is consumed domestically and exported to other countries', 'rufino street in makati right inside the makati central business district', 'its estuary is considered to have abnormally low rates of dissolved oxygen', 'he later cited his first wife anita as the inspiration for the song', 'no one else could claim that']
hyp = ['it is consumed domestically and exported to other countries', 'rofino street in mccauti right inside the macasi central business district', 'its estiary is considered to have a normally low rates of dissolved oxygen', 'he later sighted his first wife anita as the inspiration for the song', 'no one else could claim that']
summary = werpy.summary(ref, hyp)
print(summary)
Results Output:
Example 9 - Provide a complete breakdown of the Weighted Word Error Rate for each of the input texts
Python Code:
ref = ['the tower caused minor discontent because it blocked sight lines of central park', 'her father was an alderman in the city government', 'he was commonly referred to as the blacksmith of ballinalee']
hyp = ['the tower caused minor discontent because it blocked sightlines of central park', 'our father was an alderman in the city government', 'he was commonly referred to as the blacksmith of balen alley']
weighted_summary = werpy.summaryp(ref, hyp, insertions_weight = 0.5, deletions_weight = 0.5, substitutions_weight = 1)
print(weighted_summary)
Results Output:
Example 10 - Get the complete breakdown as a polars DataFrame
Python Code:
ref = ['it was beautiful and sunny today', 'she cited multiple reasons why']
hyp = ['it was a beautiful and sunny day', 'she sighted multiple reasons why']
summary = werpy.summary(ref, hyp, output="polars")
print(summary.select("wer", "ld", "inserted_words", "substituted_words"))
Results Output:
shape: (2, 4)
┌──────────┬─────┬────────────────┬───────────────────────┐
│ wer ┆ ld ┆ inserted_words ┆ substituted_words │
│ --- ┆ --- ┆ --- ┆ --- │
│ f64 ┆ i64 ┆ list[str] ┆ list[struct[2]] │
╞══════════╪═════╪════════════════╪═══════════════════════╡
│ 0.333333 ┆ 2 ┆ ["a"] ┆ [{"today","day"}] │
│ 0.2 ┆ 1 ┆ [] ┆ [{"cited","sighted"}] │
└──────────┴─────┴────────────────┴───────────────────────┘
Example 11 - Calculate the Word Error Rate on NumPy arrays
Python Code:
import numpy as np
ref = np.array(['i love cold pizza', 'the sugar bear character was popular'])
hyp = np.array(['i love pizza', 'the sugar bare character was popular'])
wer = werpy.wer(ref, hyp)
print(wer)
Results Output:
0.2
Optional dependencies
- NumPy - werpy accepts one-dimensional NumPy arrays of strings as inputs, from the NumPy that your project installs.
- Pandas - Powerful data structures for data analysis, time series, and statistics. The pandas extra installs it, pip install "werpy[pandas]", for the pandas DataFrame of summary() and summaryp().
- Polars - A DataFrame library. The polars extra installs it, pip install "werpy[polars]", for the polars DataFrame of summary() and summaryp() with output="polars".
Licensing
werpy is released under the terms of the BSD 3-Clause License. Please refer to the LICENSE file for full details.
This project uses pandas and polars as optional dependencies. For license details, please refer to their official repositories:
- Pandas - https://github.com/pandas-dev/pandas
- Polars - https://github.com/pola-rs/polars
Metadata
Release files for werpy 4.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| werpy-4.0.0.tar.gz | 122.7 kB | With provenance | Details for werpy-4.0.0.tar.gz |
Built distributions (wheels)
Total release size: 1.1 MB
Release files / werpy-4.0.0.tar.gz
| Download URL | werpy-4.0.0.tar.gz |
|---|---|
| Size | 122.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
141cc8c61edf5c723ec0e3e2d36af331eabd1b7de206afaa9fe65276625fc071
|
|
BLAKE2b-256 checksum How to use checksums |
1206bb2a3b167d421621f86ef9e008d4784b3f0180c2c7fd27c5859562d006b0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 5, 2026.
Transparency logRelease files / werpy-4.0.0-cp311-abi3-win_arm64.whl
| Download URL | werpy-4.0.0-cp311-abi3-win_arm64.whl |
|---|---|
| Size | 123.4 kB |
| Tags | CPython 3.11 Windows ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
0c37060f84b7a0666a836a55d2a8371af86320f1c5e14ddd01e936546c8031df
|
|
BLAKE2b-256 checksum How to use checksums |
f3b66354dbd5f9ea31779a1f43ef6095eb02d91224b96f815aa5125e2b2e34ca
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 5, 2026.
Transparency logRelease files / werpy-4.0.0-cp311-abi3-win_amd64.whl
| Download URL | werpy-4.0.0-cp311-abi3-win_amd64.whl |
|---|---|
| Size | 128.7 kB |
| Tags | CPython 3.11 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
e53081319a3c62910dc458e30808be9d899016c4bbdf1858ece3e2990de1325a
|
|
BLAKE2b-256 checksum How to use checksums |
de224f1588109e77780f343fd77826d0fd6bbff6abdebd1a36f1f2e056a7815b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 5, 2026.
Transparency logRelease files / werpy-4.0.0-cp311-abi3-musllinux_1_2_x86_64.whl
| Download URL | werpy-4.0.0-cp311-abi3-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 146.9 kB |
| Tags | CPython 3.11 Linux musl 1.2+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
8f91998be90bc530320c60835eebcd4405acc85e44969b9eae2bab83dda37578
|
|
BLAKE2b-256 checksum How to use checksums |
6d49348992ef97d7dda9ff2da1520054e55bddbedcf04ed210bd59b2340be4df
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 5, 2026.
Transparency logRelease files / werpy-4.0.0-cp311-abi3-musllinux_1_2_aarch64.whl
| Download URL | werpy-4.0.0-cp311-abi3-musllinux_1_2_aarch64.whl |
|---|---|
| Size | 145.7 kB |
| Tags | CPython 3.11 Linux musl 1.2+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
4db535aae94082af5de24d13c4fa18d6df08b449924a550a7a6df6a1ddfa99e6
|
|
BLAKE2b-256 checksum How to use checksums |
d612c6aba612450ac29ed870ffdfa8707fffc7753febf11209e09fdc1fd52261
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 5, 2026.
Transparency logRelease files / werpy-4.0.0-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
| Download URL | werpy-4.0.0-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 145.1 kB |
| Tags | CPython 3.11 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
e7880db84787a1015f43cae6c02778388136c300d4822fea06cd878ffa9162f8
|
|
BLAKE2b-256 checksum How to use checksums |
880e6df8bea3543a847644bff1d99bf351e6f6ceb133d7a32c676dd0dbfd0ae1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 5, 2026.
Transparency logRelease files / werpy-4.0.0-cp311-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
| Download URL | werpy-4.0.0-cp311-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl |
|---|---|
| Size | 145.5 kB |
| Tags | CPython 3.11 Linux glibc 2.17+ ARM64 Linux glibc 2.28+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
55258064349042cba730c60902c26c0f5bbf137bfb5471737a9bdcd97b928393
|
|
BLAKE2b-256 checksum How to use checksums |
4f9b4a055c00557862464053a5ad218be7f4bb2c705cd186df82c74d2f63b5d9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 5, 2026.
Transparency logRelease files / werpy-4.0.0-cp311-abi3-macosx_11_0_arm64.whl
| Download URL | werpy-4.0.0-cp311-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 126.8 kB |
| Tags | CPython 3.11 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
27ca2c8e7695f3e829efa151d245bd7abb0679c6d06828b0d63862879663b7f4
|
|
BLAKE2b-256 checksum How to use checksums |
2026f1ae78714d65b73adde739da3a8a7b0b9e7ab7630d983b023da012f98b2c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 5, 2026.
Transparency logSecurity for werpy 4.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 8 files in this release have been uploaded with provenance metadata.
Attestation for werpy-4.0.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 5, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.