基于文本模式“图像”来匹配字符
在给定主模式的情况下,将 X 的字符串模式与字母表中的任何大写字母 AZ 进行匹配的好方法是什么。我正在寻找一个代码示例(Java 中)或只是一个通用算法想法。
例如,我得到了“T”的“主模式”:
X X X X X X X X X X
X X
X X
X X
X X
X X
X X
X X
X X
X X
X X
...并且以下所有模式都必须根据主模式确定为 T。
X X X X X X X X X
X X X
X
X
X
X
X
X
X
X
X
或
X X X X X X X X X
X X
X X
X X
X X
X X
X X
X X
X X
X X
X X
或
X X X X X X X X X
X X X X X X X X X
X X
X X
X X
X X
X X
X X
X X
X X
X X
X X
算法必须足够通用才能适用于所有字母; T只是一个例子。
What would be a good way to approach matching a String pattern of X's to any uppercase letter in the alphabet, A-Z, given a master pattern. I'm looking for either a code example (in Java) or just a general algorithm idea.
For example, I'm given the "master pattern" for 'T' of:
X X X X X X X X X X
X X
X X
X X
X X
X X
X X
X X
X X
X X
X X
...and all of the following patterns must be determined to be T's based on the master pattern.
X X X X X X X X X
X X X
X
X
X
X
X
X
X
X
X
or
X X X X X X X X X
X X
X X
X X
X X
X X
X X
X X
X X
X X
X X
or
X X X X X X X X X
X X X X X X X X X
X X
X X
X X
X X
X X
X X
X X
X X
X X
X X
The algorithm would have to be generic enough to work for all letters; T is just an example.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
查看 http://jocr.sourceforge.net/,这是一个免费的 OCR 库。它是一个 C 库,因此直接使用它可能不适合您。如果不出意外,你至少可以挖掘源码。
您可能还想访问 http://userscripts.org/scripts/review/38736,这是基于神经网络的 OCR 算法的纯 JavaScript 实现。
正如评论中已经提到的,这绝不是一个需要很好解决的小问题,但您也许可以使用适合您的数据的朴素神经网络来解决。
Look into http://jocr.sourceforge.net/, which is a free OCR library. It's a C library, so using it directly is probably not an option for you. If nothing else, you can at least dig through the source.
You may also want to take a peak at http://userscripts.org/scripts/review/38736, which is a pure JavaScript implementation of a neural-net based OCR algorithm.
As has been mentioned in the comments already this is by no means a trivial problem to solve well, but you might be able to get by on a naive neural net that suits your data.