Kofax KTM Dictionary Gotcha on Dates
In KTM there is a nifty feature to search the entire document for a date field. It will recognize all dates existing on the form and with some other snazzy logic you can find the date you are looking for. If it is nearby the word “recieved”, then you probably have a recieve date. Easy, right?
Okay, sometimes dates get a little more tricky. “3/17/2011
“, “3-17-20011
” and “MAR 17, 2001
” are all valid date strings. Any of those formats could be found on your document. In KTM there is a nifty feature to search for the string “MAR
” and replace it with a “3
” when searching for dates. You use it in your locator’s regular expression. You can setup your own dictionary of months to look for “March
” or “Mar
” (or “Marzo
” if you need internationalization).
Here’s the gotcha. I recently found text in an OCR’d document like this: “19 NOV2008
“. It’s a bit of an odd string. The OCR engine didn’t think there was enough space between the “NOV
” and the “2008
” to put an actual space character in the ORC’d text. So, I can read it, but KTM can’t. The nifty feature to search for the string “NOV
” fails because it is only looking at whole words, those with whitespace on either side. Unfortunately, there is no option in the KTM dictionary setup to change this.
Here’s the fix. Modify the default KTM regular expression from this:
[0-3]?d§English_Months_Abr§([12]d{3}|d{2})
to this:
[0-3]?ds*(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)s*[0-3]?d
You can now make the space character optional in your regular expression search. You are no longer using the month dictionary, but that’s okay. This logic is only to locate a date, not translate it from a string to a date when found.
Problem solved.