Registry / ai-ml / anls
library0.0.2pypypi✓ verified 84d ago

Average Normalized Levenshtein Similarity (ANLS) for evaluating text similarity, especially in OCR and document understanding tasks. Version 0.0.2, released occasionally.

pip install anls
INSTALL
IMPORT
SIG · ANLS
A
anls
ai-mlpythonv0.0.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

anls_score
from anls import anls_score
Direct import from anls package

Compute ANLS between two strings.

from anls import anls_score reference = "hello world" prediction = "hello world" score = anls_score(reference, prediction) print(score)
Debug
Known issues
gotchaanls_score expects two strings; do not pass lists or tuples.
fix
Ensure both inputs are str.
affects: all
deprecatedThe library uses Levenshtein package, which may be deprecated in future Python versions.
fix
Consider implementing custom Levenshtein or use rapidfuzz.
affects: >=3.10
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'anls'
Package not installed.
fix
pip install anls
TypeError: anls_score() takes 2 positional arguments but 3 were given
Extra argument passed to anls_score.
fix
Use anls_score(reference, prediction) with exactly two strings.
Upgrade
Version history
0.0.2latest on PyPI · released Jul 14, 2022
Audit
Dependencies
levenshteinrequiredANLS uses Levenshtein distance internally
Agent activity
46 hits · last 30 days
node
40
OpenAI (training)
1
Resources
anls — pip install anls · libregistry