Getting Started
Installation
pip install ocr-stringdist
Quick Example
After installation, you can quickly calculate an OCR-aware string distance:
from ocr_stringdist import WeightedLevenshtein
# Calculate distance using the default OCR error costs
# ("O" vs "0" has a low cost)
distance = WeightedLevenshtein().distance("HELLO", "HELL0")
print(f"The OCR-aware distance is: {distance}")
This uses the built-in ocr_distance_map
which assigns lower costs to common OCR character confusions. See the Usage Examples and API Reference for more details and customization options.