hmm_tagger Class Reference

The class hmm_tagger implements the syntactic analyzer and is the main class, which uses all the others. More...

#include <hmm_tagger.h>

Inheritance diagram for hmm_tagger:
Inheritance graph
[legend]
Collaboration diagram for hmm_tagger:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 hmm_tagger (const std::string &, const std::string &, bool, unsigned int)
 Constructor.
void analyze (std::list< sentence > &)
 analyze given sentences
std::list< sentence > analyze (const std::list< sentence > &)
 analyze sentences and return analyzed copy (for java API)

Private Member Functions

bool is_forbidden (const std::string &, sentence::const_iterator) const
double ProbA_log (const std::string &, const std::string &, sentence::const_iterator) const
 Compute transition log_probability from state_i to state_j, returning appropriate smoothed values if no evidence is available.
double ProbB_log (const std::string &, const word &) const
 Compute emission log_probability for observation obs from state_i.
double ProbPi_log (const std::string &) const
 Compute initial log_probability for state_i.
std::list< emission_statesFindStates (const sentence &) const
 compute possible emission states for each word in sentence.

Private Attributes

std::string Language
std::map< std::string, double > PTag
 maps to store the probabilities
std::map< std::string, double > PBg
std::map< std::string, double > PTrg
std::map< std::string, double > PInitial
std::map< std::string, double > PWord
std::multimap< std::string,
std::string > 
Forbidden
 set of hand-specified forbidden bigram and trigram transitions
float ZERO_logprob
 log prob for zero
double c [3]
 coeficients to compute linear interpolation

Detailed Description

The class hmm_tagger implements the syntactic analyzer and is the main class, which uses all the others.


Constructor & Destructor Documentation

hmm_tagger::hmm_tagger ( const std::string &  lang,
const std::string &  HMM_File,
bool  rtk,
unsigned int  force 
)

Constructor.

Constructor: Build a HMM tagger, loading probability tables.

References aux, c, ERROR_CRASH, Forbidden, Language, PBg, PInitial, PTag, PTrg, PWord, TRACE, WARNING, and ZERO_logprob.


Member Function Documentation

std::list< sentence > hmm_tagger::analyze ( const std::list< sentence > &  ls  ) 

analyze sentences and return analyzed copy (for java API)

Disambiguate given sentences, return analyzed copy.

References analyze().

void hmm_tagger::analyze ( std::list< sentence > &  ls  )  [virtual]

analyze given sentences

Disambiguate given sentences with provided options.

Implements POS_tagger.

References aux, FindStates(), POS_tagger::force, FORCE_RETOK, POS_tagger::force_select(), FORCE_TAGGER, Language, ProbA_log(), ProbB_log(), ProbPi_log(), POS_tagger::retok, POS_tagger::retokenize(), TRACE, and ZERO_logprob.

Referenced by analyze().

list< emission_states > hmm_tagger::FindStates ( const sentence &  sent  )  const [private]

compute possible emission states for each word in sentence.

Obtain a list with the states that *may* have emmited current observation (a sentence).

References Language, and TRACE.

Referenced by analyze().

bool hmm_tagger::is_forbidden ( const std::string &  ,
sentence::const_iterator   
) const [private]

Referenced by ProbA_log().

double hmm_tagger::ProbA_log ( const std::string &  state_i,
const std::string &  state_j,
sentence::const_iterator  w 
) const [private]

Compute transition log_probability from state_i to state_j, returning appropriate smoothed values if no evidence is available.

If the trigram is in the "forbidden" list, result is probability zero.

References c, is_forbidden(), PBg, PTag, and PTrg.

Referenced by analyze().

double hmm_tagger::ProbB_log ( const std::string &  state_i,
const word &  obs 
) const [private]

Compute emission log_probability for observation obs from state_i.

Pb=P(state|word)*P(word)/P(state) approximating P(s|w) by: P(s|w)~=P(t3|w)*P(s)/P(t3) thus, Pb ~= P(t3|w)*P(w)/P(t3)

References PWord.

Referenced by analyze().

double hmm_tagger::ProbPi_log ( const std::string &  state_i  )  const [private]

Compute initial log_probability for state_i.

References PInitial, and ZERO_logprob.

Referenced by analyze().


Member Data Documentation

double hmm_tagger::c[3] [private]

coeficients to compute linear interpolation

Referenced by hmm_tagger(), and ProbA_log().

std::multimap<std::string, std::string> hmm_tagger::Forbidden [private]

set of hand-specified forbidden bigram and trigram transitions

Referenced by hmm_tagger().

std::string hmm_tagger::Language [private]

Referenced by analyze(), FindStates(), and hmm_tagger().

std::map<std::string, double> hmm_tagger::PBg [private]

Referenced by hmm_tagger(), and ProbA_log().

std::map<std::string, double> hmm_tagger::PInitial [private]

Referenced by hmm_tagger(), and ProbPi_log().

std::map<std::string, double> hmm_tagger::PTag [private]

maps to store the probabilities

Referenced by hmm_tagger(), and ProbA_log().

std::map<std::string, double> hmm_tagger::PTrg [private]

Referenced by hmm_tagger(), and ProbA_log().

std::map<std::string, double> hmm_tagger::PWord [private]

Referenced by hmm_tagger(), and ProbB_log().

float hmm_tagger::ZERO_logprob [private]

log prob for zero

Referenced by analyze(), hmm_tagger(), and ProbPi_log().


The documentation for this class was generated from the following files:
Generated on Tue Jul 27 16:29:32 2010 for FreeLing by  doxygen 1.6.3