Skip to content

Commit

Permalink
Merge branch 'rl-0.12.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
amenezes committed Nov 21, 2023
2 parents a06c9e4 + dac4e47 commit 0f045cf
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
tests:
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', 'pypy-3.8', 'pypy-3.9']
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', 'pypy-3.8', 'pypy-3.9', 'pypy-3.10']
os: [ubuntu]
fail-fast: true
runs-on: ${{ matrix.os }}-latest
Expand Down
2 changes: 1 addition & 1 deletion aiopytesseract/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
)
from .models import OSD, Box, Data, Parameter

__version__ = "0.11.0"
__version__ = "0.12.0"
__all__ = [
"__version__",
"OSD",
Expand Down
8 changes: 6 additions & 2 deletions aiopytesseract/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,7 @@ async def image_to_data(
timeout: float = AIOPYTESSERACT_DEFAULT_TIMEOUT,
encoding: str = AIOPYTESSERACT_DEFAULT_ENCODING,
tessdata_dir: Optional[str] = None,
psm: int = AIOPYTESSERACT_DEFAULT_PSM,
) -> List[Data]:
"""Information about boxes, confidences, line and page numbers.
Expand All @@ -507,6 +508,7 @@ async def image_to_data(
:param timeout: command timeout (default: 30)
:param encoding: decode bytes to string. (default: utf-8)
:param tessdata_dir: location of tessdata path. (default: None)
:param psm: page segmentation modes. (default: 3)
"""
raise NotImplementedError

Expand All @@ -519,10 +521,11 @@ async def _(
timeout: float = AIOPYTESSERACT_DEFAULT_TIMEOUT,
encoding: str = AIOPYTESSERACT_DEFAULT_ENCODING,
tessdata_dir: Optional[str] = None,
psm: int = AIOPYTESSERACT_DEFAULT_PSM,
) -> List[Data]:
await file_exists(image)
data_values = await image_to_data(
Path(image).read_bytes(), dpi, lang, timeout, encoding, tessdata_dir
Path(image).read_bytes(), dpi, lang, timeout, encoding, tessdata_dir, psm
)
return data_values

Expand All @@ -535,8 +538,9 @@ async def _(
timeout: float = AIOPYTESSERACT_DEFAULT_TIMEOUT,
encoding: str = AIOPYTESSERACT_DEFAULT_ENCODING,
tessdata_dir: Optional[str] = None,
psm: int = AIOPYTESSERACT_DEFAULT_PSM,
) -> List[Data]:
cmdline = f"stdin stdout -c tessedit_create_tsv=1 --dpi {dpi} -l {lang}"
cmdline = f"stdin stdout -c tessedit_create_tsv=1 --dpi {dpi} -l {lang} --psm {psm}"
if tessdata_dir:
cmdline = f"--tessdata-dir {tessdata_dir} {cmdline}"
try:
Expand Down

0 comments on commit 0f045cf

Please sign in to comment.