hmm_tagger.h
Go to the documentation of this file.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 #ifndef _TAGGER
00030 #define _TAGGER
00031
00032 #include <map>
00033 #include <list>
00034 #include <set>
00035
00036 #include "fries/language.h"
00037 #include "freeling/tagger.h"
00038
00049
00050 class viterbi {
00051 public:
00053 viterbi(int);
00055 ~viterbi();
00056
00058 std::map <std::string, double> *delta_log;
00060 std::map <std::string, std::string> *phi;
00061 };
00062
00063
00071
00072 class emission_states: public std::set<std::string> {};
00073
00074
00081
00082 class hmm_tagger: public POS_tagger {
00083 private:
00084
00085 std::string Language;
00086
00088 std::map <std::string, double> PTag;
00089 std::map <std::string, double> PBg;
00090 std::map <std::string, double> PTrg;
00091 std::map <std::string, double> PInitial;
00092 std::map <std::string, double> PWord;
00093
00095 std::multimap <std::string, std::string> Forbidden;
00097 float ZERO_logprob;
00098
00100 double c[3];
00101
00102 bool is_forbidden(const std::string &, sentence::const_iterator) const;
00103 double ProbA_log(const std::string &, const std::string &, sentence::const_iterator) const;
00104 double ProbB_log(const std::string &, const word &) const;
00105 double ProbPi_log(const std::string &) const;
00106
00108 std::list<emission_states> FindStates(const sentence &) const;
00109
00110 public:
00112 hmm_tagger(const std::string &, const std::string &, bool, unsigned int);
00113
00115 void analyze(std::list<sentence> &);
00117 std::list<sentence> analyze(const std::list<sentence> &);
00118 };
00119
00120 #endif
00121