diff --git a/trainer/src/MacaonTrain.cpp b/trainer/src/MacaonTrain.cpp index 2b95753b153687b1e8fcf6d9b3b76c1b733a3c15..25311dfdea0f5d7a8a4fdf42c99d0dc0ede81f77 100644 --- a/trainer/src/MacaonTrain.cpp +++ b/trainer/src/MacaonTrain.cpp @@ -31,6 +31,8 @@ po::options_description MacaonTrain::getOptionsDescription() "Raw text file of the development corpus") ("nbEpochs,n", po::value<int>()->default_value(5), "Number of training epochs") + ("machine", po::value<std::string>()->default_value(""), + "Reading machine file content") ("help,h", "Produce this help message"); desc.add(req).add(opt); @@ -91,6 +93,16 @@ int MacaonTrain::main() bool debug = variables.count("debug") == 0 ? false : true; bool printAdvancement = !debug && variables.count("silent") == 0 ? true : false; bool computeDevScore = variables.count("devScore") == 0 ? false : true; + auto machineContent = variables["machine"].as<std::string>(); + + if (!machineContent.empty()) + { + std::FILE * file = fopen(machinePath.c_str(), "w"); + if (!file) + util::error(fmt::format("can't open file '{}'\n", machinePath.c_str())); + fmt::print(file, "{}", machineContent); + std::fclose(file); + } fmt::print(stderr, "[{}] Training using device : {}\n", util::getTime(), NeuralNetworkImpl::device.str());