#include <arpa-lm-compiler.h>
Public Member Functions | |
ArpaLmCompiler (const ArpaParseOptions &options, int sub_eps, fst::SymbolTable *symbols) | |
~ArpaLmCompiler () | |
const fst::StdVectorFst & | Fst () const |
fst::StdVectorFst * | MutableFst () |
Public Member Functions inherited from ArpaFileParser | |
ArpaFileParser (const ArpaParseOptions &options, fst::SymbolTable *symbols) | |
Constructs the parser with the given options and optional symbol table. More... | |
virtual | ~ArpaFileParser () |
void | Read (std::istream &is) |
Read ARPA LM file from a stream. More... | |
const ArpaParseOptions & | Options () const |
Parser options. More... | |
Protected Member Functions | |
virtual void | HeaderAvailable () |
Override function called to signal that ARPA header with the expected number of n-grams has been read, and ngram_counts() is now valid. More... | |
virtual void | ConsumeNGram (const NGram &ngram) |
Pure override that must be implemented to process current n-gram. More... | |
virtual void | ReadComplete () |
Override function called after the last n-gram has been consumed. More... | |
Protected Member Functions inherited from ArpaFileParser | |
virtual void | ReadStarted () |
Override called before reading starts. More... | |
const fst::SymbolTable * | Symbols () const |
Read-only access to symbol table. Not owned, do not make public. More... | |
int32 | LineNumber () const |
Inside ConsumeNGram(), provides the current line number. More... | |
std::string | LineReference () const |
Inside ConsumeNGram(), returns a formatted reference to the line being compiled, to print out as part of diagnostics. More... | |
bool | ShouldWarn () |
Increments warning count, and returns true if a warning should be printed or false if the count has exceeded the set maximum. More... | |
const std::vector< int32 > & | NgramCounts () const |
N-gram counts. Valid from the point when HeaderAvailable() is called. More... | |
Private Member Functions | |
void | RemoveRedundantStates () |
void | Check () const |
Private Attributes | |
int | sub_eps_ |
ArpaLmCompilerImplInterface * | impl_ |
fst::StdVectorFst | fst_ |
Friends | |
template<class HistKey > | |
class | ArpaLmCompilerImpl |
Definition at line 32 of file arpa-lm-compiler.h.
|
inline |
Definition at line 34 of file arpa-lm-compiler.h.
References ArpaLmCompiler::~ArpaLmCompiler().
~ArpaLmCompiler | ( | ) |
|
private |
Definition at line 363 of file arpa-lm-compiler.cc.
References ArpaLmCompilerImpl< HistKey >::fst_, and KALDI_ERR.
Referenced by ArpaLmCompiler::MutableFst().
|
protectedvirtual |
Pure override that must be implemented to process current n-gram.
The n-grams are sent in the file order, which guarantees that all (k-1)-grams are processed before the first k-gram is.
Implements ArpaFileParser.
Definition at line 306 of file arpa-lm-compiler.cc.
References rnnlm::i, KALDI_WARN, and NGram::words.
Referenced by ArpaLmCompiler::MutableFst().
|
inline |
Definition at line 41 of file arpa-lm-compiler.h.
References ArpaLmCompiler::fst_.
Referenced by kaldi::CoverageTest(), and kaldi::ScoringTest().
|
protectedvirtual |
Override function called to signal that ARPA header with the expected number of n-grams has been read, and ngram_counts() is now valid.
Reimplemented from ArpaFileParser.
Definition at line 284 of file arpa-lm-compiler.cc.
References ArpaLmCompilerImpl< HistKey >::fst_, ArpaParseOptions::kAddToSymbols, KALDI_ASSERT, KALDI_LOG, and ArpaLmCompilerImpl< HistKey >::sub_eps_.
Referenced by ArpaLmCompiler::MutableFst().
|
inline |
Definition at line 42 of file arpa-lm-compiler.h.
References ArpaLmCompiler::Check(), ArpaLmCompiler::ConsumeNGram(), ArpaLmCompiler::fst_, ArpaLmCompiler::HeaderAvailable(), ArpaLmCompiler::ReadComplete(), and ArpaLmCompiler::RemoveRedundantStates().
Referenced by kaldi::CoverageTest().
|
protectedvirtual |
Override function called after the last n-gram has been consumed.
Reimplemented from ArpaFileParser.
Definition at line 370 of file arpa-lm-compiler.cc.
References ArpaLmCompilerImpl< HistKey >::fst_.
Referenced by ArpaLmCompiler::MutableFst().
|
private |
Definition at line 323 of file arpa-lm-compiler.cc.
References ArpaLmCompilerImpl< HistKey >::fst_, KALDI_LOG, fst::RemoveEpsLocal(), and ArpaLmCompilerImpl< HistKey >::sub_eps_.
Referenced by ArpaLmCompiler::MutableFst().
|
friend |
Definition at line 60 of file arpa-lm-compiler.h.
|
private |
Definition at line 59 of file arpa-lm-compiler.h.
Referenced by ArpaLmCompiler::Fst(), and ArpaLmCompiler::MutableFst().
|
private |
Definition at line 58 of file arpa-lm-compiler.h.
|
private |
Definition at line 57 of file arpa-lm-compiler.h.