diff --git a/reading_machine/src/Action.cpp b/reading_machine/src/Action.cpp index 26fe98497cae24dfad0021c4f3a522d277c1be8d..eb03c35dce0a395f66795e23fa24f07e77563f65 100644 --- a/reading_machine/src/Action.cpp +++ b/reading_machine/src/Action.cpp @@ -667,15 +667,15 @@ Action Action::attach(Config::Object governorObject, int governorIndex, Config:: return false; // Check for cycles - while (govLineIndex != depLineIndex) - { - try - { - govLineIndex = std::stoi(config.getAsFeature(Config::headColName, govLineIndex)); - } catch(std::exception &) {return true;} - } +// while (govLineIndex != depLineIndex) +// { +// try +// { +// govLineIndex = std::stoi(config.getAsFeature(Config::headColName, govLineIndex)); +// } catch(std::exception &) {return true;} +// } - return false; + return true; }; return {Type::Write, apply, undo, appliable}; @@ -743,9 +743,6 @@ Action Action::setRootUpdateIdsEmptyStackIfSentChanged() firstIndexOfSentence = i; } - if (firstIndexOfSentence < 0) - util::myThrow("could not find any token in current sentence"); - for (int i = firstIndexOfSentence; i <= lineIndex; ++i) { if (!config.has(0, i, 0)) diff --git a/reading_machine/src/Transition.cpp b/reading_machine/src/Transition.cpp index 76601d3cfd0af61edc812da9ac5ec9656eeae52a..7fcc7ca3fc3ad52672771262c2c233b6e2973ca7 100644 --- a/reading_machine/src/Transition.cpp +++ b/reading_machine/src/Transition.cpp @@ -362,7 +362,7 @@ void Transition::initStandardLeft_rel(std::string label) return 0; int cost = getNbLinkedWith(config.getWordIndex(), getLastIndexOfSentence(config.getWordIndex(), config), Config::Object::Buffer, depIndex, config); - cost += getNbLinkedWith(1, config.getStackSize()-2, Config::Object::Stack, depIndex, config); + cost += getNbLinkedWith(1, config.getStackSize()-1, Config::Object::Stack, depIndex, config); if (label != config.getConst(Config::deprelColName, depIndex, 0)) ++cost; @@ -406,7 +406,7 @@ void Transition::initEagerRight_rel(std::string label) { auto depIndex = config.getWordIndex(); - int cost = getNbLinkedWith(1, config.getStackSize()-2, Config::Object::Stack, depIndex, config); + int cost = getNbLinkedWith(1, config.getStackSize()-1, Config::Object::Stack, depIndex, config); cost += getNbLinkedWithHead(depIndex+1, getLastIndexOfSentence(depIndex, config), Config::Object::Buffer, depIndex, config); if (label != config.getConst(Config::deprelColName, depIndex, 0))