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 _ACCENTS_MOD 00030 #define _ACCENTS_MOD 00031 00032 #include <string> 00033 #include <set> 00034 #include <map> 00035 00036 #include "freeling/morfo/sufrule.h" 00037 00038 namespace freeling { 00039 00046 00047 class accents_module { 00048 00049 public: 00051 accents_module(); 00053 virtual void fix_accentuation(std::set<std::wstring> &, const sufrule &) const =0; 00055 virtual ~accents_module() {}; 00056 00057 }; 00058 00059 00065 00066 class accents_default: public accents_module { 00067 00068 public: 00070 accents_default(); 00071 00073 void fix_accentuation(std::set<std::wstring> &, const sufrule &) const; 00074 }; 00075 00076 00082 00083 class accents_es: public accents_module { 00084 00085 private: 00087 static const regexp llana_acc; 00088 static const regexp aguda_mal; 00089 static const regexp monosil; 00090 static const regexp last_vowel_put_acc; 00091 static const regexp last_vowel_not_acc; 00092 static const regexp any_vowel_acc; 00093 static const regexp diacritic; 00095 static const std::map<std::wstring,std::wstring> with_acc; 00096 static const std::map<std::wstring,std::wstring> without_acc; 00098 static std::wstring remove_accent_esp(const std::wstring &); 00100 static std::wstring put_accent_esp(const std::wstring &); 00101 00102 public: 00104 accents_es(); 00105 00107 void fix_accentuation(std::set<std::wstring> &, const sufrule &) const; 00108 }; 00109 00115 00116 class accents_gl: public accents_module { 00117 00118 private: 00120 static const regexp last_vowel_put_acc; 00121 static const regexp last_vowel_not_acc; 00122 static const regexp any_vowel_acc; 00123 static const regexp any_closed_vowel_acc; 00124 static const regexp oxytone_without_acc; 00125 static const regexp oxytone_with_acc; 00126 static const regexp diacritic_acc; 00127 static const regexp past_subj_with_acc; 00128 static const regexp infinitive_r_accusative_allomorph; 00129 static const regexp present_s_accusative_allomorph; 00130 00132 static const std::map<std::wstring,std::wstring> with_acc; 00133 static const std::map<std::wstring,std::wstring> without_acc; 00135 static std::wstring remove_accent_gl(const std::wstring &); 00137 static std::wstring put_accent_gl(const std::wstring &); 00139 static void fix_accusative_allomorph_gl(std::set<std::wstring> &); 00140 00141 public: 00143 accents_gl(); 00144 00146 void fix_accentuation(std::set<std::wstring> &, const sufrule &) const; 00147 }; 00148 00149 } // namespace 00150 00151 #endif