You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tika.apache.org by "Tyler Palsulich (JIRA)" <ji...@apache.org> on 2014/09/13 20:53:36 UTC

[jira] [Comment Edited] (TIKA-93) OCR support

    [ https://issues.apache.org/jira/browse/TIKA-93?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14132881#comment-14132881 ] 

Tyler Palsulich edited comment on TIKA-93 at 9/13/14 6:53 PM:
--------------------------------------------------------------

I've started working on this again. It works well when Tesseract is installed and configured properly, but how should we handle when it's not installed? My thinking was changing `TesseractOCRParser` to extend `ExternalParser` and add a call to `ExternalParser.check()` before anything in `TesseractOCRParser.doOCR()`. Then, if `tesseract` fails the check, `throw new TikaException("Tesseract is unavailable")`.

I'm having two problems with this solution. One, `TikaException`s are also thrown if OCR times out. So, the exceptions could be more granular. Two, even if we throw a `TikaException` from `TesseractOCRParser.parse()` (possibly bubbled up from a `doOCR()` call), the exception is caught (somewhere) before reaching the top call from a unit test... So, we can't check we should actually fail the test or not.

Any thoughts on this? The main blocker right now is unit tests -- they pass when Tesseract is installed, fail when it isn't. How should we handle that?

Edit: Another idea from [~chrismattmann]: We could do the external check in the unit test. So, if `tesseract` is not on the path, we pass the test. Otherwise, let it continue as normal. This would work. Any other ideas/input?


was (Author: tpalsulich):
I've started working on this again. It works well when Tesseract is installed and configured properly, but how should we handle when it's not installed? My thinking was changing `TesseractOCRParser` to extend `ExternalParser` and add a call to `ExternalParser.check()` before anything in `TesseractOCRParser.doOCR()`. Then, if `tesseract` fails the check, `throw new TikaException("Tesseract is unavailable")`.

I'm having two problems with this solution. One, `TikaException`s are also thrown if OCR times out. So, the exceptions could be more granular. Two, even if we throw a `TikaException` from `TesseractOCRParser.parse()` (possibly bubbled up from a `doOCR()` call), the exception is caught (somewhere) before reaching the top call from a unit test... So, we can't check we should actually fail the test or not.

Any thoughts on this? The main blocker right now is unit tests -- they pass when Tesseract is installed, fail when it isn't. How should we handle that?

> OCR support
> -----------
>
>                 Key: TIKA-93
>                 URL: https://issues.apache.org/jira/browse/TIKA-93
>             Project: Tika
>          Issue Type: New Feature
>          Components: parser
>            Reporter: Jukka Zitting
>            Assignee: Chris A. Mattmann
>            Priority: Minor
>             Fix For: 1.7
>
>         Attachments: Petr_tika-config.xml, TIKA-93.patch, TIKA-93.patch, TIKA-93.patch, TIKA-93.patch, TesseractOCRParser.patch, TesseractOCRParser.patch, TesseractOCR_Tyler.patch, TesseractOCR_Tyler_v2.patch, testOCR.docx, testOCR.pdf, testOCR.pptx
>
>
> I don't know of any decent open source pure Java OCR libraries, but there are command line OCR tools like Tesseract (http://code.google.com/p/tesseract-ocr/) that could be invoked by Tika to extract text content (where available) from image files.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)