Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if (Configuration.Settings.Tools.OcrFixUseHardcodedRules)
- {
- // normalize for easy computation
- // foo-bar => foobar
- word = word.Replace("-", string.Empty);
- word = word.Replace("/", "");
- word = word.Replace("&", "");
- var dp = new bool[word.Length + 1];
- dp[0] = true;
- var l = 0;
- const int minWordLength = 2;
- for (int r = minWordLength; r <= word.Length; r++)
- {
- // foobar
- while (r - l >= minWordLength)
- {
- var w = word.Substring(l, r - l);
- if (dp[l] && _nameList.Contains(w))
- {
- dp[r] = true;
- }
- l++;
- }
- l = 0;
- }
- return dp[dp.Length - 1];
- }
Add Comment
Please, Sign In to add comment