diff --git a/transition_machine/src/ActionBank.cpp b/transition_machine/src/ActionBank.cpp index ae8d59f27a4c80cece2ffbc2901bb16a76fb0885..c66201134a9e565a0443223d581a19e67344eb24 100644 --- a/transition_machine/src/ActionBank.cpp +++ b/transition_machine/src/ActionBank.cpp @@ -144,6 +144,9 @@ std::vector<Action::BasicAction> ActionBank::str2sequence(const std::string & na else if(std::string(b1) == "EPSILON") { } + else if(std::string(b1) == "MOVE") + { + } else if(std::string(b1) == "ERROR") { auto apply = [](Config &, Action::BasicAction &) diff --git a/transition_machine/src/Oracle.cpp b/transition_machine/src/Oracle.cpp index 9eeea8ed6a24201b2a07d3bb40780d5b96bb81a9..cce65937aec591dd8b0af2574ab2f548f696e884 100644 --- a/transition_machine/src/Oracle.cpp +++ b/transition_machine/src/Oracle.cpp @@ -246,6 +246,51 @@ void Oracle::createDatabase() return (action == "WRITE b.0 MORPHO " + c.getTape("MORPHO").getRef(0) || c.endOfTapes()) ? 0 : 1; }))); + str2oracle.emplace("strategy_tagger,morpho,lemmatizer,parser", std::unique_ptr<Oracle>(new Oracle( + [](Oracle *) + { + }, + [](Config & c, Oracle *) + { + if (c.pastActions.size() == 0) + return std::string("MOVE signature"); + + std::string previousState = noAccentLower(c.pastActions.getElem(0).first); + std::string previousAction = noAccentLower(c.pastActions.getElem(0).second.name); + std::string newState; + + if (previousState == "signature") + newState = "tagger"; + else if (previousState == "tagger") + newState = "morpho"; + else if (previousState == "morpho") + newState = "lemmatizer_lookup"; + else if (previousState == "lemmatizer_lookup") + { + if (previousAction == "notfound") + newState = "lemmatizer_rules"; + else + newState = "parser"; + } + else if (previousState == "lemmatizer_rules") + newState = "parser"; + else if (previousState == "parser") + { + if (split(previousAction, ' ')[0] == "shift" || split(previousAction, ' ')[0] == "right") + newState = "signature"; + else + newState = "parser"; + } + else + newState = "unknown("+std::string(ERRINFO)+")("+previousState+")("+previousAction+")"; + + return "MOVE " + newState; + }, + [](Config &, Oracle *, const std::string &) + { + return 0; + }))); + str2oracle.emplace("signature", std::unique_ptr<Oracle>(new Oracle( [](Oracle * oracle) {