SpellCorrector [word,...] Macro (v9.0.2)
The OCR action is wonderful. I enjoy it a lot. But of course it does make mistakes, that's the nature of OCR. Fixing those mistakes is not easy. But this little macro makes it a lot easier than the ways I've been using up until now (eg, sed).
This macro assumes that the text you are trying to correct is in a global variable called "OCRtext". Of course you are free to change that name or modify this approach any way you want. This macro also assumes that the words being corrected are somewhat distinct from each other, and it tends to work best when the words you are checking are not short, say 5 or more characters in length. It really doesn't work too well if the words you are trying to correct are 2 or 3 characters in length. It needs more information than that to work correctly, so I recommend 5 letters or more, although that depends on the nature of the words you are using. If your words are very distinct, then you might even be able to get 3 or 4 letter words to work.
Let's assume you are reading an image into the OCR action and you send the output of that action into a variable called OCRtext. And let's say you were expecting the output of that OCR action to generate (among other words) the words that are the days of the week: Monday, Tuesday, etc. Here's the command you would issue (next image). Any words that were "close" to the words you indicate would be "fixed" to those corrected words. In this particular program it works only when the words are "one character off". I'm planning another version which works differently, but this version should be effective for many purposes.
If you create the action above, it would fix all "near misses". For example if OCRtext contained the word "Wedmesday" (which could be a typical OCR error) it would fix that and replace it with "Wednesday". This version fixes any single character OCR error. For many people, that should be adequate. For lack of a better title I'm calling it a "spell checker." It's correcting some text based on the "dictionary" of words that you pass it, so it seems appropriate to call it a spell checker.
I don't need credit or attribution. Feel free to use it for anything. I donate it to the public domain. Hopefully it's fully debugged but I do not guarantee that it is free of bugs. use at your own risk.
I didn't measure how fast it is, but it feels speedy to me. Compared to the OCR that you perform, it's lightning fast.