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 "fries/language.h"
00036 #include "freeling/automat.h"
00037 #include "regexp-pcre++.h"
00038
00039 #define RE_NUM "^([0-9]+\\"+MACO_Thousand+")*[0-9]+(\\"+MACO_Decimal+")?[0-9]*$"
00040 #define RE_CODE "^.*[0-9].*$"
00041
00042
00043 #define CODE 1
00044 #define ORD 2
00045
00046
00051
00052 class numbers_module : public automat {
00053
00054 protected:
00055
00056 std::string MACO_Decimal, MACO_Thousand;
00057
00059 std::map<std::string,float> value;
00061 std::map<std::string,int> tok;
00063 std::map<int,long double> power;
00064
00066 long double bilion,milion,units;
00067 int block;
00068 int iscode;
00069 RegEx RE_number;
00070 RegEx RE_code;
00071
00072 public:
00074 numbers_module(const std::string &, const std::string &);
00075 };
00076
00081
00082 class numbers_default : public numbers_module {
00083
00084 private:
00085 int ComputeToken(int,sentence::iterator&,sentence &);
00086 void ResetActions();
00087 void StateActions(int, int, int, sentence::const_iterator);
00088 void SetMultiwordAnalysis(sentence::iterator, int);
00089
00090 public:
00092 numbers_default(const std::string &, const std::string &);
00093 };
00094
00095
00100
00101 class numbers_es : public numbers_module {
00102
00103 private:
00104 int ComputeToken(int,sentence::iterator&, sentence &);
00105 void ResetActions();
00106 void StateActions(int, int, int, sentence::const_iterator);
00107 void SetMultiwordAnalysis(sentence::iterator, int);
00108
00109 public:
00111 numbers_es(const std::string &, const std::string &);
00112 };
00113
00114
00119
00120 class numbers_ca : public numbers_module {
00121
00122 private:
00123 int ComputeToken(int,sentence::iterator&,sentence &);
00124 void ResetActions();
00125 void StateActions(int, int, int, sentence::const_iterator);
00126 void SetMultiwordAnalysis(sentence::iterator, int);
00127
00128 public:
00130 numbers_ca(const std::string &, const std::string &);
00131 };
00132
00137
00138 class numbers_gl : public numbers_module {
00139
00140 private:
00141 int ComputeToken(int,sentence::iterator&,sentence &);
00142 void ResetActions();
00143 void StateActions(int, int, int, sentence::const_iterator);
00144 void SetMultiwordAnalysis(sentence::iterator, int);
00145
00146 public:
00148 numbers_gl(const std::string &, const std::string &);
00149 };
00150
00151
00156
00157 class numbers_it : public numbers_module {
00158
00159 private:
00160 int ComputeToken(int,sentence::iterator&, sentence &);
00161 void ResetActions();
00162 void StateActions(int, int, int, sentence::const_iterator);
00163 void SetMultiwordAnalysis(sentence::iterator, int);
00164
00165
00166 long double hundreds;
00167 long double thousands;
00168 long double floatUnits;
00169
00170
00171 public:
00173 numbers_it(const std::string &, const std::string &);
00174 };
00175
00176
00181
00182 class numbers_en : public numbers_module {
00183
00184 private:
00185 int ComputeToken(int,sentence::iterator&, sentence &);
00186 void ResetActions();
00187 void StateActions(int, int, int, sentence::const_iterator);
00188 void SetMultiwordAnalysis(sentence::iterator, int);
00189
00190 public:
00192 numbers_en(const std::string &, const std::string &);
00193 };
00194
00195
00196 #endif
00197