void tess_training_tester( //call tess const STRING& filename, //filename to output PBLOB *blob, //blob to match DENORM *denorm, //de-normaliser BOOL8 correct, //ly segmented char *text, //correct text inT32 count, //chars in text BLOB_CHOICE_LIST *ratings //list of results ) { TBLOB *tessblob; //converted blob TEXTROW tessrow; //dummy row if (correct) { classify_norm_method.set_value(character); // force char norm spc 30/11/93 tess_bn_matching.set_value(false); //turn it off tess_cn_matching.set_value(false); //convert blob tessblob = make_tess_blob (blob, TRUE); //make dummy row make_tess_row(denorm, &tessrow); //learn it LearnBlob(filename, tessblob, &tessrow, text); free_blob(tessblob); } }
/********************************************************************** * compare_bln_blobs * * Compare 2 baseline normalised blobs and return the rating. **********************************************************************/ float Tesseract::compare_bln_blobs( //match 2 blobs PBLOB *blob1, //first blob DENORM *denorm1, PBLOB *blob2, //other blob DENORM *denorm2) { TBLOB *tblob1; //tessblobs TBLOB *tblob2; TEXTROW tessrow1, tessrow2; //tess rows float rating; //match result tblob1 = make_tess_blob (blob1, TRUE); make_tess_row(denorm1, &tessrow1); tblob2 = make_tess_blob (blob2, TRUE); make_tess_row(denorm2, &tessrow2); rating = compare_tess_blobs (tblob1, &tessrow1, tblob2, &tessrow2); free_blob(tblob1); free_blob(tblob2); return rating; }
void tess_adapter( //adapt to word WERD *word, //bln word DENORM *denorm, //de-normalise const char *string, //string for word const char *raw_string, //before context const char *rejmap //reject map ) { TWERD *tessword; //converted word static TEXTROW tessrow; //dummy row //make dummy row make_tess_row(denorm, &tessrow); //make a word tessword = make_tess_word (word, &tessrow); AdaptToWord(tessword, &tessrow, string, raw_string, rejmap); //adapt to it delete_word(tessword); //free it }
void Tesseract::tess_bn_matcher( //call tess PBLOB *pblob, //previous blob PBLOB *blob, //blob to match PBLOB *nblob, //next blob WERD *word, //word it came from DENORM *denorm, //de-normaliser BLOB_CHOICE_LIST *ratings //list of results ) { TBLOB *tessblob; //converted blob TEXTROW tessrow; //dummy row tess_bn_matching.set_value(true); //turn it on tess_cn_matching.set_value(false); //convert blob tessblob = make_rotated_tess_blob(denorm, blob, true); //make dummy row make_tess_row(denorm, &tessrow); //classify AdaptiveClassifier(tessblob, NULL, &tessrow, ratings, NULL); free_blob(tessblob); }
void tess_training_tester( //call tess PBLOB *blob, //blob to match DENORM *denorm, //de-normaliser BOOL8 correct, //ly segmented char *text, //correct text INT32 count, //chars in text BLOB_CHOICE_LIST *ratings //list of results ) { TBLOB *tessblob; //converted blob TEXTROW tessrow; //dummy row if (correct) { NormMethod = character; //Force char norm spc 30/11/93 tess_bn_matching = FALSE; //turn it off tess_cn_matching = FALSE; //convert blob tessblob = make_tess_blob (blob, TRUE); //make dummy row make_tess_row(denorm, &tessrow); //learn it LearnBlob(tessblob, &tessrow, text, count); free_blob(tessblob); } }
void tess_default_matcher( //call tess PBLOB *pblob, //previous blob PBLOB *blob, //blob to match PBLOB *nblob, //next blob WERD *word, //word it came from DENORM *denorm, //de-normaliser BLOB_CHOICE_LIST &ratings //list of results ) { LIST result; //tess output TBLOB *tessblob; //converted blob TEXTROW tessrow; //dummy row tess_bn_matching = FALSE; //turn it off tess_cn_matching = FALSE; //convert blob tessblob = make_tess_blob (blob, TRUE); //make dummy row make_tess_row(denorm, &tessrow); //classify result = AdaptiveClassifier (tessblob, NULL, &tessrow); free_blob(tessblob); //make our format convert_choice_list(result, ratings); }