Enhanced evaluation metrics for NLP taks
Project description
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}")
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file evalnlp-0.1.1.tar.gz.
File metadata
- Download URL: evalnlp-0.1.1.tar.gz
- Upload date:
- Size: 16.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8c9eceda4cf08d57ddc2c64a79a113f93a52512d3c5e05ef24d7976e21249019
|
|
| MD5 |
e146b8144690abc73e8e85bc78663df9
|
|
| BLAKE2b-256 |
61433a4208ade1a7a0750b147bfbbc058b34a801e0a4f1b18f4b06d91310ac5a
|
File details
Details for the file evalnlp-0.1.1-py3-none-any.whl.
File metadata
- Download URL: evalnlp-0.1.1-py3-none-any.whl
- Upload date:
- Size: 17.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c09a3f6dbea67f44e527f41c147710d6d6978ff636a0cfe1a46c2272971549d2
|
|
| MD5 |
d18ee698e14f3346bec3a548d85c18d8
|
|
| BLAKE2b-256 |
56e096f392502650b56343b07e4a928ed7baeafdfdc7e201320651a98407fd20
|