From abcc9be5c536d8552f213e7fabf1e52ee74ca202 Mon Sep 17 00:00:00 2001 From: Franck Dary <franck.dary@lis-lab.fr> Date: Sun, 3 Nov 2019 18:46:24 +0100 Subject: [PATCH] Removed signature --- transition_machine/src/Oracle.cpp | 56 +++++++++---------------------- 1 file changed, 16 insertions(+), 40 deletions(-) diff --git a/transition_machine/src/Oracle.cpp b/transition_machine/src/Oracle.cpp index 5ebb769..73d6fe9 100644 --- a/transition_machine/src/Oracle.cpp +++ b/transition_machine/src/Oracle.cpp @@ -360,18 +360,16 @@ void Oracle::createDatabase() [](Config & c, Oracle *) { if (c.pastActions.size() == 0) - return std::string("MOVE signature 0"); + return std::string("MOVE tagger 0"); std::string previousState = util::noAccentLower(c.pastActions.getElem(0).first); std::string previousAction = util::noAccentLower(c.pastActions.getElem(0).second.name); std::string newState; int movement = 0; - if (previousState == "signature") - newState = "tagger"; - else if (previousState == "tagger" || previousState == "error_tagger") + if (previousState == "tagger" || previousState == "error_tagger") { - newState = "signature"; + newState = "tagger"; movement = 1; } @@ -432,27 +430,17 @@ void Oracle::createDatabase() std::string previousState = util::noAccentLower(c.pastActions.getElem(0).first); std::string previousAction = util::noAccentLower(c.pastActions.getElem(0).second.name); - std::string newState; + std::string newState = "tokenizer"; int movement = 0; - if (previousState == "signature") + if (util::split(previousAction, ' ')[0] == "splitword") { - newState = "tokenizer"; - movement = 1; + int nbSplit = util::split(util::split(previousAction, ' ')[1], '@').size(); + movement = nbSplit; } - else if (previousState == "tokenizer") - { - if (util::split(previousAction, ' ')[0] == "splitword" || util::split(previousAction, ' ')[0] == "endword") - newState = "signature"; - else - newState = "tokenizer"; + else if (previousAction == "endword") + movement = 1; - if (util::split(previousAction, ' ')[0] == "splitword") - { - int nbSplit = util::split(util::split(previousAction, ' ')[1], '@').size(); - movement = nbSplit-1; - } - } return "MOVE " + newState + " " + std::to_string(movement); }, [](Config &, Oracle *, const std::string &) @@ -474,12 +462,10 @@ void Oracle::createDatabase() std::string newState; int movement = 0; - if (previousState == "signature") - newState = "tagger"; - else if (previousState == "tokenizer") + if (previousState == "tokenizer") { if (util::split(previousAction, ' ')[0] == "splitword" || util::split(previousAction, ' ')[0] == "endword") - newState = "signature"; + newState = "tagger"; else newState = "tokenizer"; @@ -506,23 +492,18 @@ void Oracle::createDatabase() [](Config & c, Oracle *) { if (c.pastActions.size() == 0) - return std::string("MOVE signature 0"); + return std::string("MOVE parser 0"); std::string previousState = util::noAccentLower(c.pastActions.getElem(0).first); std::string previousAction = util::noAccentLower(c.pastActions.getElem(0).second.name); std::string newState; int movement = 0; - if (previousState == "signature") - newState = "parser"; - else if (previousState == "parser") + if (previousState == "parser") { newState = "parser"; if (util::split(previousAction, ' ')[0] == "shift" || util::split(previousAction, ' ')[0] == "right") - { movement = 1; - newState = "signature"; - } if (movement > 0 && c.endOfTapes()) movement = 0; @@ -535,10 +516,7 @@ void Oracle::createDatabase() newState = "parser"; std::string previousParserAction = util::noAccentLower(c.pastActions.getElem(1).second.name); if (util::split(previousParserAction, ' ')[0] == "shift" || util::split(previousParserAction, ' ')[0] == "right") - { - newState = "signature"; movement = 1; - } } return "MOVE " + newState + " " + std::to_string(movement); @@ -555,16 +533,14 @@ void Oracle::createDatabase() [](Config & c, Oracle *) { if (c.pastActions.size() == 0) - return std::string("MOVE signature 0"); + return std::string("MOVE tagger 0"); std::string previousState = util::noAccentLower(c.pastActions.getElem(0).first); std::string previousAction = util::noAccentLower(c.pastActions.getElem(0).second.name); std::string newState; int movement = 0; - if (previousState == "signature") - newState = "tagger"; - else if (previousState == "tagger") + if (previousState == "tagger") newState = "morpho"; else if (previousState == "morpho") newState = "lemmatizer_lookup"; @@ -583,7 +559,7 @@ void Oracle::createDatabase() { if (util::split(previousAction, ' ')[0] == "shift" || util::split(previousAction, ' ')[0] == "right") { - newState = "signature"; + newState = "tagger"; if (c.endOfTapes()) newState = "parser"; movement = 1; -- GitLab