{"action":"created","issue":{"url":"https://api.github.com/repos/strider1551/djvubind/issues/20","labels_url":"https://api.github.com/repos/strider1551/djvubind/issues/20/labels{/name}","comments_url":"https://api.github.com/repos/strider1551/djvubind/issues/20/comments","events_url":"https://api.github.com/repos/strider1551/djvubind/issues/20/events","html_url":"https://github.com/strider1551/djvubind/issues/20","id":110023090,"number":20,"title":"\"wrn: OCR failure\" erroneously(?) shown","user":{"login":"publicus","id":3667562,"avatar_url":"https://avatars.githubusercontent.com/u/3667562?v=3","gravatar_id":"","url":"https://api.github.com/users/publicus","html_url":"https://github.com/publicus","followers_url":"https://api.github.com/users/publicus/followers","following_url":"https://api.github.com/users/publicus/following{/other_user}","gists_url":"https://api.github.com/users/publicus/gists{/gist_id}","starred_url":"https://api.github.com/users/publicus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/publicus/subscriptions","organizations_url":"https://api.github.com/users/publicus/orgs","repos_url":"https://api.github.com/users/publicus/repos","events_url":"https://api.github.com/users/publicus/events{/privacy}","received_events_url":"https://api.github.com/users/publicus/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-10-06T14:41:30Z","updated_at":"2015-10-06T23:24:44Z","closed_at":null,"body":"This might be related to Issue #7, but it seems different to me, so I'm opening a new issue. I'm running `djvubind` on a directory full of .tif images from ScanTailor, and am getting a warning about \"OCR failure\" for each page. However, djvubind *is* creating HOCR files — an .html file appears for each page. These HOCR files are able to be used successfully by `pdfbeads`, so they seem to be valid. But `djvubind` seems not to understand that OCR was successful, so the output .djvu file doesn't have any selectable text.\r\n\r\nHere's the output:\r\n\r\n```\r\n* Collecting files to be processed.\r\n  Binding a total of 14 file(s).\r\n* Analyzing image information.\r\n  Spawning 8 processing threads.\r\n* Performing optical character recognition.\r\n  Spawning 8 processing threads.\r\nwrn: OCR failure on P1100185_1L.tif - This page will have no OCR content.\r\nwrn: OCR failure on P1100187_2R.tif - This page will have no OCR content.\r\nwrn: OCR failure on P1100184_2R.tif - This page will have no OCR content.\r\nwrn: OCR failure on P1100184_1L.tif - This page will have no OCR content.\r\nwrn: OCR failure on P1100186_2R.tif - This page will have no OCR content.\r\nwrn: OCR failure on P1100186_1L.tif - This page will have no OCR content.\r\nwrn: OCR failure on P1100187_1L.tif - This page will have no OCR content.\r\nwrn: OCR failure on P1100185_2R.tif - This page will have no OCR content.\r\nwrn: OCR failure on P1100188_2R.tif - This page will have no OCR content.\r\nwrn: OCR failure on P1100188_1L.tif - This page will have no OCR content.\r\nwrn: OCR failure on P1100190_1L.tif - This page will have no OCR content.\r\nwrn: OCR failure on P1100189_2R.tif - This page will have no OCR content.\r\nwrn: OCR failure on P1100190_2R.tif - This page will have no OCR content.\r\nwrn: OCR failure on P1100189_1L.tif - This page will have no OCR content.\r\n* Encoding all information to /path/to/book(1).djvu.\r\n```\r\n(I redacted the path on the last line)\r\n\r\nI installed djvubind from the latest commit on master (3f11cfbad216), and am running it in openSUSE 13.1. I'd be grateful for any advice you have, and can send my test files as needed (GitHub won't let me upload .tif, .html, .djvu, or .tar.gz files).\r\n\r\nThank you for your work on this project!\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/strider1551/djvubind/issues/comments/146032167","html_url":"https://github.com/strider1551/djvubind/issues/20#issuecomment-146032167","issue_url":"https://api.github.com/repos/strider1551/djvubind/issues/20","id":146032167,"user":{"login":"publicus","id":3667562,"avatar_url":"https://avatars.githubusercontent.com/u/3667562?v=3","gravatar_id":"","url":"https://api.github.com/users/publicus","html_url":"https://github.com/publicus","followers_url":"https://api.github.com/users/publicus/followers","following_url":"https://api.github.com/users/publicus/following{/other_user}","gists_url":"https://api.github.com/users/publicus/gists{/gist_id}","starred_url":"https://api.github.com/users/publicus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/publicus/subscriptions","organizations_url":"https://api.github.com/users/publicus/orgs","repos_url":"https://api.github.com/users/publicus/repos","events_url":"https://api.github.com/users/publicus/events{/privacy}","received_events_url":"https://api.github.com/users/publicus/received_events","type":"User","site_admin":false},"created_at":"2015-10-06T23:24:44Z","updated_at":"2015-10-06T23:24:44Z","body":"Sorry to keep commenting, but I got the djvu file working! Things worked after I made the following changes:\r\n\r\n* In `ocr.py`:\r\n    * Change all instances of `.hocr` to `.html` (find and replace)\r\n    * Change line 236 from:\r\n        `element['text'] = re.search('\\'>(.*?)</span', element['complete']).group(1)`  \r\n        to  \r\n        `element['text'] = re.search('>(.*?)</span', element['complete']).group(1)`  \r\n        (i.e., remove the escaped single-quote from the beginning of the regex).\r\nIf I make these changes and run `djvubind` again, and then open the .djvu output in Evince (the default PDF reader in Gnome), the text is present and able to be highlighted / copied / etc.\r\n\r\nI'm not sure *why* these changes are necessary, just that they work on my system. Do they make sense to you?"}}