#include <n_gram.h>
Public Member Functions | |
ngram (dictionary *d, int sz=0) | |
ngram (ngram &ng) | |
int * | wordp () |
int * | wordp (int k) |
const int * | wordp () const |
const int * | wordp (int k) const |
int | containsWord (const char *s, int lev) |
void | trans (const ngram &ng) |
void | invert (const ngram &ng) |
void | shift () |
void | shift (int sz) |
bool | operator== (const ngram &compare) const |
bool | operator!= (const ngram &compare) const |
int | ckhisto (int sz) |
int | pushc (int c) |
int | pushc (int *codes, int sz) |
int | pushw (const char *w) |
Public Attributes | |
dictionary * | dict |
char * | link |
char * | succlink |
int | midx [MAX_NGRAM] |
char * | path [MAX_NGRAM] |
float | bowv [MAX_NGRAM] |
int | lev |
int | size |
long long | freq |
int | succ |
float | bow |
float | prob |
unsigned char | info |
unsigned char | pinfo |
int | isym |
Friends | |
std::ifstream & | operator>> (std::ifstream &fi, ngram &ng) |
std::ofstream & | operator<< (std::ofstream &fi, ngram &ng) |
std::istream & | operator>> (std::istream &fi, ngram &ng) |
std::ostream & | operator<< (std::ostream &fi, ngram &ng) |
Definition at line 44 of file n_gram.h.
ngram::ngram | ( | dictionary * | d, | |
int | sz = 0 | |||
) |
ngram::ngram | ( | ngram & | ng | ) |
int ngram::ckhisto | ( | int | sz | ) | [inline] |
Definition at line 128 of file n_gram.h.
References dict, dictionary::oovcode(), and wordp().
Referenced by mshiftbeta::discount(), shiftbeta::discount(), shiftone::discount(), and linearwb::discount().
int ngram::containsWord | ( | const char * | s, | |
int | lev | |||
) | [inline] |
Definition at line 83 of file n_gram.h.
References dict, dictionary::encode(), size, and wordp().
Referenced by interplm::gencorrcounts(), main(), mdiadaptlm::saveARPA_per_level(), mdiadaptlm::saveARPA_per_word(), mdiadaptlm::saveASR(), mdiadaptlm::saveBIN_per_level(), mdiadaptlm::saveBIN_per_word(), mshiftbeta::train(), and shiftbeta::train().
void ngram::invert | ( | const ngram & | ng | ) |
Definition at line 85 of file n_gram.cpp.
Referenced by lmtable::lprob(), and lmtable::maxsuffptr().
bool ngram::operator!= | ( | const ngram & | compare | ) | const [inline] |
bool ngram::operator== | ( | const ngram & | compare | ) | const [inline] |
int ngram::pushc | ( | int * | codes, | |
int | sz | |||
) |
int ngram::pushc | ( | int | c | ) |
Definition at line 157 of file n_gram.cpp.
References MAX_NGRAM, size, and src.
Referenced by lmtable::clprob(), lmmacro::clprob(), lmInterpolation::clprob(), lmclass::clprob(), mdiadaptlm::compute_backoff_per_level(), interplm::gensuccstat(), main(), lmclass::mapping(), lmtable::ngcnt(), pushw(), mdiadaptlm::saveARPA_per_level(), mdiadaptlm::saveARPA_per_word(), mdiadaptlm::saveBIN_per_level(), mdiadaptlm::saveBIN_per_word(), mdiadaptlm::saveMT(), shiftbeta::train(), and lmtable::wdprune().
int ngram::pushw | ( | const char * | w | ) |
Definition at line 139 of file n_gram.cpp.
References dict, dictionary::encode(), NULL, and pushc().
Referenced by interplm::gencorrcounts(), ngramtable::generate(), init(), lmmacro::map(), lmmacro::Micro2MacroMapping(), lmmacro::One2OneMapping(), operator>>(), and parseline().
void ngram::shift | ( | int | sz | ) |
void ngram::shift | ( | ) |
Definition at line 93 of file n_gram.cpp.
References MAX_NGRAM, and size.
Referenced by mdiadaptlm::discount(), lmtable::lprobx(), mdiadaptlm::saveARPA_per_word(), and mdiadaptlm::saveBIN_per_word().
void ngram::trans | ( | const ngram & | ng | ) |
Definition at line 66 of file n_gram.cpp.
References dictionary::decode(), dict, dictionary::encode(), freq, info, isym, MAX_NGRAM, midx, size, and wordp().
Referenced by ngramtable::augment(), mdiadaptlm::bodiscount(), lmInterpolation::clprob(), lmmacro::cmaxsuffptr(), computePP(), symshiftbeta::discount(), mshiftbeta::discount(), shiftbeta::discount(), shiftone::discount(), mixture::discount(), mdiadaptlm::discount(), linearwb::discount(), ngramtable::generate(), ngramtable::generate_dstco(), ngramtable::generate_hmask(), mixture::get(), lmmacro::lprob(), main(), lmmacro::map(), lmmacro::maxsuffptr(), ngramtable::prob(), mdiadaptlm::saveARPA_per_level(), mdiadaptlm::saveARPA_per_word(), mdiadaptlm::saveASR(), mdiadaptlm::saveBIN_per_level(), mdiadaptlm::saveBIN_per_word(), plsa::saveFeat(), mdiadaptlm::saveMT(), mdiadaptlm::scalefact(), lmtable::succscan(), and interplm::test_ngt().
const int* ngram::wordp | ( | int | k | ) | const [inline] |
const int* ngram::wordp | ( | ) | const [inline] |
int* ngram::wordp | ( | int | k | ) | [inline] |
int* ngram::wordp | ( | ) | [inline] |
Definition at line 69 of file n_gram.h.
References size.
Referenced by mdiadaptlm::adapt(), lmtable::add(), lmtable::addwithoffset(), ckhisto(), lmtable::clprob(), lmtable::cmaxsuffptr(), computePP(), containsWord(), symshiftbeta::discount(), mshiftbeta::discount(), shiftbeta::discount(), shiftone::discount(), mixture::discount(), mdiadaptlm::discount(), linearwb::discount(), interplm::gencorrcounts(), ngramtable::generate(), ngramtable::generate_dstco(), ngramtable::generate_hmask(), normcache::get(), ngramtable::get(), mixture::get(), lmtable::get(), invert(), lmtable::lprob(), lmclass::lprob(), main(), lmmacro::map(), lmclass::mapping(), lmmacro::Micro2MacroMapping(), lmtable::ngcnt(), lmmacro::One2OneMapping(), ngramtable::prob(), mdiadaptlm::prob(), prob(), normcache::put(), ngramtable::put(), doc::read(), mdiadaptlm::saveARPA_per_level(), mdiadaptlm::saveARPA_per_word(), mdiadaptlm::saveASR(), mdiadaptlm::saveBIN_per_level(), mdiadaptlm::saveBIN_per_word(), plsa::saveFeat(), mdiadaptlm::saveMT(), mdiadaptlm::savescalefactor(), mdiadaptlm::scalefact(), ngramtable::scan(), lmtable::succscan(), interplm::test_ngt(), interplm::test_txt(), mixture::train(), trans(), mdiadaptlm::txclprob(), interplm::unigr(), lmtable::wdprune(), wordp(), and interplm::zerofreq().
std::ostream& operator<< | ( | std::ostream & | fi, | |
ngram & | ng | |||
) | [friend] |
std::ofstream& operator<< | ( | std::ofstream & | fi, | |
ngram & | ng | |||
) | [friend] |
std::istream& operator>> | ( | std::istream & | fi, | |
ngram & | ng | |||
) | [friend] |
std::ifstream& operator>> | ( | std::ifstream & | fi, | |
ngram & | ng | |||
) | [friend] |
float ngram::bow |
Definition at line 59 of file n_gram.h.
Referenced by lmtable::get(), lmtable::lprob(), and lmtable::lprobx().
float ngram::bowv[MAX_NGRAM] |
Definition at line 48 of file n_gram.h.
Referenced by ckhisto(), lmmacro::cmaxsuffptr(), containsWord(), init(), lmmacro::lprob(), main(), lmmacro::maxsuffptr(), ngram(), operator!=(), operator<<(), operator==(), operator>>(), parseline(), pushw(), and trans().
long long ngram::freq |
Definition at line 57 of file n_gram.h.
Referenced by symshiftbeta::discount(), mshiftbeta::discount(), shiftbeta::discount(), shiftone::discount(), linearwb::discount(), interplm::gencorrcounts(), ngramtable::generate(), ngramtable::generate_dstco(), interplm::gensuccstat(), normcache::get(), ngramtable::get(), lmtable::get(), init(), ngramtable::loadtxt(), main(), mshiftbeta::mfreq(), ngram(), operator<<(), operator>>(), ngramtable::prob(), prob(), normcache::put(), ngramtable::put(), plsa::saveFeat(), mdiadaptlm::saveMT(), ngramtable::scan(), interplm::test_ngt(), mshiftbeta::train(), shiftbeta::train(), mixture::train(), trans(), mdiadaptlm::txclprob(), ngramtable::update(), and interplm::zerofreq().
unsigned char ngram::info |
Definition at line 62 of file n_gram.h.
Referenced by ngramtable::get(), mixture::get(), lmtable::get(), ngram(), mdiadaptlm::saveARPA_per_word(), mdiadaptlm::saveBIN_per_word(), ngramtable::scan(), ngramtable::succscan(), and trans().
int ngram::lev |
Definition at line 55 of file n_gram.h.
Referenced by ngramtable::get(), lmtable::get(), lmtable::lprob(), lmtable::maxsuffptr(), and lmtable::succscan().
char* ngram::link |
Definition at line 49 of file n_gram.h.
Referenced by mdiadaptlm::bodiscount(), mdiadaptlm::compute_backoff_per_level(), mshiftbeta::discount(), shiftbeta::discount(), linearwb::discount(), interplm::gencorrcounts(), interplm::gensuccstat(), ngramtable::get(), mixture::get(), lmtable::get(), lmtable::lprob(), lmtable::maxsuffptr(), mshiftbeta::mfreq(), ngram(), mdiadaptlm::saveARPA_per_word(), mdiadaptlm::saveBIN_per_word(), ngramtable::scan(), ngramtable::succscan(), lmtable::succscan(), shiftbeta::train(), and ngramtable::update().
int ngram::midx[MAX_NGRAM] |
Definition at line 51 of file n_gram.h.
Referenced by ngram(), ngramtable::scan(), lmtable::succscan(), and trans().
char* ngram::path[MAX_NGRAM] |
Definition at line 52 of file n_gram.h.
Referenced by lmtable::get(), lmtable::lprob(), lmtable::maxsuffptr(), and ngram().
unsigned char ngram::pinfo |
Definition at line 63 of file n_gram.h.
Referenced by interplm::gencorrcounts(), interplm::gensuccstat(), ngramtable::get(), mshiftbeta::mfreq(), ngram(), ngramtable::scan(), and ngramtable::update().
float ngram::prob |
Definition at line 60 of file n_gram.h.
Referenced by lmtable::get(), lmtable::lprob(), and lmtable::lprobx().
int ngram::size |
Definition at line 56 of file n_gram.h.
Referenced by lmtable::add(), lmtable::addwithoffset(), lmtable::clprob(), lmInterpolation::clprob(), lmtable::cmaxsuffptr(), mdiadaptlm::compute_backoff_per_level(), computePP(), containsWord(), mdiadaptlm::discount(), interplm::gencorrcounts(), ngramtable::generate(), ngramtable::generate_dstco(), ngramtable::generate_hmask(), ngramtable::get(), mixture::get(), lmtable::get(), invert(), lmtable::lprob(), lmtable::lprobx(), main(), lmmacro::map(), lmclass::mapping(), lmtable::maxsuffptr(), lmmacro::Micro2MacroMapping(), ngram(), lmmacro::One2OneMapping(), operator!=(), operator<<(), operator==(), operator>>(), parseline(), ngramtable::prob(), mdiadaptlm::prob(), prob(), pushc(), ngramtable::put(), doc::read(), mdiadaptlm::saveASR(), mdiadaptlm::saveMT(), lmtable::savetxt(), ngramtable::scan(), shift(), lmtable::succscan(), interplm::test_ngt(), interplm::test_txt(), trans(), ngramtable::update(), lmtable::wdprune(), wordp(), and mdiadaptlm::zeta().
int ngram::succ |
Definition at line 58 of file n_gram.h.
Referenced by mshiftbeta::discount(), shiftbeta::discount(), shiftone::discount(), linearwb::discount(), ngramtable::get(), lmtable::get(), lmtable::maxsuffptr(), ngram(), prob(), ngramtable::scan(), and lmtable::succscan().
char* ngram::succlink |