TWiki> FST Web>FstQuickTour>ArcMapDoc (revision 7)EditAttach

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 doc 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); 
doc [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); 
doc
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:

map1.png

Map(&A, RmWeightMapper()):

map2.png

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

Topic attachments
I Attachment History Action Size Date Who Comment
PNGpng map1.png r1 manage 19.1 K 2009-03-17 - 19:13 CyrilAllauzen Map example: input FST
PNGpng map2.png r1 manage 18.2 K 2009-03-17 - 19:13 CyrilAllauzen Map example: output FST
Edit | Attach | Watch | Print version | History: r11 | r9 < r8 < r7 < r6 | Backlinks | Raw View | Raw edit | More topic actions...
Topic revision: r7 - 2011-04-12 - AntoineAmarilli
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 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