Relabel
Description
TBA
This operation relabels the input and/or output labels of an FST. The relabeling can be specified by a set of pair of integer labels.
When the FST has input and/or output symbol tables, the relabeling can be specified by giving new input and/or output symbol tables. The operation then modifies the interger labels of each arc in such a way that its symbolic labels are preserved.
Usage
template <class Arc>
void Relabel(
MutableFst<Arc> *fst,
const vector<pair<typename Arc::Label, typename A::Label> >& ipairs,
const vector<pair<typename Arc::Label, typename A::Label> >& opairs);
|
[bad link?] |
template<class Arc>
void Relabel(
MutableFst<Arc> *fst,
const SymbolTable* new_isymbols,
const SymbolTable* new_osymbols);
|
template <class Arc> RelabelFst<Arc>::
RelabelFst(const Fst<A>& fst,
const vector<pair<Label, Label> >& ipairs,
const vector<pair<Label, Label> >& opairs);
|
|
template <class Arc> RelabelFst<Arc>::
RelabelFst(const Fst<A>& fst,
const SymbolTable* new_isymbols,
const SymbolTable* new_osymbols)
|
fstrelabel [--relabel_ipairs=$ipairs] [--relabel_opairs=$opairs] in.fst out.fst
|
fstrelabel [--relabel_isymbols=$isyms] [--relabel_osymbols=$osyms] in.fst out.fst
|
Examples
TBA
A
:
symbol table S1 |
eps |
0 |
a |
1 |
b |
2 |
c |
3 |
d |
4 |
f |
5 |
g |
6 |
A |
|
|
B
:
S2 |
eps |
0 |
g |
1 |
f |
2 |
d |
3 |
c |
4 |
b |
5 |
a |
6 |
B |
|
|
fstrelabel --relabel_isymbols=s2 --relabel_osymbols=s2 a.fst b.fst
Complexity
Relabel
- Time: O(V + E + Si + So)
- Space: O(Si + So)
where
V = # of states,
E = # of arcs of the input FST,
Si = # of input symbols and
So = # of output symbols.
RelabelFst
- Time: O(v + e + Si + So)
- Space: O(Si + So)
where
v = # of states visited,
e = # of arcs visited of the input FST,
Si = # of input symbols and
So = # of output symbols. Constant time and space to visit an input state or arc is assumed and exclusive of
caching.
--
CyrilAllauzen - 03 Mar 2009