Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OCR spelling mistakes #136

Open
statzhero opened this issue Oct 3, 2023 · 2 comments
Open

OCR spelling mistakes #136

statzhero opened this issue Oct 3, 2023 · 2 comments

Comments

@statzhero
Copy link

What is the recommended practice for OCR typos that come from say poor kerning? Examples below.

mformation --> information
wntmg --> writing

The problem I have is that SymSpell lookup_compound seems to suggest other words such as "formation" or "with a" instead of the correct terms.

Apologies if this is not the right place to ask.

@wolfgarbe
Copy link
Owner

wolfgarbe commented Oct 3, 2023

Symspell takes two factors into account when ranking correction candidates:

  1. the Damerau-Levenshtein edit distance between the misspelled term and the correction candidates (smaller edit distance wins)
  2. the term frequency of the correction candidate (the most frequent word wins)

Symspell does not take into account:

  1. the context (neigbouring words)
  2. how close on the keyboard the misspelled and correct characters are
  3. how phonetically close the misspelled and correct characters are
  4. how optically close the misspelled and correct characters are (e.g. for OCR)

Using those factors with weighted Damerau-Levenshtein edit distance for the ranking of correction candidates could significantly improve correction quality.
But the purpose of SymSpell was just to demonstrate the symmetric-delete algorithm and its speed advantage, but not to provide a turn-key spelling correction.
But there is a SymSpell implementation with weighted Damerau-Levenshtein edit distance / keyboard-distance which probably could be used to improve correction quality for OCR

@statzhero
Copy link
Author

statzhero commented Oct 3, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants