diff --git a/libcorpus2/tagset.cpp b/libcorpus2/tagset.cpp index fd0af7be58fdbee633ce8344cfc3a3ad4655b62a..8ae89fe8ce636626ab3651e2670429508580a815 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 271a7353fd2dbe2478fde435a52321463d662547..504dc22343da59260d43996edce3a9874041cd14 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;