Skip to content
Snippets Groups Projects
Select Git revision
  • 73a30ea572dc749d6f0122e08c2a81005decfec8
  • master default protected
  • fix-words-ann
  • wccl-rules-migration
  • develop
5 results

annotationmatch.h

Blame
  • user avatar
    Adam Wardynski authored
    MatchVector, AnnotationMatch, TokenMatch are now MatchData
    MatchData is value_type of Match which now has get_value/set_value
    Match has also copy construction working properly now
    Default value for Match holds MatchVector so adding $m:_M var in grammar works as intended.
    a3897913
    History
    annotationmatch.h 1.10 KiB
    #ifndef LIBWCCL_VALUES_ANNOTATIONMATCH_H
    #define LIBWCCL_VALUES_ANNOTATIONMATCH_H
    
    #include <libwccl/values/matchdata.h>
    
    namespace Wccl {
    
    class AnnotationMatch : public MatchData
    {
    public:
    
    	explicit AnnotationMatch(Position position, const std::string channel)
    		: position_(position), channel_(channel)
    	{
    		BOOST_ASSERT(position_.get_value() != Position::Nowhere);
    	}
    
    	explicit AnnotationMatch(int pos,const std::string channel)
    		: position_(pos), channel_(channel)
    	{
    		BOOST_ASSERT(position_.get_value() != Position::Nowhere);
    	}
    
    	/// MatchData override.
    	bool empty() const {
    		return false;
    	}
    
    	/// MatchData override.
    	Position first_token(const boost::shared_ptr<Corpus2::AnnotatedSentence>& s) const;
    
    	/// MatchData override.
    	Position last_token(const boost::shared_ptr<Corpus2::AnnotatedSentence>& s) const;
    
    	/// MatchData override
    	std::string to_raw_string() const;
    
    protected:
    	/// MatchData override
    	AnnotationMatch* clone_internal() const {
    		return new AnnotationMatch(*this);
    	}
    
    private:
    	Position position_;
    	std::string channel_;
    };
    
    } /* end ns Wccl */
    
    #endif // LIBWCCL_VALUES_ANNOTATIONMATCH_H