Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: partition_pdf() support language specification for PaddleOCR #3400

Merged

Conversation

christinestraub
Copy link
Collaborator

@christinestraub christinestraub commented Jul 15, 2024

Closes #3159.

This PR extends language specification capability to PaddleOCR in addition to TesseractOCR. Users can now specify OCR languages for both OCR engines when using partition_pdf().

Testing

os.environ["OCR_AGENT"] = "unstructured.partition.utils.ocr_models.paddle_ocr.OCRAgentPaddle"

elements = partition_pdf(
    filename=<file_path>,
    strategy=strategy,
    languages=["chi_sim"], # chinese - simplified
    infer_table_structure=True,
)

Copy link
Collaborator

@scanny scanny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple changes I think you'll need to make but approving in advance.

unstructured/partition/lang.py Outdated Show resolved Hide resolved
@christinestraub christinestraub added this pull request to the merge queue Jul 16, 2024
Merged via the queue into main with commit 48bdf94 Jul 16, 2024
51 checks passed
@christinestraub christinestraub deleted the feat/pdf-support-paddleocr-language-specification branch July 16, 2024 23:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug/language specification does not work for PaddleOCR agent
2 participants