本文整理汇总了C++中ME_Model::load_from_file方法的典型用法代码示例。如果您正苦于以下问题:C++ ME_Model::load_from_file方法的具体用法?C++ ME_Model::load_from_file怎么用?C++ ME_Model::load_from_file使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ME_Model
的用法示例。
在下文中一共展示了ME_Model::load_from_file方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char* argv[])
{
if (argc < 3 || argc > 4) {
cerr << "Usage: " << argv[0] << "input output [path-to-ruby]" << endl;
exit(1);
}
ME_Model model;
string inFile = argv[1];
string outFile = argv[2];
//string modelFile = argv[3];
string modelFile = "model1-1.0";
string rubyCommand = (argc == 4) ? argv[3] : "ruby";
string eventFile = inFile + ".event";
string resultFile = inFile + ".result";
cerr << "Extracting events.";
string extractionCommand =
rubyCommand + " EventExtracter.rb " + inFile + " " + eventFile;
system(extractionCommand.c_str());
cerr << "roading model file." << endl;
model.load_from_file(modelFile.c_str());
//model.load_from_file("model" + setID + "-" + ineq);
//ifstream fileIn(string("/home/users/y-matsu/private/workspace/eclipse-workspace/GENIASS/" + setID + "/test.txt").c_str());
//ofstream fileOut(string("/home/users/y-matsu/private/workspace/eclipse-workspace/GENIASS/" + setID + "/test-" + ineq + ".prob").c_str());
ifstream fileIn(eventFile.c_str());
ofstream fileOut(resultFile.c_str());
string line, markedTxt;
getline(fileIn, markedTxt);
cerr << "start classification." << endl;
while (getline(fileIn, line)){
vector<string> tokens;
split(line, tokens);
ME_Sample s;
for(vector<string>::const_iterator token = tokens.begin() + 1;
token != tokens.end(); ++token){
s.add_feature(*token);
}
(void) model.classify(s);
fileOut << s.label << endl;
}
fileOut.close();
fileIn.close();
remove(eventFile.c_str());
string splitCommand =
rubyCommand + " Classifying2Splitting.rb "
+ resultFile + " " + markedTxt + " " + outFile;
system(splitCommand.c_str());
return 0;
}