From 4569eb22837dc79686b527c912518c1720540477 Mon Sep 17 00:00:00 2001 From: Adam Wardynski <award@.(win7-laptop)> Date: Wed, 16 Feb 2011 16:37:56 +0100 Subject: [PATCH] fix bug #1270: check agreement only on existing categories. Previously effectively agreement was checked on all categories, even if a lexeme's tag didn't have some of the selected categories. That led to treating such lexeme as not agreeing with one that had more matching categories, even if it was agreeing on all categories that were present. --- libwccl/ops/actions/unify.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libwccl/ops/actions/unify.cpp b/libwccl/ops/actions/unify.cpp index 0733efd..0cf5152 100644 --- a/libwccl/ops/actions/unify.cpp +++ b/libwccl/ops/actions/unify.cpp @@ -57,9 +57,13 @@ Bool Unify::execute(const ActionExecContext& context) const std::vector<Corpus2::Lexeme> curr_rem; // get only lexemes that agree with a lexeme from previous token foreach(const Corpus2::Lexeme& curr_lex, remainings[i]) { + int curr_match_cats = attribs->matching_categories(curr_lex.tag()); foreach(const Corpus2::Lexeme& prev_lex, prev_rem) { Corpus2::Tag inter = curr_lex.tag().get_masked(prev_lex.tag()); - if (attribs->matching_categories(inter) == attribs->matching_categories(curr_lex.tag())) { + int min_to_match = std::min( + curr_match_cats, + attribs->matching_categories(prev_lex.tag())); + if (attribs->matching_categories(inter) == min_to_match) { curr_rem.push_back(curr_lex); break; } -- GitLab