fstprune

According to the documentation:

This operation deletes states and arcs in the input FST that do not belong to a successful path whose weight is no more (w.r.t the natural the natural semiring order) than the threshold t ⊗-times the weight of the shortest path in the input FST.

Weights need to be commutative and have the path property. Both destructive and constructive implemenations are available

Example:

 

 

 

unprunedfst

The fst:

0 0 0 0 0.699999988
0 1 0 0 0.299899995
0 2 0 0 9.99999975e-05
1
2 Infinity

After running

fstprune –weight=3 unpruned.fst pruned.fst

generates the new fst

0 0 0 0 0.699999988
0 1 0 0 0.299899995
1

Which has had the state 2 removed, as well as the transition to that state.

The demo can be found at /projects/speech/sys/kaldi-master/egs/rm/s5-avt26/demo/

Leave a Reply