ArcMap

Description

This operation transforms each arc and final state in the input FST. The transformation is specified by a function object called an arc mapper.

For instance, RmWeightMapper doc replaces the weight of every arc and final state by 1.

A list of available arc mappers and instructions on how to create them are given here.

Usage

template <class Arc, class ArcMapper>
ArcMap(MutableFst<Arc> *fst, ArcMapper *mapper); 
 
template <class Arc, class ArcMapper>
ArcMap(MutableFst<Arc> *fst, ArcMapper mapper); 
template <class Arc, class ArcMapper>
ArcMap(const Fst<Arc> &ifst, MutableFst<Arc> *ofst, ArcMapper *mapper); 
template <class Arc, class ArcMapper>
ArcMap(const Fst<Arc> &ifst, MutableFst<Arc> *ofst, ArcMapper mapper); 
template <class Arc, class ArcMapper> ArcMapFst<Arc>::
ArcMapFst(const Fst<A> &fst, ArcMapper *mapper); 
doc
template <class Arc, class ArcMapper> ArcMapFst<Arc>::
ArcMapFst(const Fst<A> &fst, const ArcMapper &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)",
      "to_log", "to_log64", "to_standard"
      ) type: string default: "identity"
    -weight (Weight parameter) type: string default: ""

Note fstmap also includes state mappers.

Example

A:

map1.png

ArcMap(&A, RmWeightMapper()):

map2.png

ArcMap(&A, RmWeightMapper<StdArc>());
ArcMap(A, &B, RmWeightMapper<StdArc>());
ArcMapFst B(A, RmWeightMapper<StdArc>());

fstmap --map_type=rmweight a.fst b.fst

Complexity

ArcMap:

  • 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.

ArcMapFst:

  • 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).

See Also

Arc Mappers, StateMap

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 < r10 < r9 < r8 < r7 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r11 - 2018-04-27 - MichaelRiley
 
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