22 #ifndef KALDI_FSTEXT_GRAMMAR_CONTEXT_FST_H_ 23 #define KALDI_FSTEXT_GRAMMAR_CONTEXT_FST_H_ 47 #include <fst/fstlib.h> 48 #include <fst/fst-decl.h> 92 return medium_number *
93 ((nonterm_phones_offset + medium_number) / medium_number);
121 int32 nonterm_phones_offset,
122 const std::vector<int32> &disambig_syms,
123 const VectorFst<StdArc> &ifst,
124 VectorFst<StdArc> *ofst,
125 std::vector<std::vector<int32> > *ilabels);
170 const std::vector<int32>& phones,
171 const std::vector<int32>& disambig_syms);
211 virtual StateId
Start() {
return 0; }
213 virtual Weight
Final(StateId s);
216 virtual bool GetArc(StateId s, Label ilabel, Arc *arc);
241 Label
FindLabel(
const std::vector<int32> &label_info);
247 typedef unordered_map<std::vector<int32>,
Label,
287 #endif // KALDI_FSTEXT_GRAMMAR_CONTEXT_FST_H_ fst::StdArc::StateId StateId
void SwapIlabelInfo(std::vector< std::vector< int32 > > *vec)
A hashing function-object for vectors.
For an extended explanation of the framework of which grammar-fsts are a part, please see Support for...
virtual StateId Start()
Here is a note on the state space of InverseLeftBiphoneContextFst; see Special symbols in C...
NonterminalValues
An anonymous enum to define some values for symbols used in our grammar-fst framework.
InverseLeftBiphoneContextFst(Label nonterm_phones_offset, const std::vector< int32 > &phones, const std::vector< int32 > &disambig_syms)
Constructor.
virtual bool GetArc(StateId s, Label ilabel, Arc *arc)
Note: ilabel must not be epsilon.
class DeterministicOnDemandFst is an "FST-like" base-class.
std::vector< std::vector< int32 > > ilabel_info_
const std::vector< std::vector< int32 > > & IlabelInfo() const
VectorToLabelMap ilabel_map_
virtual Weight Final(StateId s)
void ComposeContextLeftBiphone(int32 nonterm_phones_offset, const vector< int32 > &disambig_syms_in, const VectorFst< StdArc > &ifst, VectorFst< StdArc > *ofst, std::vector< std::vector< int32 > > *ilabels)
This is a variant of the function ComposeContext() which is to be used with our "grammar FST" framewo...
fst::StdArc::Weight Weight
unordered_map< std::vector< int32 >, Label, kaldi::VectorHasher< int32 > > VectorToLabelMap
Label FindLabel(const std::vector< int32 > &label_info)
Finds the label index corresponding to this context-window of phones (likely of width context_width_)...
int32 nonterm_phones_offset_
int32 GetEncodingMultiple(int32 nonterm_phones_offset)
~InverseLeftBiphoneContextFst()
kaldi::ConstIntegerSet< Label > disambig_syms_
int32 GetPhoneSymbolFor(enum NonterminalValues n)
kaldi::ConstIntegerSet< Label > phone_syms_