Skip to content
Snippets Groups Projects
Commit d998c411 authored by Adam Radziszewski's avatar Adam Radziszewski
Browse files

add with_values_masked Tag function

parent 6b9ad465
Branches
No related merge requests found
......@@ -2,7 +2,7 @@ PROJECT(Corpus2Library)
set(corpus2_ver_major "1")
set(corpus2_ver_minor "3")
set(corpus2_ver_patch "0")
set(corpus2_ver_patch "1")
cmake_minimum_required(VERSION 2.8.0)
......
......@@ -59,6 +59,12 @@ int mask_card(const Tag& mask)
+ PwrNlp::count_bits_set(mask.get_values());
}
Tag with_values_masked(Tag input, Tag attr_value, Tag attr_mask) {
Tag output(input);
output.add_values_masked(attr_value.get_values(), attr_mask.get_values());
return output;
}
bool select_preferred_disamb(const Tagset& tagset, Token* token)
{
size_t lex_idx = token->get_preferred_lexeme_index(tagset);
......
......@@ -45,6 +45,13 @@ Tag mask_token(const Token& token, const Tag& mask, bool disamb_only);
/** Returns the number of set elements belonging to the mask given. */
int mask_card(const Tag& mask);
/**
* Returns a copy of the given input tag with the attribute referred
* to by attr_mask value set to attr_value (possibly empty).
* NOTE: only attribute part of the masks are considered.
*/
Tag with_values_masked(Tag input, Tag attr_value, Tag attr_mask);
/** Forces one disamb lexeme per token. The selection is based on tagset
* definition order. Returns if any disamb found.
*/
......@@ -99,6 +106,7 @@ bool disambiguate_subset(Token* token, const Tag& mask_where,
/** Sets lexemes' disamb markers iff lexeme.tag is wanted_tag. */
void set_disambs(Token *token, const Tag& wanted_tag);
} /* end ns Corpus2 */
#endif // LIBCORPUS2_TAGGING_H
......@@ -21,6 +21,8 @@ Tag mask_token(const Token& token, const Tag& mask, bool disamb_only);
int mask_card(const Tag& mask);
Tag with_values_masked(Tag input, Tag attr_value, Tag attr_mask);
bool select_preferred_disamb(const Tagset& tagset, Token* token);
void select_preferred_lexeme(const Tagset& tagset, Token* token);
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment