Merge pull request #16 from EbookFoundation/dev-david

Added path setting for Tesseract. Removed printing in getContext func…
pull/19/head
XxMistaCruzxX 2024-02-29 23:13:40 -05:00 committed by GitHub
commit 8c2bc63bff
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 5 deletions

View File

@ -516,7 +516,6 @@ class AltTextHTML(AltText):
text = elem.text.strip()
context[0] = text
except:
print("error 0")
context[0] = None
elem = tag
text = ""
@ -527,9 +526,7 @@ class AltTextHTML(AltText):
text = elem.text.strip()
context[1] = text
except:
print("error 1")
context[1] = None
print(context)
return context
def genChars(self, imgData: bytes, src: str) -> str:

View File

@ -5,8 +5,9 @@ import pytesseract
from .ocrengine import OCREngine
class Tesseract(OCREngine):
def __init__(self) -> None:
self.customPath = None
def __init__(self, path:str = None) -> None:
if (path != None):
self._setTesseract(path)
return None
def _setTesseract(self, path: str) -> bool: