From 9144f99761afa3e0bcd6b2547eb60490a06f532f Mon Sep 17 00:00:00 2001
From: Franck Dary <franck.dary@lis-lab.fr>
Date: Thu, 9 Apr 2020 12:49:28 +0200
Subject: [PATCH] addded parameter machine to macaonTrain

---
 trainer/src/MacaonTrain.cpp | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/trainer/src/MacaonTrain.cpp b/trainer/src/MacaonTrain.cpp
index 2b95753..25311df 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());
 
-- 
GitLab