Adding custom phrases to Tesseract white list

2019-07-17 06:26发布

问题:

I'm building a simple Tesseract application on Android it goals is to recognize simple command like CALL, MESSAGE, etc. Because the number of commands is small and fixed, I want to add them to white list so the program can achieve higher accuracy. How can I do that? Many thanks in advance :)

回答1:

As far as I understand you cannot whitelist words in tesseract. You can only whitelist characters and digits using the following code snippet

tessBaseAPI.setVariable(TessBaseAPI.VAR_CHAR_WHITELIST,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmopqrstuvwxyz0123456789%,");

after initializing tesseract using tessBaseAPI.init(...,...);