TWiki
>
FST Web
>
FstQuickTour
>
StateMapDoc
(revision 1) (raw view)
Edit
Attach
---+ !StateMap ---++ Description This operation transforms each state in the input FST. The transformation is specified by a function object called a _state mapper_. For instance, =ArcSumMapper= %DOX{structfst_1_1_arc_sum_mapper.html[%H%]}% combines arcs with the same input label, output label and destination state, summing their weights. A list of available state mappers and instructions on how to create them are given [[FstAdvancedUsage#StateMappers][here]]. ---++ Usage | <verbatim>template <class Arc, class StateMapper> StateMap(MutableFst<Arc> *fst, StateMapper *mapper); </verbatim> | %DOX{namespacefst.html#StateMap[%H%]}% | | <verbatim>template <class Arc, class StateMapper> StateMap(MutableFst<Arc> *fst, StateMapper mapper); </verbatim> |^| | <verbatim>template <class Arc, class StateMapper> StateMap(const Fst<Arc> &ifst, MutableFst<Arc> *ofst, StateMapper *mapper); </verbatim> |^| | <verbatim>template <class Arc, class StateMapper> StateMap(const Fst<Arc> &ifst, MutableFst<Arc> *ofst, StateMapper mapper); </verbatim> |^| | <verbatim>template <class Arc, class StateMapper> StateMapFst<Arc>:: StateMapFst(const Fst<A> &fst, StateMapper *mapper); </verbatim> | %DOX{fst::StateMapFst[%H%]}% | | <verbatim>template <class Arc, class StateMapper> StateMapFst<Arc>:: StateMapFst(const Fst<A> &fst, const StateMapper &mapper); </verbatim> |^| | <verbatim>fstmap [--opts] in.fst out.fst -map_type (Map operation, one of: "identity", "arc_sum") type: string default: "identity" -weight (Weight parameter) type: string default: "" </verbatim> || Note =fstmap= also includes [[ArcMapDoc][arc mappers]]. ---++ Example (Under construction). ---+++ =A=: %ATTACHURL%/map1.png ---+++ =StateMap(&A, <nop>ArcSumMapper(A))=: %ATTACHURL%/map2.png <verbatim> StateMap(&A, ArcSumMapper<StdArc>(A)); StateMap(A, &B, ArcSumMapper<StdArc>(A)); StateMapFst B(A, ArcSumMapper<StdArc>(A)); fstmap --map_type=arc_sum a.fst b.fst </verbatim> ---++ Complexity =StateMap:= * Time: _O(c*V)_ * Space: _O(m)_ where _V_ = # of states, _c_ = cost of processing one state by the mapper and _m_ = total memory usage for the mapper. =StateMapFst:= * Time: _O(c*v)_ * Space: _O(m)_ where _v_ = # of visited states, _c_ = cost of processing one state by the mapper and _m_ = total memory usage for the mapper. Constant time and space to visit an input state is assumed and exclusive of [[FstAdvancedUsage#FstCaching][caching]]. For instance in the case of =ArcSumMap=, we have _c = O(D log(D))_ and _m = O(D)_, where _D_ = maximum out-degree. -- Main.MichaelRiley - 05 Dec 2011
Edit
|
Attach
|
Watch
|
P
rint version
|
H
istory
:
r4
<
r3
<
r2
<
r1
|
B
acklinks
|
V
iew topic
|
Raw edit
|
More topic actions...
Topic revision: r1 - 2011-12-05
-
MichaelRiley
FST
Log In
or
Register
FST Web
Create New Topic
Index
Search
Changes
Notifications
Statistics
Preferences
Webs
Contrib
FST
Forum
GRM
Kernel
Main
Sandbox
TWiki
Main
Copyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki?
Send feedback