NGram  ngram-1.3.15
OpenGrm-NGram library
Public Types | Public Member Functions | Protected Member Functions | List of all members
ngram::NGramModelMerge Class Reference

#include <ngram-model-merge.h>

Inheritance diagram for ngram::NGramModelMerge:
Inheritance graph
[legend]
Collaboration diagram for ngram::NGramModelMerge:
Collaboration graph
[legend]

Public Types

typedef fst::StdArc::StateId StateId
 
typedef fst::StdArc::Label Label
 
- Public Types inherited from ngram::NGramMerge< fst::StdArc >
typedef fst::StdArc::StateId StateId
 
typedef fst::StdArc::Label Label
 
typedef fst::StdArc::Weight Weight
 
- Public Types inherited from ngram::NGramMutableModel< fst::StdArc >
typedef fst::StdArc::StateId StateId
 
typedef fst::StdArc::Label Label
 
typedef fst::StdArc::Weight Weight
 
- Public Types inherited from ngram::NGramModel< fst::StdArc >
typedef fst::StdArc::StateId StateId
 
typedef fst::StdArc::Label Label
 
typedef fst::StdArc::Weight Weight
 

Public Member Functions

 NGramModelMerge (fst::StdMutableFst *infst1, Label backoff_label=0, double norm_eps=kNormEps, bool check_consistency=false)
 
void MergeNGramModels (const fst::StdFst &infst2, double alpha, double beta, bool norm=false)
 
- Public Member Functions inherited from ngram::NGramMerge< fst::StdArc >
 NGramMerge (fst::MutableFst< fst::StdArc > *infst1, Label backoff_label=0, double norm_eps=kNormEps, bool check_consistency=false)
 
- Public Member Functions inherited from ngram::NGramMutableModel< fst::StdArc >
 NGramMutableModel (fst::MutableFst< fst::StdArc > *infst, Label backoff_label, double norm_eps, bool state_ngrams, bool infinite_backoff=false)
 
 NGramMutableModel (fst::MutableFst< fst::StdArc > *infst, Label backoff_label)
 
 NGramMutableModel (fst::MutableFst< fst::StdArc > *infst)
 
const fst::ExpandedFst< fst::StdArc > & GetExpandedFst () const
 
fst::MutableFst< fst::StdArc > * GetMutableFst ()
 
void RecalcBackoff (StateId st)
 
void RecalcBackoff ()
 
void ScaleWeights (double scale)
 
void SetAllowInfiniteBO ()
 
void SortStates ()
 
void SetScalarValue (Weight *w, double scalar)
 
Weight ScaleWeight (Weight w, double scalar)
 
- Public Member Functions inherited from ngram::NGramModel< fst::StdArc >
 NGramModel (const fst::Fst< fst::StdArc > &infst, Label backoff_label, double norm_eps, bool state_ngrams)
 
 NGramModel (const fst::Fst< fst::StdArc > &infst, Label backoff_label)
 
 NGramModel (const fst::Fst< fst::StdArc > &infst)
 
virtual ~NGramModel ()=default
 
StateId NumStates () const
 
int64_t GetSize () const
 
int HiOrder () const
 
int StateOrder (StateId state) const
 
StateId NGramState (const std::vector< Label > &ngram) const
 
const std::vector< Label > & StateNGram (StateId state) const
 
StateId UnigramState () const
 
double GetSymbolUnigramCost (Label symbol) const
 
Label BackoffLabel () const
 
StateId GetBackoff (StateId st, Weight *bocost) const
 
bool CheckTopology () const
 
bool CheckNormalization () const
 
double CalculateBackoffCost (double hi_neglog_sum, double low_neglog_sum, bool infinite_backoff=false) const
 
bool CalculateBackoffFactors (double hi_neglog_sum, double low_neglog_sum, double *nlog_backoff_num, double *nlog_backoff_denom, bool infinite_backoff=false) const
 
bool CalculateStateProbs (std::vector< double > *probs, bool stationary=false, size_t maxiters=10000) const
 
const fst::Fst< fst::StdArc > & GetFst () const
 
void InitModel ()
 
double NormEps () const
 
int NumNGrams (StateId st)
 
Weight GetNGramCost (const std::vector< Label > &ngram) const
 
Weight FinalCostInModel (StateId mst, int *order) const
 
void UpdateState (StateId st, int order, bool unigram_state, const std::vector< Label > *ngram=0)
 
Weight GetFinalWeight (StateId st) const
 
Weight GetBackoffCost (StateId st) const
 
double EstimateTotalUnigramCount () const
 
bool Error () const
 

Protected Member Functions

Weight MergeWeights (StateId s1, StateId s2, Label label, Weight w1, Weight w2, bool in_fst1, bool in_fst2) const override
 
double NormWeight (StateId st, bool in_fst1, bool in_fst2) const override
 
- Protected Member Functions inherited from ngram::NGramMerge< fst::StdArc >
bool MergeNGramModels (const fst::Fst< fst::StdArc > &infst2, bool norm=false, int max_order=-1)
 
virtual bool MaxOrderOkay (int order) const
 
virtual bool MergeUnshared (bool in_fst1) const
 
const NGramModel< fst::StdArc > & NGram2 () const
 
size_t NumStates1 () const
 
size_t NumStates2 () const
 
StateId ExactMap1To2 (StateId s1) const
 
StateId ExactMap2To1 (StateId s2) const
 
StateId BackoffMap1To2 (StateId s1) const
 
StateId BackoffMap2To1 (StateId s2) const
 
- Protected Member Functions inherited from ngram::NGramMutableModel< fst::StdArc >
Weight GetBackoffFinalCost (StateId st) const
 
bool FindMutableArc (fst::MutableArcIterator< fst::MutableFst< fst::StdArc >> *biter, Label label) const
 
void ScaleStateWeight (StateId st, double scale)
 
void SortArcs (StateId s)
 
void DeBackoffNGramModel ()
 
- Protected Member Functions inherited from ngram::NGramModel< fst::StdArc >
void SetError ()
 
double NegLogDiff (double a, double b) const
 
void FillStateCounts (std::vector< double > *state_counts)
 
bool FillBackoffArcWeights (StateId st, StateId bo, std::vector< double > *bo_arc_weight) const
 
bool FindArc (fst::ArcIterator< fst::Fst< fst::StdArc >> *biter, Label label) const
 
Weight FindArcWeight (StateId st, Label label) const
 
bool FindNGramInModel (StateId *mst, int *order, Label label, double *cost) const
 
bool CalcBONegLogSums (StateId st, double *hi_neglog_sum, double *low_neglog_sum, bool infinite_backoff=false, bool unigram=false) const
 
bool PrintStateNGram (StateId st, std::ostream &ostrm=std::cerr) const
 

Additional Inherited Members

- Static Public Member Functions inherited from ngram::NGramModel< fst::StdArc >
static double ScalarValue (Weight w)
 
static Weight UnitCount ()
 
static double FactorValue (Weight w)
 
- Static Protected Member Functions inherited from ngram::NGramModel< fst::StdArc >
static double WeightRep (double wt, bool neglogs, bool intcnts)
 

Detailed Description

Definition at line 28 of file ngram-model-merge.h.

Member Typedef Documentation

typedef fst::StdArc::Label ngram::NGramModelMerge::Label

Definition at line 31 of file ngram-model-merge.h.

typedef fst::StdArc::StateId ngram::NGramModelMerge::StateId

Definition at line 30 of file ngram-model-merge.h.

Constructor & Destructor Documentation

ngram::NGramModelMerge::NGramModelMerge ( fst::StdMutableFst *  infst1,
Label  backoff_label = 0,
double  norm_eps = kNormEps,
bool  check_consistency = false 
)
inlineexplicit

Definition at line 36 of file ngram-model-merge.h.

Member Function Documentation

void ngram::NGramModelMerge::MergeNGramModels ( const fst::StdFst &  infst2,
double  alpha,
double  beta,
bool  norm = false 
)
inline

Definition at line 50 of file ngram-model-merge.h.

Weight ngram::NGramModelMerge::MergeWeights ( StateId  s1,
StateId  s2,
Label  label,
Weight  w1,
Weight  w2,
bool  in_fst1,
bool  in_fst2 
) const
inlineoverrideprotectedvirtual

Implements ngram::NGramMerge< fst::StdArc >.

Definition at line 72 of file ngram-model-merge.h.

double ngram::NGramModelMerge::NormWeight ( StateId  st,
bool  in_fst1,
bool  in_fst2 
) const
inlineoverrideprotectedvirtual

Reimplemented from ngram::NGramMerge< fst::StdArc >.

Definition at line 83 of file ngram-model-merge.h.


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