TWiki> FST Web>FstQuickTour>ReplaceDoc (revision 4)EditAttach

Replace

Description

Work in progress, under construction TBA

Usage

template <class Arc>
void Replace(const vector<pair<typename Arc::Label, const Fst<Arc>* > > >&label_fst_pairs, 
             MutableFst<Arc> *ofst,
             typename Arc::Label root,
             bool epsilon_on_replace);
doc [bad link?]
template <class Arc> ReplaceFst<Arc>::
ReplaceFst(const vector<pair<typename Arc::Label, const Fst<Arc>* > > > &label_fst_pairs,
           typename Arc::Label root);
doc
template <class Arc> ReplaceFst<Arc>::
ReplaceFst(const vector<pair<typename Arc::Label, const Fst<Arc>* > > > &label_fst_pairs,
           const ReplaceFstOptions<Arc> &opts);
fstreplace [--epsilon_on_replace] root.fst rootlabel [subfst1.fst label1 ....] [out.fst]

Examples

Symbol table:

eps 0
$Root 1
$Name 2
$FirstName 3
$LastName 4
dial 5
please 6
johan 7
schalkwyk 8
google 9
michael 10
riley 11

A1:

root FST:

g1.png

A2:

FST for nonterminal $Name :

g2.png

A3:

FST for nonterminal $FirstName :

g3.png

A4:

Fst for nonterminal $LastName :

g4.png

B:

g_out.png

vector<pair<Label, const Fst<Arc>*> > > label_fst_pairs;
label_fst_pairs.push_back(make_pair(1, A1.Copy()));
label_fst_pairs.push_back(make_pair(2, A2.Copy()));
label_fst_pairs.push_back(make_pair(3, A3.Copy()));
label_fst_pairs.push_back(make_pair(4, A4.Copy()));
Replace(label_fst_pairs, &B, 1, true);

ReplaceFst<Arc> B(label_fst_pairs, ReplaceFstOptions<Arc>(1, true));

fstreplace --epsilon_on_replace a1.fst 1 a2.fst 2 a3.fst 3 a4.fst 4 b.fst

Complexity

Work in progress, under construction TBA

Caveats

Work in progress, under construction TBA

-- CyrilAllauzen - 02 Mar 2009

Topic attachments
I Attachment History Action Size Date Who Comment
PNGpng g1.png r2 r1 manage 11.7 K 2009-03-02 - 20:09 CyrilAllauzen Replace example: root fst
PNGpng g2.png r2 r1 manage 12.7 K 2009-03-02 - 20:10 CyrilAllauzen Replace example: fst for nonterminal $Name
PNGpng g3.png r2 r1 manage 6.3 K 2009-03-02 - 20:10 CyrilAllauzen Replace example: fst for nonterminal $FirstName
PNGpng g4.png r2 r1 manage 6.9 K 2009-03-02 - 20:11 CyrilAllauzen Replace example: fst for nonterminal $LastName
PNGpng g_out.png r1 manage 22.1 K 2009-03-02 - 20:11 CyrilAllauzen Replace example: resulting fst
Edit | Attach | Watch | Print version | History: r10 | r6 < r5 < r4 < r3 | Backlinks | Raw View | Raw edit | More topic actions...
Topic revision: r4 - 2009-03-06 - CyrilAllauzen
 
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