#ifndef LIBWCCL_VALUES_TSET_H #define LIBWCCL_VALUES_TSET_H #include <libwccl/values/value.h> #include <libcorpus2/tag.h> namespace Wccl { class TSet : public Value { public: WCCL_VALUE_PREAMBLE; typedef Corpus2::Tag value_type; TSet() : tag_() { } explicit TSet(Corpus2::Tag tag) : tag_(tag) { } const Corpus2::Tag& get_value() const { return tag_; } void set_value(const Corpus2::Tag& tag) { tag_ = tag; } Corpus2::Tag& tag_ref() { return tag_; } void insert_symbol(const Corpus2::Tagset& tagset, const std::string& s); bool empty() const { return tag_.is_null(); } /** * @return true if each tagset symbol from this set exists in the other set * (note that an empty set is a subset of anything) */ bool is_subset_of(const TSet& other) const { return tag_.get_masked(other.tag_) == tag_; } /** * @return true if there is at least one common symbol between this set and * the other set (an empty set intersects with nothing) */ bool intersects(const TSet& other) const { return !tag_.get_masked(other.tag_).is_null(); } bool equals(const TSet& other) const { return tag_ == other.tag_; } std::string to_string(const Corpus2::Tagset &) const; std::string to_raw_string() const; private: Corpus2::Tag tag_; }; } /* end ns Wccl */ #endif // LIBWCCL_VALUES_TSET_H