FreeLing
4.0
|
00001 00002 // 00003 // FreeLing - Open Source Language Analyzers 00004 // 00005 // Copyright (C) 2014 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 Affero General Public 00010 // License as published by the Free Software Foundation; either 00011 // version 3 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 // Affero General Public License for more details. 00017 // 00018 // You should have received a copy of the GNU Affero 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 #ifndef _QUANTITIES_MOD 00030 #define _QUANTITIES_MOD 00031 00032 #include <map> 00033 00034 #include "freeling/morfo/language.h" 00035 #include "freeling/morfo/automat.h" 00036 #include "freeling/morfo/locutions.h" 00037 00038 namespace freeling { 00039 00043 00044 class quantities_status : public automat_status { 00045 public: 00047 std::wstring value1, value2; 00048 std::wstring unitType; 00050 std::wstring unitCode; 00051 }; 00052 00058 00059 class quantities_module: public automat<quantities_status> { 00060 00061 private: 00062 virtual void ResetActions(quantities_status *) const ; 00063 virtual void SetMultiwordAnalysis(sentence::iterator, int, const quantities_status *) const; 00064 00065 protected: 00066 virtual void readConfig(const std::wstring &); 00068 std::map<std::wstring,int> tok; 00070 std::map<std::wstring,long double> fract; 00072 std::map<std::wstring,std::wstring> units; 00074 locutions measures; 00076 std::wstring currency_key; 00077 00078 public: 00080 quantities_module(); 00081 }; 00082 00083 00088 00089 class quantities_default: public quantities_module { 00090 00091 private: 00092 int ComputeToken(int,sentence::iterator&,sentence &) const; 00093 void StateActions(int, int, int, sentence::const_iterator, quantities_status *) const; 00094 00095 public: 00097 quantities_default(const std::wstring &); 00098 }; 00099 00100 00105 00106 class quantities_es: public quantities_module { 00107 00108 private: 00109 int ComputeToken(int,sentence::iterator&, sentence &) const; 00110 void StateActions(int, int, int, sentence::const_iterator, quantities_status *) const; 00111 00112 public: 00114 quantities_es(const std::wstring &); 00115 }; 00116 00121 00122 class quantities_ca: public quantities_module { 00123 00124 private: 00125 int ComputeToken(int,sentence::iterator&, sentence &) const; 00126 void StateActions(int, int, int, sentence::const_iterator, quantities_status *) const; 00127 00128 public: 00130 quantities_ca(const std::wstring &); 00131 }; 00132 00133 00138 00139 class quantities_gl: public quantities_module { 00140 00141 private: 00142 int ComputeToken(int,sentence::iterator&, sentence &) const; 00143 void StateActions(int, int, int, sentence::const_iterator, quantities_status *) const; 00144 00145 public: 00147 quantities_gl(const std::wstring &); 00148 }; 00149 00154 00155 class quantities_pt: public quantities_module { 00156 00157 private: 00158 int ComputeToken(int,sentence::iterator&, sentence &) const; 00159 void StateActions(int, int, int, sentence::const_iterator, quantities_status *) const; 00160 00161 public: 00163 quantities_pt(const std::wstring &); 00164 }; 00165 00170 00171 class quantities_en: public quantities_module { 00172 00173 private: 00174 int ComputeToken(int,sentence::iterator&, sentence &) const; 00175 void StateActions(int, int, int, sentence::const_iterator, quantities_status *) const; 00176 00177 public: 00179 quantities_en(const std::wstring &); 00180 }; 00181 00186 00187 class quantities_ru: public quantities_module { 00188 00189 private: 00190 int ComputeToken(int,sentence::iterator&, sentence &) const; 00191 void StateActions(int, int, int, sentence::const_iterator, quantities_status *) const; 00192 00193 public: 00195 quantities_ru(const std::wstring &); 00196 }; 00197 00198 } // namespace 00199 00200 #endif 00201