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

numbers_modules.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 _NUMBERS_MOD
00031 #define _NUMBERS_MOD
00032 
00033 #include <map>
00034 
00035 #include "language.h"
00036 #include "automat.h"
00037 #include "regexp.h"
00038 
00039 #define RE_NUM "^([0-9]+\\"+MACO_Thousand+")*[0-9]+(\\"+MACO_Decimal+")?[0-9]*$"
00040 #define RE_CODE "^.*[0-9].*$"
00041 
00042 
00047 
00048 class numbers_module : public automat {
00049 
00050    protected:
00051       // configuration options
00052       string MACO_Decimal, MACO_Thousand;
00053 
00055       map<string,float> value;
00057       map<string,int> tok;
00059       map<int,long double> power;
00060 
00062       long double bilion,milion,units;
00063       int block;
00064       bool iscode;
00065       RegEx RE_number;
00066       RegEx RE_code;
00067  
00068    public:
00070       numbers_module(const string &, const string &);
00071 };
00072 
00077 
00078 class numbers_default : public numbers_module {
00079 
00080    private: 
00081       int ComputeToken(int,sentence::const_iterator,const sentence &);
00082       void ResetActions();
00083       void StateActions(int, int, int, sentence::const_iterator);
00084       void SetMultiwordAnalysis(sentence::iterator) const;
00085 
00086    public:
00088       numbers_default(const string &, const string &);
00089 };
00090 
00091 
00096 
00097 class numbers_es : public numbers_module {
00098 
00099    private:
00100       int ComputeToken(int,sentence::const_iterator,const sentence &);
00101       void ResetActions();
00102       void StateActions(int, int, int, sentence::const_iterator);
00103       void SetMultiwordAnalysis(sentence::iterator) const;
00104 
00105    public:
00107       numbers_es(const string &, const string &);
00108 };
00109 
00110 
00115 
00116 class numbers_ca : public numbers_module {
00117 
00118    private:
00119       int ComputeToken(int,sentence::const_iterator,const sentence &);
00120       void ResetActions();
00121       void StateActions(int, int, int, sentence::const_iterator);
00122       void SetMultiwordAnalysis(sentence::iterator) const;
00123 
00124    public:
00126       numbers_ca(const string &, const string &);
00127 };
00128 
00133 
00134 class numbers_gl : public numbers_module {
00135 
00136    private:
00137       int ComputeToken(int,sentence::const_iterator,const sentence &);
00138       void ResetActions();
00139       void StateActions(int, int, int, sentence::const_iterator);
00140       void SetMultiwordAnalysis(sentence::iterator) const;
00141 
00142    public:
00144       numbers_gl(const string &, const string &);
00145 };
00146 
00147 
00152 
00153 class numbers_en : public numbers_module {
00154 
00155    private: 
00156       int ComputeToken(int,sentence::const_iterator,const sentence &);
00157       void ResetActions();
00158       void StateActions(int, int, int, sentence::const_iterator);
00159       void SetMultiwordAnalysis(sentence::iterator) const;
00160 
00161    public:
00163       numbers_en(const string &, const string &);
00164 };
00165 
00166 
00167 #endif
00168 

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