22 #ifndef TROPICALSPARSETUPLEWEIGHTFUNCS_H_ 23 #define TROPICALSPARSETUPLEWEIGHTFUNCS_H_ 29 unordered_set<uint>& idx ) {
30 typedef TupleArc32::StateId StateId;
31 for ( StateIterator< VectorFst<TupleArc32> > si ( myfst ); !si.Done();
33 StateId state_id = si.Value();
34 for ( MutableArcIterator< VectorFst<TupleArc32> > ai ( &myfst, si.Value() );
35 !ai.Done(); ai.Next() ) {
36 const TupleW32 w = ai.Value().weight;
37 for ( SparseTupleWeightIterator<FeatureWeight32, int> it ( w ); !it.Done();
39 idx.insert ( it.Value().first );
Implements Tropical Sparse tuple weight semiring, extending from openfst SparsePowerWeight class...
void listSparseFeatureIndices(VectorFst< TupleArc32 > &myfst, unordered_set< uint > &idx)
Traverses a machine and returns the indices actually used for the sparse vector weight tropical semir...