下面是我的python脚本,用于读取图像上的文本。但它不能正常工作,因为后来的t被理解为+或f.I想知道如何处理这个问题吗?我还附上了我正在尝试读取的文件。
import tesserocr
from PIL import Image
print tesserocr.tesseract_version() # print tesseract-ocr version
print tesserocr.get_languages() # prints tessdata path and list of available languages
image = Image.open('t
我有一个使用正则表达式从文本(format =mm)中提取日期的代码。
备注:文本是在票据图像上使用OCR获取的。因此,预期的日期格式是,但是它可以是任何随机文本,因为它是使用OCR获得的。
import re
date_reg_exp = re.compile('\d{2}[-/.]\d{2}[-/.]\d{4}') #works for mm-dd-yyyy
matches_list=date_reg_exp.findall(test_str)
for match in matches_list2:
print match
如果我有一个字符串'This is a
我有一大串简短的短语,例如:
sql server data analysis # SQL is not a common word
bodybuilding # common word
export opml # opml is not a common word
best ocr mac # ocr and mac are not common words
我想检测单词是不是一个不常见的词,不应该是进一步的过程。
我试过用NLTK来做这件事,但是它会产生奇怪的结果:
result = word in nltk.corpus.words.words()
sql = false
iso = t