From 495d54606cad4061be45a65df2fc97ce8bf3b4ea Mon Sep 17 00:00:00 2001 From: Adam Radziszewski <adam.radziszewski@pwr.wroc.pl> Date: Fri, 15 Jul 2011 13:57:22 +0200 Subject: [PATCH] generalise Tagset::expand... to all attribs --- libcorpus2/tagset.cpp | 2 +- libcorpus2/tagset.h | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/libcorpus2/tagset.cpp b/libcorpus2/tagset.cpp index fd0af7b..8ae89fe 100644 --- a/libcorpus2/tagset.cpp +++ b/libcorpus2/tagset.cpp @@ -609,7 +609,7 @@ Tag Tagset::expand_unspec_attrs(const Tag& tag) const Tag new_tag(tag); idx_t pos_idx = tag.get_pos_index(); const std::vector<idx_t>& attrs = get_pos_attributes(pos_idx); - foreach (const idx_t& a, attrs) { + for (idx_t a = 0; a < attribute_count(); ++a) { mask_t attr_mask = get_attribute_mask(a); mask_t value = tag.get_values_for(attr_mask); if (!value.any()) { // no value given diff --git a/libcorpus2/tagset.h b/libcorpus2/tagset.h index 271a735..504dc22 100644 --- a/libcorpus2/tagset.h +++ b/libcorpus2/tagset.h @@ -374,12 +374,12 @@ public: Tag select_singular(const Tag& tag) const; /** - * Creates a copy of the given tag where optional or required attributes - * with no value given are encoded as each possible value set. - * NOTE: this may result in tags technically invalid (multiple values set - * for one attribute), yet it is convenient for some tagging scenarios to - * explicitly distinguish between an irrelevant attribute and a relevant - * one but no value given. + * Creates a copy of the given tag where any attribute with no value given + * is encoded as each possible value set. NOTE: this produce an invalid + * tag (multiple values set for one attribute), yet it is convenient for + * some tagging scenarios to be able to retrieve unspecified attr value as + * a non-zero mask. This can always be decoded into a valid tag by using + * select_singular. */ Tag expand_unspec_attrs(const Tag& tag) const; -- GitLab