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

dependencies.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 _DEPENDENCIES
00031 #define _DEPENDENCIES
00032 
00033 using namespace std;
00034 
00035 #include "language.h"
00036 #include "dep_rules.h"
00037 
00038 #include <string>
00039 #include <map>
00040 
00041 
00049 
00050 class completer {
00051 
00052   private:
00054     map<pair<string,string>,completerRule>  chgram;
00056     parse_tree::iterator find_last_label(parse_tree *, const string &) const;
00058     completerRule gramatica(const string &, const string &);
00060     parse_tree * applyRule(const completerRule &, parse_tree *, parse_tree *);
00061 
00062   public:  
00064     completer(const string &);
00066     parse_tree complete(parse_tree &, const string &);    
00067 };
00068 
00069 
00070 
00072 
00073 typedef rule_expression* expcreator(const string &);
00074 
00080 
00081 class depLabeler {
00082 
00083   private:
00084     map<string, list <ruleLabeler> > rules;
00085     map<string, expcreator *> expressions;
00086 
00087   public:
00089     depLabeler(const string &);
00091     void label(dep_tree*);
00093     void label(dep_tree*, dep_tree::iterator);
00095     void registerFunction(const string, expcreator*);
00096 };
00097 
00098 
00099 
00108 
00109 class dependencyMaker {
00110 
00111  private:
00113    completer comp; 
00115    depLabeler labeler;
00116    // Root symbol used by the chunk parser when the tree is not complete.
00117    string start;
00118   
00120    void registerFunction(const string &, expcreator*);
00122    dep_tree* dependencies(parse_tree &tr);
00123 
00124  public:   
00126    dependencyMaker(const string &, const string &);
00128    void analyze(list<sentence> &);
00130    list<sentence> analyze(const list<sentence> &);
00131 };
00132 
00133 #endif
00134 

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