No project description provided
Project description
CERMatch
CERMatch is a novel Python library designed for evaluating Optical Character Recognition (OCR) systems using Character Error Rate (CER) based metrics. This library provides a unique method for matching ground truth text words with predicted words, offering a comprehensive analysis of OCR accuracy.
Features
- Calculate CER Match Score: Compares predicted text against ground truth using CER.
- Configurable Parameters: Customize CER threshold, weights for match categories, and normalization settings.
- Detailed Output: Provides a composite score and ratios of matched, errored, invented, and missed words.
- Flexibility: Options for case sensitivity, special character inclusion, ASCII transliteration, and word list returns.
How does it work?
CERMatch operates in several steps:
-
Normalization: The input texts (both predicted and ground truth) are normalized by removing extra spaces, handling case sensitivity, special characters, and transliterating to ASCII as per configuration.
-
Word Comparison: The normalized texts are split into words. Each word in the predicted text is then compared with the ground truth text.
-
CER Calculation: For each predicted word, the Character Error Rate (CER) is calculated against each word in the ground truth. The CER threshold is used to determine if a word is considered a match, an error, or an invented word.
-
Scoring: The algorithm calculates the percentages of matched, errored, invented, and missed words. These values are then used to compute a composite score based on provided weights, giving a holistic view of the OCR's accuracy.
-
Output: CERMatch returns a dictionary with the composite score and ratios of each word category. Optionally, it can also return lists of words in each category for a more detailed analysis.
Installation
Install CERMatch using pip:
pip install cermatch
Usage
Here is a basic example of how to use CERMatch:
from cermatch import calculateCERMatch
text_pred = "Hello, my namo is me Diego Bonilla"
text_gt = "Hello, my name is Diego Bonilla S."
result = calculateCERMatch(text_pred, text_gt)
print(result)
# Output: {'composite_score': 0.7642857142857142, 'ratio_matched': 0.7142857142857143, 'ratio_errors': 0.14285714285714285, 'ratio_invented': 0.14285714285714285, 'ratio_missed': 0.14285714285714285}
LICENSE
CERMatch is licensed under the MIT License - see the LICENSE file for details.
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 CERMatch-0.420.69.tar.gz.
File metadata
- Download URL: CERMatch-0.420.69.tar.gz
- Upload date:
- Size: 2.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c5301c7e4618112fc2db032332ac47366cf1512fbb117a8a0f2b6f9bdf1831ac
|
|
| MD5 |
300df3ba2ef6120c181dc4e4c2f971b3
|
|
| BLAKE2b-256 |
69ced742cd196f26c444cd862e2ef5dc216ca9393dff334a944f6974f2c04712
|
File details
Details for the file CERMatch-0.420.69-py3-none-any.whl.
File metadata
- Download URL: CERMatch-0.420.69-py3-none-any.whl
- Upload date:
- Size: 2.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
12a3b7712aee654c6152cc00878ddc3f7bf7ea2900cdb9cc38a1697335f66097
|
|
| MD5 |
7a564cab0e5821cc73f920ed03a31d52
|
|
| BLAKE2b-256 |
dfec3869e131b6f36a5a174c4bd873efc806502bf23505bb69ddc9fd8ada17c0
|