How to use the pyocr.libtesseract.is_available function in pyocr

To help you get started, we’ve selected a few pyocr examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github openpaperwork / pyocr / run_tests.py View on Github external
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 libtesseract.is_available():
        print("---")
        print("Tesseract C-API:")
        unittest.TextTestRunner().run(tests_libtesseract.get_all_tests())
    if tesseract.is_available():
        print("---")
        print("Tesseract SH:")
        unittest.TextTestRunner().run(tests_tesseract.get_all_tests())
    if cuneiform.is_available():
        print("---")
        print("Cuneiform SH:")
        unittest.TextTestRunner().run(tests_cuneiform.get_all_tests())
github openpaperwork / pyocr / tests / tests_libtesseract.py View on Github external
def test_available(self):
        self.assertTrue(
            libtesseract.is_available(),
            "Tesseract not found."
            " Are libtesseract and libleptonica installed ? "