StdToLatticeMapper< Real > Class Template Reference

Class StdToLatticeMapper maps a normal arc (StdArc) to a LatticeArc by putting the StdArc weight as the first element of the LatticeWeight. More...

#include <lattice-utils.h>

Public Member Functions

LatticeArc operator() (const StdArc &arc)
 
MapFinalAction FinalAction ()
 
MapSymbolsAction InputSymbolsAction ()
 
MapSymbolsAction OutputSymbolsAction ()
 
uint64 Properties (uint64 props)
 

Private Types

typedef LatticeWeightTpl< Real > LatticeWeight
 
typedef ArcTpl< LatticeWeightLatticeArc
 

Detailed Description

template<class Real>
class fst::StdToLatticeMapper< Real >

Class StdToLatticeMapper maps a normal arc (StdArc) to a LatticeArc by putting the StdArc weight as the first element of the LatticeWeight.

Useful when doing LM rescoring.

Definition at line 196 of file lattice-utils.h.

Member Typedef Documentation

◆ LatticeArc

typedef ArcTpl<LatticeWeight> LatticeArc
private

Definition at line 198 of file lattice-utils.h.

◆ LatticeWeight

typedef LatticeWeightTpl<Real> LatticeWeight
private

Definition at line 197 of file lattice-utils.h.

Member Function Documentation

◆ FinalAction()

MapFinalAction FinalAction ( )
inline

Definition at line 211 of file lattice-utils.h.

211 { return MAP_NO_SUPERFINAL; }

◆ InputSymbolsAction()

MapSymbolsAction InputSymbolsAction ( )
inline

Definition at line 213 of file lattice-utils.h.

213 { return MAP_COPY_SYMBOLS; }

◆ operator()()

LatticeArc operator() ( const StdArc arc)
inline

Definition at line 200 of file lattice-utils.h.

200  {
201  // Note: we have to check whether the arc's weight is zero below,
202  // and if so return (infinity, infinity) and not (infinity, zero),
203  // because (infinity, zero) is not a valid LatticeWeight, which should
204  // either be both finite, or both infinite (i.e. Zero()).
205  return LatticeArc(arc.ilabel, arc.olabel,
206  LatticeWeight(arc.weight.Value(),
207  arc.weight == StdArc::Weight::Zero() ?
208  arc.weight.Value() : 0.0),
209  arc.nextstate);
210  }
LatticeWeightTpl< Real > LatticeWeight
ArcTpl< LatticeWeight > LatticeArc

◆ OutputSymbolsAction()

MapSymbolsAction OutputSymbolsAction ( )
inline

Definition at line 215 of file lattice-utils.h.

215 { return MAP_COPY_SYMBOLS; }

◆ Properties()

uint64 Properties ( uint64  props)
inline

Definition at line 218 of file lattice-utils.h.

218 { return props; }

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