List of all members
moot::mootDynHMM Class Reference

abstract HMM subclass for use with dynamic lexical probabilities.

Inheritance diagram for moot::mootDynHMM:
Inheritance graph
[legend]
Collaboration diagram for moot::mootDynHMM:
Collaboration graph
[legend]

Public Member Functions

Constructors, etc.
 mootDynHMM (void)
 
virtual ~mootDynHMM (void)
 
virtual void set_options (const mootDynHMMOptions &opts)
 
void lex_clear (void)
 
void lex_resize (TokID tokid_max)
 
TokID lex_get_tokid (const mootTokString &tok_text)
 
void tagset_resize (TagID tagid_max)
 
TagID get_tagid (const mootTagString &tagstr)
 
Tagging: Hooks (API)
virtual void tag_hook_pre (mootSentence &sent)
 
virtual void tag_hook_post (mootSentence &sent)
 
User-level Niceties
virtual void tw_put_info (moot::TokenWriter *tw)
 
Top-level Tagging Interface (overrides)
virtual void tag_io (TokenReader *reader, TokenWriter *writer)
 
virtual void tag_sentence (mootSentence &sentence)
 
- Public Member Functions inherited from moot::mootHMM
 mootHMM (void)
 
virtual ~mootHMM (void)
 
void clear (bool wipe_everything=true, bool unlogify=false)
 
bool save (const char *filename, int compression_level=(-1))
 
bool save (mootio::mostream *obs, const char *filename=__null)
 
bool _bindump (mootio::mostream *obs, const mootBinIO::HeaderInfo &hdr, const char *filename=__null)
 
bool load (const char *filename=__null)
 
bool load (mootio::mistream *ibs, const char *filename=__null)
 
bool _binload (mootio::mistream *ibs, const mootBinIO::HeaderInfo &hdr, const char *filename=__null)
 
void unknown_token_name (const mootTokString &name)
 
void unknown_tag_name (const mootTokString &name)
 
void unknown_class_name (const mootTagSet &tagset)
 
virtual bool load_model (const string &modelname, const mootTagString &start_tag_str="__$", const char *myname="mootHMM::load_model()", bool do_estimate_nglambdas=true, bool do_estimate_wlambdas=true, bool do_estimate_clambdas=true, bool do_build_suffix_trie=true, bool do_compute_logprobs=true)
 
virtual bool compile (const mootLexfreqs &lexfreqs, const mootNgrams &ngrams, const mootClassfreqs &classfreqs, const mootTagString &start_tag_str="__$", const mootTaster &mtaster=builtinTaster)
 
void assign_ids_fl (void)
 
void assign_ids_lf (const mootLexfreqs &lexfreqs)
 
void assign_ids_ng (const mootNgrams &ngrams)
 
void assign_ids_cf (const mootClassfreqs &classfreqs)
 
void compile_unknown_lexclass (const mootClassfreqs &classfreqs)
 
bool estimate_lambdas (const mootNgrams &ngrams)
 
bool estimate_wlambdas (const mootLexfreqs &lf)
 
bool estimate_clambdas (const mootClassfreqs &cf)
 
bool build_suffix_trie (const mootLexfreqs &lf, const mootNgrams &ng, bool verbose=false)
 
bool compute_logprobs (void)
 
void set_ngram_prob (ProbT p, TagID t1=0, TagID t2=0, TagID t3=0)
 
void tag_sentence (mootSentence &sentence)
 
virtual void tag_stream (TokenReader *reader, TokenWriter *writer)
 
void viterbi_clear (void)
 
void viterbi_step (const mootToken &token)
 
void viterbi_step (TokID tokid, const LexClass &lexclass, const mootTokString &toktext="")
 
void viterbi_step (TokID tokid, ClassID classid, const LexClass &lclass, const mootTokString &toktext="")
 
void viterbi_step (TokID tokid, const mootTokString &toktext="")
 
void viterbi_step (const mootTokString &token_text)
 
void viterbi_step (const mootTokString &token_text, const set< mootTagString > &tags)
 
void viterbi_step (TokID tokid, TagID tagid, ViterbiColumn *col=__null)
 
void viterbi_step (const mootTokString &toktext, const mootTagString &tag)
 
void viterbi_finish (const TagID final_tagid)
 
void viterbi_finish (void)
 
void viterbi_flush (TokenWriter *writer, mootSentence &toks, ViterbiNode *nod)
 
void tag_mark_best (mootSentence &sentence)
 
void tag_mark_best (ViterbiPathNode *pnod, mootSentence &sentence)
 
void tag_dump_trace (mootSentence &sentence, bool dumpPredict=false)
 
ViterbiPathNodeviterbi_best_path (void)
 
ViterbiPathNodeviterbi_best_path (TagID tagid)
 
ViterbiPathNodeviterbi_best_path (const mootTagString &tagstr)
 
ViterbiNodeviterbi_best_node (void)
 
ViterbiNodeviterbi_best_node (TagID tagid)
 
ViterbiNodeviterbi_flushable_node (void)
 
ViterbiPathNodeviterbi_node_path (ViterbiNode *node)
 
bool viterbi_column_ok (const ViterbiColumn *col) const
 
ViterbiColumnviterbi_populate_row (TagID curtagid, ProbT wordpr=0.0, ViterbiColumn *col=__null, ProbT probmin=1.0)
 
void viterbi_clear_bestpath (void)
 
void _viterbi_step_fallback (TokID tokid, ViterbiColumn *col)
 
ViterbiNodeviterbi_get_node (void)
 
ViterbiRowviterbi_get_row (void)
 
ViterbiColumnviterbi_get_column (void)
 
ViterbiPathNodeviterbi_get_pathnode (void)
 
TokID token2id (const mootTokString &token) const
 
void token2lexclass (const mootToken &token, LexClass &tok_class) const
 
LexClasstagset2lexclass (const mootTagSet &tagset, LexClass *lclass=__null, bool add_tagids=false)
 
ClassID class2id (const LexClass &lclass, bool autopopulate=true, bool autocreate=true)
 
const ProbT wordp (const TokID tokid, const TagID tagid) const
 
const ProbT wordp (const mootTokString &tokstr, const mootTagString &tagstr) const
 
const ProbT classp (const ClassID classid, const TagID tagid) const
 
const ProbT classp (const LexClass &lclass, const mootTagString &tagstr) const
 
const ProbT tagp (const TagID tagid) const
 
const ProbT tagp (const mootTagString &tag) const
 
const ProbT tagp (const TagID prevtagid, const TagID tagid) const
 
const ProbT tagp (const mootTagString &prevtag, const mootTagString &tag) const
 
const ProbT tagp (const Trigram &trigram, ProbT ProbZero=-1E+38) const
 
const ProbT tagp (const TagID prevtagid2, const TagID prevtagid1, const TagID tagid) const
 
const ProbT tagp (const mootTagString &prevtag2, const mootTagString &prevtag1, const mootTagString &tag) const
 
void carp (const char *fmt,...)
 
void txtdump (FILE *file, bool dump_constants=true, bool dump_lexprobs=true, bool dump_classprobs=true, bool dump_suftrie=true, bool dump_ngprobs=true)
 
void viterbi_txtdump (TokenWriter *w, int ncols=0)
 
void viterbi_txtdump_col (TokenWriter *w, ViterbiColumn *col, int colnum=0)
 

Additional Inherited Members

- Public Types inherited from moot::mootHMM
typedef mootEnumID TagID
 
typedef mootEnumID TokID
 
typedef mootEnumID FlavorID
 
typedef mootEnumID ClassID
 
typedef moot::VerbosityLevel VerbosityLevel
 
typedef set< TagIDLexClass
 
typedef mootEnum< mootTagString, __gnu_cxx::hash< mootTagString >, equal_to< mootTagString > > TagIDTable
 
typedef mootEnum< mootTokString, __gnu_cxx::hash< mootTokString >, equal_to< mootTokString > > TokIDTable
 
typedef mootEnum< LexClass, LexClassHash, LexClassEqualClassIDTable
 
typedef AssocVector< TagID, ProbTLexProbSubTable
 
typedef LexProbSubTable LexClassProbSubTable
 
typedef vector< LexProbSubTableLexProbTable
 
typedef LexProbTable LexClassProbTable
 
typedef ProbTUnigramProbTable
 
typedef hash_map< Trigram, ProbT, Trigram::HashFcn, Trigram::EqualFcnTrigramProbHash
 
typedef ProbTTrigramProbArray
 Type for uni-, bi- and trigram probability lookup table. More...
 
typedef Trigram NgramProbKey
 Generic n-gram key: trigrams. More...
 
typedef TrigramProbHash NgramProbHash
 Generic n-gram probabilities: trigrams, hashed. More...
 
typedef TrigramProbArray NgramProbArray
 Generic n-gram probabilities: trigrams, dense. More...
 
- Public Attributes inherited from moot::mootHMM
int verbose
 
size_t ndots
 
bool save_ambiguities
 
bool save_flavors
 
bool save_mark_unknown
 
bool hash_ngrams
 
bool relax
 
bool use_lex_classes
 
bool use_flavors
 
TagID start_tagid
 
ProbT unknown_lex_threshhold
 
ProbT unknown_class_threshhold
 
LexClass uclass
 
ProbT nglambda1
 
ProbT nglambda2
 
ProbT nglambda3
 
ProbT wlambda0
 
ProbT wlambda1
 
ProbT clambda0
 
ProbT clambda1
 
ProbT beamwd
 
TokIDTable tokids
 
TagIDTable tagids
 
ClassIDTable classids
 
mootTaster taster
 
size_t n_tags
 
size_t n_toks
 
size_t n_classes
 
LexProbTable lexprobs
 
LexClassProbTable lcprobs
 
NgramProbHash ngprobsh
 
NgramProbArray ngprobsa
 
SuffixTrie suftrie
 
ViterbiColumnvtable
 
size_t nsents
 
size_t ntokens
 
size_t nnewtokens
 
size_t nunclassed
 
size_t nnewclasses
 
size_t nunknown
 
size_t nfallbacks
 
- Protected Attributes inherited from moot::mootHMM
ViterbiNodetrash_nodes
 
ViterbiRowtrash_rows
 
ViterbiColumntrash_columns
 
ViterbiPathNodetrash_pathnodes
 
TagID vtagid
 
ProbT vbestpr
 
ProbT vtagpr
 
ProbT vwordpr
 
ViterbiNodevbestpn
 
ViterbiPathNodevbestpath
 

Constructor & Destructor Documentation

◆ mootDynHMM()

moot::mootDynHMM::mootDynHMM ( void  )
inline

Default constructor sets hash_ngrams=true

◆ ~mootDynHMM()

virtual moot::mootDynHMM::~mootDynHMM ( void  )
inlinevirtual

Destructor

Member Function Documentation

◆ set_options()

virtual void moot::mootDynHMM::set_options ( const mootDynHMMOptions opts)
inlinevirtual

Set generic user-level options. Default does nothing.

Reimplemented in moot::mootDynLexHMM_Boltzmann, moot::mootDynLexHMM, and moot::mootMIParser.

◆ lex_clear()

void moot::mootDynHMM::lex_clear ( void  )
inline

clears lexprobs & tokids, leaves 'UNKNOWN' entry present but empty

◆ lex_resize()

void moot::mootDynHMM::lex_resize ( TokID  tokid_max)
inline

resize lexicon to fit the id tokid_max

◆ lex_get_tokid()

TokID moot::mootDynHMM::lex_get_tokid ( const mootTokString tok_text)
inline

Get or insert an ID for token text tok_text. Implicitly resizes lexprobs, tokids, and sets n_toks

◆ tagset_resize()

void moot::mootDynHMM::tagset_resize ( TagID  tagid_max)
inline

Grow tagids to fit the id tagid_max. Only works if hash_ngrams==true

◆ get_tagid()

TagID moot::mootDynHMM::get_tagid ( const mootTagString tagstr)
inline

Get or insert a tag-id for tag tagstr. Implicitly resizes tagids and sets n_tags

◆ tag_hook_pre()

virtual void moot::mootDynHMM::tag_hook_pre ( mootSentence sent)
inlinevirtual

Prepare dynamic lexicon for tagging sent. Default implementation does nothing.

Reimplemented in moot::mootDynLexHMM.

◆ tag_hook_post()

virtual void moot::mootDynHMM::tag_hook_post ( mootSentence sent)
inlinevirtual

Cleanup dynamic lexicon after tagging sent. Default implementation does nothing.

Reimplemented in moot::mootDynLexHMM.

◆ tw_put_info()

virtual void moot::mootDynHMM::tw_put_info ( moot::TokenWriter tw)
inlinevirtual

Write some debugging header information to an output stream Default implementation does nothing.

Reimplemented in moot::mootDynLexHMM_Boltzmann, moot::mootDynLexHMM, and moot::mootMIParser.

References moot::TokenWriter::printf_raw().

◆ tag_io()

virtual void moot::mootDynHMM::tag_io ( TokenReader reader,
TokenWriter writer 
)
virtual

Top-level tagging interface: TokenIO layer. Really just a dup of mootHMM::tag_io which calls virtual tag_sentence()

Reimplemented from moot::mootHMM.

◆ tag_sentence()

virtual void moot::mootDynHMM::tag_sentence ( mootSentence sentence)
virtual

Top-level tagging interface: mootSentence Just wraps mootHMM::tag_sentence() in calls to tag_hook_pre() and tag_hook_post().

Reimplemented in moot::mootMIParser.


The documentation for this class was generated from the following file: