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 _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
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