diff --git a/libwccl/ops/action.cpp b/libwccl/ops/action.cpp index 4bcf570ac86635584325057200a9e3e948224a23..99a7eed05d11f4cbbad5def0f296a0722859a933 100644 --- a/libwccl/ops/action.cpp +++ b/libwccl/ops/action.cpp @@ -1,4 +1,4 @@ -#include <libwccl/ops/action.h> +#include <libwccl/ops/tagaction.h> #include <libwccl/ops/functions/constant.h> namespace Wccl { diff --git a/libwccl/ops/action.h b/libwccl/ops/action.h index 4af09847b76d00410d4075fafbaf6b982616fcd7..c41ef95f7308790d146971fb7a52ed268b70f98a 100644 --- a/libwccl/ops/action.h +++ b/libwccl/ops/action.h @@ -1,5 +1,5 @@ -#ifndef LIBWCCL_OPS_ACTION_H -#define LIBWCCL_OPS_ACTION_H +#ifndef LIBWCCL_OPS_TAGACTION_H +#define LIBWCCL_OPS_TAGACTION_H #include <libwccl/ops/actionexeccontext.h> #include <libwccl/ops/function.h> @@ -10,7 +10,7 @@ namespace Wccl { /** * Abstract base class for actions in WCCL rules */ -class Action : public Expression +class TagAction : public Expression { public: /** @@ -29,4 +29,4 @@ namespace detail { } /* end ns Wccl */ -#endif // LIBWCCL_OPS_ACTION_H +#endif // LIBWCCL_OPS_TAGACTION_H diff --git a/libwccl/ops/actions/delete.h b/libwccl/ops/actions/delete.h index 376877b7b86c9107c0a74ca6f104e56eeca05ab4..83fe105772dcadfb06ff37915ad5d0886df3b253 100644 --- a/libwccl/ops/actions/delete.h +++ b/libwccl/ops/actions/delete.h @@ -1,7 +1,7 @@ #ifndef LIBWCCL_OPS_ACTIONS_DELETE_H #define LIBWCCL_OPS_ACTIONS_DELETE_H -#include <libwccl/ops/action.h> +#include <libwccl/ops/tagaction.h> #include <libwccl/values/position.h> #include <libwccl/values/bool.h> #include <libwccl/ops/function.h> @@ -13,7 +13,7 @@ namespace Wccl { * (unless no lexemes would be left, in which case * token is left alone with no changes) */ -class Delete : public Action +class Delete : public TagAction { public: typedef boost::shared_ptr<Function<Position> > PosFunctionPtr; diff --git a/libwccl/ops/actions/relabel.h b/libwccl/ops/actions/relabel.h index 5bfd73b0e3f1cf88e42c2d34d4cd14896c13bb58..1fa5a8c55b57dabf734c99e828c298731dabfb35 100644 --- a/libwccl/ops/actions/relabel.h +++ b/libwccl/ops/actions/relabel.h @@ -1,7 +1,7 @@ #ifndef LIBWCCL_OPS_ACTIONS_RELABEL_H #define LIBWCCL_OPS_ACTIONS_RELABEL_H -#include <libwccl/ops/action.h> +#include <libwccl/ops/tagaction.h> #include <libwccl/values/position.h> #include <libwccl/values/bool.h> #include <libwccl/ops/function.h> @@ -11,7 +11,7 @@ namespace Wccl { /** * Action to change part of speech for lexemes that meet a condition. */ -class Relabel : public Action +class Relabel : public TagAction { public: typedef boost::shared_ptr<Function<Position> > PosFunctionPtr; diff --git a/libwccl/ops/actions/select.h b/libwccl/ops/actions/select.h index df08cfee7f4179388d7d913db6df258d71ab4147..12a8431f91b160c823137e54ac2f489b4df5ee94 100644 --- a/libwccl/ops/actions/select.h +++ b/libwccl/ops/actions/select.h @@ -1,7 +1,7 @@ #ifndef LIBWCCL_OPS_ACTIONS_SELECT_H #define LIBWCCL_OPS_ACTIONS_SELECT_H -#include <libwccl/ops/action.h> +#include <libwccl/ops/tagaction.h> #include <libwccl/values/position.h> #include <libwccl/values/bool.h> #include <libwccl/ops/function.h> @@ -13,7 +13,7 @@ namespace Wccl { * (unless no lexemes would be left, in which case * token is left alone with no changes) */ -class Select : public Action +class Select : public TagAction { public: typedef boost::shared_ptr<Function<Position> > PosFunctionPtr; diff --git a/libwccl/ops/tagrule.cpp b/libwccl/ops/tagrule.cpp index ca7c10a4280a594f966f4902a412412c296da9d0..2fc123f268cde8735c03c0c11aaa4fa5593a079a 100644 --- a/libwccl/ops/tagrule.cpp +++ b/libwccl/ops/tagrule.cpp @@ -18,7 +18,7 @@ Bool TagRule::execute(SentenceContext &sentence_context) Bool changed(false); ActionExecContext aec(sentence_context, variables_); if(condition_->apply(aec)->get_value()) { - foreach(const boost::shared_ptr<Action>& action, *actions_) { + foreach(const boost::shared_ptr<TagAction>& action, *actions_) { if(action->execute(aec).get_value()) { changed.set_value(true); } @@ -39,7 +39,7 @@ std::string TagRule::to_string(const Corpus2::Tagset &tagset) const { std::ostringstream os; os << "rule(\"" << name_ << "\", " << condition_->to_string(tagset); - foreach(const boost::shared_ptr<Action>& action, *actions_) { + foreach(const boost::shared_ptr<TagAction>& action, *actions_) { os << ", " << action->to_string(tagset); } os << ")"; @@ -48,7 +48,7 @@ std::string TagRule::to_string(const Corpus2::Tagset &tagset) const std::ostream& TagRule::write_to(std::ostream& os) const { os << "rule(\"" << name_ << "\", " << *condition_; - foreach(const boost::shared_ptr<Action>& action, *actions_) { + foreach(const boost::shared_ptr<TagAction>& action, *actions_) { os << ", " << *action; } os << ")"; diff --git a/libwccl/ops/tagrule.h b/libwccl/ops/tagrule.h index c525add0bcd950866533e3dd4d4a89abeca80753..44813c4d7b63ccee2f5b1d2bf9c5483a52822c09 100644 --- a/libwccl/ops/tagrule.h +++ b/libwccl/ops/tagrule.h @@ -5,7 +5,7 @@ #include <libwccl/ops/parsedexpression.h> #include <libwccl/ops/functions/constant.h> -#include <libwccl/ops/action.h> +#include <libwccl/ops/tagaction.h> namespace Wccl { @@ -20,7 +20,7 @@ public: TagRule( const std::string& name, const Variables& variables, - const boost::shared_ptr<const std::vector<boost::shared_ptr<Action> > >& actions, + const boost::shared_ptr<const std::vector<boost::shared_ptr<TagAction> > >& actions, const boost::shared_ptr<const Function<Bool> >& condition = TrueCondition()); /** @@ -144,7 +144,7 @@ protected: private: static const boost::shared_ptr<const Function<Bool> > TrueCondition(); - boost::shared_ptr<const std::vector<boost::shared_ptr<Action> > > actions_; + boost::shared_ptr<const std::vector<boost::shared_ptr<TagAction> > > actions_; boost::shared_ptr<const Function<Bool> > condition_; std::string name_; }; @@ -158,7 +158,7 @@ inline TagRule::TagRule( const std::string& name, const Variables& variables, - const boost::shared_ptr<const std::vector<boost::shared_ptr<Action> > >& actions, + const boost::shared_ptr<const std::vector<boost::shared_ptr<TagAction> > >& actions, const boost::shared_ptr<const Function<Bool> >& condition) : ParsedExpression(variables), actions_(actions), diff --git a/libwccl/parser/grammar.g b/libwccl/parser/grammar.g index 4a213e9d9d4468f1b5f5e5b175509eeb74183b18..ce46e9ee4998e7e2d5b5a65610414857992abd74 100644 --- a/libwccl/parser/grammar.g +++ b/libwccl/parser/grammar.g @@ -1365,7 +1365,7 @@ symset_setvar // Single action such as select, delete, relabel or unify action [const Corpus2::Tagset& tagset, Variables& vars] - returns [boost::shared_ptr<Action> act] + returns [boost::shared_ptr<TagAction> act] : act = action_select [tagset, vars] | act = action_delete [tagset, vars] | act = action_relabel [tagset, vars] @@ -1378,10 +1378,10 @@ action // select(...), select(...), delete(...) action_sequence [const Corpus2::Tagset& tagset, Variables& vars] - returns [boost::shared_ptr<std::vector<boost::shared_ptr<Action> > > v_act] + returns [boost::shared_ptr<std::vector<boost::shared_ptr<TagAction> > > v_act] { - boost::shared_ptr<Action> act; - v_act.reset(new std::vector<boost::shared_ptr<Action> >); + boost::shared_ptr<TagAction> act; + v_act.reset(new std::vector<boost::shared_ptr<TagAction> >); } : act = action[tagset, vars] { v_act->push_back(act); @@ -1401,7 +1401,7 @@ rule returns [boost::shared_ptr<TagRule> rle] { boost::shared_ptr<Function<Bool> > condition; - boost::shared_ptr<std::vector<boost::shared_ptr<Action> > > actions; + boost::shared_ptr<std::vector<boost::shared_ptr<TagAction> > > actions; } : "rule" LPAREN name: STRING COMMA (condition = bool_operator [tagset, vars] COMMA)?