本文整理汇总了C++中Labeler::train方法的典型用法代码示例。如果您正苦于以下问题:C++ Labeler::train方法的具体用法?C++ Labeler::train怎么用?C++ Labeler::train使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Labeler
的用法示例。
在下文中一共展示了Labeler::train方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char* argv[]) {
std::string trainFile = "", devFile = "", testFile = "", modelFile = "";
std::string wordEmbFile = "", charEmbFile = "", optionFile = "";
std::string outputFile = "";
bool bTrain = false;
dsr::Argument_helper ah;
ah.new_flag("l", "learn", "train or test", bTrain);
ah.new_named_string("train", "trainCorpus", "named_string", "training corpus to train a model, must when training", trainFile);
ah.new_named_string("dev", "devCorpus", "named_string", "development corpus to train a model, optional when training", devFile);
ah.new_named_string("test", "testCorpus", "named_string",
"testing corpus to train a model or input file to test a model, optional when training and must when testing", testFile);
ah.new_named_string("model", "modelFile", "named_string", "model file, must when training and testing", modelFile);
ah.new_named_string("word", "wordEmbFile", "named_string", "pretrained word embedding file to train a model, optional when training", wordEmbFile);
ah.new_named_string("char", "charEmbFile", "named_string", "pretrained char embedding file to train a model, optional when training", charEmbFile);
ah.new_named_string("option", "optionFile", "named_string", "option file to train a model, optional when training", optionFile);
ah.new_named_string("output", "outputFile", "named_string", "output file to test, must when testing", outputFile);
ah.process(argc, argv);
Labeler tagger;
if (bTrain) {
tagger.train(trainFile, devFile, testFile, modelFile, optionFile, wordEmbFile, charEmbFile);
} else {
tagger.test(testFile, outputFile, modelFile);
}
}
示例2: main
int main(int argc, char* argv[]) {
#if USE_CUDA==1
InitTensorEngine();
#else
InitTensorEngine<cpu>();
#endif
std::string trainFile = "", devFile = "", testFile = "", modelFile = "";
std::string wordEmbFile = "", charEmbFile = "", optionFile = "";
std::string outputFile = "";
bool bTrain = false;
dsr::Argument_helper ah;
ah.new_flag("l", "learn", "train or test", bTrain);
ah.new_named_string("train", "trainCorpus", "named_string",
"training corpus to train a model, must when training", trainFile);
ah.new_named_string("dev", "devCorpus", "named_string",
"development corpus to train a model, optional when training",
devFile);
ah.new_named_string("test", "testCorpus", "named_string",
"testing corpus to train a model or input file to test a model, optional when training and must when testing",
testFile);
ah.new_named_string("model", "modelFile", "named_string",
"model file, must when training and testing", modelFile);
ah.new_named_string("word", "wordEmbFile", "named_string",
"pretrained word embedding file to train a model, optional when training",
wordEmbFile);
ah.new_named_string("char", "charEmbFile", "named_string",
"pretrained char embedding file to train a model, optional when training",
charEmbFile);
ah.new_named_string("option", "optionFile", "named_string",
"option file to train a model, optional when training", optionFile);
ah.new_named_string("output", "outputFile", "named_string",
"output file to test, must when testing", outputFile);
ah.process(argc, argv);
Labeler tagger;
if (bTrain) {
tagger.train(trainFile, devFile, testFile, modelFile, optionFile,
wordEmbFile, charEmbFile);
} else {
tagger.test(testFile, outputFile, modelFile);
}
//test(argv);
//ah.write_values(std::cout);
#if USE_CUDA==1
ShutdownTensorEngine();
#else
ShutdownTensorEngine<cpu>();
#endif
}