Public Types | Public Member Functions | Static Public Member Functions | Friends

fst::CompactFst< A, C, U > Class Template Reference

#include <fst/compact-fst.h>

Inherits ImplToExpandedFst< CompactFstImpl< A, C, U > >.

Collaboration diagram for fst::CompactFst< A, C, U >:
Collaboration graph
[legend]

List of all members.

Public Types

typedef A Arc
typedef A::StateId StateId
typedef CompactFstImpl< A, C, U > Impl
typedef CacheState< A > State
typedef U Unsigned

Public Member Functions

template<class F , class G >
void friend Cast (const F &, G *)
 CompactFst ()
 CompactFst (const Fst< A > &fst, const C &compactor=C(), const CompactFstOptions &opts=CompactFstOptions())
 CompactFst (const Fst< A > &fst, C *compactor, const CompactFstOptions &opts=CompactFstOptions())
template<class Iterator >
 CompactFst (const Iterator &begin, const Iterator &end, const C &compactor=C(), const CompactFstOptions &opts=CompactFstOptions())
template<class Iterator >
 CompactFst (const Iterator &begin, const Iterator &end, C *compactor, const CompactFstOptions &opts=CompactFstOptions())
 CompactFst (const CompactFst< A, C, U > &fst, bool safe=false)
 See Fst<>::Copy() for doc.
virtual CompactFst< A, C, U > * Copy (bool safe=false) const
 Get a copy of this CompactFst. 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
template<class Iterator >
void SetCompactElements (const Iterator &b, const Iterator &e)

Static Public Member Functions

static CompactFst< A, C, U > * Read (istream &strm, const FstReadOptions &opts)
 Read a CompactFst from an input stream; return NULL on error.
static CompactFst< A, C, U > * Read (const string &filename)

Friends

class StateIterator< CompactFst< A, C, U > >
class ArcIterator< CompactFst< A, C, U > >

Detailed Description

template<class A, class C, class U>
class fst::CompactFst< A, C, U >

CompactFst. This class attaches interface to implementation and handles reference counting, delegating most methods to ImplToExpandedFst. The unsigned type U is used to represent indices into the compact arc array (uint32 by default, declared in fst-decl.h).

Definition at line 706 of file compact-fst.h.


Member Typedef Documentation

template<class A, class C, class U>
typedef A fst::CompactFst< A, C, U >::Arc

Reimplemented from fst::ImplToExpandedFst< CompactFstImpl< A, C, U > >.

Definition at line 712 of file compact-fst.h.

template<class A, class C, class U>
typedef CompactFstImpl<A, C, U> fst::CompactFst< A, C, U >::Impl

Definition at line 714 of file compact-fst.h.

template<class A, class C, class U>
typedef CacheState<A> fst::CompactFst< A, C, U >::State

Definition at line 715 of file compact-fst.h.

template<class A, class C, class U>
typedef A::StateId fst::CompactFst< A, C, U >::StateId

Reimplemented from fst::ImplToExpandedFst< CompactFstImpl< A, C, U > >.

Definition at line 713 of file compact-fst.h.

template<class A, class C, class U>
typedef U fst::CompactFst< A, C, U >::Unsigned

Definition at line 716 of file compact-fst.h.


Constructor & Destructor Documentation

template<class A, class C, class U>
fst::CompactFst< A, C, U >::CompactFst (  )  [inline]

Definition at line 718 of file compact-fst.h.

template<class A, class C, class U>
fst::CompactFst< A, C, U >::CompactFst ( const Fst< A > &  fst,
const C &  compactor = C(),
const CompactFstOptions opts = CompactFstOptions() 
) [inline, explicit]

Definition at line 720 of file compact-fst.h.

template<class A, class C, class U>
fst::CompactFst< A, C, U >::CompactFst ( const Fst< A > &  fst,
C *  compactor,
const CompactFstOptions opts = CompactFstOptions() 
) [inline]

Definition at line 724 of file compact-fst.h.

template<class A, class C, class U>
template<class Iterator >
fst::CompactFst< A, C, U >::CompactFst ( const Iterator &  begin,
const Iterator &  end,
const C &  compactor = C(),
const CompactFstOptions opts = CompactFstOptions() 
) [inline, explicit]

The following 2 constructors take as input two iterators delimiting a set of (already) compacted transitions, starting with the transitions out of the initial state. The format of the input differs for fixed out-degree and variable out-degree compactors.

  • For fixed out-degree compactors, the final weight (encoded as a compacted transition) needs to be given only for final states. All strings (compactor of size 1) will be assume to be terminated by a final state even when the final state is not implicitely given.
  • For variable out-degree compactors, the final weight (encoded as a compacted transition) needs to be given for all states and must appeared first in the list (for state s, final weight of s, followed by outgoing transitons in s).

These 2 constructors allows the direct construction of a CompactFst without first creating a more memory hungry 'regular' FST. This is useful when memory usage is severely constrained.

Definition at line 748 of file compact-fst.h.

template<class A, class C, class U>
template<class Iterator >
fst::CompactFst< A, C, U >::CompactFst ( const Iterator &  begin,
const Iterator &  end,
C *  compactor,
const CompactFstOptions opts = CompactFstOptions() 
) [inline]

Definition at line 754 of file compact-fst.h.

template<class A, class C, class U>
fst::CompactFst< A, C, U >::CompactFst ( const CompactFst< A, C, U > &  fst,
bool  safe = false 
) [inline]

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

Definition at line 759 of file compact-fst.h.


Member Function Documentation

template<class A, class C, class U>
template<class F , class G >
void friend fst::CompactFst< A, C, U >::Cast ( const F &  ,
G *   
)
template<class A, class C, class U>
virtual CompactFst<A, C, U>* fst::CompactFst< A, C, U >::Copy ( bool  safe = false  )  const [inline, virtual]

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

Implements fst::ExpandedFst< typename CompactFstImpl< A, C, U >::Arc >.

Definition at line 763 of file compact-fst.h.

template<class A, class C, class U>
virtual void fst::CompactFst< A, C, U >::InitArcIterator ( StateId  s,
ArcIteratorData< A > *  data 
) const [inline, virtual]

Definition at line 784 of file compact-fst.h.

template<class A, class C, class U>
virtual MatcherBase<A>* fst::CompactFst< A, C, U >::InitMatcher ( MatchType  match_type  )  const [inline, virtual]

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

Reimplemented from fst::Fst< typename CompactFstImpl< A, C, U >::Arc >.

Definition at line 788 of file compact-fst.h.

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

Definition at line 780 of file compact-fst.h.

template<class A, class C, class U>
static CompactFst<A, C, U>* fst::CompactFst< A, C, U >::Read ( const string &  filename  )  [inline, static]

Read a CompactFst from a file; return NULL on error Empty filename reads from standard input

Reimplemented from fst::ImplToExpandedFst< CompactFstImpl< A, C, U > >.

Definition at line 775 of file compact-fst.h.

template<class A, class C, class U>
static CompactFst<A, C, U>* fst::CompactFst< A, C, U >::Read ( istream &  strm,
const FstReadOptions opts 
) [inline, static]

Read a CompactFst from an input stream; return NULL on error.

Reimplemented from fst::ExpandedFst< typename CompactFstImpl< A, C, U >::Arc >.

Definition at line 768 of file compact-fst.h.

template<class A, class C, class U>
template<class Iterator >
void fst::CompactFst< A, C, U >::SetCompactElements ( const Iterator &  b,
const Iterator &  e 
) [inline]

Definition at line 793 of file compact-fst.h.


Friends And Related Function Documentation

template<class A, class C, class U>
friend class ArcIterator< CompactFst< A, C, U > > [friend]

Definition at line 709 of file compact-fst.h.

template<class A, class C, class U>
friend class StateIterator< CompactFst< A, C, U > > [friend]

Definition at line 708 of file compact-fst.h.


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