Loading user-words from code

551 views
Skip to first unread message

Piotr Szperka

unread,
Dec 8, 2016, 3:43:01 AM12/8/16
to tesseract-ocr
Hello,
I have a question about loading my own words. I can't save my words in unencrypted eng.user-words file due to legal reasons. I need some way to load it directly to Tesseract or read from encrypted file.  I use C# wrapper, but firstly I must know if it is even possible?

Thanks,
Peter

Allistair C

unread,
Dec 8, 2016, 3:51:10 AM12/8/16
to tesser...@googlegroups.com
Not sure it can but I wondered whether the scope of your legal regulation would allow:

1. Encrypt the user words file or store in your source code
2. In you wrapper program just before tesseract api init decrypt the file to tessdata 
3. Init tesseract pointed to this file
4. Perform ocr
5. Delete the decrypted file

It does mean there is a temporary vulnerability but it's one idea if you don't find a native way to do this with tesseract.

Cheers

Sent from my iPhone
--
You received this message because you are subscribed to the Google Groups "tesseract-ocr" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tesseract-oc...@googlegroups.com.
To post to this group, send email to tesser...@googlegroups.com.
Visit this group at https://groups.google.com/group/tesseract-ocr.
To view this discussion on the web visit https://groups.google.com/d/msgid/tesseract-ocr/9b30528c-fec4-4a68-bc10-6f1d58ca5941%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Piotr Szperka

unread,
Dec 8, 2016, 5:45:33 AM12/8/16
to tesseract-ocr
Thank you fro your respond @Allistar C

Sadly it means, that I must keep user-words file decrypted during OCR process, what means almost constantly for me :(
My legal regulations preventing me from storing my words decrypted. I can have decrypted words only in my app code.

Allistair

unread,
Dec 8, 2016, 6:18:23 AM12/8/16
to tesser...@googlegroups.com
Maybe you could look at compiling decryption into Tesseract. 

I'm no expert but it looks like the words are read in from a file name here:


line 267

if (!trie_ptr->read_and_add_word_list(name.string(), getUnicharset(), which is a Trie instance function read_and_add_word_list https://github.com/tesseract-ocr/tesseract/blob/690616279c9acb4d82ca6e3f1539ec756cf12a9a/dict/trie.cpp
Trie::RRP_REVERSE_IF_HAS_RTL)) {
which uses function read_word_list

You could add some decryption there before Trie parses it?

Cheers


To unsubscribe from this group and stop receiving emails from it, send an email to tesseract-ocr+unsubscribe@googlegroups.com.

To post to this group, send email to tesser...@googlegroups.com.
Visit this group at https://groups.google.com/group/tesseract-ocr.
Reply all
Reply to author
Forward
0 new messages