From 33dc14dab2adf5efd9d72c34fd00cb0006af1fe3 Mon Sep 17 00:00:00 2001 From: Adam Radziszewski <adam.radziszewski@pwr.wroc.pl> Date: Wed, 17 Aug 2011 15:47:08 +0200 Subject: [PATCH] convenience function to set disambs when tag=wanted_tag --- libcorpus2/tagging.cpp | 7 +++++++ libcorpus2/tagging.h | 2 ++ swig/tagging.i | 1 + 3 files changed, 10 insertions(+) diff --git a/libcorpus2/tagging.cpp b/libcorpus2/tagging.cpp index b4bc5c3..ffcfdd0 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 65c4b80..6d65211 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 0d65ecf..ec90902 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; -- GitLab