48 char_classifier_ = NULL;
50 word_size_model_ = NULL;
52 word_unigrams_ = NULL;
54 size_normalization_ =
false;
58 delete char_classifier_;
59 char_classifier_ = NULL;
61 delete word_size_model_;
62 word_size_model_ = NULL;
70 delete word_unigrams_;
71 word_unigrams_ = NULL;
104 tess_unicharset_ = tess_unicharset;
105 string data_file_path;
109 fprintf(stderr,
"Unable to get data file path\n");
119 fprintf(stderr,
"Cube ERROR (CubeRecoContext::Load): unable to load " 124 string lm_file_name = data_file_path + lang_ +
".cube.lm";
127 fprintf(stderr,
"Cube ERROR (CubeRecoContext::Load): unable to read cube " 128 "language model params from %s\n", lm_file_name.c_str());
131 lang_mod_ =
new TessLangModel(lm_params, data_file_path,
133 tessdata_manager,
this);
147 if (params_ == NULL) {
148 fprintf(stderr,
"Cube ERROR (CubeRecoContext::Load): unable to read " 149 "CubeTuningParams from %s\n", data_file_path.c_str());
155 lang_mod_, char_set_,
157 if (char_classifier_ == NULL) {
158 fprintf(stderr,
"Cube ERROR (CubeRecoContext::Load): unable to load " 159 "CharClassifierFactory object from %s\n", data_file_path.c_str());
175 if (cntxt->Load(tessdata_manager, tess_unicharset) ==
false) {
176 fprintf(stderr,
"Cube ERROR (CubeRecoContext::Create): unable to init " 177 "CubeRecoContext object\n");
static CharSet * Create(TessdataManager *tessdata_manager, UNICHARSET *tess_unicharset)
static CharBigrams * Create(const string &data_file_path, const string &lang)
static bool ReadFileToString(const string &file_name, string *str)
static CubeRecoContext * Create(Tesseract *tess_obj, TessdataManager *tessdata_manager, UNICHARSET *tess_unicharset)
static WordUnigrams * Create(const string &data_file_path, const string &lang)
static CharClassifier * Create(const string &data_file_path, const string &lang, LangModel *lang_mod, CharSet *char_set, TuningParams *params)
const char * string() const
static CubeTuningParams * Create(const string &data_file, const string &lang)
bool GetDataFilePath(string *path) const
static WordSizeModel * Create(const string &data_file_path, const string &lang, CharSet *char_set, bool contextual)
CubeRecoContext(Tesseract *tess_obj)