78 fprintf(stderr,
"Cube ERROR (CubeTuningParams::Load): unable to read " 79 "file %s\n", tuning_params_file.c_str());
84 vector<string> str_vec;
86 if (str_vec.size() < 8) {
87 fprintf(stderr,
"Cube ERROR (CubeTuningParams::Load): number of rows " 88 "in parameter file is too low\n");
93 for (
int entry = 0; entry < str_vec.size(); entry++) {
95 vector<string> str_tok;
99 if (str_tok.size() != 2) {
100 fprintf(stderr,
"Cube ERROR (CubeTuningParams::Load): invalid format in " 101 "line: %s.\n", str_vec[entry].c_str());
106 char peekchar = (str_tok[1].c_str())[0];
107 if ((peekchar >=
'0' && peekchar <=
'9') ||
108 peekchar ==
'-' || peekchar ==
'+' ||
111 if (sscanf(str_tok[1].c_str(),
"%lf", &val) != 1) {
112 fprintf(stderr,
"Cube ERROR (CubeTuningParams::Load): invalid format " 113 "in line: %s.\n", str_vec[entry].c_str());
119 if (str_tok[0] ==
"RecoWgt") {
121 }
else if (str_tok[0] ==
"SizeWgt") {
123 }
else if (str_tok[0] ==
"CharBigramsWgt") {
125 }
else if (str_tok[0] ==
"WordUnigramsWgt") {
127 }
else if (str_tok[0] ==
"MaxSegPerChar") {
129 }
else if (str_tok[0] ==
"BeamWidth") {
131 }
else if (str_tok[0] ==
"Classifier") {
132 if (str_tok[1] ==
"NN") {
134 }
else if (str_tok[1] ==
"HYBRID_NN") {
137 fprintf(stderr,
"Cube ERROR (CubeTuningParams::Load): invalid " 138 "classifier type in line: %s.\n", str_vec[entry].c_str());
141 }
else if (str_tok[0] ==
"FeatureType") {
142 if (str_tok[1] ==
"BMP") {
144 }
else if (str_tok[1] ==
"CHEBYSHEV") {
146 }
else if (str_tok[1] ==
"HYBRID") {
149 fprintf(stderr,
"Cube ERROR (CubeTuningParams::Load): invalid feature " 150 "type in line: %s.\n", str_vec[entry].c_str());
153 }
else if (str_tok[0] ==
"ConvGridSize") {
155 }
else if (str_tok[0] ==
"HistWindWid") {
157 }
else if (str_tok[0] ==
"MinConCompSize") {
159 }
else if (str_tok[0] ==
"MaxWordAspectRatio") {
161 }
else if (str_tok[0] ==
"MinSpaceHeightRatio") {
163 }
else if (str_tok[0] ==
"MaxSpaceHeightRatio") {
165 }
else if (str_tok[0] ==
"CombinerRunThresh") {
167 }
else if (str_tok[0] ==
"CombinerClassifierThresh") {
169 }
else if (str_tok[0] ==
"OODWgt") {
171 }
else if (str_tok[0] ==
"NumWgt") {
174 fprintf(stderr,
"Cube ERROR (CubeTuningParams::Load): unknown parameter " 175 "in line: %s.\n", str_vec[entry].c_str());
type_classifer tp_classifier_
double word_unigrams_wgt_
static bool ReadFileToString(const string &file_name, string *str)
double combiner_classifier_thresh_
double min_space_height_ratio_
static void SplitStringUsing(const string &str, const string &delims, vector< string > *str_vec)
double combiner_run_thresh_
double max_word_aspect_ratio_
double max_space_height_ratio_