FreeLing  3.1
accents_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 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 //    General Public License for more details.
00017 //
00018 //    You should have received a copy of the GNU 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 freeling::regexp llana_acc;
00088     static const freeling::regexp aguda_mal;
00089     static const freeling::regexp monosil;
00090     static const freeling::regexp last_vowel_put_acc;
00091     static const freeling::regexp last_vowel_not_acc;
00092     static const freeling::regexp any_vowel_acc;
00094     static const std::map<std::wstring,std::wstring> with_acc;
00095     static const std::map<std::wstring,std::wstring> without_acc;
00097     static std::wstring remove_accent_esp(const std::wstring &);
00099     static std::wstring put_accent_esp(const std::wstring &);
00100 
00101   public:
00103     accents_es();
00104 
00106     void fix_accentuation(std::set<std::wstring> &, const sufrule &) const;
00107   };
00108 
00114 
00115   class accents_gl: public accents_module {
00116 
00117   private:
00119     static const freeling::regexp last_vowel_put_acc;
00120     static const freeling::regexp last_vowel_not_acc;
00121     static const freeling::regexp any_vowel_acc;
00122     static const freeling::regexp any_closed_vowel_acc;
00123     static const freeling::regexp oxytone_without_acc;
00124     static const freeling::regexp oxytone_with_acc;
00125     static const freeling::regexp diacritic_acc;
00126     static const freeling::regexp past_subj_with_acc;
00127     static const freeling::regexp infinitive_r_accusative_allomorph;
00128     static const freeling::regexp present_s_accusative_allomorph;
00129    
00131     static const std::map<std::wstring,std::wstring> with_acc;
00132     static const std::map<std::wstring,std::wstring> without_acc;
00134     static std::wstring remove_accent_gl(const std::wstring &);
00136     static std::wstring put_accent_gl(const std::wstring &);
00138     static void fix_accusative_allomorph_gl(std::set<std::wstring> &);
00139 
00140   public:
00142     accents_gl();
00143 
00145     void fix_accentuation(std::set<std::wstring> &, const sufrule &) const;
00146   };
00147 
00148 } // namespace
00149 
00150 #endif