Skip to content
Snippets Groups Projects
Commit e74435f9 authored by Adam Wardynski's avatar Adam Wardynski
Browse files

Fix bug#1264 - leave only underspecified lexemes if agreement exists only via them.

Underlying issue was temporary table of remaining lexemes for a token not being
updated (emptied) if only underspecified lexemes of the token met an agreement.
Effectively the token was left in its original state i.e. with all
original lexemes present, both those that were underspecified and the remaining
ones that did not met a weak agreement that was otherwise met via the
underspecified lexemes.
parent 4a8f58d5
Branches
No related tags found
No related merge requests found
...@@ -70,19 +70,12 @@ Bool Unify::execute(const ActionExecContext& context) const ...@@ -70,19 +70,12 @@ Bool Unify::execute(const ActionExecContext& context) const
// there is no agreement possible, abort with no changes // there is no agreement possible, abort with no changes
changed.set_value(false); changed.set_value(false);
return changed; return changed;
} else {
// there were underspecified lexemes, they will be left in the end
// so agreement is met anyway, however we need to mark that
// changes were made because we removed some lexemes that did not
// meet agreement;
// "previous" index has to be left alone though, pointing at previous
// token that still had some agreedable lexemes
changed.set_value(true);
} }
} else { } else {
// some non-underspecified lexemes are left, so // some non-underspecified lexemes are left, so
// next time around, "previous" token is going to be the current one // next time around, "previous" token is going to be the current one
previous = i; previous = i;
}
// there were changes only if we actually removed something // there were changes only if we actually removed something
if (curr_rem.size() != remainings[i].size()) { if (curr_rem.size() != remainings[i].size()) {
changed.set_value(true); changed.set_value(true);
...@@ -90,11 +83,9 @@ Bool Unify::execute(const ActionExecContext& context) const ...@@ -90,11 +83,9 @@ Bool Unify::execute(const ActionExecContext& context) const
} }
} }
} }
}
// finally assign remaining lexemes to original tokens // finally assign remaining lexemes to original tokens
if (changed.get_value()) { if (changed.get_value()) {
for (size_t i = 0; i < remainings.size(); ++i) { for (size_t i = 0; i < remainings.size(); ++i) {
if (remainings[i].size() > 0) {
std::vector<Corpus2::Lexeme>& lexemes = sc.at(i + abs_left)->lexemes(); std::vector<Corpus2::Lexeme>& lexemes = sc.at(i + abs_left)->lexemes();
lexemes = remainings[i]; lexemes = remainings[i];
// underspecced lexemes meet agreement too, so leave them in the end, if any // underspecced lexemes meet agreement too, so leave them in the end, if any
...@@ -103,7 +94,6 @@ Bool Unify::execute(const ActionExecContext& context) const ...@@ -103,7 +94,6 @@ Bool Unify::execute(const ActionExecContext& context) const
} }
} }
} }
}
return changed; return changed;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment