Select Git revision
isannotatedas.h
isannotatedas.h 1.24 KiB
#ifndef LIBWCCL_OPS_MATCH_CONDITIONS_ISANNOTATEDAS_H
#define LIBWCCL_OPS_MATCH_CONDITIONS_ISANNOTATEDAS_H
#include <libwccl/ops/match/matchcondition.h>
#include <libwccl/ops/function.h>
namespace Wccl {
/**
* is() match condition - matches an annotation
*/
class IsAnnotatedAs : public MatchCondition
{
public:
IsAnnotatedAs(const std::string& annotation_name)
: chan_name_(annotation_name) {
BOOST_ASSERT(!chan_name_.empty());
}
/**
* @returns Name of the Condition.
*/
std::string name() const {
return "is";
}
/**
* Applies the condition to the given execution context.
* If a match is found, the current sentence Position is increased
* by the lenght of matched annotation segment.
*/
MatchResult apply(const ActionExecContext& context) const;
/**
* @returns String representation of the Condition
*/
std::string to_string(const Corpus2::Tagset& tagset) const;
protected:
/**
* Writes the string representation of the Condition to
* an output stream.
* @returns Stream written to.
* @note May be incomplete and/or containt internal info.
*/
std::ostream& write_to(std::ostream& ostream) const;
private:
const std::string chan_name_;
};
} /* end ns Wccl */
#endif // LIBWCCL_OPS_MATCH_CONDITIONS_ISANNOTATEDAS_H