evalNLP
evalNLP is a Python library offering advanced metrics for evaluating Automatic Speech Recognition (ASR) and translation models. This library is designed to meet the needs of researchers and developers working on Natural Language Processing tasks.
Features
-
UWER: Universal Word Error Rate, an enhanced metric for fair transcription evaluation, adapted to morphologically rich and low-resource languages. It uses a revised version of the Levenshtein algorithm with weighted substitutions through a
cost_funcand segmentation operations with au_cost. For more details, see the paper: Universal-WER: Enhancing WER with Segmentation and Weighted Substitution for Varied Linguistic Contexts. -
UTER: (Coming Soon) Universal Translation Error Rate, a robust metric for translation evaluation. It provides scores that closely align with human Direct Assessment (DA) evaluations, even for low-resource languages.
Installation
Install evalNLP using pip:
pip install evalnlp
Usage
The uwer function is defined as:
def uwer(ref: str, hyp: str, cost_func=None, u_cost=None):
By default:
- The substitution cost function (
cost_func) uses the Sorensen-Dice similarity measure. - You can also use an average-based function that combines CER, similarity_rate_lcs, jaccard_coefficient_lcs, fuzzy_ratio, and Sorensen-Dice by passing
"moyenne"as thecost_funcparameter. - The union cost (
u_cost) is defined as described in the paper.
The uwer function works with both single strings and lists of strings.
Example with single strings:
from evalnlp import uwer
reference = "This is a reference"
hypothesis = "This is a hypothesis"
score = uwer(reference, hypothesis)
print(f"UWER Score: {score}")
Example with lists:
from evalnlp import uwer
references = ["This is a reference", "Another reference"]
hypotheses = ["This is a hypothesis", "Another hypothesis"]
scores = uwer(references, hypotheses)
print(f"UWER Scores: {scores}")
Metadata
Release files for evalnlp 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 | |
|---|---|---|---|
| evalnlp-0.1.2.tar.gz | 16.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| evalnlp-0.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 33.4 kB
Release files / evalnlp-0.1.2.tar.gz
| Download URL | evalnlp-0.1.2.tar.gz |
|---|---|
| Size | 16.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9771fd638d11de2a89b5dd3b7fc853ddd95024515ba610c99bd4d182607a5284
|
|
BLAKE2b-256 checksum How to use checksums |
a60071408aa43c5a6d9ad263ccf506c8896b4fa6e2fd3ab08b2be962e51576fd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.4
|
Release files / evalnlp-0.1.2-py3-none-any.whl
| Download URL | evalnlp-0.1.2-py3-none-any.whl |
|---|---|
| Size | 17.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1dbdb0445053f9b0b928252d2a4cabc2618927946d56d23da07dc656b9bc212e
|
|
BLAKE2b-256 checksum How to use checksums |
35eba07170ca2fecf321c889380c0278d4a1f72752cb67cad20084da0e20fc13
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.4
|