【发布时间】:2014-03-04 03:15:02
【问题描述】:
我正在尝试利用 Levenshtein Distance 的帮助在 OCR 页面上查找模糊关键字(静态文本)。
为此,我想给出允许的错误百分比(例如 15%)。
string Keyword = "past due electric service";
由于关键字长度为 25 个字符,我希望允许出现 4 个错误(25 * .15 向上取整)
我需要能够将其与...进行比较...
string Entire_OCR_Page = "previous bill amount payment received on 12/26/13 thank
you! current electric service total balances unpaid 7
days after the total due date are subject to a late
charge of 7.5% of the amount due or $2.00, whichever/5
greater. "
这就是我现在的做法......
int LevenshteinDistance = LevenshteinAlgorithm(Keyword, Entire_OCR_Page); // = 202
int NumberOfErrorsAllowed = 4;
int Allowance = (Entire_OCR_Page.Length() - Keyword.Length()) + NumberOfErrorsAllowed; // = 205
很明显,Keyword 在OCR_Text 中找不到(它不应该是这样)。但是,使用 Levenshtein 的距离,错误的数量小于 15% 的余地(因此我的逻辑说它找到了)。
有人知道更好的方法吗?
【问题讨论】:
-
发布了一个更好的问题。 goo.gl/Rb6ejp
标签: c# ocr levenshtein-distance fuzzy-search