Public Member Functions | Static Public Member Functions | Friends

fst::CompactFst< A, ArcCompactor, Unsigned, CompactStore, CacheStore > Class Template Reference

namespace internal More...

#include <fst/compact-fst.h>

Inherits ImplToExpandedFst< internal::CompactFstImpl< A, DefaultCompactor< ArcCompactor, Unsigned, CompactStore >, CacheStore > >.

Collaboration diagram for fst::CompactFst< A, ArcCompactor, Unsigned, CompactStore, CacheStore >:
Collaboration graph
[legend]

List of all members.

Public Member Functions

template<class F , class G >
void friend Cast (const F &, G *)
 CompactFst ()
 CompactFst (const Fst< A > &fst, const ArcCompactor &compactor=ArcCompactor(), const CompactFstOptions &opts=CompactFstOptions(), std::shared_ptr< CompactStore > data=std::shared_ptr< CompactStore >())
 If data is not nullptr, it is assumed to be already initialized.
 CompactFst (const Fst< Arc > &fst, std::shared_ptr< ArcCompactor > compactor, const CompactFstOptions &opts=CompactFstOptions(), std::shared_ptr< CompactStore > data=std::shared_ptr< CompactStore >())
 If data is not nullptr, it is assumed to be already initialized.
template<class Iterator >
 CompactFst (const Iterator &begin, const Iterator &end, const ArcCompactor &compactor=ArcCompactor(), const CompactFstOptions &opts=CompactFstOptions())
template<class Iterator >
 CompactFst (const Iterator &begin, const Iterator &end, std::shared_ptr< ArcCompactor > compactor, const CompactFstOptions &opts=CompactFstOptions())
 CompactFst (const CompactFst< A, ArcCompactor, Unsigned, CompactStore, CacheStore > &fst, bool safe=false)
 See Fst<>::Copy() for doc.
CompactFst< A, ArcCompactor,
Unsigned, CompactStore,
CacheStore > * 
Copy (bool safe=false) const override
 Get a copy of this CompactFst. See Fst<>::Copy() for further doc.
bool Write (std::ostream &strm, const FstWriteOptions &opts) const override
 Writes an FST to an output stream; returns false on error.
bool Write (const string &filename) const override
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).
template<class Iterator >
void SetCompactElements (const Iterator &b, const Iterator &e)

Static Public Member Functions

static CompactFst< A,
ArcCompactor, Unsigned,
CompactStore, CacheStore > * 
Read (std::istream &strm, const FstReadOptions &opts)
 Read a CompactFst from an input stream; return nullptr on error.
static CompactFst< A,
ArcCompactor, Unsigned,
CompactStore, CacheStore > * 
Read (const string &filename)
template<class FST >
static bool WriteFst (const FST &fst, const ArcCompactor &compactor, std::ostream &strm, const FstWriteOptions &opts)

Friends

class StateIterator< CompactFst< A, ArcCompactor, Unsigned, CompactStore, CacheStore > >
 < for CacheArcIterator
class ArcIterator< CompactFst< A, ArcCompactor, Unsigned, CompactStore, CacheStore > >

Detailed Description

template<class A, class ArcCompactor, class Unsigned, class CompactStore, class CacheStore>
class fst::CompactFst< A, ArcCompactor, Unsigned, CompactStore, CacheStore >

namespace internal

This class attaches interface to implementation and handles reference counting, delegating most methods to ImplToExpandedFst. The Unsigned type is used to represent indices into the compact arc array. (Template argument defaults are declared in fst-decl.h.)

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


Constructor & Destructor Documentation

template<class A, class ArcCompactor, class Unsigned, class CompactStore, class CacheStore>
fst::CompactFst< A, ArcCompactor, Unsigned, CompactStore, CacheStore >::CompactFst (  )  [inline]

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

template<class A, class ArcCompactor, class Unsigned, class CompactStore, class CacheStore>
fst::CompactFst< A, ArcCompactor, Unsigned, CompactStore, CacheStore >::CompactFst ( const Fst< A > &  fst,
const ArcCompactor &  compactor = ArcCompactor(),
const CompactFstOptions opts = CompactFstOptions(),
std::shared_ptr< CompactStore >  data = std::shared_ptr<CompactStore>() 
) [inline, explicit]

If data is not nullptr, it is assumed to be already initialized.

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

template<class A, class ArcCompactor, class Unsigned, class CompactStore, class CacheStore>
fst::CompactFst< A, ArcCompactor, Unsigned, CompactStore, CacheStore >::CompactFst ( const Fst< Arc > &  fst,
std::shared_ptr< ArcCompactor >  compactor,
const CompactFstOptions opts = CompactFstOptions(),
std::shared_ptr< CompactStore >  data = std::shared_ptr<CompactStore>() 
) [inline]

If data is not nullptr, it is assumed to be already initialized.

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

template<class A, class ArcCompactor, class Unsigned, class CompactStore, class CacheStore>
template<class Iterator >
fst::CompactFst< A, ArcCompactor, Unsigned, CompactStore, CacheStore >::CompactFst ( const Iterator &  begin,
const Iterator &  end,
const ArcCompactor &  compactor = ArcCompactor(),
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 1048 of file compact-fst.h.

template<class A, class ArcCompactor, class Unsigned, class CompactStore, class CacheStore>
template<class Iterator >
fst::CompactFst< A, ArcCompactor, Unsigned, CompactStore, CacheStore >::CompactFst ( const Iterator &  begin,
const Iterator &  end,
std::shared_ptr< ArcCompactor >  compactor,
const CompactFstOptions opts = CompactFstOptions() 
) [inline]

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

template<class A, class ArcCompactor, class Unsigned, class CompactStore, class CacheStore>
fst::CompactFst< A, ArcCompactor, Unsigned, CompactStore, CacheStore >::CompactFst ( const CompactFst< A, ArcCompactor, Unsigned, CompactStore, CacheStore > &  fst,
bool  safe = false 
) [inline]

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

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


Member Function Documentation

template<class A, class ArcCompactor, class Unsigned, class CompactStore, class CacheStore>
template<class F , class G >
void friend fst::CompactFst< A, ArcCompactor, Unsigned, CompactStore, CacheStore >::Cast ( const F &  ,
G *   
)
template<class A, class ArcCompactor, class Unsigned, class CompactStore, class CacheStore>
CompactFst<A, ArcCompactor, Unsigned, CompactStore, CacheStore>* fst::CompactFst< A, ArcCompactor, Unsigned, CompactStore, CacheStore >::Copy ( bool  safe = false  )  const [inline, override, virtual]
template<class A, class ArcCompactor, class Unsigned, class CompactStore, class CacheStore>
void fst::CompactFst< A, ArcCompactor, Unsigned, CompactStore, 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::CompactFstImpl< A, DefaultCompactor< ArcCompactor, Unsigned, CompactStore >, CacheStore >::Arc >.

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

template<class A, class ArcCompactor, class Unsigned, class CompactStore, class CacheStore>
MatcherBase<Arc>* fst::CompactFst< A, ArcCompactor, Unsigned, CompactStore, 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::CompactFstImpl< A, DefaultCompactor< ArcCompactor, Unsigned, CompactStore >, CacheStore >::Arc >.

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

template<class A, class ArcCompactor, class Unsigned, class CompactStore, class CacheStore>
void fst::CompactFst< A, ArcCompactor, Unsigned, CompactStore, 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::CompactFstImpl< A, DefaultCompactor< ArcCompactor, Unsigned, CompactStore >, CacheStore >::Arc >.

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

template<class A, class ArcCompactor, class Unsigned, class CompactStore, class CacheStore>
static CompactFst<A, ArcCompactor, Unsigned, CompactStore, CacheStore>* fst::CompactFst< A, ArcCompactor, Unsigned, CompactStore, CacheStore >::Read ( const string &  filename  )  [inline, static]

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

Reimplemented from fst::ImplToExpandedFst< internal::CompactFstImpl< A, DefaultCompactor< ArcCompactor, Unsigned, CompactStore >, CacheStore > >.

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

template<class A, class ArcCompactor, class Unsigned, class CompactStore, class CacheStore>
static CompactFst<A, ArcCompactor, Unsigned, CompactStore, CacheStore>* fst::CompactFst< A, ArcCompactor, Unsigned, CompactStore, CacheStore >::Read ( std::istream &  strm,
const FstReadOptions opts 
) [inline, static]

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

Reimplemented from fst::ImplToExpandedFst< internal::CompactFstImpl< A, DefaultCompactor< ArcCompactor, Unsigned, CompactStore >, CacheStore > >.

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

template<class A, class ArcCompactor, class Unsigned, class CompactStore, class CacheStore>
template<class Iterator >
void fst::CompactFst< A, ArcCompactor, Unsigned, CompactStore, CacheStore >::SetCompactElements ( const Iterator &  b,
const Iterator &  e 
) [inline]

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

template<class A, class ArcCompactor, class Unsigned, class CompactStore, class CacheStore>
bool fst::CompactFst< A, ArcCompactor, Unsigned, CompactStore, CacheStore >::Write ( std::ostream &  strm,
const FstWriteOptions opts 
) const [inline, override, virtual]

Writes an FST to an output stream; returns false on error.

Reimplemented from fst::Fst< typename internal::CompactFstImpl< A, DefaultCompactor< ArcCompactor, Unsigned, CompactStore >, CacheStore >::Arc >.

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

template<class A, class ArcCompactor, class Unsigned, class CompactStore, class CacheStore>
bool fst::CompactFst< A, ArcCompactor, Unsigned, CompactStore, CacheStore >::Write ( const string &  filename  )  const [inline, override, virtual]

Writes an FST to a file; returns false on error; an empty filename results in writing to standard output.

Reimplemented from fst::Fst< typename internal::CompactFstImpl< A, DefaultCompactor< ArcCompactor, Unsigned, CompactStore >, CacheStore >::Arc >.

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

template<class A , class ArcCompactor , class Unsigned , class CompactStore , class CacheStore >
template<class FST >
bool fst::CompactFst< A, ArcCompactor, Unsigned, CompactStore, CacheStore >::WriteFst ( const FST &  fst,
const ArcCompactor &  compactor,
std::ostream &  strm,
const FstWriteOptions opts 
) [static]

Writes FST in Compact format, with a possible pass over the machine before writing to compute the number of states and arcs.

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


Friends And Related Function Documentation

template<class A, class ArcCompactor, class Unsigned, class CompactStore, class CacheStore>
friend class ArcIterator< CompactFst< A, ArcCompactor, Unsigned, CompactStore, CacheStore > > [friend]

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

template<class A, class ArcCompactor, class Unsigned, class CompactStore, class CacheStore>
friend class StateIterator< CompactFst< A, ArcCompactor, Unsigned, CompactStore, CacheStore > > [friend]

< for CacheArcIterator

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