mirror of
https://github.com/DS4SD/docling.git
synced 2025-08-02 15:32:30 +00:00
docs: update examples and installation for ocrmac support
- Added `OcrMacOptions` to `custom_convert.py` and `full_page_ocr.py` examples. - Included usage comments and examples for `OcrMacOptions` in OCR pipelines. - Updated installation guide to include instructions for installing `ocrmac`, noting macOS version requirements (10.15+). - Highlighted that `ocrmac` leverages Apple's Vision framework as an OCR backend. This enhances documentation for users working on macOS to leverage `ocrmac` effectively. Signed-off-by: Suhwan Seo <nuridol@gmail.com>
This commit is contained in:
parent
0c23b69433
commit
2576e65753
@ -7,6 +7,7 @@ from docling.backend.pypdfium2_backend import PyPdfiumDocumentBackend
|
|||||||
from docling.datamodel.base_models import InputFormat
|
from docling.datamodel.base_models import InputFormat
|
||||||
from docling.datamodel.pipeline_options import PdfPipelineOptions
|
from docling.datamodel.pipeline_options import PdfPipelineOptions
|
||||||
from docling.document_converter import DocumentConverter, PdfFormatOption
|
from docling.document_converter import DocumentConverter, PdfFormatOption
|
||||||
|
from docling.models.ocr_mac_model import OcrMacOptions
|
||||||
from docling.models.tesseract_ocr_cli_model import TesseractCliOcrOptions
|
from docling.models.tesseract_ocr_cli_model import TesseractCliOcrOptions
|
||||||
from docling.models.tesseract_ocr_model import TesseractOcrOptions
|
from docling.models.tesseract_ocr_model import TesseractOcrOptions
|
||||||
|
|
||||||
@ -122,6 +123,20 @@ def main():
|
|||||||
# }
|
# }
|
||||||
# )
|
# )
|
||||||
|
|
||||||
|
# Docling Parse with ocrmac(Mac only)
|
||||||
|
# ----------------------
|
||||||
|
# pipeline_options = PdfPipelineOptions()
|
||||||
|
# pipeline_options.do_ocr = True
|
||||||
|
# pipeline_options.do_table_structure = True
|
||||||
|
# pipeline_options.table_structure_options.do_cell_matching = True
|
||||||
|
# pipeline_options.ocr_options = OcrMacOptions()
|
||||||
|
|
||||||
|
# doc_converter = DocumentConverter(
|
||||||
|
# format_options={
|
||||||
|
# InputFormat.PDF: PdfFormatOption(pipeline_options=pipeline_options)
|
||||||
|
# }
|
||||||
|
# )
|
||||||
|
|
||||||
###########################################################################
|
###########################################################################
|
||||||
|
|
||||||
start_time = time.time()
|
start_time = time.time()
|
||||||
|
@ -4,6 +4,7 @@ from docling.backend.docling_parse_backend import DoclingParseDocumentBackend
|
|||||||
from docling.datamodel.base_models import InputFormat
|
from docling.datamodel.base_models import InputFormat
|
||||||
from docling.datamodel.pipeline_options import (
|
from docling.datamodel.pipeline_options import (
|
||||||
EasyOcrOptions,
|
EasyOcrOptions,
|
||||||
|
OcrMacOptions,
|
||||||
PdfPipelineOptions,
|
PdfPipelineOptions,
|
||||||
TesseractCliOcrOptions,
|
TesseractCliOcrOptions,
|
||||||
TesseractOcrOptions,
|
TesseractOcrOptions,
|
||||||
@ -19,9 +20,10 @@ def main():
|
|||||||
pipeline_options.do_table_structure = True
|
pipeline_options.do_table_structure = True
|
||||||
pipeline_options.table_structure_options.do_cell_matching = True
|
pipeline_options.table_structure_options.do_cell_matching = True
|
||||||
|
|
||||||
# Any of the OCR options can be used:EasyOcrOptions, TesseractOcrOptions, TesseractCliOcrOptions
|
# Any of the OCR options can be used:EasyOcrOptions, TesseractOcrOptions, TesseractCliOcrOptions, OcrMacOptions(Mac only)
|
||||||
# ocr_options = EasyOcrOptions(force_full_page_ocr=True)
|
# ocr_options = EasyOcrOptions(force_full_page_ocr=True)
|
||||||
# ocr_options = TesseractOcrOptions(force_full_page_ocr=True)
|
# ocr_options = TesseractOcrOptions(force_full_page_ocr=True)
|
||||||
|
# ocr_options = OcrMacOptions(force_full_page_ocr=True)
|
||||||
ocr_options = TesseractCliOcrOptions(force_full_page_ocr=True)
|
ocr_options = TesseractCliOcrOptions(force_full_page_ocr=True)
|
||||||
pipeline_options.ocr_options = ocr_options
|
pipeline_options.ocr_options = ocr_options
|
||||||
|
|
||||||
|
@ -92,6 +92,17 @@ Works on macOS, Linux, and Windows, with support for both x86_64 and arm64 archi
|
|||||||
pip install --no-binary :all: tesserocr
|
pip install --no-binary :all: tesserocr
|
||||||
```
|
```
|
||||||
|
|
||||||
|
<h3>ocrmac installation</h3>
|
||||||
|
|
||||||
|
[ocrmac](https://github.com/straussmaximilian/ocrmac) is using
|
||||||
|
Apple's vision(or livetext) framework as OCR backend.
|
||||||
|
For using this engine with Docling, ocrmac must be installed on your system.
|
||||||
|
This only works on macOS systems with newer macOS versions (10.15+).
|
||||||
|
|
||||||
|
```console
|
||||||
|
pip install ocrmac
|
||||||
|
```
|
||||||
|
|
||||||
## Development setup
|
## Development setup
|
||||||
|
|
||||||
To develop Docling features, bugfixes etc., install as follows from your local clone's root dir:
|
To develop Docling features, bugfixes etc., install as follows from your local clone's root dir:
|
||||||
|
Loading…
Reference in New Issue
Block a user