tesseract::Wordrec Class Reference

#include <wordrec.h>

Inheritance diagram for tesseract::Wordrec:
tesseract::Classify tesseract::CCStruct tesseract::CUtil tesseract::CCUtil tesseract::Tesseract

List of all members.

Public Member Functions

 Wordrec ()
 ~Wordrec ()
void save_summary (inT32 elapsed_time)
int end_recog ()
BLOB_CHOICE_LIST_VECTOR * evaluate_chunks (CHUNKS_RECORD *chunks_record, SEARCH_STATE search_state)
void update_ratings (const BLOB_CHOICE_LIST_VECTOR &new_choices, const CHUNKS_RECORD *chunks_record, const SEARCH_STATE search_state)
void expand_node (FLOAT32 worst_priority, CHUNKS_RECORD *chunks_record, SEARCH_RECORD *the_search)
BLOB_CHOICE_LIST * join_blobs_and_classify (TBLOB *blobs, SEAMS seam_list, int x, int y, int fx, const MATRIX *ratings, BLOB_CHOICE_LIST_VECTOR *old_choices)
MATRIX * word_associator (TBLOB *blobs, SEAMS seams, STATE *state, int fxid, WERD_CHOICE *best_choice, WERD_CHOICE *raw_choice, char *correct, DANGERR *fixpt, STATE *best_state)
void mfeature_init ()
BLOB_CHOICE_LIST * classify_piece (TBLOB *pieces, SEAMS seams, inT16 start, inT16 end)
BLOB_CHOICE_LIST * get_piece_rating (MATRIX *ratings, TBLOB *blobs, SEAMS seams, inT16 start, inT16 end)
void dj_statistics (FILE *File)
void dj_cleanup ()
FLOAT32 prioritize_state (CHUNKS_RECORD *chunks_record, SEARCH_RECORD *the_search)
FLOAT32 width_priority (CHUNKS_RECORD *chunks_record, STATE *state, int num_joints)
FLOAT32 seamcut_priority (SEAMS seams, STATE *state, int num_joints)
FLOAT32 rating_priority (CHUNKS_RECORD *chunks_record, STATE *state, int num_joints)
program_editup

Initialize all the things in the program that need to be initialized. init_permute determines whether to initialize the permute functions and Dawg models.

void program_editup (const char *textbase, bool init_permute)
cc_recog

Recognize a word.

BLOB_CHOICE_LIST_VECTOR * cc_recog (TWERD *tessword, WERD_CHOICE *best_choice, WERD_CHOICE *best_raw_choice, BOOL8 tester, BOOL8 trainer, bool last_word_on_line)
program_editdown

This function holds any nessessary post processing for the Wise Owl program.

void program_editdown (inT32 elasped_time)
set_pass1

Get ready to do some pass 1 stuff.

void set_pass1 ()
set_pass2

Get ready to do some pass 2 stuff.

void set_pass2 ()
start_recog

Startup recog program ready to recognize words.

int start_recog (const char *textbase)
call_matcher

Called from Tess with a blob in tess form. Convert the blob to editor form. Call the matcher setup by the segmenter in tess_matcher. Convert the output choices back to tess form.

BLOB_CHOICE_LIST * call_matcher (TBLOB *ptblob, TBLOB *tessblob, TBLOB *ntblob, void *, TEXTROW *)
program_init

Initialize all the things in the program that need to be initialized.

void program_init ()
classify_blob

Classify the this blob if it is not already recorded in the match table. Attempt to recognize this blob as a character. The recognition rating for this blob will be stored as a part of the blob. This value will also be returned to the caller.

Parameters:
pblob Previous blob
blob Current blob
nlob Next blob
row The row to process
string The string to display in ScrollView
color The colour to use when displayed with ScrollView
BLOB_CHOICE_LIST * classify_blob (TBLOB *pblob, TBLOB *blob, TBLOB *nblob, TEXTROW *row, const char *string, C_COL color)
update_blob_classifications

For each blob in the given word update match_table with the corresponding BLOB_CHOICES_LIST from choices.

void update_blob_classifications (TWERD *word, const BLOB_CHOICE_LIST_VECTOR &choices)
evaluate_state

Evaluate the segmentation that is represented by this state in the best first search. Add this state to the "states_seen" list.

inT16 evaluate_state (CHUNKS_RECORD *chunks_record, SEARCH_RECORD *the_search, DANGERR *fixpt)
BLOB_CHOICE_LIST_VECTOR * rebuild_current_state (TBLOB *blobs, SEAMS seam_list, STATE *state, BLOB_CHOICE_LIST_VECTOR *char_choices, int fx, bool force_rebuild, const WERD_CHOICE &best_choice, const MATRIX *ratings)
best_first_search

Find the best segmentation by doing a best first search of the solution space.

void best_first_search (CHUNKS_RECORD *chunks_record, WERD_CHOICE *best_choice, WERD_CHOICE *raw_choice, STATE *state, DANGERR *fixpt, STATE *best_state)
improve_one_blob

Start with the current word of blobs and its classification. Find the worst blobs and try to divide it up to improve the ratings.

bool improve_one_blob (TWERD *word, BLOB_CHOICE_LIST_VECTOR *char_choices, int fx, inT32 *blob_number, SEAMS *seam_list, DANGERR *fixpt, bool split_next_to_fragment)
modify_blob_choice

Takes a blob and its chop index, converts that chop index to a unichar_id, and stores the chop index in place of the blob's original unichar_id.

void modify_blob_choice (BLOB_CHOICE_LIST *answer, int chop_index)
chop_one_blob

Start with the current one-blob word and its classification. Find the worst blobs and try to divide it up to improve the ratings. Used for testing chopper.

bool chop_one_blob (TWERD *word, BLOB_CHOICE_LIST_VECTOR *char_choices, inT32 *blob_number, SEAMS *seam_list, int *right_chop_index)
chop_word_main

Classify the blobs in this word and permute the results. Find the worst blob in the word and chop it up. Continue this process until a good answer has been found or all the blobs have been chopped up enough. Return the word level ratings.

BLOB_CHOICE_LIST_VECTOR * chop_word_main (register TWERD *word, int fx, WERD_CHOICE *best_choice, WERD_CHOICE *raw_choice, BOOL8 tester, BOOL8 trainer)
improve_by_chopping

Start with the current word of blobs and its classification. Find the worst blobs and try to divide them up to improve the ratings. As long as ratings are produced by the new blob splitting. When all the splitting has been accomplished all the ratings memory is reclaimed.

void improve_by_chopping (register TWERD *word, BLOB_CHOICE_LIST_VECTOR *char_choices, int fx, STATE *best_state, WERD_CHOICE *best_choice, WERD_CHOICE *raw_choice, SEAMS *seam_list, DANGERR *fixpt, STATE *chop_states, inT32 *state_count)
inT16 select_blob_to_split (const BLOB_CHOICE_LIST_VECTOR &char_choices, float rating_ceiling, bool split_next_to_fragment)
dict_word()

Test the dictionaries, returning NO_PERM (0) if not found, or one of the PermuterType values if found, according to the dictionary.

int dict_word (const WERD_CHOICE &word)

Public Attributes

POLY_MATCHER tess_matcher
POLY_TESTER tess_tester
POLY_TESTER tess_trainer
DENORM * tess_denorm
WERD * tess_word

Constructor & Destructor Documentation

tesseract::Wordrec::Wordrec (  ) 
tesseract::Wordrec::~Wordrec (  ) 

Member Function Documentation

void tesseract::Wordrec::best_first_search ( CHUNKS_RECORD *  chunks_record,
WERD_CHOICE *  best_choice,
WERD_CHOICE *  raw_choice,
STATE *  state,
DANGERR *  fixpt,
STATE *  best_state 
)
BLOB_CHOICE_LIST * tesseract::Wordrec::call_matcher ( TBLOB *  ptblob,
TBLOB *  tessblob,
TBLOB *  ntblob,
void *  ,
TEXTROW *   
)
BLOB_CHOICE_LIST_VECTOR * tesseract::Wordrec::cc_recog ( TWERD *  tessword,
WERD_CHOICE *  best_choice,
WERD_CHOICE *  best_raw_choice,
BOOL8  tester,
BOOL8  trainer,
bool  last_word_on_line 
)
bool tesseract::Wordrec::chop_one_blob ( TWERD *  word,
BLOB_CHOICE_LIST_VECTOR *  char_choices,
inT32 *  blob_number,
SEAMS *  seam_list,
int *  right_chop_index 
)
BLOB_CHOICE_LIST_VECTOR * tesseract::Wordrec::chop_word_main ( register TWERD *  word,
int  fx,
WERD_CHOICE *  best_choice,
WERD_CHOICE *  raw_choice,
BOOL8  tester,
BOOL8  trainer 
)
BLOB_CHOICE_LIST * tesseract::Wordrec::classify_blob ( TBLOB *  pblob,
TBLOB *  blob,
TBLOB *  nblob,
TEXTROW *  row,
const char *  string,
C_COL  color 
)
BLOB_CHOICE_LIST * tesseract::Wordrec::classify_piece ( TBLOB *  pieces,
SEAMS  seams,
inT16  start,
inT16  end 
)
int tesseract::Wordrec::dict_word ( const WERD_CHOICE &  word  ) 
void tesseract::Wordrec::dj_cleanup (  )  [inline]
void tesseract::Wordrec::dj_statistics ( FILE *  File  )  [inline]
int tesseract::Wordrec::end_recog (  ) 
BLOB_CHOICE_LIST_VECTOR * tesseract::Wordrec::evaluate_chunks ( CHUNKS_RECORD *  chunks_record,
SEARCH_STATE  search_state 
)

evaluate_chunks

A particular word level segmentation has been chosen. Evaluation this to find the word list that corresponds to it.

inT16 tesseract::Wordrec::evaluate_state ( CHUNKS_RECORD *  chunks_record,
SEARCH_RECORD *  the_search,
DANGERR *  fixpt 
)
void tesseract::Wordrec::expand_node ( FLOAT32  worst_priority,
CHUNKS_RECORD *  chunks_record,
SEARCH_RECORD *  the_search 
)
BLOB_CHOICE_LIST * tesseract::Wordrec::get_piece_rating ( MATRIX *  ratings,
TBLOB *  blobs,
SEAMS  seams,
inT16  start,
inT16  end 
)
void tesseract::Wordrec::improve_by_chopping ( register TWERD *  word,
BLOB_CHOICE_LIST_VECTOR *  char_choices,
int  fx,
STATE *  best_state,
WERD_CHOICE *  best_choice,
WERD_CHOICE *  raw_choice,
SEAMS *  seam_list,
DANGERR *  fixpt,
STATE *  chop_states,
inT32 *  state_count 
)
bool tesseract::Wordrec::improve_one_blob ( TWERD *  word,
BLOB_CHOICE_LIST_VECTOR *  char_choices,
int  fx,
inT32 *  blob_number,
SEAMS *  seam_list,
DANGERR *  fixpt,
bool  split_next_to_fragment 
)
BLOB_CHOICE_LIST * tesseract::Wordrec::join_blobs_and_classify ( TBLOB *  blobs,
SEAMS  seam_list,
int  x,
int  y,
int  fx,
const MATRIX *  ratings,
BLOB_CHOICE_LIST_VECTOR *  old_choices 
)
void tesseract::Wordrec::mfeature_init (  ) 
void tesseract::Wordrec::modify_blob_choice ( BLOB_CHOICE_LIST *  answer,
int  chop_index 
)
FLOAT32 tesseract::Wordrec::prioritize_state ( CHUNKS_RECORD *  chunks_record,
SEARCH_RECORD *  the_search 
)
void tesseract::Wordrec::program_editdown ( inT32  elasped_time  ) 
void tesseract::Wordrec::program_editup ( const char *  textbase,
bool  init_permute 
)
void tesseract::Wordrec::program_init (  ) 
FLOAT32 tesseract::Wordrec::rating_priority ( CHUNKS_RECORD *  chunks_record,
STATE *  state,
int  num_joints 
)
BLOB_CHOICE_LIST_VECTOR * tesseract::Wordrec::rebuild_current_state ( TBLOB *  blobs,
SEAMS  seam_list,
STATE *  state,
BLOB_CHOICE_LIST_VECTOR *  old_choices,
int  fx,
bool  force_rebuild,
const WERD_CHOICE &  best_choice,
const MATRIX *  ratings 
)

rebuild_current_state

Evaluate the segmentation that is represented by this state in the best first search. Add this state to the "states_seen" list.

void tesseract::Wordrec::save_summary ( inT32  elapsed_time  ) 
FLOAT32 tesseract::Wordrec::seamcut_priority ( SEAMS  seams,
STATE *  state,
int  num_joints 
)
inT16 tesseract::Wordrec::select_blob_to_split ( const BLOB_CHOICE_LIST_VECTOR &  char_choices,
float  rating_ceiling,
bool  split_next_to_fragment 
)
void tesseract::Wordrec::set_pass1 (  ) 
void tesseract::Wordrec::set_pass2 (  ) 
int tesseract::Wordrec::start_recog ( const char *  textbase  ) 
void tesseract::Wordrec::update_blob_classifications ( TWERD *  word,
const BLOB_CHOICE_LIST_VECTOR &  choices 
)
void tesseract::Wordrec::update_ratings ( const BLOB_CHOICE_LIST_VECTOR &  new_choices,
const CHUNKS_RECORD *  chunks_record,
const SEARCH_STATE  search_state 
)
FLOAT32 tesseract::Wordrec::width_priority ( CHUNKS_RECORD *  chunks_record,
STATE *  state,
int  num_joints 
)
MATRIX * tesseract::Wordrec::word_associator ( TBLOB *  blobs,
SEAMS  seams,
STATE *  state,
int  fxid,
WERD_CHOICE *  best_choice,
WERD_CHOICE *  raw_choice,
char *  correct,
DANGERR *  fixpt,
STATE *  best_state 
)

Member Data Documentation


The documentation for this class was generated from the following files:
Generated on Sun Jul 18 17:11:29 2010 for Tesseract by  doxygen 1.6.3