I'm trying to get the actual charset loaded by Tesseract from a 
.traineddata file. I can call TessBaseAPI::GetUnichar(id++) in a loop but 
how to find what the maximum acceptable id is? TessBaseAPI::GetUnichar() 
implementation is just
 
const char* TessBaseAPI::GetUnichar 
<http://tesseract-ocr.github.io/4.0.0/a01625.html#ga34314bb3635a6e0d171e33d4b4181db2>
(int unichar_id) {
 return tesseract_ 
<http://tesseract-ocr.github.io/4.0.0/a02186.html#a247f50792f581df05afe336a2aeda402>
->unicharset 
<http://tesseract-ocr.github.io/4.0.0/a02666.html#a69c5179ac5f10a24f3f97e16ca09460f>
.id_to_unichar 
<http://tesseract-ocr.github.io/4.0.0/a03950.html#aa19fb595808fe4688c580334937dfa45>
(unichar_id);
}

that in turn calls
  
const char* UNICHARSET::id_to_unichar 
<http://tesseract-ocr.github.io/4.0.0/a03950.html#aa19fb595808fe4688c580334937dfa45>
(UNICHAR_ID 
<http://tesseract-ocr.github.io/4.0.0/a00605.html#afedceee7ea132dae3d224db2cf8b5618>
 
id) const {
 if (id == INVALID_UNICHAR_ID) {
  return INVALID_UNICHAR;
 }
 ASSERT_HOST 
<http://tesseract-ocr.github.io/4.0.0/a00503.html#a93a603f4063a6b9403d81caa245a583b>(id
 
< this->size 
<http://tesseract-ocr.github.io/4.0.0/a03950.html#adb332692009836a2d89e5fdf63f9765f>
());
 return unichars[id].representation;
}

I assume it will crash if id is out of bounds. And UNICHARSET:: 
<http://tesseract-ocr.github.io/4.0.0/a03950.html#aa19fb595808fe4688c580334937dfa45>size()
 
is not exposed via TessBaseAPI. Any idea how one could 
use TessBaseAPI::GetUnichar() to get chars known to Tesseract?

-- 
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 [email protected].
To post to this group, send email to [email protected].
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/4a15931d-eeed-486b-916f-7da5039ec21a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to