ocr-weighted-levenhstein
Science Score: 44.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (5.9%) to scientific vocabulary
Repository
Basic Info
- Host: GitHub
- Owner: zas97
- Language: Python
- Default Branch: main
- Size: 2.33 MB
Statistics
- Stars: 9
- Watchers: 1
- Forks: 1
- Open Issues: 0
- Releases: 0
Metadata Files
README.md
Ocr weighted Levenshtein distance
Getting started
Install the weighted_levenshtein library :
pip install weighted-levenshtein
Download json with the params for the weighted levenshtein from https://github.com/zas97/ocrweightedlevenshtein/blob/main/paramsweightedleven.json
Usage
```python import json from weighted_levenshtein import lev import numpy as np
with open("../paramsweightedleven.json", "r") as f: levenparams = json.load(f) for k in levenparams.keys(): levenparams[k] = np.array(levenparams[k]) leven_params
Order of the words to compare matter matter :
To get the correct distance use
lev("wordinocr", "wordtomatch", **leven_params)
print(lev("rat", "cat", *leven_params)) ## prints 1.16 print(lev("eat", "cat", *levenparams)) ## prints 0.57 print(lev("Bat", "8at", **levenparams)) ## prints 0.46 print(lev("hello", "hell0", *leven_params)) ## prints 0.13 print(lev("What", "what", *levenparams)) ## prints 0.26 print(lev("hello", "helloi", **levenparams)) ## prints 0.24 print(lev("hello", "helloH", **leven_params)) ## prints 0.83 ```
Use Cases
The Levenshtein distance is often used to search words in ocrised texts in fault tolerant manner. For example if we are searching for the word THEATRE in an image with text, the ocr will sometimes recognize words like THEATRF or T4EATRE. To match also this words a common tactic is to search any word that is at a Levenshtein distance 1 from THEATRE. However, in this use case not all edit operation should have the same cost, the word THEATRF should be closer to the word THEATRW since the ocr is more likely to confuse an F from E than a W from an E.
Owner
- Name: Joan Capell Gracia
- Login: zas97
- Kind: user
- Location: Lyon
- Company: Tessi Lab
- Repositories: 20
- Profile: https://github.com/zas97
Citation (CITATION.cff)
cff-version: 1.0.0 message: "If you use this software, please cite it as below." authors: - family-names: "Capell Gracia" given-names: "Joan" title: "Ocr weightec Levenshtein distance" version: 1.0.0 date-released: 2022-07-13 url: "https://github.com/zas97/ocr_weighted_levenshtein"
GitHub Events
Total
- Watch event: 1
Last Year
- Watch event: 1
Committers
Last synced: about 3 years ago
All Time
- Total Commits: 11
- Total Committers: 2
- Avg Commits per committer: 5.5
- Development Distribution Score (DDS): 0.364
Top Committers
| Name | Commits | |
|---|---|---|
| jcg | j****a@t****r | 7 |
| Joan Capell Gracia | j****7@g****m | 4 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 8 months ago
All Time
- Total issues: 1
- Total pull requests: 0
- Average time to close issues: 8 days
- Average time to close pull requests: N/A
- Total issue authors: 1
- Total pull request authors: 0
- Average comments per issue: 2.0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- EloiDuchaussoy (1)
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- pypi 65 last-month
- Total dependent packages: 0
- Total dependent repositories: 0
- Total versions: 6
- Total maintainers: 1
pypi.org: ocr-weighted-levenhstein
Weights for levenshtein distance based on ocr character similarity
- Homepage: https://github.com/zas97/ocr_weighted_levenshtein
- Documentation: https://ocr-weighted-levenhstein.readthedocs.io/
- License: Copyright (c) 2018 The Python Packaging Authority Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
Latest release: 1.0.0
published over 3 years ago