83 fprintf(stderr,
"Cube ERROR (CubeTuningParams::Load): unable to read "
84 "file %s\n", tuning_params_file.c_str());
89 vector<string> str_vec;
91 if (str_vec.size() < 8) {
92 fprintf(stderr,
"Cube ERROR (CubeTuningParams::Load): number of rows "
93 "in parameter file is too low\n");
98 for (
int entry = 0; entry < str_vec.size(); entry++) {
100 vector<string> str_tok;
104 if (str_tok.size() != 2) {
105 fprintf(stderr,
"Cube ERROR (CubeTuningParams::Load): invalid format in "
106 "line: %s.\n", str_vec[entry].c_str());
111 char peekchar = (str_tok[1].c_str())[0];
112 if ((peekchar >=
'0' && peekchar <=
'9') ||
113 peekchar ==
'-' || peekchar ==
'+' ||
116 if (sscanf(str_tok[1].c_str(),
"%lf", &val) != 1) {
117 fprintf(stderr,
"Cube ERROR (CubeTuningParams::Load): invalid format "
118 "in line: %s.\n", str_vec[entry].c_str());
124 if (str_tok[0] ==
"RecoWgt") {
126 }
else if (str_tok[0] ==
"SizeWgt") {
128 }
else if (str_tok[0] ==
"CharBigramsWgt") {
130 }
else if (str_tok[0] ==
"WordUnigramsWgt") {
132 }
else if (str_tok[0] ==
"MaxSegPerChar") {
134 }
else if (str_tok[0] ==
"BeamWidth") {
136 }
else if (str_tok[0] ==
"Classifier") {
137 if (str_tok[1] ==
"NN") {
139 }
else if (str_tok[1] ==
"HYBRID_NN") {
142 fprintf(stderr,
"Cube ERROR (CubeTuningParams::Load): invalid "
143 "classifier type in line: %s.\n", str_vec[entry].c_str());
146 }
else if (str_tok[0] ==
"FeatureType") {
147 if (str_tok[1] ==
"BMP") {
149 }
else if (str_tok[1] ==
"CHEBYSHEV") {
151 }
else if (str_tok[1] ==
"HYBRID") {
154 fprintf(stderr,
"Cube ERROR (CubeTuningParams::Load): invalid feature "
155 "type in line: %s.\n", str_vec[entry].c_str());
158 }
else if (str_tok[0] ==
"ConvGridSize") {
160 }
else if (str_tok[0] ==
"HistWindWid") {
162 }
else if (str_tok[0] ==
"MinConCompSize") {
164 }
else if (str_tok[0] ==
"MaxWordAspectRatio") {
166 }
else if (str_tok[0] ==
"MinSpaceHeightRatio") {
168 }
else if (str_tok[0] ==
"MaxSpaceHeightRatio") {
170 }
else if (str_tok[0] ==
"CombinerRunThresh") {
172 }
else if (str_tok[0] ==
"CombinerClassifierThresh") {
174 }
else if (str_tok[0] ==
"OODWgt") {
176 }
else if (str_tok[0] ==
"NumWgt") {
179 fprintf(stderr,
"Cube ERROR (CubeTuningParams::Load): unknown parameter "
180 "in line: %s.\n", str_vec[entry].c_str());
double max_word_aspect_ratio_
static bool ReadFileToString(const string &file_name, string *str)
double min_space_height_ratio_
double word_unigrams_wgt_
static void SplitStringUsing(const string &str, const string &delims, vector< string > *str_vec)
type_classifer tp_classifier_
double max_space_height_ratio_
double combiner_run_thresh_
double combiner_classifier_thresh_