diff --git a/libcorpus2/tagging.cpp b/libcorpus2/tagging.cpp index b4bc5c39291cd14eb436400e9ee6032e8e73dd2e..ffcfdd015209a01366b4959a7b491d726e82b528 100644 --- a/libcorpus2/tagging.cpp +++ b/libcorpus2/tagging.cpp @@ -168,4 +168,11 @@ bool disambiguate_subset(Token* token, const Tag& mask_where, return true; } +void set_disambs(Token *token, const Tag& wanted_tag) +{ + foreach (Lexeme& lex, token->lexemes()) { + lex.set_disamb(lex.tag() == wanted_tag); + } +} + } /* end ns Corpus2 */ diff --git a/libcorpus2/tagging.h b/libcorpus2/tagging.h index 65c4b80a1fe59958cc5e0313bf8f28320635a0a7..6d65211f40e2ea059af6afbee278a96c2fd37541 100644 --- a/libcorpus2/tagging.h +++ b/libcorpus2/tagging.h @@ -97,6 +97,8 @@ bool disambiguate_equal(Token* token, const Tag& mask_where, bool disambiguate_subset(Token* token, const Tag& mask_where, const Tag& mask_wanted); +/** 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 diff --git a/swig/tagging.i b/swig/tagging.i index 0d65ecf1ad8509507ea4569d8ad0af7e753e8230..ec90902b9fc3121809429e8807a85a44e2a95ae1 100644 --- a/swig/tagging.i +++ b/swig/tagging.i @@ -37,6 +37,7 @@ bool disambiguate_equal(Token* token, const Tag& mask_where, const Tag& mask_wan bool disambiguate_subset(Token* token, const Tag& mask_where, const Tag& mask_wanted); +void set_disambs(Token *token, const Tag& wanted_tag); } using namespace std;