WordErrorRate.py
Alignment and word error rate calculations
Python version of WordErrorrate.jl, which, because of Julia, is much faster.
Installation
pip install git+https://github.com/davidavdav/WordErrorRate.py.git
Synopsis
Usage:
>>> import worderrorrate
>>> ## A single comparison / alignment between reference and hypothesis
>>> w = worderrorrate.WER(["this", "is", "a", "test"], "this is another".split())
>>> print(f"Full alignment:\n{w}")
Full alignment:
REF: this is a test
HYP: this is * another
Eval c c d s
>>> print("The word error rate is", w.wer())
The word error rate is 0.5
>>> refali, hypali, evalali = w.align()
>>> print("Alignment indices:", refali, hypali, evalali)
Alignment indices: [0, 1, 2, 3] [0, 1, None, 2] ['c', 'c', 'd', 's']
>>> w.nref ## number of words in the reference
4
>>> w.nhyp ## in hypothesis
3
>>> w.nsub ## substitutions
1
>>> w.nins ## insertions
0
>>> w.ndel ## deletions
1
>>> ## Aggregate over multiple pairs of reference and hypothesis
>>> ws = worderrorrate.WERs() ## multiple utterances
>>> ws.append(["this", "is", "a", "test"], "this is another".split())
>>> ws.append("a b c d".split(), "a c e".split())
>>> ws.wer()
0.5
>>> ws.nref
8
>>> ws.nhyp
6
>>> ws.nsub
2
>>> ws.nins
0
>>> ws.ndel
2
Metadata
Release files for worderrorrate 0.1.2
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 |
|---|---|---|---|---|
| worderrorrate-0.1.2.tar.gz | 4.5 kB | Without provenance | Details for worderrorrate-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| worderrorrate-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for worderrorrate-0.1.2-py3-none-any.whl |
Total release size: 9.6 kB
Release files / worderrorrate-0.1.2.tar.gz
| Download URL | worderrorrate-0.1.2.tar.gz |
|---|---|
| Size | 4.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bba39608f52099eb50c1b65bbc5bd41778a81d141a6d98a384cfa477896b9fac
|
|
BLAKE2b-256 checksum How to use checksums |
f21ff4393d581c3e5428558c99971de3cdb4613600c01cca02fbea4f1a0427b9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.9
|
Release files / worderrorrate-0.1.2-py3-none-any.whl
| Download URL | worderrorrate-0.1.2-py3-none-any.whl |
|---|---|
| Size | 5.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
900ddbf8a7903328202f584a10ed8a9b4febc4e38034bdb8a09c59c143e1cc22
|
|
BLAKE2b-256 checksum How to use checksums |
5931d59c808b6488f3ce4c9065bf19b844f6cb5f942f79dc514e00dfae3bc5d5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.9
|
Security for worderrorrate 0.1.2
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A 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.