// MeCab -- Yet Another Part-of-Speech and Morphological Analyzer // // // Copyright(C) 2001-2006 Taku Kudo // Copyright(C) 2004-2006 Nippon Telegraph and Telephone Corporation #ifndef MECAB_VITERBI_H_ #define MECAB_VITERBI_H_ #include #include "mecab.h" #include "thread.h" namespace MeCab { class Lattice; class Param; class Connector; template class Tokenizer; class Viterbi { public: bool open(const Param ¶m); bool analyze(Lattice *lattice) const; const Tokenizer *tokenizer() const; const Connector *connector() const; const char *what() { return what_.str(); } static bool buildResultForNBest(Lattice *lattice); Viterbi(); virtual ~Viterbi(); private: template bool viterbi(Lattice *lattice) const; static bool forwardbackward(Lattice *lattice); static bool initPartial(Lattice *lattice); static bool initNBest(Lattice *lattice); static bool buildBestLattice(Lattice *lattice); static bool buildAllLattice(Lattice *lattice); static bool buildAlternative(Lattice *lattice); scoped_ptr > tokenizer_; scoped_ptr connector_; int cost_factor_; whatlog what_; }; } #endif // MECAB_VITERBI_H_