diff --git a/decoder/src/macaon_decode.cpp b/decoder/src/macaon_decode.cpp index b005aa87fed4c5ebdd98689706976f919d95b60d..f6e9b941c301e926916bf130ce8048bb04bcca37 100644 --- a/decoder/src/macaon_decode.cpp +++ b/decoder/src/macaon_decode.cpp @@ -51,7 +51,7 @@ po::options_description getOptionsDescription() "For each state of the Config, show its feature representation") ("readSize", po::value<int>()->default_value(0), "The number of lines of input that will be read and stored in memory at once.") - ("dictCapacity", po::value<int>()->default_value(30000), + ("dictCapacity", po::value<int>()->default_value(50000), "The maximal size of each Dict (number of differents embeddings).") ("interactive", po::value<bool>()->default_value(true), "Is the shell interactive ? Display advancement informations") diff --git a/trainer/src/macaon_train.cpp b/trainer/src/macaon_train.cpp index aaa3f7c6ec7c8c46d971ddbc16e9fea65908814f..7a9a2b80211c781de3ca871571fa28de8da69066 100644 --- a/trainer/src/macaon_train.cpp +++ b/trainer/src/macaon_train.cpp @@ -79,7 +79,7 @@ po::options_description getOptionsDescription() "The value of the token that act as a delimiter for sequences") ("batchSize", po::value<int>()->default_value(50), "The size of each minibatch (in number of taining examples)") - ("dictCapacity", po::value<int>()->default_value(30000), + ("dictCapacity", po::value<int>()->default_value(50000), "The maximal size of each Dict (number of differents embeddings).") ("tapeToMask", po::value<std::string>()->default_value("FORM"), "The name of the Tape for which some of the elements will be masked.") diff --git a/transition_machine/src/ActionBank.cpp b/transition_machine/src/ActionBank.cpp index 7a304b6fbcb19122644d3ec493ea135170327107..d85fc39b2be2cacdf69638017fc1777c2e1c7520 100644 --- a/transition_machine/src/ActionBank.cpp +++ b/transition_machine/src/ActionBank.cpp @@ -561,14 +561,26 @@ std::vector<Action::BasicAction> ActionBank::str2sequence(const std::string & na auto undo = [dist](Config &, Action::BasicAction &) { }; - auto appliable = [dist](Config &, Action::BasicAction &) + auto appliable = [dist](Config & c, Action::BasicAction) { + std::string classifierName = c.pastActions.top().first; + int stateHistorySize = c.getStateHistory(classifierName).size(); + + if (c.getCurrentStateHistory().size() >= 2 && (c.getCurrentStateHistory().top() == "BACK" || c.getCurrentStateHistory().getElem(1) == "BACK")) + return false; + + if (c.hashHistory.contains(c.computeHash())) + return false; + + if (stateHistorySize <= dist) + return false; + return true; }; - Action::BasicAction basicAction = - {Action::BasicAction::Type::Write, "", apply, undo, appliable}; + Action::BasicAction basicAction = + {Action::BasicAction::Type::Write, "", apply, undo, appliable}; - sequence.emplace_back(basicAction); + sequence.emplace_back(basicAction); } else { diff --git a/transition_machine/src/Oracle.cpp b/transition_machine/src/Oracle.cpp index 805b62c455cdeeb99fada7d4bff0e5fce9354ebe..bc54f85da6ffa8b52f4bbf881d1a9846a32f4851 100644 --- a/transition_machine/src/Oracle.cpp +++ b/transition_machine/src/Oracle.cpp @@ -97,6 +97,7 @@ void Oracle::createDatabase() str2oracle.emplace("error_tagger", std::unique_ptr<Oracle>(new Oracle( [](Oracle * oracle) { + return; File file(oracle->filename, "r"); FILE * fd = file.getDescriptor(); char b1[1024]; @@ -155,6 +156,7 @@ void Oracle::createDatabase() str2oracle.emplace("error_morpho", std::unique_ptr<Oracle>(new Oracle( [](Oracle * oracle) { + return; File file(oracle->filename, "r"); FILE * fd = file.getDescriptor(); char b1[1024]; @@ -220,6 +222,7 @@ void Oracle::createDatabase() str2oracle.emplace("error_parser", std::unique_ptr<Oracle>(new Oracle( [](Oracle * oracle) { + return; File file(oracle->filename, "r"); FILE * fd = file.getDescriptor(); char b1[1024];