以下は、TessNet2 (OCR フレームワーク) を使用して、TessNet2 に組み込まれている OCR 関数によってキャプチャされた単語のリストをスキャンする関数です。私がスキャンしているページの品質は完璧とは言えませんので、単語の検出は 100% 正確ではありません。
そのため、「S」と「5」、または「l」と「1」を混同することがあります。また、大文字と小文字は考慮されません。したがって、両方のケースを検索する必要があります。
それが機能する方法は、紙の上で互いに近い特定の単語を検索することです。したがって、最初の一連の単語 [I] は「Abstracting Service Ordered」です。ページにこれらの単語が隣り合って含まれている場合、次の単語セット [j] に移動し、次に次の [h] に移動します。ページに 3 つの単語セットがすべて含まれている場合、true が返されます。
これは私が考えた最良の方法ですが、ここの誰かが別の方法を試してくれることを願っています.
public Boolean isPageABSTRACTING(List<tessnet2.Word> wordList)
{
for (int i = 0; i < wordList.Count; i++) //scan through words
{
if ((wordList[i].Text == "Abstracting" || wordList[i].Text == "abstracting" || wordList[i].Text == "abstractmg" || wordList[i].Text == "Abstractmg" && wordList[i].Confidence >= 50) && (wordList[i + 1].Text == "Service" || wordList[i + 1].Text == "service" || wordList[i + 1].Text == "5ervice" && wordList[i + 1].Confidence >= 50) && (wordList[i + 2].Text == "Ordered" || wordList[i + 2].Text == "ordered" && wordList[i + 2].Confidence >= 50)) //find 1st tier check
{
for (int j = 0; j < wordList.Count; j++) //scan through words again
{
if ((wordList[j].Text == "Due" || wordList[j].Text == "Oue" && wordList[j].Confidence >= 50) && (wordList[j + 1].Text == "Date" || wordList[j + 1].Text == "Oate" && wordList[j + 1].Confidence >= 50) && (wordList[j + 2].Text == "&" && wordList[j + 2].Confidence >= 50)) //find 2nd tier check
{
for (int h = 0; h < wordList.Count; h++) //scan through words again
{
if ((wordList[h].Text == "Additional" || wordList[h].Text == "additional" && wordList[h].Confidence >= 50) && (wordList[h + 1].Text == "comments" || wordList[h + 1].Text == "Comments" && wordList[h + 1].Confidence >= 50) && (wordList[h + 2].Text == "about" || wordList[h + 2].Text == "About" && wordList[h + 2].Confidence >= 50) && (wordList[h + 3].Text == "this" || wordList[h + 3].Text == "This" && wordList[h + 3].Confidence >= 50)) //find 3rd tier check
{
return true;
}
}
}
}
}
}
return false;
}