thiagoalessio / tesseract-ocr-for-php

A wrapper to work with Tesseract OCR inside PHP.
https://packagist.org/packages/thiagoalessio/tesseract_ocr
MIT License
2.86k stars 551 forks source link

Can not use userWords. #164

Closed sakunok closed 5 years ago

sakunok commented 5 years ago

I try this code in laravel

echo (new TesseractOCR(storage_path('app\imgOCR\S__43089922.jpg'))) ->userWords(storage_path('app\userWord\AssetWord.txt')) ->run();

but return this error. How do i fix this error

Method thiagoalessio\TesseractOCR\Command::__toString() must not throw an exception, caught Exception: user-words option is only available on Tesseract 3.04 or later. Your version of Tesseract is v4.0.0.20190314

sakunok commented 5 years ago

i use "thiagoalessio/tesseract_ocr": "^2.7"

ahavryliuk commented 5 years ago

@sakunok a problem is that library tries to run version_compare on '3.05' and 'v4.0.0.20190314', where it obviously fails. You can disable version check manually at src/Option.php:63 or fix the function by parsing out the 'v' as it should (and it is in psm method, but not everywhere else) be done.

thiagoalessio commented 5 years ago

@ahavryliuk seriously? what a stupid bug :( Thank you so much for pointing it out! I didn't have time to inspect this issue, you saved me precious minutes! :yellow_heart: :green_heart: :black_heart:

@sakunok sorry for the delay, you obviously already found a workaround in order to keep working, but I released a fix on version 2.7.4. And thank you very much for reporting it! :heart: :purple_heart: :blue_heart: