BiglmFasterDecoder::Token Class Reference
Collaboration diagram for BiglmFasterDecoder::Token:

Public Member Functions

 Token (const Arc &arc, Weight &ac_weight, Token *prev)
 
 Token (const Arc &arc, Token *prev)
 
bool operator< (const Token &other)
 
 ~Token ()
 

Static Public Member Functions

static void TokenDelete (Token *tok)
 

Public Attributes

Arc arc_
 
Tokenprev_
 
int32 ref_count_
 
Weight weight_
 

Detailed Description

Definition at line 195 of file biglm-faster-decoder.h.

Constructor & Destructor Documentation

◆ Token() [1/2]

Token ( const Arc arc,
Weight ac_weight,
Token prev 
)
inline

Definition at line 204 of file biglm-faster-decoder.h.

References BiglmFasterDecoder::Token::ref_count_, fst::Times(), and BiglmFasterDecoder::Token::weight_.

204  :
205  arc_(arc), prev_(prev), ref_count_(1) {
206  if (prev) {
207  prev->ref_count_++;
208  weight_ = Times(Times(prev->weight_, arc.weight), ac_weight);
209  } else {
210  weight_ = Times(arc.weight, ac_weight);
211  }
212  }
LatticeWeightTpl< FloatType > Times(const LatticeWeightTpl< FloatType > &w1, const LatticeWeightTpl< FloatType > &w2)

◆ Token() [2/2]

Token ( const Arc arc,
Token prev 
)
inline

Definition at line 213 of file biglm-faster-decoder.h.

References BiglmFasterDecoder::Token::ref_count_, fst::Times(), and BiglmFasterDecoder::Token::weight_.

213  :
214  arc_(arc), prev_(prev), ref_count_(1) {
215  if (prev) {
216  prev->ref_count_++;
217  weight_ = Times(prev->weight_, arc.weight);
218  } else {
219  weight_ = arc.weight;
220  }
221  }
LatticeWeightTpl< FloatType > Times(const LatticeWeightTpl< FloatType > &w1, const LatticeWeightTpl< FloatType > &w2)

◆ ~Token()

~Token ( )
inline

Definition at line 227 of file biglm-faster-decoder.h.

References KALDI_ASSERT.

227  {
228  KALDI_ASSERT(ref_count_ == 1);
229  if (prev_ != NULL) TokenDelete(prev_);
230  }
#define KALDI_ASSERT(cond)
Definition: kaldi-error.h:185

Member Function Documentation

◆ operator<()

bool operator< ( const Token other)
inline

Definition at line 222 of file biglm-faster-decoder.h.

References BiglmFasterDecoder::Token::weight_.

222  {
223  return weight_.Value() > other.weight_.Value();
224  // This makes sense for log + tropical semiring.
225  }

◆ TokenDelete()

static void TokenDelete ( Token tok)
inlinestatic

Definition at line 231 of file biglm-faster-decoder.h.

References BiglmFasterDecoder::Token::ref_count_.

231  {
232  if (tok->ref_count_ == 1) {
233  delete tok;
234  } else {
235  tok->ref_count_--;
236  }
237  }

Member Data Documentation

◆ arc_

Arc arc_

Definition at line 197 of file biglm-faster-decoder.h.

Referenced by BiglmFasterDecoder::ProcessEmitting().

◆ prev_

Token* prev_

Definition at line 201 of file biglm-faster-decoder.h.

Referenced by BiglmFasterDecoder::GetBestPath().

◆ ref_count_

◆ weight_


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