Пример #1
0
 def test_available(self):
     self.assertTrue(tesseract.is_available(),
                     "Tesseract not found. Is it installed ?")
Пример #2
0
 def test_available(self):
     self.assertTrue(tesseract.is_available(),
                     "Tesseract not found. Is it installed ?")
Пример #3
0
 def test_available(self, is_on_path):
     is_on_path.return_value = True
     self.assertTrue(tesseract.is_available())
     is_on_path.assert_called_once_with("tesseract")
Пример #4
0
 def test_available(self, which):
     which.return_value = True
     self.assertTrue(tesseract.is_available())
     which.assert_called_once_with("tesseract")
Пример #5
0
from pyocr import pyocr
from pyocr import tesseract

from tests import tests_cuneiform
from tests import tests_tesseract

if __name__ == '__main__':
    for tool in pyocr.TOOLS:
        print("- OCR: %s" % tool.get_name())
        available = tool.is_available()
        print("  is_available(): %s" % (str(available)))
        if available:
            print("  get_version(): %s" % (str(tool.get_version())))
            print("  get_available_languages(): ")
            print("    " + ", ".join(tool.get_available_languages()))
        print("")
    print("")

    print("OCR tool found:")
    for tool in pyocr.get_available_tools():
        print("- %s" % tool.get_name())
    if tesseract.is_available():
        print("---")
        print("Tesseract:")
        unittest.TextTestRunner().run(tests_tesseract.get_all_tests())
    if cuneiform.is_available():
        print("---")
        print("Cuneiform:")
        unittest.TextTestRunner().run(tests_cuneiform.get_all_tests())

Пример #6
0
 def scanImage(self, img):
     if (tesseract.is_available()):
         return tesseract.image_to_string(Image.open(img))
     else:
         return "FAIL"
Пример #7
0
 def scanImage(self, img):
     if tesseract.is_available():
         return tesseract.image_to_string(Image.open(img))
     else:
         return "FAIL"