Public Member Functions | Friends

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

namespace internal More...

#include <fst/replace.h>

Inherits ImplToFst< internal::ReplaceFstImpl< A, T, CacheStore > >.

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

List of all members.

Public Member Functions

 ReplaceFst (const std::vector< std::pair< Label, const Fst< Arc > * >> &fst_array, Label root)
 ReplaceFst (const std::vector< std::pair< Label, const Fst< Arc > * >> &fst_array, const ReplaceFstOptions< Arc, StateTable, CacheStore > &opts)
 ReplaceFst (const ReplaceFst< Arc, StateTable, CacheStore > &fst, bool safe=false)
 See Fst<>::Copy() for doc.
ReplaceFst< Arc, StateTable,
CacheStore > * 
Copy (bool safe=false) const override
 Get a copy of this ReplaceFst. See Fst<>::Copy() for further doc.
void InitStateIterator (StateIteratorData< Arc > *data) const override
void InitArcIterator (StateId s, ArcIteratorData< Arc > *data) const override
MatcherBase< Arc > * InitMatcher (MatchType match_type) const override
 For generic matcher construction (not normally called directly by users).
bool CyclicDependencies () const
const StateTable & GetStateTable () const
const Fst< Arc > & GetFst (Label nonterminal) const

Friends

class ArcIterator< ReplaceFst< Arc, StateTable, CacheStore > >
class StateIterator< ReplaceFst< Arc, StateTable, CacheStore > >
class ReplaceFstMatcher< Arc, StateTable, CacheStore >

Detailed Description

template<class A, class T, class CacheStore>
class fst::ReplaceFst< A, T, CacheStore >

namespace internal

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 pairs. 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 self-loop arc on the start state.

The ReplaceFst class supports an optionally caching arc iterator.

The ReplaceFst needs 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 (the FST is ilabel-sorted and matching on the input, or the FST is olabel -orted and matching on the output). In order to obtain the most efficient behaviour, it is recommended to set call_label_type to REPLACE_LABEL_INPUT or REPLACE_LABEL_BOTH and return_label_type to REPLACE_LABEL_OUTPUT or REPLACE_LABEL_NEITHER. This means that the call arc does not have epsilon on the input side and the return arc has epsilon on the input side) and matching on the input side.

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

Definition at line 947 of file replace.h.


Constructor & Destructor Documentation

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

Definition at line 967 of file replace.h.

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

Definition at line 972 of file replace.h.

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

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

Definition at line 977 of file replace.h.


Member Function Documentation

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

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

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

Definition at line 982 of file replace.h.

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

Definition at line 1005 of file replace.h.

template<class A, class T, class CacheStore>
const Fst<Arc>& fst::ReplaceFst< A, T, CacheStore >::GetFst ( Label  nonterminal  )  const [inline]

Definition at line 1011 of file replace.h.

template<class A, class T, class CacheStore>
const StateTable& fst::ReplaceFst< A, T, CacheStore >::GetStateTable (  )  const [inline]

Definition at line 1007 of file replace.h.

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

For generic arc iterator construction (not normally called directly by users).

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

Definition at line 989 of file replace.h.

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

For generic matcher construction (not normally called directly by users).

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

Definition at line 993 of file replace.h.

template<class Arc , class StateTable , class CacheStore >
void fst::ReplaceFst< Arc, StateTable, CacheStore >::InitStateIterator ( StateIteratorData< Arc > *  data  )  const [inline, override, virtual]

For generic state iterator construction (not normally called directly by users).

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

Definition at line 1414 of file replace.h.


Friends And Related Function Documentation

template<class A, class T, class CacheStore>
friend class ArcIterator< ReplaceFst< Arc, StateTable, CacheStore > > [friend]

Definition at line 963 of file replace.h.

template<class A, class T, class CacheStore>
friend class ReplaceFstMatcher< Arc, StateTable, CacheStore > [friend]

Definition at line 965 of file replace.h.

template<class A, class T, class CacheStore>
friend class StateIterator< ReplaceFst< Arc, StateTable, CacheStore > > [friend]

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