From 2ac42b6d934900c65db2a4382ac258d0662cb680 Mon Sep 17 00:00:00 2001
From: Franck Dary <franck.dary@lis-lab.fr>
Date: Tue, 31 Mar 2020 14:40:04 +0200
Subject: [PATCH] .ts file path is now relative to expdir

---
 reading_machine/src/ReadingMachine.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/reading_machine/src/ReadingMachine.cpp b/reading_machine/src/ReadingMachine.cpp
index 84314a3..5890f26 100644
--- a/reading_machine/src/ReadingMachine.cpp
+++ b/reading_machine/src/ReadingMachine.cpp
@@ -46,7 +46,7 @@ void ReadingMachine::readFromFile(std::filesystem::path path)
     if (!util::doIfNameMatch(std::regex("Name : (.+)"), lines[curLine++], [this](auto sm){name = sm[1];}))
       util::myThrow("No name specified");
 
-    while (util::doIfNameMatch(std::regex("Classifier : (.+) (.+) (.+)"), lines[curLine++], [this](auto sm){classifier.reset(new Classifier(sm[1], sm[2], sm[3]));}));
+    while (util::doIfNameMatch(std::regex("Classifier : (.+) (.+) (.+)"), lines[curLine++], [this,path](auto sm){classifier.reset(new Classifier(sm.str(1), sm.str(2), path.parent_path() / sm.str(3)));}));
     if (!classifier.get())
       util::myThrow("No Classifier specified");
 
@@ -54,7 +54,7 @@ void ReadingMachine::readFromFile(std::filesystem::path path)
 
     if (!util::doIfNameMatch(std::regex("Predictions : (.+)"), lines[curLine++], [this](auto sm)
     {
-      auto predictions = std::string(sm[1]);
+      auto predictions = sm.str(1);
       auto splited = util::split(predictions, ' ');
       for (auto & prediction : splited)
         predicted.insert(std::string(prediction));
-- 
GitLab