Public Types | Public Member Functions | Friends

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

Recursivively replaces arcs in the root Fst with other Fsts. This version is a delayed Fst. More...

#include <fst/replace.h>

Inherits ImplToFst< ReplaceFstImpl< A, T > >.

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

List of all members.

Public Types

typedef A Arc
typedef A::Label Label
typedef A::Weight Weight
typedef A::StateId StateId
typedef CacheState< A > State
typedef ReplaceFstImpl< A, T > Impl

Public Member Functions

 ReplaceFst (const vector< pair< Label, const Fst< A > * > > &fst_array, Label root)
 ReplaceFst (const vector< pair< Label, const Fst< A > * > > &fst_array, const ReplaceFstOptions< A, T > &opts)
 ReplaceFst (const ReplaceFst< A, T > &fst, bool safe=false)
 See Fst<>::Copy() for doc.
virtual ReplaceFst< A, T > * Copy (bool safe=false) const
 Get a copy of this ReplaceFst. See Fst<>::Copy() for further doc.
virtual void InitStateIterator (StateIteratorData< A > *data) const
virtual void InitArcIterator (StateId s, ArcIteratorData< A > *data) const
virtual MatcherBase< A > * InitMatcher (MatchType match_type) const
bool CyclicDependencies () const

Friends

class ArcIterator< ReplaceFst< A, T > >
class StateIterator< ReplaceFst< A, T > >
class ReplaceFstMatcher< A, T >

Detailed Description

template<class A, class T = DefaultReplaceStateTable<A>>
class fst::ReplaceFst< A, T >

Recursivively replaces arcs in the root Fst with other Fsts. This version is a delayed Fst.

ReplaceFst supports dynamic replacement of arcs in one Fst with another Fst. This replacement is recursive. ReplaceFst can be used to support a variety of delayed constructions such as recursive transition networks, union, or closure. It is constructed with an array of Fst(s). One Fst represents the root (or topology) machine. The root Fst refers to other Fsts by recursively replacing arcs labeled as non-terminals with the matching non-terminal Fst. Currently the ReplaceFst uses the output symbols of the arcs to determine whether the arc is a non-terminal arc or not. A non-terminal can be any label that is not a non-zero terminal label in the output alphabet.

Note that the constructor uses a vector of pair<>. These correspond to the tuple of non-terminal Label and corresponding Fst. For example to implement the closure operation we need 2 Fsts. The first root Fst is a single Arc on the start State that self loops, it references the particular machine for which we are performing the closure operation.

The ReplaceFst class supports an optionally caching arc iterator: ArcIterator< ReplaceFst > The ReplaceFst need to be built such that it is known to be ilabel or olabel sorted (see usage below).

Observe that Matcher<Fst > will use the optionally caching arc iterator when available (Fst is ilabel sorted and matching on the input, or Fst is olabel sorted and matching on the output). In order to obtain the most efficient behaviour, it is recommended to set 'epsilon_on_replace' to false (this means constructing acceptors as transducers with epsilons on the input side of nonterminal arcs) and matching on the input side.

This class attaches interface to implementation and handles reference counting, delegating most methods to ImplToFst.

Definition at line 955 of file replace.h.


Member Typedef Documentation

template<class A, class T = DefaultReplaceStateTable<A>>
typedef A fst::ReplaceFst< A, T >::Arc

Reimplemented from fst::ImplToFst< ReplaceFstImpl< A, T > >.

Definition at line 961 of file replace.h.

template<class A, class T = DefaultReplaceStateTable<A>>
typedef ReplaceFstImpl<A, T> fst::ReplaceFst< A, T >::Impl

Definition at line 966 of file replace.h.

template<class A, class T = DefaultReplaceStateTable<A>>
typedef A::Label fst::ReplaceFst< A, T >::Label

Definition at line 962 of file replace.h.

template<class A, class T = DefaultReplaceStateTable<A>>
typedef CacheState<A> fst::ReplaceFst< A, T >::State

Definition at line 965 of file replace.h.

template<class A, class T = DefaultReplaceStateTable<A>>
typedef A::StateId fst::ReplaceFst< A, T >::StateId

Reimplemented from fst::ImplToFst< ReplaceFstImpl< A, T > >.

Definition at line 964 of file replace.h.

template<class A, class T = DefaultReplaceStateTable<A>>
typedef A::Weight fst::ReplaceFst< A, T >::Weight

Reimplemented from fst::ImplToFst< ReplaceFstImpl< A, T > >.

Definition at line 963 of file replace.h.


Constructor & Destructor Documentation

template<class A, class T = DefaultReplaceStateTable<A>>
fst::ReplaceFst< A, T >::ReplaceFst ( const vector< pair< Label, const Fst< A > * > > &  fst_array,
Label  root 
) [inline]

Definition at line 970 of file replace.h.

template<class A, class T = DefaultReplaceStateTable<A>>
fst::ReplaceFst< A, T >::ReplaceFst ( const vector< pair< Label, const Fst< A > * > > &  fst_array,
const ReplaceFstOptions< A, T > &  opts 
) [inline]

Definition at line 974 of file replace.h.

template<class A, class T = DefaultReplaceStateTable<A>>
fst::ReplaceFst< A, T >::ReplaceFst ( const ReplaceFst< A, T > &  fst,
bool  safe = false 
) [inline]

See Fst<>::Copy() for doc.

Definition at line 979 of file replace.h.


Member Function Documentation

template<class A, class T = DefaultReplaceStateTable<A>>
virtual ReplaceFst<A, T>* fst::ReplaceFst< A, T >::Copy ( bool  safe = false  )  const [inline, virtual]

Get a copy of this ReplaceFst. See Fst<>::Copy() for further doc.

Implements fst::Fst< typename ReplaceFstImpl< A, T >::Arc >.

Definition at line 983 of file replace.h.

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

Definition at line 1005 of file replace.h.

template<class A, class T = DefaultReplaceStateTable<A>>
virtual void fst::ReplaceFst< A, T >::InitArcIterator ( StateId  s,
ArcIteratorData< A > *  data 
) const [inline, virtual]

Definition at line 989 of file replace.h.

template<class A, class T = DefaultReplaceStateTable<A>>
virtual MatcherBase<A>* fst::ReplaceFst< A, T >::InitMatcher ( MatchType  match_type  )  const [inline, virtual]

For generic matcher construction; not normally called directly by users.

Reimplemented from fst::Fst< typename ReplaceFstImpl< A, T >::Arc >.

Definition at line 993 of file replace.h.

template<class A, class T >
void fst::ReplaceFst< A, T >::InitStateIterator ( StateIteratorData< A > *  data  )  const [inline, virtual]

Definition at line 1414 of file replace.h.


Friends And Related Function Documentation

template<class A, class T = DefaultReplaceStateTable<A>>
friend class ArcIterator< ReplaceFst< A, T > > [friend]

Definition at line 957 of file replace.h.

template<class A, class T = DefaultReplaceStateTable<A>>
friend class ReplaceFstMatcher< A, T > [friend]

Definition at line 959 of file replace.h.

template<class A, class T = DefaultReplaceStateTable<A>>
friend class StateIterator< ReplaceFst< A, T > > [friend]

Definition at line 958 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