Skip to main content

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_func and segmentation operations with a u_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 the cost_func parameter.
  • 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)

Source distribution for evalnlp 0.1.2
File Size Uploaded
evalnlp-0.1.2.tar.gz 16.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for evalnlp 0.1.2
File Interpreter ABI Platform
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

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.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