How to use the pyocr.libtesseract.get_available_languages 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 / tests / tests_libtesseract.py View on Github external
def test_nolangs(self):
        tessdata_prefix = os.getenv("TESSDATA_PREFIX", "")
        os.environ['TESSDATA_PREFIX'] = '/opt/tulipe'
        try:
            langs = libtesseract.get_available_languages()
            self.assertEqual(langs, [])
        finally:
            if tessdata_prefix == "":
                os.environ['TESSDATA_PREFIX'] = ""
                os.unsetenv("TESSDATA_PREFIX")
            else:
                os.environ['TESSDATA_PREFIX'] = tessdata_prefix
github openpaperwork / pyocr / tests / tests_libtesseract.py View on Github external
def test_langs(self):
        langs = libtesseract.get_available_languages()
        self.assertTrue("eng" in langs,
                        ("English training does not appear to be installed."
                         " (required for the tests)"))
        self.assertTrue("fra" in langs,
                        ("French training does not appear to be installed."
                         " (required for the tests)"))
        self.assertTrue("jpn" in langs,
                        ("Japanese training does not appear to be installed."
                         " (required for the tests)"))