Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members

dep_rules.h

Go to the documentation of this file.
00001 
00002 //
00003 //    FreeLing - Open Source Language Analyzers
00004 //
00005 //    Copyright (C) 2004   TALP Research Center
00006 //                         Universitat Politecnica de Catalunya
00007 //
00008 //    This library is free software; you can redistribute it and/or
00009 //    modify it under the terms of the GNU Lesser General Public
00010 //    License as published by the Free Software Foundation; either
00011 //    version 2.1 of the License, or (at your option) any later version.
00012 //
00013 //    This library is distributed in the hope that it will be useful,
00014 //    but WITHOUT ANY WARRANTY; without even the implied warranty of
00015 //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00016 //    Lesser General Public License for more details.
00017 //
00018 //    You should have received a copy of the GNU Lesser General Public
00019 //    License along with this library; if not, write to the Free Software
00020 //    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
00021 //
00022 //    contact: Lluis Padro (padro@lsi.upc.es)
00023 //             TALP Research Center
00024 //             despatx C6.212 - Campus Nord UPC
00025 //             08034 Barcelona.  SPAIN
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     // set of values (if any) to check against.
00079     set<string> valueList;
00080 
00081   public:
00082     // constructors and destructors
00083     rule_expression();
00084     rule_expression(const string &);
00085     virtual ~rule_expression() {}
00086     // search a value in expression list
00087     bool find(const string &) const;
00088     // virtual, evaluate expression
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; // items are class#verbLemma
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

Generated on Wed Apr 26 12:55:30 2006 for FreeLing by  doxygen 1.4.4