Edinburgh Speech Tools 2.4-release
EST_Ngrammar Class Reference
Collaboration diagram for EST_Ngrammar:

Public Types

enum  representation_t { sparse , dense , backoff }
 
enum  entry_t { frequencies , log_frequencies }
 

Public Member Functions

 EST_Ngrammar (int o, representation_t r, const EST_StrList &wordlist)
 
 EST_Ngrammar (int o, representation_t r, const EST_StrList &wordlist, const EST_StrList &predlist)
 
 EST_Ngrammar (int o, representation_t r, EST_Discrete &v)
 
void default_values ()
 
void clear ()
 
bool init (int o, representation_t r, const EST_StrList &wordlist)
 
bool init (int o, representation_t r, const EST_StrList &wordlist, const EST_StrList &predlist)
 
bool init (int o, representation_t r, EST_Discrete &v)
 
bool init (int o, representation_t r, EST_Discrete &v, EST_Discrete &pv)
 
int num_states (void) const
 
double samples (void) const
 
int order () const
 
int get_vocab_length () const
 
EST_String get_vocab_word (int i) const
 
int get_vocab_word (const EST_String &s) const
 
int get_pred_vocab_length () const
 
EST_String get_pred_vocab_word (int i) const
 
int get_pred_vocab_word (const EST_String &s) const
 
int closed_vocab () const
 
entry_t entry_type () const
 
representation_t representation () const
 
bool build (const EST_StrList &filenames, const EST_String &prev=SENTENCE_START_MARKER, const EST_String &prev_prev=SENTENCE_END_MARKER, const EST_String &last=SENTENCE_END_MARKER, const EST_String &input_format="", const EST_String &oov_mode="", const int mincount=1, const int maxcount=10)
 
void accumulate (const EST_StrVector &words, const double count=1)
 
void accumulate (const EST_IVector &words, const double count=1)
 
void make_htk_compatible ()
 
EST_read_status load (const EST_String &filename)
 
EST_read_status load (const EST_String &filename, const EST_StrList &wordlist)
 
EST_write_status save (const EST_String &filename, const EST_String type="cstr_ascii", const bool trace=false, double floor=0.0)
 
int wordlist_index (const EST_String &word, const bool report=true) const
 
const EST_Stringwordlist_index (int i) const
 
int predlist_index (const EST_String &word) const
 
const EST_Stringpredlist_index (int i) const
 
bool set_entry_type (entry_t new_type)
 
bool set_representation (representation_t new_representation)
 
double probability (const EST_StrVector &words, bool force=false, const bool trace=false) const
 
double frequency (const EST_StrVector &words, bool force=false, const bool trace=false) const
 
const EST_Stringpredict (const EST_StrVector &words, double *prob, int *state) const
 
const EST_Stringpredict (const EST_StrVector &words) const
 
const EST_Stringpredict (const EST_StrVector &words, double *prob) const
 
const EST_Stringpredict (const EST_IVector &words, double *prob, int *state) const
 
const EST_Stringpredict (const EST_IVector &words) const
 
const EST_Stringpredict (const EST_IVector &words, double *prob) const
 
int find_state_id (const EST_StrVector &words) const
 
int find_state_id (const EST_IVector &words) const
 
int find_next_state_id (int state, int word) const
 
double reverse_probability (const EST_StrVector &words, bool force=false) const
 
double reverse_probability (const EST_IVector &words, bool force=false) const
 
const EST_DiscreteProbDistributionprob_dist (const EST_StrVector &words) const
 
const EST_DiscreteProbDistributionprob_dist (const EST_IVector &words) const
 
const EST_DiscreteProbDistributionprob_dist (int state) const
 
void fill_window_start (EST_IVector &window, const EST_String &prev, const EST_String &prev_prev) const
 
void fill_window_start (EST_StrVector &window, const EST_String &prev, const EST_String &prev_prev) const
 
bool ngram_exists (const EST_StrVector &words) const
 
bool ngram_exists (const EST_StrVector &words, const double threshold) const
 
const double get_backoff_weight (const EST_StrVector &words) const
 
bool set_backoff_weight (const EST_StrVector &words, const double w)
 
void print_freqs (ostream &os, double floor=0.0)
 
bool compute_backoff_weights (const int mincount=1, const int maxcount=10)
 
bool merge (EST_Ngrammar &n, float weight)
 

Protected Member Functions

bool init_sparse_representation ()
 
bool init_dense_representation ()
 
const double get_backoff_discount (const int order, const double freq) const
 
bool init_backoff_representation ()
 
void prune_backoff_representation (EST_BackoffNgrammarState *start_state=NULL)
 
void backoff_restore_unigram_states ()
 
int find_dense_state_index (const EST_IVector &words, int index=0) const
 
const EST_StrVectormake_ngram_from_index (const int i) const
 
bool init_vocab (const EST_StrList &wordlist)
 
bool init_vocab (const EST_StrList &word_list, const EST_StrList &pred_list)
 
bool check_vocab (const EST_StrList &wordlist)
 
const EST_Stringlastword (const EST_StrVector &words) const
 
const int lastword (const EST_IVector &words) const
 
bool sparse_to_dense ()
 
bool dense_to_sparse ()
 
void take_logs ()
 
void take_exps ()
 
void freqs_to_probs ()
 
bool build_sparse (const EST_String &filename, const EST_String &prev, const EST_String &prev_prev, const EST_String &last)
 
bool build_ngram (const EST_String &filename, const EST_String &prev, const EST_String &prev_prev, const EST_String &last, const EST_String &input_format)
 
void iterate (EST_StrVector &words, void(*function)(EST_Ngrammar *n, EST_StrVector &words, void *params), void *params)
 
void const_iterate (EST_StrVector &words, void(*function)(const EST_Ngrammar *const n, EST_StrVector &words, void *params), void *params) const
 
bool p_init (int o, representation_t r)
 
bool oov_preprocess (const EST_String &filename, EST_String &new_filename, const EST_String &what)
 
const EST_NgrammarStatefind_state_const (const EST_StrVector &words) const
 
EST_NgrammarStatefind_state (const EST_StrVector &words)
 
const EST_NgrammarStatefind_state_const (const EST_IVector &words) const
 
EST_NgrammarStatefind_state (const EST_IVector &words)
 
const EST_DiscreteProbDistributionbackoff_prob_dist (const EST_StrVector &words) const
 
const double backoff_reverse_probability_sub (const EST_StrVector &words, const EST_BackoffNgrammarState *root) const
 
const double backoff_probability (const EST_StrVector &words, const bool trace=false) const
 
const double backoff_reverse_probability (const EST_StrVector &words) const
 
const EST_Stringbackoff_most_probable (const EST_StrVector &words, double *prob=NULL) const
 
void backoff_traverse (EST_BackoffNgrammarState *start_state, void(*function)(EST_BackoffNgrammarState *s, void *params), void *params)
 
void backoff_traverse (EST_BackoffNgrammarState *start_state, void(*function)(EST_BackoffNgrammarState *s, void *params), void *params, const int level)
 

Protected Attributes

int p_order
 
int p_num_samples
 
double p_number_of_sentences
 
EST_String p_sentence_start_marker
 
EST_String p_sentence_end_marker
 
representation_t p_representation
 
entry_t p_entry_type
 
EST_PredictionSuffixTree sparse_representation
 
EST_BackoffNgrammarStatebackoff_representation
 
double backoff_threshold
 
double backoff_unigram_floor_freq
 
EST_DVectorbackoff_discount
 
int p_num_states
 
EST_NgrammarStatep_states
 
EST_Discretevocab
 
EST_Discretepred_vocab
 
EST_DiscreteProbDistribution vocab_pdf
 
bool allow_oov
 

Friends

class EST_BackoffNgrammar
 
ostream & operator<< (ostream &s, EST_Ngrammar &n)
 
EST_read_status load_ngram_htk_ascii (const EST_String filename, EST_Ngrammar &n)
 
EST_read_status load_ngram_htk_binary (const EST_String filename, EST_Ngrammar &n)
 
EST_read_status load_ngram_arpa (const EST_String filename, EST_Ngrammar &n, const EST_StrList &vocab)
 
EST_read_status load_ngram_cstr_ascii (const EST_String filename, EST_Ngrammar &n)
 
EST_read_status load_ngram_cstr_bin (const EST_String filename, EST_Ngrammar &n)
 
EST_write_status save_ngram_htk_ascii_sub (const EST_String &word, ostream *ost, EST_Ngrammar &n, double floor)
 
EST_write_status save_ngram_htk_ascii (const EST_String filename, EST_Ngrammar &n, double floor)
 
EST_write_status save_ngram_cstr_ascii (const EST_String filename, EST_Ngrammar &n, const bool trace, double floor)
 
EST_write_status save_ngram_cstr_bin (const EST_String filename, EST_Ngrammar &n, const bool trace, double floor)
 
EST_write_status save_ngram_arpa (const EST_String filename, EST_Ngrammar &n)
 
EST_write_status save_ngram_arpa_sub (ostream *ost, EST_Ngrammar &n, const EST_StrVector &words)
 
EST_write_status save_ngram_wfst (const EST_String filename, EST_Ngrammar &n)
 
void frequency_of_frequencies (EST_DVector &ff, EST_Ngrammar &n, int this_order)
 
void map_frequencies (EST_Ngrammar &n, const EST_DVector &map, const int this_order)
 
bool Good_Turing_smooth (EST_Ngrammar &n, int maxcount, int mincount)
 
void Good_Turing_discount (EST_Ngrammar &ngrammar, const int maxcount, const double default_discount)
 
void fs_build_backoff_ngrams (EST_Ngrammar *backoff_ngrams, EST_Ngrammar &ngram)
 
int fs_backoff_smooth (EST_Ngrammar *backoff_ngrams, EST_Ngrammar &ngram, int smooth_thresh)
 

Detailed Description

Definition at line 209 of file EST_Ngrammar.h.

Member Enumeration Documentation

◆ representation_t

enum EST_Ngrammar::representation_t

Definition at line 214 of file EST_Ngrammar.h.

◆ entry_t

enum EST_Ngrammar::entry_t

Definition at line 219 of file EST_Ngrammar.h.

Constructor & Destructor Documentation

◆ EST_Ngrammar() [1/4]

EST_Ngrammar::EST_Ngrammar ( )
inline

Definition at line 366 of file EST_Ngrammar.h.

◆ EST_Ngrammar() [2/4]

EST_Ngrammar::EST_Ngrammar ( int  o,
representation_t  r,
const EST_StrList wordlist 
)
inline

Definition at line 368 of file EST_Ngrammar.h.

◆ EST_Ngrammar() [3/4]

EST_Ngrammar::EST_Ngrammar ( int  o,
representation_t  r,
const EST_StrList wordlist,
const EST_StrList predlist 
)
inline

Definition at line 375 of file EST_Ngrammar.h.

◆ EST_Ngrammar() [4/4]

EST_Ngrammar::EST_Ngrammar ( int  o,
representation_t  r,
EST_Discrete v 
)
inline

Definition at line 382 of file EST_Ngrammar.h.

◆ ~EST_Ngrammar()

EST_Ngrammar::~EST_Ngrammar ( )

Definition at line 498 of file EST_Ngrammar.cc.

Member Function Documentation

◆ init_sparse_representation()

bool EST_Ngrammar::init_sparse_representation ( )
protected

Definition at line 595 of file EST_Ngrammar.cc.

◆ init_dense_representation()

bool EST_Ngrammar::init_dense_representation ( )
protected

Definition at line 575 of file EST_Ngrammar.cc.

◆ get_backoff_discount()

const double EST_Ngrammar::get_backoff_discount ( const int  order,
const double  freq 
) const
protected

Definition at line 2394 of file EST_Ngrammar.cc.

◆ init_backoff_representation()

bool EST_Ngrammar::init_backoff_representation ( )
protected

Definition at line 611 of file EST_Ngrammar.cc.

◆ prune_backoff_representation()

void EST_Ngrammar::prune_backoff_representation ( EST_BackoffNgrammarState start_state = NULL)
protected

Definition at line 1578 of file EST_Ngrammar.cc.

◆ backoff_restore_unigram_states()

void EST_Ngrammar::backoff_restore_unigram_states ( )
protected

Definition at line 1558 of file EST_Ngrammar.cc.

◆ find_dense_state_index()

int EST_Ngrammar::find_dense_state_index ( const EST_IVector words,
int  index = 0 
) const
protected

Definition at line 1682 of file EST_Ngrammar.cc.

◆ make_ngram_from_index()

const EST_StrVector & EST_Ngrammar::make_ngram_from_index ( const int  i) const
protected

Definition at line 621 of file EST_Ngrammar.cc.

◆ init_vocab() [1/2]

bool EST_Ngrammar::init_vocab ( const EST_StrList wordlist)
protected

Definition at line 651 of file EST_Ngrammar.cc.

◆ init_vocab() [2/2]

bool EST_Ngrammar::init_vocab ( const EST_StrList word_list,
const EST_StrList pred_list 
)
protected

Definition at line 663 of file EST_Ngrammar.cc.

◆ check_vocab()

bool EST_Ngrammar::check_vocab ( const EST_StrList wordlist)
protected

Definition at line 677 of file EST_Ngrammar.cc.

◆ lastword() [1/2]

const EST_String & EST_Ngrammar::lastword ( const EST_StrVector words) const
inlineprotected

Definition at line 287 of file EST_Ngrammar.h.

◆ lastword() [2/2]

const int EST_Ngrammar::lastword ( const EST_IVector words) const
inlineprotected

Definition at line 289 of file EST_Ngrammar.h.

◆ sparse_to_dense()

bool EST_Ngrammar::sparse_to_dense ( )
protected

Definition at line 1668 of file EST_Ngrammar.cc.

◆ dense_to_sparse()

bool EST_Ngrammar::dense_to_sparse ( )
protected

Definition at line 1675 of file EST_Ngrammar.cc.

◆ build_sparse()

bool EST_Ngrammar::build_sparse ( const EST_String filename,
const EST_String prev,
const EST_String prev_prev,
const EST_String last 
)
protected

Definition at line 1020 of file EST_Ngrammar.cc.

◆ build_ngram()

bool EST_Ngrammar::build_ngram ( const EST_String filename,
const EST_String prev,
const EST_String prev_prev,
const EST_String last,
const EST_String input_format 
)
protected

Definition at line 1164 of file EST_Ngrammar.cc.

◆ iterate()

void EST_Ngrammar::iterate ( EST_StrVector words,
void(*)(EST_Ngrammar *n, EST_StrVector &words, void *params)  function,
void *  params 
)
protected

Definition at line 2236 of file EST_Ngrammar.cc.

◆ const_iterate()

void EST_Ngrammar::const_iterate ( EST_StrVector words,
void(*)(const EST_Ngrammar *const n, EST_StrVector &words, void *params)  function,
void *  params 
) const
protected

Definition at line 2282 of file EST_Ngrammar.cc.

◆ p_init()

bool EST_Ngrammar::p_init ( int  o,
EST_Ngrammar::representation_t  r 
)
protected

Definition at line 539 of file EST_Ngrammar.cc.

◆ oov_preprocess()

bool EST_Ngrammar::oov_preprocess ( const EST_String filename,
EST_String new_filename,
const EST_String what 
)
protected

Definition at line 1052 of file EST_Ngrammar.cc.

◆ find_state_const() [1/2]

const EST_NgrammarState & EST_Ngrammar::find_state_const ( const EST_StrVector words) const
protected

Definition at line 1749 of file EST_Ngrammar.cc.

◆ find_state() [1/2]

EST_NgrammarState & EST_Ngrammar::find_state ( const EST_StrVector words)
protected

Definition at line 1711 of file EST_Ngrammar.cc.

◆ find_state_const() [2/2]

const EST_NgrammarState & EST_Ngrammar::find_state_const ( const EST_IVector words) const
protected

Definition at line 1811 of file EST_Ngrammar.cc.

◆ find_state() [2/2]

EST_NgrammarState & EST_Ngrammar::find_state ( const EST_IVector words)
protected

Definition at line 1785 of file EST_Ngrammar.cc.

◆ backoff_prob_dist()

const EST_DiscreteProbDistribution & EST_Ngrammar::backoff_prob_dist ( const EST_StrVector words) const
protected

Definition at line 2369 of file EST_Ngrammar.cc.

◆ backoff_reverse_probability_sub()

const double EST_Ngrammar::backoff_reverse_probability_sub ( const EST_StrVector words,
const EST_BackoffNgrammarState root 
) const
protected

Definition at line 2531 of file EST_Ngrammar.cc.

◆ backoff_probability()

const double EST_Ngrammar::backoff_probability ( const EST_StrVector words,
const bool  trace = false 
) const
protected

Definition at line 2409 of file EST_Ngrammar.cc.

◆ backoff_reverse_probability()

const double EST_Ngrammar::backoff_reverse_probability ( const EST_StrVector words) const
protected

Definition at line 2604 of file EST_Ngrammar.cc.

◆ backoff_most_probable()

const EST_String & EST_Ngrammar::backoff_most_probable ( const EST_StrVector words,
double *  prob = NULL 
) const
protected

Definition at line 2628 of file EST_Ngrammar.cc.

◆ backoff_traverse() [1/2]

void EST_Ngrammar::backoff_traverse ( EST_BackoffNgrammarState start_state,
void(*)(EST_BackoffNgrammarState *s, void *params)  function,
void *  params 
)
protected

Definition at line 2667 of file EST_Ngrammar.cc.

◆ backoff_traverse() [2/2]

void EST_Ngrammar::backoff_traverse ( EST_BackoffNgrammarState start_state,
void(*)(EST_BackoffNgrammarState *s, void *params)  function,
void *  params,
const int  level 
)
protected

Definition at line 2693 of file EST_Ngrammar.cc.

◆ default_values()

void EST_Ngrammar::default_values ( )

Definition at line 483 of file EST_Ngrammar.cc.

◆ clear()

void EST_Ngrammar::clear ( )

Definition at line 503 of file EST_Ngrammar.cc.

◆ init() [1/4]

bool EST_Ngrammar::init ( int  o,
EST_Ngrammar::representation_t  r,
const EST_StrList wordlist 
)

Definition at line 508 of file EST_Ngrammar.cc.

◆ init() [2/4]

bool EST_Ngrammar::init ( int  o,
EST_Ngrammar::representation_t  r,
const EST_StrList wordlist,
const EST_StrList predlist 
)

Definition at line 514 of file EST_Ngrammar.cc.

◆ init() [3/4]

bool EST_Ngrammar::init ( int  o,
EST_Ngrammar::representation_t  r,
EST_Discrete v 
)

Definition at line 521 of file EST_Ngrammar.cc.

◆ init() [4/4]

bool EST_Ngrammar::init ( int  o,
EST_Ngrammar::representation_t  r,
EST_Discrete v,
EST_Discrete pv 
)

Definition at line 530 of file EST_Ngrammar.cc.

◆ num_states()

int EST_Ngrammar::num_states ( void  ) const
inline

Definition at line 400 of file EST_Ngrammar.h.

◆ samples()

double EST_Ngrammar::samples ( void  ) const
inline

Definition at line 401 of file EST_Ngrammar.h.

◆ order()

int EST_Ngrammar::order ( ) const
inline

Definition at line 402 of file EST_Ngrammar.h.

◆ get_vocab_length()

int EST_Ngrammar::get_vocab_length ( ) const
inline

Definition at line 403 of file EST_Ngrammar.h.

◆ get_vocab_word() [1/2]

EST_String EST_Ngrammar::get_vocab_word ( int  i) const

Definition at line 1989 of file EST_Ngrammar.cc.

◆ get_vocab_word() [2/2]

int EST_Ngrammar::get_vocab_word ( const EST_String s) const

Definition at line 1997 of file EST_Ngrammar.cc.

◆ get_pred_vocab_length()

int EST_Ngrammar::get_pred_vocab_length ( ) const
inline

Definition at line 406 of file EST_Ngrammar.h.

◆ get_pred_vocab_word() [1/2]

EST_String EST_Ngrammar::get_pred_vocab_word ( int  i) const
inline

Definition at line 407 of file EST_Ngrammar.h.

◆ get_pred_vocab_word() [2/2]

int EST_Ngrammar::get_pred_vocab_word ( const EST_String s) const
inline

Definition at line 408 of file EST_Ngrammar.h.

◆ closed_vocab()

int EST_Ngrammar::closed_vocab ( ) const
inline

Definition at line 410 of file EST_Ngrammar.h.

◆ entry_type()

entry_t EST_Ngrammar::entry_type ( ) const
inline

Definition at line 411 of file EST_Ngrammar.h.

◆ representation()

representation_t EST_Ngrammar::representation ( ) const
inline

Definition at line 412 of file EST_Ngrammar.h.

◆ build()

bool EST_Ngrammar::build ( const EST_StrList filenames,
const EST_String prev = SENTENCE_START_MARKER,
const EST_String prev_prev = SENTENCE_END_MARKER,
const EST_String last = SENTENCE_END_MARKER,
const EST_String input_format = "",
const EST_String oov_mode = "",
const int  mincount = 1,
const int  maxcount = 10 
)

Definition at line 759 of file EST_Ngrammar.cc.

◆ accumulate() [1/2]

void EST_Ngrammar::accumulate ( const EST_StrVector words,
const double  count = 1 
)

Definition at line 884 of file EST_Ngrammar.cc.

◆ accumulate() [2/2]

void EST_Ngrammar::accumulate ( const EST_IVector words,
const double  count = 1 
)

Definition at line 914 of file EST_Ngrammar.cc.

◆ make_htk_compatible()

void EST_Ngrammar::make_htk_compatible ( )

Definition at line 2205 of file EST_Ngrammar.cc.

◆ load() [1/2]

EST_read_status EST_Ngrammar::load ( const EST_String filename)

Definition at line 2121 of file EST_Ngrammar.cc.

◆ load() [2/2]

EST_read_status EST_Ngrammar::load ( const EST_String filename,
const EST_StrList wordlist 
)

Definition at line 2160 of file EST_Ngrammar.cc.

◆ save()

EST_write_status EST_Ngrammar::save ( const EST_String filename,
const EST_String  type = "cstr_ascii",
const bool  trace = false,
double  floor = 0.0 
)

Definition at line 2213 of file EST_Ngrammar.cc.

◆ wordlist_index() [1/2]

int EST_Ngrammar::wordlist_index ( const EST_String word,
const bool  report = true 
) const

Definition at line 733 of file EST_Ngrammar.cc.

◆ wordlist_index() [2/2]

const EST_String & EST_Ngrammar::wordlist_index ( int  i) const

Definition at line 697 of file EST_Ngrammar.cc.

◆ predlist_index() [1/2]

int EST_Ngrammar::predlist_index ( const EST_String word) const

Definition at line 702 of file EST_Ngrammar.cc.

◆ predlist_index() [2/2]

const EST_String & EST_Ngrammar::predlist_index ( int  i) const

Definition at line 728 of file EST_Ngrammar.cc.

◆ set_entry_type()

bool EST_Ngrammar::set_entry_type ( EST_Ngrammar::entry_t  new_type)

Definition at line 1657 of file EST_Ngrammar.cc.

◆ set_representation()

bool EST_Ngrammar::set_representation ( EST_Ngrammar::representation_t  new_representation)

Definition at line 1836 of file EST_Ngrammar.cc.

◆ probability()

double EST_Ngrammar::probability ( const EST_StrVector words,
bool  force = false,
const bool  trace = false 
) const

Definition at line 1853 of file EST_Ngrammar.cc.

◆ frequency()

double EST_Ngrammar::frequency ( const EST_StrVector words,
bool  force = false,
const bool  trace = false 
) const

Definition at line 1876 of file EST_Ngrammar.cc.

◆ predict() [1/6]

const EST_String & EST_Ngrammar::predict ( const EST_StrVector words,
double *  prob,
int *  state 
) const

Definition at line 1899 of file EST_Ngrammar.cc.

◆ predict() [2/6]

const EST_String & EST_Ngrammar::predict ( const EST_StrVector words) const
inline

Definition at line 463 of file EST_Ngrammar.h.

◆ predict() [3/6]

const EST_String & EST_Ngrammar::predict ( const EST_StrVector words,
double *  prob 
) const
inline

Definition at line 465 of file EST_Ngrammar.h.

◆ predict() [4/6]

const EST_String & EST_Ngrammar::predict ( const EST_IVector words,
double *  prob,
int *  state 
) const

Definition at line 1927 of file EST_Ngrammar.cc.

◆ predict() [5/6]

const EST_String & EST_Ngrammar::predict ( const EST_IVector words) const
inline

Definition at line 469 of file EST_Ngrammar.h.

◆ predict() [6/6]

const EST_String & EST_Ngrammar::predict ( const EST_IVector words,
double *  prob 
) const
inline

Definition at line 471 of file EST_Ngrammar.h.

◆ find_state_id() [1/2]

int EST_Ngrammar::find_state_id ( const EST_StrVector words) const

Definition at line 1955 of file EST_Ngrammar.cc.

◆ find_state_id() [2/2]

int EST_Ngrammar::find_state_id ( const EST_IVector words) const

Definition at line 1972 of file EST_Ngrammar.cc.

◆ find_next_state_id()

int EST_Ngrammar::find_next_state_id ( int  state,
int  word 
) const

Definition at line 1699 of file EST_Ngrammar.cc.

◆ reverse_probability() [1/2]

double EST_Ngrammar::reverse_probability ( const EST_StrVector words,
bool  force = false 
) const

Definition at line 2003 of file EST_Ngrammar.cc.

◆ reverse_probability() [2/2]

double EST_Ngrammar::reverse_probability ( const EST_IVector words,
bool  force = false 
) const

Definition at line 2032 of file EST_Ngrammar.cc.

◆ prob_dist() [1/3]

const EST_DiscreteProbDistribution & EST_Ngrammar::prob_dist ( const EST_StrVector words) const

Definition at line 2070 of file EST_Ngrammar.cc.

◆ prob_dist() [2/3]

const EST_DiscreteProbDistribution & EST_Ngrammar::prob_dist ( const EST_IVector words) const

Definition at line 2095 of file EST_Ngrammar.cc.

◆ prob_dist() [3/3]

const EST_DiscreteProbDistribution & EST_Ngrammar::prob_dist ( int  state) const

Definition at line 2064 of file EST_Ngrammar.cc.

◆ fill_window_start() [1/2]

void EST_Ngrammar::fill_window_start ( EST_IVector window,
const EST_String prev,
const EST_String prev_prev 
) const

Definition at line 1030 of file EST_Ngrammar.cc.

◆ fill_window_start() [2/2]

void EST_Ngrammar::fill_window_start ( EST_StrVector window,
const EST_String prev,
const EST_String prev_prev 
) const

Definition at line 1041 of file EST_Ngrammar.cc.

◆ ngram_exists() [1/2]

bool EST_Ngrammar::ngram_exists ( const EST_StrVector words) const

Definition at line 956 of file EST_Ngrammar.cc.

◆ ngram_exists() [2/2]

bool EST_Ngrammar::ngram_exists ( const EST_StrVector words,
const double  threshold 
) const

Definition at line 984 of file EST_Ngrammar.cc.

◆ get_backoff_weight()

const double EST_Ngrammar::get_backoff_weight ( const EST_StrVector words) const

Definition at line 997 of file EST_Ngrammar.cc.

◆ set_backoff_weight()

bool EST_Ngrammar::set_backoff_weight ( const EST_StrVector words,
const double  w 
)

Definition at line 1008 of file EST_Ngrammar.cc.

◆ print_freqs()

void EST_Ngrammar::print_freqs ( ostream &  os,
double  floor = 0.0 
)

Definition at line 2328 of file EST_Ngrammar.cc.

◆ compute_backoff_weights()

bool EST_Ngrammar::compute_backoff_weights ( const int  mincount = 1,
const int  maxcount = 10 
)

Definition at line 1489 of file EST_Ngrammar.cc.

◆ merge()

bool EST_Ngrammar::merge ( EST_Ngrammar n,
float  weight 
)

Definition at line 2739 of file EST_Ngrammar.cc.

Friends And Related Function Documentation

◆ EST_BackoffNgrammar

friend class EST_BackoffNgrammar
friend

Definition at line 583 of file EST_Ngrammar.h.

◆ operator<<

ostream & operator<< ( ostream &  s,
EST_Ngrammar n 
)
friend

Definition at line 1629 of file EST_Ngrammar.cc.

◆ load_ngram_htk_ascii

EST_read_status load_ngram_htk_ascii ( const EST_String  filename,
EST_Ngrammar n 
)
friend

Definition at line 54 of file ngrammar_io.cc.

◆ load_ngram_htk_binary

EST_read_status load_ngram_htk_binary ( const EST_String  filename,
EST_Ngrammar n 
)
friend

Definition at line 62 of file ngrammar_io.cc.

◆ load_ngram_arpa

EST_read_status load_ngram_arpa ( const EST_String  filename,
EST_Ngrammar n,
const EST_StrList vocab 
)
friend

Definition at line 70 of file ngrammar_io.cc.

◆ load_ngram_cstr_ascii

EST_read_status load_ngram_cstr_ascii ( const EST_String  filename,
EST_Ngrammar n 
)
friend

Definition at line 218 of file ngrammar_io.cc.

◆ load_ngram_cstr_bin

EST_read_status load_ngram_cstr_bin ( const EST_String  filename,
EST_Ngrammar n 
)
friend

Definition at line 280 of file ngrammar_io.cc.

◆ save_ngram_htk_ascii_sub

EST_write_status save_ngram_htk_ascii_sub ( const EST_String word,
ostream *  ost,
EST_Ngrammar n,
double  floor 
)
friend

Definition at line 407 of file ngrammar_io.cc.

◆ save_ngram_htk_ascii

EST_write_status save_ngram_htk_ascii ( const EST_String  filename,
EST_Ngrammar n,
double  floor 
)
friend

Definition at line 548 of file ngrammar_io.cc.

◆ save_ngram_cstr_ascii

EST_write_status save_ngram_cstr_ascii ( const EST_String  filename,
EST_Ngrammar n,
const bool  trace,
double  floor 
)
friend

Definition at line 729 of file ngrammar_io.cc.

◆ save_ngram_cstr_bin

EST_write_status save_ngram_cstr_bin ( const EST_String  filename,
EST_Ngrammar n,
const bool  trace,
double  floor 
)
friend

Definition at line 826 of file ngrammar_io.cc.

◆ save_ngram_arpa

EST_write_status save_ngram_arpa ( const EST_String  filename,
EST_Ngrammar n 
)
friend

Definition at line 653 of file ngrammar_io.cc.

◆ save_ngram_wfst

EST_write_status save_ngram_wfst ( const EST_String  filename,
EST_Ngrammar n 
)
friend

Definition at line 788 of file ngrammar_io.cc.

◆ frequency_of_frequencies

void frequency_of_frequencies ( EST_DVector ff,
EST_Ngrammar n,
int  this_order 
)
friend

Definition at line 205 of file ngrammar_aux.cc.

◆ map_frequencies

void map_frequencies ( EST_Ngrammar n,
const EST_DVector map,
const int  this_order 
)
friend

Definition at line 304 of file ngrammar_aux.cc.

◆ Good_Turing_smooth

bool Good_Turing_smooth ( EST_Ngrammar n,
int  maxcount,
int  mincount 
)
friend

Definition at line 408 of file ngrammar_aux.cc.

◆ Good_Turing_discount

void Good_Turing_discount ( EST_Ngrammar ngrammar,
const int  maxcount,
const double  default_discount 
)
friend

Definition at line 539 of file ngrammar_aux.cc.

◆ fs_build_backoff_ngrams

void fs_build_backoff_ngrams ( EST_Ngrammar backoff_ngrams,
EST_Ngrammar ngram 
)
friend

Definition at line 73 of file freqsmooth.cc.

◆ fs_backoff_smooth

int fs_backoff_smooth ( EST_Ngrammar backoff_ngrams,
EST_Ngrammar ngram,
int  smooth_thresh 
)
friend

Definition at line 109 of file freqsmooth.cc.

Member Data Documentation

◆ p_order

int EST_Ngrammar::p_order
protected

Definition at line 225 of file EST_Ngrammar.h.

◆ p_num_samples

int EST_Ngrammar::p_num_samples
protected

Definition at line 226 of file EST_Ngrammar.h.

◆ p_number_of_sentences

double EST_Ngrammar::p_number_of_sentences
protected

Definition at line 228 of file EST_Ngrammar.h.

◆ p_sentence_start_marker

EST_String EST_Ngrammar::p_sentence_start_marker
protected

Definition at line 231 of file EST_Ngrammar.h.

◆ p_sentence_end_marker

EST_String EST_Ngrammar::p_sentence_end_marker
protected

Definition at line 232 of file EST_Ngrammar.h.

◆ p_representation

representation_t EST_Ngrammar::p_representation
protected

Definition at line 235 of file EST_Ngrammar.h.

◆ p_entry_type

entry_t EST_Ngrammar::p_entry_type
protected

Definition at line 236 of file EST_Ngrammar.h.

◆ sparse_representation

EST_PredictionSuffixTree EST_Ngrammar::sparse_representation
protected

Definition at line 240 of file EST_Ngrammar.h.

◆ backoff_representation

EST_BackoffNgrammarState* EST_Ngrammar::backoff_representation
protected

Definition at line 250 of file EST_Ngrammar.h.

◆ backoff_threshold

double EST_Ngrammar::backoff_threshold
protected

Definition at line 252 of file EST_Ngrammar.h.

◆ backoff_unigram_floor_freq

double EST_Ngrammar::backoff_unigram_floor_freq
protected

Definition at line 255 of file EST_Ngrammar.h.

◆ backoff_discount

EST_DVector* EST_Ngrammar::backoff_discount
protected

Definition at line 262 of file EST_Ngrammar.h.

◆ p_num_states

int EST_Ngrammar::p_num_states
protected

Definition at line 268 of file EST_Ngrammar.h.

◆ p_states

EST_NgrammarState* EST_Ngrammar::p_states
protected

Definition at line 269 of file EST_Ngrammar.h.

◆ vocab

EST_Discrete* EST_Ngrammar::vocab
protected

Definition at line 276 of file EST_Ngrammar.h.

◆ pred_vocab

EST_Discrete* EST_Ngrammar::pred_vocab
protected

Definition at line 277 of file EST_Ngrammar.h.

◆ vocab_pdf

EST_DiscreteProbDistribution EST_Ngrammar::vocab_pdf
protected

Definition at line 285 of file EST_Ngrammar.h.

◆ allow_oov

bool EST_Ngrammar::allow_oov
protected

Definition at line 292 of file EST_Ngrammar.h.


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