Classes | Public Types | Public Member Functions

fst::ReplaceFstImpl< A, T > Class Template Reference

Implementation class for replace class Fst. More...

#include <fst/replace.h>

Inherits fst::CacheImpl< A >.

Collaboration diagram for fst::ReplaceFstImpl< A, T >:
Collaboration graph
[legend]

List of all members.

Classes

class  PrefixTuple
 Tuple of fst_id and destination state (entry in stack prefix).
class  StackPrefix
 Container for stack prefix.
class  StackPrefixEqual
 Compare two stack prefix classes for equality.
class  StackPrefixKey
 Hash function for stack prefix to prefix id.

Public Types

typedef A::Label Label
typedef A::Weight Weight
typedef A::StateId StateId
typedef CacheState< A > State
typedef A Arc
typedef unordered_map< Label,
Label
NonTerminalHash
typedef T StateTable
typedef T::PrefixId PrefixId
typedef ReplaceStateTuple
< StateId, PrefixId
StateTuple

Public Member Functions

 ReplaceFstImpl (const vector< pair< Label, const Fst< A > * > > &fst_tuples, const ReplaceFstOptions< A, T > &opts)
 ReplaceFstImpl (const ReplaceFstImpl &impl)
 ~ReplaceFstImpl ()
bool CyclicDependencies () const
StateId Start ()
 Return or compute start state of replace fst.
Weight Final (StateId s)
 return final weight of state (kInfWeight means state is not final)
size_t NumArcs (StateId s)
bool IsNonTerminal (Label l) const
 Returns whether a given label is a non terminal.
size_t NumInputEpsilons (StateId s)
size_t NumOutputEpsilons (StateId s)
void InitArcIterator (StateId s, ArcIteratorData< A > *data)
void Expand (StateId s)
 Extend current state (walk arcs one level deep).
void Expand (StateId s, const StateTuple &tuple, const ArcIteratorData< A > &data)
bool ComputeFinalArc (const StateTuple &tuple, A *arcp, uint32 flags=kArcValueFlags)
bool ComputeArc (const StateTuple &tuple, const A &arc, A *arcp, uint32 flags=kArcValueFlags)
uint32 ArcIteratorFlags () const
 Returns the arc iterator flags supported by this Fst.
T * GetStateTable () const
const Fst< A > * GetFst (Label fst_id) const
bool EpsilonOnReplace () const

Detailed Description

template<class A, class T>
class fst::ReplaceFstImpl< A, T >

Implementation class for replace class Fst.

The replace implementation class supports a dynamic expansion of a recursive transition network represented as Fst with dynamic replacable arcs.

Definition at line 305 of file replace.h.


Member Typedef Documentation

template<class A, class T>
typedef A fst::ReplaceFstImpl< A, T >::Arc

Reimplemented from fst::CacheBaseImpl< CacheState< A > >.

Definition at line 328 of file replace.h.

template<class A, class T>
typedef A::Label fst::ReplaceFstImpl< A, T >::Label

Definition at line 324 of file replace.h.

template<class A, class T>
typedef unordered_map<Label, Label> fst::ReplaceFstImpl< A, T >::NonTerminalHash

Definition at line 329 of file replace.h.

template<class A, class T>
typedef T::PrefixId fst::ReplaceFstImpl< A, T >::PrefixId

Definition at line 332 of file replace.h.

template<class A, class T>
typedef CacheState<A> fst::ReplaceFstImpl< A, T >::State

Reimplemented from fst::CacheImpl< A >.

Definition at line 327 of file replace.h.

template<class A, class T>
typedef A::StateId fst::ReplaceFstImpl< A, T >::StateId

Reimplemented from fst::CacheBaseImpl< CacheState< A > >.

Definition at line 326 of file replace.h.

template<class A, class T>
typedef T fst::ReplaceFstImpl< A, T >::StateTable

Definition at line 331 of file replace.h.

template<class A, class T>
typedef ReplaceStateTuple<StateId, PrefixId> fst::ReplaceFstImpl< A, T >::StateTuple

Definition at line 333 of file replace.h.

template<class A, class T>
typedef A::Weight fst::ReplaceFstImpl< A, T >::Weight

Reimplemented from fst::CacheBaseImpl< CacheState< A > >.

Definition at line 325 of file replace.h.


Constructor & Destructor Documentation

template<class A, class T>
fst::ReplaceFstImpl< A, T >::ReplaceFstImpl ( const vector< pair< Label, const Fst< A > * > > &  fst_tuples,
const ReplaceFstOptions< A, T > &  opts 
) [inline]

constructor for replace class implementation.

Parameters:
fst_tuples array of label/fst tuples, one for each non-terminal

Definition at line 337 of file replace.h.

template<class A, class T>
fst::ReplaceFstImpl< A, T >::ReplaceFstImpl ( const ReplaceFstImpl< A, T > &  impl  )  [inline]

Definition at line 426 of file replace.h.

template<class A, class T>
fst::ReplaceFstImpl< A, T >::~ReplaceFstImpl (  )  [inline]

Definition at line 444 of file replace.h.


Member Function Documentation

template<class A, class T>
uint32 fst::ReplaceFstImpl< A, T >::ArcIteratorFlags (  )  const [inline]

Returns the arc iterator flags supported by this Fst.

Definition at line 747 of file replace.h.

template<class A, class T>
bool fst::ReplaceFstImpl< A, T >::ComputeArc ( const StateTuple tuple,
const A &  arc,
A *  arcp,
uint32  flags = kArcValueFlags 
) [inline]

Compute the arc in the replace fst corresponding to a given in the underlying machine. Returns false if the underlying arc corresponds to no arc in the replace.

Definition at line 698 of file replace.h.

template<class A, class T>
bool fst::ReplaceFstImpl< A, T >::ComputeFinalArc ( const StateTuple tuple,
A *  arcp,
uint32  flags = kArcValueFlags 
) [inline]

If arcp == 0, only returns if a final arc is required, does not actually compute it.

Definition at line 667 of file replace.h.

template<class A, class T>
bool fst::ReplaceFstImpl< A, T >::CyclicDependencies (  )  const [inline]

Computes the dependency graph of the replace class and returns true if the dependencies are cyclic. Cyclic dependencies will result in an un-expandable replace fst.

Definition at line 459 of file replace.h.

template<class A, class T>
bool fst::ReplaceFstImpl< A, T >::EpsilonOnReplace (  )  const [inline]

Definition at line 762 of file replace.h.

template<class A, class T>
void fst::ReplaceFstImpl< A, T >::Expand ( StateId  s  )  [inline]

Extend current state (walk arcs one level deep).

Definition at line 615 of file replace.h.

template<class A, class T>
void fst::ReplaceFstImpl< A, T >::Expand ( StateId  s,
const StateTuple tuple,
const ArcIteratorData< A > &  data 
) [inline]

Definition at line 641 of file replace.h.

template<class A, class T>
Weight fst::ReplaceFstImpl< A, T >::Final ( StateId  s  )  [inline]

return final weight of state (kInfWeight means state is not final)

Definition at line 488 of file replace.h.

template<class A, class T>
const Fst<A>* fst::ReplaceFstImpl< A, T >::GetFst ( Label  fst_id  )  const [inline]

Definition at line 758 of file replace.h.

template<class A, class T>
T* fst::ReplaceFstImpl< A, T >::GetStateTable (  )  const [inline]

Definition at line 754 of file replace.h.

template<class A, class T>
void fst::ReplaceFstImpl< A, T >::InitArcIterator ( StateId  s,
ArcIteratorData< A > *  data 
) [inline]

return the base arc iterator, if arcs have not been computed yet, extend/recurse for new arcs.

Definition at line 604 of file replace.h.

template<class A, class T>
bool fst::ReplaceFstImpl< A, T >::IsNonTerminal ( Label  l  )  const [inline]

Returns whether a given label is a non terminal.

Definition at line 524 of file replace.h.

template<class A, class T>
size_t fst::ReplaceFstImpl< A, T >::NumArcs ( StateId  s  )  [inline]

Definition at line 503 of file replace.h.

template<class A, class T>
size_t fst::ReplaceFstImpl< A, T >::NumInputEpsilons ( StateId  s  )  [inline]

Definition at line 536 of file replace.h.

template<class A, class T>
size_t fst::ReplaceFstImpl< A, T >::NumOutputEpsilons ( StateId  s  )  [inline]

Definition at line 573 of file replace.h.

template<class A, class T>
StateId fst::ReplaceFstImpl< A, T >::Start (  )  [inline]

Return or compute start state of replace fst.

Definition at line 465 of file replace.h.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines