Skip to content
Snippets Groups Projects
Commit 673b4d2a authored by Franck Dary's avatar Franck Dary
Browse files

Removed cycle checking in Action::attach and fixed index problem in some transition cost

parent 65bb83a7
No related branches found
No related tags found
No related merge requests found
......@@ -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))
......
......@@ -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))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment