#include <fst/edit-fst.h>
Inherits fst::FstImpl< A >.

Public Types | |
| typedef A | Arc |
| typedef Arc::Weight | Weight |
| typedef Arc::StateId | StateId |
Public Member Functions | |
| EditFstImpl () | |
| EditFstImpl (const Fst< A > &wrapped) | |
| EditFstImpl (const EditFstImpl &impl) | |
| ~EditFstImpl () | |
| StateId | Start () const |
| Weight | Final (StateId s) const |
| size_t | NumArcs (StateId s) const |
| size_t | NumInputEpsilons (StateId s) const |
| size_t | NumOutputEpsilons (StateId s) const |
| StateId | NumStates () const |
| bool | Write (ostream &strm, const FstWriteOptions &opts) const |
| void | SetStart (StateId s) |
| end const Fst operations | |
| void | SetFinal (StateId s, Weight w) |
| Sets the final state for this fst. | |
| StateId | AddState () |
| Adds a new state to this fst, initially with no arcs. | |
| void | AddArc (StateId s, const Arc &arc) |
| Adds the specified arc to the specified state of this fst. | |
| void | DeleteStates (const vector< StateId > &dstates) |
| void | DeleteStates () |
| Deletes all states in this fst. | |
| void | DeleteArcs (StateId s, size_t n) |
| Removes all but the first n outgoing arcs of the specified state. | |
| void | DeleteArcs (StateId s) |
| Removes all outgoing arcs from the specified state. | |
| void | InitStateIterator (StateIteratorData< Arc > *data) const |
| end non-const MutableFst operations | |
| void | InitArcIterator (StateId s, ArcIteratorData< Arc > *data) const |
| Provides information for the generic arc iterator. | |
| void | InitMutableArcIterator (StateId s, MutableArcIteratorData< A > *data) |
| Provides information for the generic mutable arc iterator. | |
Static Public Member Functions | |
| static EditFstImpl< A, MutableFstT > * | Read (istream &strm, const FstReadOptions &opts) |
This class enables non-destructive edit operations on a wrapped ExpandedFst. The implementation uses copy-on-write semantics at the node level: if a user has an underlying fst on which he or she wants to perform a relatively small number of edits (read: mutations), then this implementation will copy the edited node to an internal MutableFst and perform any edits in situ on that copied node. This class supports all the methods of MutableFst except for DeleteStates(const vector<StateId> &); thus, new nodes may also be added, and one may add transitions from existing nodes of the wrapped fst to new nodes.
template parameters: A the type of arc to use MutableFstT the type of mutable fst to use internally for edited states
Definition at line 42 of file edit-fst.h.
| typedef A fst::EditFstImpl< A, MutableFstT >::Arc |
Definition at line 49 of file edit-fst.h.
| typedef Arc::StateId fst::EditFstImpl< A, MutableFstT >::StateId |
Reimplemented from fst::FstImpl< A >.
Definition at line 51 of file edit-fst.h.
| typedef Arc::Weight fst::EditFstImpl< A, MutableFstT >::Weight |
Reimplemented from fst::FstImpl< A >.
Definition at line 50 of file edit-fst.h.
| fst::EditFstImpl< A, MutableFstT >::EditFstImpl | ( | ) | [inline] |
Constructs an editable fst implementation with no states. Effectively, this initially-empty fst will in every way mimic the behavior of a VectorFst--more precisely, a VectorFstImpl instance--but with slightly slower performance (by a constant factor), due to the fact that this class maintains a mapping between external state id's and their internal equivalents.
Definition at line 59 of file edit-fst.h.
| fst::EditFstImpl< A, MutableFstT >::EditFstImpl | ( | const Fst< A > & | wrapped | ) | [inline, explicit] |
Wraps the specified ExpandedFst. This constructor requires that the specified Fst is an ExpandedFst instance. This requirement is only enforced at runtime. (See below for the reason.)
This library uses the pointer-to-implementation or "PIMPL" design pattern. In particular, to make it convenient to bind an implementation class to its interface, there are a pair of template "binder" classes, one for immutable and one for mutable fst's (ImplToFst and ImplToMutableFst, respectively). As it happens, the API for the ImplToMutableFst<I,F> class requires that the implementation class--the template parameter "I"--have a constructor taking a const Fst reference. Accordingly, the constructor here must perform a static_cast to the ExpandedFst type required by EditFst and therefore EditFstImpl.
Definition at line 79 of file edit-fst.h.
| fst::EditFstImpl< A, MutableFstT >::EditFstImpl | ( | const EditFstImpl< A, MutableFstT > & | impl | ) | [inline] |
A copy constructor for this implementation class, used to implement the Copy() method of the Fst interface.
Definition at line 94 of file edit-fst.h.
| fst::EditFstImpl< A, MutableFstT >::~EditFstImpl | ( | ) | [inline] |
Definition at line 104 of file edit-fst.h.
| void fst::EditFstImpl< A, MutableFstT >::AddArc | ( | StateId | s, | |
| const Arc & | arc | |||
| ) | [inline] |
Adds the specified arc to the specified state of this fst.
Definition at line 369 of file edit-fst.h.
| A::StateId fst::EditFstImpl< A, MutableFstT >::AddState | ( | ) | [inline] |
Adds a new state to this fst, initially with no arcs.
Definition at line 359 of file edit-fst.h.
| void fst::EditFstImpl< A, MutableFstT >::DeleteArcs | ( | StateId | s | ) | [inline] |
Removes all outgoing arcs from the specified state.
Definition at line 212 of file edit-fst.h.
| void fst::EditFstImpl< A, MutableFstT >::DeleteArcs | ( | StateId | s, | |
| size_t | n | |||
| ) | [inline] |
Removes all but the first n outgoing arcs of the specified state.
Definition at line 206 of file edit-fst.h.
| void fst::EditFstImpl< A, MutableFstT >::DeleteStates | ( | const vector< StateId > & | dstates | ) | [inline] |
Definition at line 197 of file edit-fst.h.
| void fst::EditFstImpl< A, MutableFstT >::DeleteStates | ( | ) | [inline] |
Deletes all states in this fst.
Definition at line 386 of file edit-fst.h.
| Weight fst::EditFstImpl< A, MutableFstT >::Final | ( | StateId | s | ) | const [inline] |
Definition at line 115 of file edit-fst.h.
| void fst::EditFstImpl< A, MutableFstT >::InitArcIterator | ( | StateId | s, | |
| ArcIteratorData< Arc > * | data | |||
| ) | const [inline] |
Provides information for the generic arc iterator.
Definition at line 226 of file edit-fst.h.
| void fst::EditFstImpl< A, MutableFstT >::InitMutableArcIterator | ( | StateId | s, | |
| MutableArcIteratorData< A > * | data | |||
| ) | [inline] |
Provides information for the generic mutable arc iterator.
Definition at line 236 of file edit-fst.h.
| void fst::EditFstImpl< A, MutableFstT >::InitStateIterator | ( | StateIteratorData< Arc > * | data | ) | const [inline] |
end non-const MutableFst operations
Provides information for the generic state iterator.
Definition at line 220 of file edit-fst.h.
| size_t fst::EditFstImpl< A, MutableFstT >::NumArcs | ( | StateId | s | ) | const [inline] |
Definition at line 127 of file edit-fst.h.
| size_t fst::EditFstImpl< A, MutableFstT >::NumInputEpsilons | ( | StateId | s | ) | const [inline] |
Definition at line 133 of file edit-fst.h.
| size_t fst::EditFstImpl< A, MutableFstT >::NumOutputEpsilons | ( | StateId | s | ) | const [inline] |
Definition at line 139 of file edit-fst.h.
| StateId fst::EditFstImpl< A, MutableFstT >::NumStates | ( | ) | const [inline] |
Definition at line 146 of file edit-fst.h.
| EditFstImpl< A, MutableFstT > * fst::EditFstImpl< A, MutableFstT >::Read | ( | istream & | strm, | |
| const FstReadOptions & | opts | |||
| ) | [static] |
Definition at line 401 of file edit-fst.h.
| void fst::EditFstImpl< A, MutableFstT >::SetFinal | ( | StateId | s, | |
| Weight | w | |||
| ) | [inline] |
Sets the final state for this fst.
Definition at line 343 of file edit-fst.h.
| void fst::EditFstImpl< A, MutableFstT >::SetStart | ( | StateId | s | ) | [inline] |
end const Fst operations
EditFstImpl IMPLEMENTATION STARTS HERE.
non-const MutableFst operations Sets the start state for this fst.
Definition at line 337 of file edit-fst.h.
| StateId fst::EditFstImpl< A, MutableFstT >::Start | ( | ) | const [inline] |
const Fst/ExpandedFst operations, declared in the Fst and ExpandedFst interfaces
Definition at line 110 of file edit-fst.h.
| bool fst::EditFstImpl< A, MutableFstT >::Write | ( | ostream & | strm, | |
| const FstWriteOptions & | opts | |||
| ) | const [inline] |
Definition at line 153 of file edit-fst.h.
1.7.1