From 7258da92845227cd6cef4df09ce8883eb8768a76 Mon Sep 17 00:00:00 2001 From: Adam Wardynski <award@.(B-4.4.46a)> Date: Mon, 7 Mar 2011 13:26:52 +0100 Subject: [PATCH] Rename Action to TagAction. --- libwccl/ops/action.cpp | 2 +- libwccl/ops/action.h | 8 ++++---- libwccl/ops/actions/delete.h | 4 ++-- libwccl/ops/actions/relabel.h | 4 ++-- libwccl/ops/actions/select.h | 4 ++-- libwccl/ops/tagrule.cpp | 6 +++--- libwccl/ops/tagrule.h | 8 ++++---- libwccl/parser/grammar.g | 10 +++++----- 8 files changed, 23 insertions(+), 23 deletions(-) diff --git a/libwccl/ops/action.cpp b/libwccl/ops/action.cpp index 4bcf570..99a7eed 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 4af0984..c41ef95 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 376877b..83fe105 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 5bfd73b..1fa5a8c 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 df08cfe..12a8431 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 ca7c10a..2fc123f 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 c525add..44813c4 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 4a213e9..ce46e9e 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)? -- GitLab