Skip to main content

werpy-logo-word-error-rate

Word Error Rate for Python Tweet

Meta Python Version   Black Code Style   Documentation Status   Analytics in Motion
License werpy License   FOSSA Status   REUSE status
Security CodeQL   Codacy Security Scan   Bandit
Testing CodeFactor   Tests   codecov   View Benchmarks
Package Pypi   PyPI Downloads   Downloads   PyPI - Trusted Publisher

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.

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 remove 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) Provides a comprehensive breakdown of the calculated results including the WER, Levenshtein Distance and all the insertion, deletion and substitution errors.
summaryp(reference, hypothesis, insertions_weight=1, deletions_weight=1, substitutions_weight=1) 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.

Installation

You can install the latest werpy release with Python's pip package manager:

# Install werpy from PyPi
pip install werpy

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 - 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:

werpy-example-summary-results-word-error-rate-breakdown


Example 8 - 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:

werpy-example-summaryp-results-word-error-rate-breakdown


Dependencies

  • NumPy - Provides an assortment of routines for fast operations on arrays
  • Pandas - Powerful data structures for data analysis, time series, and statistics

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 standard scientific Python libraries including NumPy and Pandas. For license details, please refer to their official repositories:

Metadata

Release files for werpy 3.5.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 werpy 3.5.0
File Size Uploaded
werpy-3.5.0.tar.gz 45.5 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for werpy 3.5.0
File
werpy-3.5.0-cp311-abi3-win_amd64.whl CPython 3.11 abi3 Windows x86-64 Details
werpy-3.5.0-cp311-abi3-musllinux_1_2_x86_64.whl CPython 3.11 abi3 Linux musl 1.2+ x86-64 Details
werpy-3.5.0-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl CPython 3.11 abi3 Linux glibc 2.28+ x86-64, Linux glibc 2.17+ x86-64 Details
werpy-3.5.0-cp311-abi3-macosx_11_0_arm64.whl CPython 3.11 abi3 macOS 11.0+ ARM64 Details

Total release size: 551.4 kB

Release files / werpy-3.5.0.tar.gz

Download URL werpy-3.5.0.tar.gz
Size 45.5 kB
Tags Source
SHA-256 checksum
How to use checksums
50a5c00e585e21039a73a43119212be1653070bcdcd2fac11af79896a780b3a2
BLAKE2b-256 checksum
How to use checksums
5f221023b65b053c89c875faac2a204f019acfcdded6d58251f1e03cd837719a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 9, 2026.

Transparency log

Release files / werpy-3.5.0-cp311-abi3-win_amd64.whl

Download URL werpy-3.5.0-cp311-abi3-win_amd64.whl
Size 140.0 kB
Tags CPython 3.11 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
c4ec10a96dd21ef476929c32f209eb1319f27d3427d9a28968bb2a1962e79f29
BLAKE2b-256 checksum
How to use checksums
b1158c17dbd48e4d38f38ebe6da295484e4603d1e8322c193b2a7249fd0ef47e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 9, 2026.

Transparency log

Release files / werpy-3.5.0-cp311-abi3-musllinux_1_2_x86_64.whl

Download URL werpy-3.5.0-cp311-abi3-musllinux_1_2_x86_64.whl
Size 133.1 kB
Tags CPython 3.11 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
10e3bfadedc39f99592c6ba53060652e495e851b0b6f672e585a367ac50cc03f
BLAKE2b-256 checksum
How to use checksums
3e66444115f0e00c550adf469f2067fc004c5835ff4e1f5cf17291be090fa041
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 9, 2026.

Transparency log

Release files / werpy-3.5.0-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl

Download URL werpy-3.5.0-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Size 131.8 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
14051090456057feaf904633da47e2d63a497cebe30f3f459adbac4a542ac1d6
BLAKE2b-256 checksum
How to use checksums
6eac822547956c06e03d4dfb21ae13f17cfca01e813f8f941eab92df1ec6f8b5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 9, 2026.

Transparency log

Release files / werpy-3.5.0-cp311-abi3-macosx_11_0_arm64.whl

Download URL werpy-3.5.0-cp311-abi3-macosx_11_0_arm64.whl
Size 101.0 kB
Tags CPython 3.11 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
7523c60ebd93ac955c9cd9290c9a89ec19e8830557b68ff7181a7b9822c8a06c
BLAKE2b-256 checksum
How to use checksums
6fc0f71777c5fae5a13ac70181cb3c59e8b43e2377b2b99516b6c1ad31103a96
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 9, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

3.5.0 This release

5 release files

3.3.0

17 release files

3.2.0

17 release files

3.1.1

17 release files

3.1.0

17 release files

3.0.1

17 release files

3.0.0

17 release files

2.1.1

21 release files

2.1.0

21 release files

2.0.0

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.0

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

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