Map
Description
This operation transforms each arc and final state in the input FST. The transformation is specified by a function object called
a
mapper.
For instance,
RmWeightMapper

replaces the weight of every arc and final state by
1.
A list of available mappers and instructions on how to create them are given
here.
Usage
template <class Arc, class Mapper>
Map(MutableFst<Arc> *fst, Mapper *mapper); |
[bad link?] |
template <class Arc, class Mapper>
Map(MutableFst<Arc> *fst, Mapper mapper); |
template <class Arc, class Mapper>
Map(const Fst<Arc> &ifst, MutableFst<Arc> *ofst, Mapper *mapper); |
template <class Arc, class Mapper>
Map(const Fst<Arc> &ifst, MutableFst<Arc> *ofst, Mapper mapper); |
template <class Arc, class Mapper> MapFst<Arc>::
MapFst(const Fst<A> &fst, Mapper *mapper); |
|
template <class Arc, class Mapper> MapFst<Arc>::
MapFst(const Fst<A> &fst, const Mapper &mapper); |
fstmap [--opts] in.fst out.fst
-delta (Comparison/quantization delta) type: double default: 0.0009765625
-map_type (Map operation, one of: "identity", "invert", "plus (--weight)",
"quantize (--delta)", "rmweight", "superfinal", "times (--weight)"
) type: string default: "identity"
-weight (Weight parameter) type: string default: ""
|
Example
A
:
Map(&A, RmWeightMapper())
:
Map(&A, RmWeightMapper<StdArc>());
Map(A, &B, RmWeightMapper<StdArc>());
MapFst B(A, RmWeightMapper<StdArc>());
fstmap --map_type=rmweight a.fst b.fst
Complexity
Map:
- Time: O(c*(V + E))
- Space: O(m)
where
V = # of states,
E = # of arcs in input FST,
c = cost of processing one arc by the mapper and
m = total memory usage for the mapper.
MapFst:
- Time: O(c*(v + e))
- Space: O(m)
where
v = # of visited states,
e = # of visited arcs in input FST,
c = cost of processing one arc by the mapper and
m = total memory usage for the mapper. Constant time and space to visit an input state or arc is assumed and exclusive of
caching.
For instance in the case of
RmWeightMapper
, we have
c = O(1) and
m = O(1).
--
CyrilAllauzen - 04 Mar 2009