00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00028
00029
00030 #ifndef _DEPRULES
00031 #define _DEPRULES
00032
00033 #include <set>
00034
00035 using namespace std;
00036
00037
00038
00045
00046 class completerRule {
00047
00048 public:
00049 string chunk;
00050 string leftChunk;
00051 string newNode;
00052 string operation;
00053 string dependenceLabel;
00054 int weight;
00055
00057 completerRule();
00058 completerRule(const string &, const string&);
00059 completerRule( const completerRule &);
00061 completerRule & operator=( const completerRule &);
00062
00064 int operator<(const completerRule & a ) const;
00065 };
00066
00067
00075 class rule_expression {
00076
00077 protected:
00078
00079 set<string> valueList;
00080
00081 public:
00082
00083 rule_expression();
00084 rule_expression(const string &);
00085 virtual ~rule_expression() {}
00086
00087 bool find(const string &) const;
00088
00089 virtual bool eval(dep_tree::iterator, dep_tree::iterator) const =0;
00090 };
00091
00092
00106
00110
00111 class check_and : public rule_expression {
00112 private:
00113 list<rule_expression *> check_list;
00114 public:
00115 void add(rule_expression *);
00116 bool eval(dep_tree::iterator ancestor, dep_tree::iterator descendant) const;
00117 };
00118
00119
00123
00124 class check_not : public rule_expression {
00125 private:
00126 rule_expression * check_op;
00127 public:
00128 check_not(rule_expression *);
00129 bool eval(dep_tree::iterator, dep_tree::iterator) const;
00130 };
00131
00132
00136
00137 class check_side : public rule_expression {
00138 private:
00139 string side;
00140 public:
00141 check_side(const string &);
00142 bool eval (dep_tree::iterator, dep_tree::iterator) const;
00143 static rule_expression * create(const string &);
00144 };
00145
00146
00150
00151 class check_A_lemma :public rule_expression {
00152 public:
00153 check_A_lemma(const string &);
00154 bool eval(dep_tree::iterator, dep_tree::iterator) const;
00155 static rule_expression* create(const string &);
00156 };
00157
00161
00162 class check_S_lemma :public rule_expression {
00163 public:
00164 check_S_lemma(const string &);
00165 bool eval(dep_tree::iterator, dep_tree::iterator) const;
00166 static rule_expression* create(const string &);
00167 };
00168
00169
00173
00174 class check_S_category :public rule_expression {
00175 private:
00176 string catg;
00177 public:
00178 check_S_category(const string &);
00179 bool eval(dep_tree::iterator, dep_tree::iterator) const;
00180 static rule_expression* create(const string &);
00181 };
00182
00183
00187
00188 class check_A_wordclass : public rule_expression {
00189 private:
00190 string wclass;
00191 public:
00192 static set<string> wordclasses;
00193 check_A_wordclass(const string &);
00194 static rule_expression * create(const string &);
00195 bool eval (dep_tree::iterator, dep_tree::iterator) const;
00196 };
00197
00198
00202
00203 class ruleLabeler {
00204
00205 public:
00206 string label;
00207 rule_expression * re;
00208 string ancestorLabel;
00209
00210 ruleLabeler(void);
00211 ruleLabeler(const string &, rule_expression *);
00212 bool eval(dep_tree::iterator, dep_tree::iterator) const;
00213 };
00214
00215
00219
00220 class dep_info {
00221
00222 private:
00223 string dep_source;
00224 string dep_target;
00225 string dep_result;
00226
00227 public:
00228 dep_info(void);
00229 dep_info(const string &, const string &, const string &);
00230
00231 string get_dep_source(void);
00232 string get_dep_target(void);
00233 string get_dep_result(void);
00234 void set_dep_source(const string &);
00235 void set_dep_target(const string &);
00236 void set_dep_result(const string &);
00237 };
00238
00239
00240 #endif