For an extended explanation of the framework of which grammar-fsts are a part, please see Support for grammars and graphs with on-the-fly parts. (i.e. More...
Namespaces | |
internal | |
pre_determinize_helpers | |
Typedefs | |
typedef fst::StdArc | StdArc |
typedef fst::StdArc::Label | Label |
typedef fst::StdArc::StateId | StateId |
typedef fst::StdVectorFst | StdVectorFst |
typedef fst::StdArc::Weight | Weight |
typedef unsigned char | StatePropertiesType |
typedef VectorFstTplHolder< StdArc > | VectorFstHolder |
typedef float | BaseFloat |
typedef LatticeWeightTpl< BaseFloat > | LatticeWeight |
typedef CompactLatticeWeightTpl< LatticeWeight, int32 > | CompactLatticeWeight |
typedef CompactLatticeWeightCommonDivisorTpl< LatticeWeight, int32 > | CompactLatticeWeightCommonDivisor |
typedef ArcticWeightTpl< float > | ArcticWeight |
Enumerations | |
enum | { kStateHasEpsilonArcsEntering = 0x1, kStateHasNonEpsilonArcsEntering = 0x2, kStateHasEpsilonArcsLeaving = 0x4, kStateHasNonEpsilonArcsLeaving = 0x8 } |
enum | StatePropertiesEnum { kStateFinal = 0x1, kStateInitial = 0x2, kStateArcsIn = 0x4, kStateMultipleArcsIn = 0x8, kStateArcsOut = 0x10, kStateMultipleArcsOut = 0x20, kStateOlabelsOut = 0x40, kStateIlabelsOut = 0x80 } |
enum | NonterminalValues { kNontermBos = 0, kNontermBegin = 1, kNontermEnd = 2, kNontermReenter = 3, kNontermUserDefined = 4, kNontermMediumNumber = 1000, kNontermBigNumber = 10000000 } |
An anonymous enum to define some values for symbols used in our grammar-fst framework. More... | |
Functions | |
template<class Arc > | |
static VectorFst< Arc > * | GenAcceptorFromSequence (const vector< typename Arc::Label > &symbols, float cost) |
template<class Arc > | |
static float | CheckPhones (const VectorFst< Arc > &linear_fst, const vector< typename Arc::Label > &phone_ids, const vector< typename Arc::Label > &disambig_ids, const vector< typename Arc::Label > &phone_seq, const vector< vector< typename Arc::Label > > &ilabel_info, int N, int P) |
template<class Arc > | |
static VectorFst< Arc > * | GenRandPhoneSeq (vector< typename Arc::Label > &phone_syms, vector< typename Arc::Label > &disambig_syms, typename Arc::Label subsequential_symbol, int num_subseq_syms, float seq_prob, vector< typename Arc::Label > *phoneseq_out) |
static void | TestContextFst (bool verbose, bool use_matcher) |
void | ComposeContext (const vector< int32 > &disambig_syms_in, int32 context_width, int32 central_position, VectorFst< StdArc > *ifst, VectorFst< StdArc > *ofst, vector< vector< int32 > > *ilabels_out, bool project_ifst) |
Used in the command-line tool fstcomposecontext. More... | |
void | AddSubsequentialLoop (StdArc::Label subseq_symbol, MutableFst< StdArc > *fst) |
Modifies an FST so that it transuces the same paths, but the input side of the paths can all have the subsequential symbol '$' appended to them any number of times (we could easily specify the number of times, but accepting any number of repetitions is just more convenient). More... | |
void | WriteILabelInfo (std::ostream &os, bool binary, const vector< vector< int32 > > &info) |
Utility function for writing ilabel-info vectors to disk. More... | |
void | ReadILabelInfo (std::istream &is, bool binary, vector< vector< int32 > > *info) |
Utility function for reading ilabel-info vectors from disk. More... | |
SymbolTable * | CreateILabelInfoSymbolTable (const vector< vector< int32 > > &info, const SymbolTable &phones_symtab, std::string separator, std::string initial_disambig) |
The following function is mainly of use for printing and debugging. More... | |
void | WriteILabelInfo (std::ostream &os, bool binary, const std::vector< std::vector< int32 > > &ilabel_info) |
Utility function for writing ilabel-info vectors to disk. More... | |
void | ReadILabelInfo (std::istream &is, bool binary, std::vector< std::vector< int32 > > *ilabel_info) |
Utility function for reading ilabel-info vectors from disk. More... | |
SymbolTable * | CreateILabelInfoSymbolTable (const std::vector< std::vector< int32 > > &ilabel_info, const SymbolTable &phones_symtab, std::string separator, std::string disambig_prefix) |
The following function is mainly of use for printing and debugging. More... | |
void | ComposeContext (const std::vector< int32 > &disambig_syms, int32 context_width, int32 central_position, VectorFst< StdArc > *ifst, VectorFst< StdArc > *ofst, std::vector< std::vector< int32 > > *ilabels_out, bool project_ifst=false) |
Used in the command-line tool fstcomposecontext. More... | |
template<class Arc > | |
void | ComposeDeterministicOnDemand (const Fst< Arc > &fst1, DeterministicOnDemandFst< Arc > *fst2, MutableFst< Arc > *fst_composed) |
template<class Arc > | |
void | ComposeDeterministicOnDemandInverse (const Fst< Arc > &fst1, DeterministicOnDemandFst< Arc > *fst2, MutableFst< Arc > *fst_composed) |
This function does '*fst_composed = Compose(Inverse(*fst2), fst1)' Note that the arguments are reversed; this is unfortunate but it's because the fst2 argument needs to be non-const and non-const arguments must follow const ones. More... | |
bool | FileExists (std::string strFilename) |
StdVectorFst * | CreateBackoffFst () |
StdVectorFst * | CreateResultFst () |
void | DeleteTestFst (StdVectorFst *fst) |
Weight | WalkSinglePath (StdVectorFst *ifst, DeterministicOnDemandFst< StdArc > *dfst) |
void | TestBackoffAndCache () |
void | TestCompose () |
template<class Weight , class IntType > | |
bool | DeterminizeLattice (const Fst< ArcTpl< Weight > > &ifst, MutableFst< ArcTpl< Weight > > *ofst, DeterminizeLatticeOptions opts=DeterminizeLatticeOptions(), bool *debug_ptr=NULL) |
This function implements the normal version of DeterminizeLattice, in which the output strings are represented using sequences of arcs, where all but the first one has an epsilon on the input side. More... | |
template<class Weight , class IntType > | |
bool | DeterminizeLattice (const Fst< ArcTpl< Weight > > &ifst, MutableFst< ArcTpl< CompactLatticeWeightTpl< Weight, IntType > > > *ofst, DeterminizeLatticeOptions opts, bool *debug_ptr) |
void | TestLatticeStringRepository () |
template<class Arc > | |
void | TestDeterminizeLattice () |
template<class Arc > | |
void | TestDeterminizeLattice2 () |
template<class F > | |
bool | DeterminizeStar (F &ifst, MutableFst< typename F::Arc > *ofst, float delta=kDelta, bool *debug_ptr=NULL, int max_states=-1, bool allow_partial=false) |
This function implements the normal version of DeterminizeStar, in which the output strings are represented using sequences of arcs, where all but the first one has an epsilon on the input side. More... | |
template<class F > | |
bool | DeterminizeStar (F &ifst, MutableFst< GallicArc< typename F::Arc > > *ofst, float delta, bool *debug_ptr, int max_states, bool allow_partial) |
template<class Arc > | |
void | TestDeterminizeGeneral () |
template<class Arc > | |
void | TestDeterminize () |
template<class Arc > | |
void | TestDeterminize2 () |
template<class Arc > | |
void | TestPush () |
template<class Arc > | |
void | TestMinimize () |
template<class Arc , class inttype > | |
void | TestStringRepository () |
template<class Arc > | |
void | ComputeStateInfo (const VectorFst< Arc > &fst, std::vector< char > *epsilon_info) |
This function will set epsilon_info to have size equal to the NumStates() of the FST, containing a logical-or of the enum values kStateHasEpsilonArcsEntering, kStateHasNonEpsilonArcsEntering, kStateHasEpsilonArcsLeaving, and kStateHasNonEpsilonArcsLeaving. More... | |
template<class Arc > | |
void | EnsureEpsilonProperty (VectorFst< Arc > *fst) |
This function modifies the fst (while maintaining equivalence) in such a way that, after the modification, all states of the FST which have epsilon-arcs entering them, have no non-epsilon arcs entering them, and all states which have epsilon-arcs leaving them, have no non-epsilon arcs leaving them. More... | |
void | TestEnsureEpsilonProperty () |
template<class Arc > | |
void | GetStateProperties (const Fst< Arc > &fst, typename Arc::StateId max_state, std::vector< StatePropertiesType > *props) |
This function works out various properties of the states in the FST, using the bit properties defined in StatePropertiesEnum. More... | |
template<class Arc , class I > | |
void | Factor (const Fst< Arc > &fst, MutableFst< Arc > *ofst, std::vector< std::vector< I > > *symbols) |
Factor identifies linear chains of states with an olabel (if any) only on the first arc of the chain, and possibly a sequence of ilabels; it outputs an FST with different symbols on the input that represent sequences of the original input symbols; it outputs the mapping from the new symbol to sequences of original symbols, as "symbols" [zero is reserved for epsilon]. More... | |
template<class Arc > | |
void | Factor (const Fst< Arc > &fst, MutableFst< Arc > *ofst1, MutableFst< Arc > *ofst2) |
This is a more conventional interface of Factor that outputs the result as two FSTs. More... | |
template<class Arc , class I > | |
void | ExpandInputSequences (const std::vector< std::vector< I > > &sequences, MutableFst< Arc > *fst) |
ExpandInputSequences expands out the input symbols into sequences of input symbols. More... | |
template<class Arc , class I > | |
void | CreateFactorFst (const std::vector< std::vector< I > > &sequences, MutableFst< Arc > *fst) |
The function CreateFactorFst will create an FST that expands out the "factors" that are the indices of the "sequences" array, into linear sequences of symbols. More... | |
template<class Arc , class I > | |
void | CreateMapFst (const std::vector< I > &symbol_map, MutableFst< Arc > *fst) |
CreateMapFst will create an FST representing this symbol_map. More... | |
template<class Arc > | |
static void | TestFactor () |
template<class Arc > | |
Arc::Label | HighestNumberedOutputSymbol (const Fst< Arc > &fst) |
Returns the highest numbered output symbol id of the FST (or zero for an empty FST. More... | |
template<class Arc > | |
Arc::Label | HighestNumberedInputSymbol (const Fst< Arc > &fst) |
Returns the highest numbered input symbol id of the FST (or zero for an empty FST. More... | |
template<class Arc > | |
Arc::StateId | NumArcs (const ExpandedFst< Arc > &fst) |
Returns the total number of arcs in an FST. More... | |
template<class Arc , class I > | |
void | GetOutputSymbols (const Fst< Arc > &fst, bool include_eps, std::vector< I > *symbols) |
GetOutputSymbols gets the list of symbols on the output of fst (including epsilon, if include_eps == true) More... | |
template<class Arc , class I > | |
void | GetInputSymbols (const Fst< Arc > &fst, bool include_eps, std::vector< I > *symbols) |
GetInputSymbols gets the list of symbols on the input of fst (including epsilon, if include_eps == true), as a sorted, unique list. More... | |
template<class Arc , class I > | |
void | RemoveSomeInputSymbols (const std::vector< I > &to_remove, MutableFst< Arc > *fst) |
RemoveSomeInputSymbols removes any symbol that appears in "to_remove", from the input side of the FST, replacing them with epsilon. More... | |
template<class Arc , class I > | |
void | MapInputSymbols (const std::vector< I > &symbol_mapping, MutableFst< Arc > *fst) |
template<class Arc , class I > | |
bool | GetLinearSymbolSequence (const Fst< Arc > &fst, std::vector< I > *isymbols_out, std::vector< I > *osymbols_out, typename Arc::Weight *tot_weight_out) |
GetLinearSymbolSequence gets the symbol sequence from a linear FST. More... | |
template<class Arc > | |
void | ConvertNbestToVector (const Fst< Arc > &fst, std::vector< VectorFst< Arc > > *fsts_out) |
This function converts an FST with a special structure, which is output by the OpenFst functions ShortestPath and RandGen, and converts them into a std::vector of separate FSTs. More... | |
template<class Arc > | |
void | NbestAsFsts (const Fst< Arc > &fst, size_t n, std::vector< VectorFst< Arc > > *fsts_out) |
Takes the n-shortest-paths (using ShortestPath), but outputs the result as a vector of up to n fsts. More... | |
template<class Arc , class I > | |
void | MakeLinearAcceptorWithAlternatives (const std::vector< std::vector< I > > &labels, MutableFst< Arc > *ofst) |
Creates an unweighted acceptor with a linear structure, with alternatives at each position. More... | |
template<class Arc , class I > | |
void | MakeLinearAcceptor (const std::vector< I > &labels, MutableFst< Arc > *ofst) |
Creates unweighted linear acceptor from symbol sequence. More... | |
template<class I > | |
void | GetSymbols (const SymbolTable &symtab, bool include_eps, std::vector< I > *syms_out) |
template<class Arc > | |
void | SafeDeterminizeWrapper (MutableFst< Arc > *ifst, MutableFst< Arc > *ofst, float delta=kDelta) |
Does PreDeterminize and DeterminizeStar and then removes the disambiguation symbols. More... | |
template<class Arc > | |
void | SafeDeterminizeMinimizeWrapper (MutableFst< Arc > *ifst, VectorFst< Arc > *ofst, float delta=kDelta) |
SafeDeterminizeMinimizeWapper is as SafeDeterminizeWrapper except that it also minimizes (encoded minimization, which is safe). More... | |
void | DeterminizeStarInLog (VectorFst< StdArc > *fst, float delta, bool *debug_ptr, int max_states) |
void | DeterminizeInLog (VectorFst< StdArc > *fst) |
void | SafeDeterminizeMinimizeWrapperInLog (VectorFst< StdArc > *ifst, VectorFst< StdArc > *ofst, float delta=kDelta) |
SafeDeterminizeMinimizeWapperInLog is as SafeDeterminizeMinimizeWrapper except it first casts tothe log semiring. More... | |
void | SafeDeterminizeWrapperInLog (VectorFst< StdArc > *ifst, VectorFst< StdArc > *ofst, float delta) |
template<class Arc > | |
void | RemoveWeights (MutableFst< Arc > *ifst) |
template<class Arc > | |
bool | PrecedingInputSymbolsAreSame (bool start_is_epsilon, const Fst< Arc > &fst) |
Returns true if and only if the FST is such that the input symbols on arcs entering any given state all have the same value. More... | |
template<class Arc , class F > | |
bool | PrecedingInputSymbolsAreSameClass (bool start_is_epsilon, const Fst< Arc > &fst, const F &f) |
This is as PrecedingInputSymbolsAreSame, but with a functor f that maps labels to classes. More... | |
template<class Arc > | |
bool | FollowingInputSymbolsAreSame (bool end_is_epsilon, const Fst< Arc > &fst) |
Returns true if and only if the FST is such that the input symbols on arcs exiting any given state all have the same value. More... | |
template<class Arc , class F > | |
bool | FollowingInputSymbolsAreSameClass (bool end_is_epsilon, const Fst< Arc > &fst, const F &f) |
template<class Arc > | |
void | MakePrecedingInputSymbolsSame (bool start_is_epsilon, MutableFst< Arc > *fst) |
MakePrecedingInputSymbolsSame ensures that all arcs entering any given fst state have the same input symbol. More... | |
template<class Arc , class F > | |
void | MakePrecedingInputSymbolsSameClass (bool start_is_epsilon, MutableFst< Arc > *fst, const F &f) |
As MakePrecedingInputSymbolsSame, but takes a functor object that maps labels to classes. More... | |
template<class Arc > | |
void | MakeFollowingInputSymbolsSame (bool end_is_epsilon, MutableFst< Arc > *fst) |
MakeFollowingInputSymbolsSame ensures that all arcs exiting any given fst state have the same input symbol. More... | |
template<class Arc , class F > | |
void | MakeFollowingInputSymbolsSameClass (bool end_is_epsilon, MutableFst< Arc > *fst, const F &f) |
As MakeFollowingInputSymbolsSame, but takes a functor object that maps labels to classes. More... | |
template<class Arc > | |
VectorFst< Arc > * | MakeLoopFst (const std::vector< const ExpandedFst< Arc > * > &fsts) |
MakeLoopFst creates an FST that has a state that is both initial and final (weight == Weight::One()), and for each non-NULL pointer fsts[i], it has an arc out whose output-symbol is i and which goes to a sub-graph whose input language is equivalent to fsts[i], where the final-state becomes a transition to the loop-state. More... | |
template<class Arc > | |
void | ClearSymbols (bool clear_input, bool clear_output, MutableFst< Arc > *fst) |
ClearSymbols sets all the symbols on the input and/or output side of the FST to zero, as specified. More... | |
template<class Arc > | |
void | ApplyProbabilityScale (float scale, MutableFst< Arc > *fst) |
ApplyProbabilityScale is applicable to FSTs in the log or tropical semiring. More... | |
template<class Arc > | |
ssize_t | FindSelfLoopWithILabel (const Fst< Arc > &fst, typename Arc::StateId s) |
template<class Arc > | |
bool | EqualAlign (const Fst< Arc > &ifst, typename Arc::StateId length, int rand_seed, MutableFst< Arc > *ofst, int num_retries=10) |
EqualAlign is similar to RandGen, but it generates a sequence with exactly "length" input symbols. More... | |
template<class Arc > | |
void | RemoveUselessArcs (MutableFst< Arc > *fst) |
template<class Arc > | |
void | PhiCompose (const Fst< Arc > &fst1, const Fst< Arc > &fst2, typename Arc::Label phi_label, MutableFst< Arc > *ofst) |
template<class Arc > | |
void | PropagateFinalInternal (typename Arc::Label phi_label, typename Arc::StateId s, MutableFst< Arc > *fst) |
template<class Arc > | |
void | PropagateFinal (typename Arc::Label phi_label, MutableFst< Arc > *fst) |
template<class Arc > | |
void | RhoCompose (const Fst< Arc > &fst1, const Fst< Arc > &fst2, typename Arc::Label rho_label, MutableFst< Arc > *ofst) |
template<> | |
bool | IsStochasticFst (const Fst< LogArc > &fst, float delta, LogArc::Weight *min_sum, LogArc::Weight *max_sum) |
template<class Arc > | |
bool | IsStochasticFst (const Fst< Arc > &fst, float delta=kDelta, typename Arc::Weight *min_sum=NULL, typename Arc::Weight *max_sum=NULL) |
This function returns true if, in the semiring of the FST, the sum (within the semiring) of all the arcs out of each state in the FST is one, to within delta. More... | |
bool | IsStochasticFstInLog (const Fst< StdArc > &fst, float delta, StdArc::Weight *min_sum, StdArc::Weight *max_sum) |
template<class Arc , class I > | |
void | TestMakeLinearAcceptor () |
template<class Arc > | |
void | TestDeterminizeStarInLog () |
template<class Arc > | |
void | TestSafeDeterminizeWrapper () |
void | TestPushInLog () |
template<class Arc > | |
void | TestAcceptorMinimize () |
template<class Arc > | |
void | TestMakeSymbolsSame () |
template<class Arc > | |
void | TestMakeSymbolsSameClass () |
template<class Arc > | |
VectorFst< Arc > * | MakeLoopFstCompare (const vector< const ExpandedFst< Arc > *> &fsts) |
template<class Arc > | |
void | TestMakeLoopFst () |
template<class Arc > | |
void | TestEqualAlign () |
template<class Arc > | |
void | Print (const Fst< Arc > &fst, std::string message) |
template<class Arc > | |
void | TestRemoveUselessArcs () |
template<ReweightType rtype> | |
void | PushInLog (VectorFst< StdArc > *fst, uint32 ptype, float delta=kDelta) |
template<class Arc > | |
void | MinimizeEncoded (VectorFst< Arc > *fst, float delta=kDelta) |
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" framework (see The ContextFst object, i.e. More... | |
int32 | GetEncodingMultiple (int32 nonterm_phones_offset) |
void | ComposeContextLeftBiphone (int32 nonterm_phones_offset, const std::vector< int32 > &disambig_syms, 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" framework (see The ContextFst object, i.e. More... | |
template<class Arc > | |
void | WriteFstKaldi (std::ostream &os, bool binary, const VectorFst< Arc > &t) |
template<class W > | |
bool | StrToWeight (const std::string &s, bool allow_zero, W *w) |
template<class Arc > | |
void | ReadFstKaldi (std::istream &is, bool binary, VectorFst< Arc > *fst) |
VectorFst< StdArc > * | ReadFstKaldi (std::string rxfilename) |
Fst< StdArc > * | ReadFstKaldiGeneric (std::string rxfilename, bool throw_on_err) |
VectorFst< StdArc > * | CastOrConvertToVectorFst (Fst< StdArc > *fst) |
void | ReadFstKaldi (std::string rxfilename, fst::StdVectorFst *ofst) |
void | WriteFstKaldi (const VectorFst< StdArc > &fst, std::string wxfilename) |
fst::VectorFst< fst::StdArc > * | ReadAndPrepareLmFst (std::string rxfilename) |
void | ReadFstKaldi (std::string rxfilename, VectorFst< StdArc > *ofst) |
template<class Weight , class Int > | |
void | ConvertLattice (const ExpandedFst< ArcTpl< Weight > > &ifst, MutableFst< ArcTpl< CompactLatticeWeightTpl< Weight, Int > > > *ofst, bool invert=true) |
Convert lattice from a normal FST to a CompactLattice FST. More... | |
template<class Weight , class Int > | |
void | ConvertLattice (const ExpandedFst< ArcTpl< CompactLatticeWeightTpl< Weight, Int > > > &ifst, MutableFst< ArcTpl< Weight > > *ofst, bool invert=true) |
Convert lattice CompactLattice format to Lattice. More... | |
template<class WeightIn , class WeightOut > | |
void | ConvertLattice (const ExpandedFst< ArcTpl< WeightIn > > &ifst, MutableFst< ArcTpl< WeightOut > > *ofst) |
Convert between CompactLattices and Lattices of different floating point types... More... | |
template<class Weight , class ScaleFloat > | |
void | ScaleLattice (const std::vector< std::vector< ScaleFloat > > &scale, MutableFst< ArcTpl< Weight > > *fst) |
Scales the pairs of weights in LatticeWeight or CompactLatticeWeight by viewing the pair (a, b) as a 2-vector and pre-multiplying by the 2x2 matrix in "scale". More... | |
template<class Weight , class Int > | |
void | RemoveAlignmentsFromCompactLattice (MutableFst< ArcTpl< CompactLatticeWeightTpl< Weight, Int > > > *fst) |
Removes state-level alignments (the strings that are part of the weights). More... | |
template<class Weight , class Int > | |
bool | CompactLatticeHasAlignment (const ExpandedFst< ArcTpl< CompactLatticeWeightTpl< Weight, Int > > > &fst) |
Returns true if lattice has alignments, i.e. More... | |
template<class Real > | |
void | ConvertFstToLattice (const ExpandedFst< ArcTpl< TropicalWeight > > &ifst, MutableFst< ArcTpl< LatticeWeightTpl< Real > > > *ofst) |
Converts TropicalWeight to LatticeWeight (puts all the weight on the first float in the lattice's pair). More... | |
template<class Weight , class Int > | |
void | TestConvert (bool invert) |
template<class Weight , class Int > | |
void | TestShortestPath () |
template<class Int > | |
void | TestConvert2 () |
template<class Weight , class Int > | |
void | TestConvertPair (bool invert) |
template<class Weight , class Int > | |
void | TestScalePair (bool invert) |
template<class Int > | |
void | ConvertLattice (const ExpandedFst< ArcTpl< LatticeWeightTpl< float > > > &ifst, MutableFst< ArcTpl< CompactLatticeWeightTpl< LatticeWeightTpl< double >, Int > > > *ofst) |
template<class Int > | |
void | ConvertLattice (const ExpandedFst< ArcTpl< LatticeWeightTpl< double > > > &ifst, MutableFst< ArcTpl< CompactLatticeWeightTpl< LatticeWeightTpl< float >, Int > > > *ofst) |
template<class Int > | |
void | ConvertLattice (const ExpandedFst< ArcTpl< CompactLatticeWeightTpl< LatticeWeightTpl< double >, Int > > > &ifst, MutableFst< ArcTpl< LatticeWeightTpl< float > > > *ofst) |
Converts CompactLattice with double to Lattice with float. More... | |
template<class Int > | |
void | ConvertLattice (const ExpandedFst< ArcTpl< CompactLatticeWeightTpl< LatticeWeightTpl< float >, Int > > > &ifst, MutableFst< ArcTpl< LatticeWeightTpl< double > > > *ofst) |
Converts CompactLattice with float to Lattice with double. More... | |
std::vector< std::vector< double > > | DefaultLatticeScale () |
Returns a default 2x2 matrix scaling factor for LatticeWeight. More... | |
std::vector< std::vector< double > > | AcousticLatticeScale (double acwt) |
std::vector< std::vector< double > > | GraphLatticeScale (double lmwt) |
std::vector< std::vector< double > > | LatticeScale (double lmwt, double acwt) |
template<class Weight , class Int > | |
void | PruneCompactLattice (Weight beam, MutableFst< ArcTpl< CompactLatticeWeightTpl< Weight, Int > > > *fst) |
LatticeWeight | RandomLatticeWeight () |
CompactLatticeWeight | RandomCompactLatticeWeight () |
void | LatticeWeightTest () |
void | CompactLatticeWeightTest () |
template<class FloatType > | |
std::ostream & | operator<< (std::ostream &strm, const LatticeWeightTpl< FloatType > &w) |
template<class FloatType > | |
std::istream & | operator>> (std::istream &strm, LatticeWeightTpl< FloatType > &w) |
template<class FloatType , class ScaleFloatType > | |
LatticeWeightTpl< FloatType > | ScaleTupleWeight (const LatticeWeightTpl< FloatType > &w, const std::vector< std::vector< ScaleFloatType > > &scale) |
template<class FloatType , class ScaleFloatType > | |
PairWeight< TropicalWeightTpl< FloatType >, TropicalWeightTpl< FloatType > > | ScaleTupleWeight (const PairWeight< TropicalWeightTpl< FloatType >, TropicalWeightTpl< FloatType > > &w, const std::vector< std::vector< ScaleFloatType > > &scale) |
template<class FloatType > | |
bool | operator== (const LatticeWeightTpl< FloatType > &wa, const LatticeWeightTpl< FloatType > &wb) |
template<class FloatType > | |
bool | operator!= (const LatticeWeightTpl< FloatType > &wa, const LatticeWeightTpl< FloatType > &wb) |
template<class FloatType > | |
int | Compare (const LatticeWeightTpl< FloatType > &w1, const LatticeWeightTpl< FloatType > &w2) |
Compare returns -1 if w1 < w2, +1 if w1 > w2, and 0 if w1 == w2. More... | |
template<class FloatType > | |
LatticeWeightTpl< FloatType > | Plus (const LatticeWeightTpl< FloatType > &w1, const LatticeWeightTpl< FloatType > &w2) |
template<class FloatType > | |
LatticeWeightTpl< FloatType > | Times (const LatticeWeightTpl< FloatType > &w1, const LatticeWeightTpl< FloatType > &w2) |
template<class FloatType > | |
LatticeWeightTpl< FloatType > | Divide (const LatticeWeightTpl< FloatType > &w1, const LatticeWeightTpl< FloatType > &w2, DivideType typ=DIVIDE_ANY) |
template<class FloatType > | |
bool | ApproxEqual (const LatticeWeightTpl< FloatType > &w1, const LatticeWeightTpl< FloatType > &w2, float delta=kDelta) |
template<class WeightType , class IntType > | |
bool | operator== (const CompactLatticeWeightTpl< WeightType, IntType > &w1, const CompactLatticeWeightTpl< WeightType, IntType > &w2) |
template<class WeightType , class IntType > | |
bool | operator!= (const CompactLatticeWeightTpl< WeightType, IntType > &w1, const CompactLatticeWeightTpl< WeightType, IntType > &w2) |
template<class WeightType , class IntType > | |
bool | ApproxEqual (const CompactLatticeWeightTpl< WeightType, IntType > &w1, const CompactLatticeWeightTpl< WeightType, IntType > &w2, float delta=kDelta) |
template<class WeightType , class IntType > | |
int | Compare (const CompactLatticeWeightTpl< WeightType, IntType > &w1, const CompactLatticeWeightTpl< WeightType, IntType > &w2) |
int | Compare (const TropicalWeight &w1, const TropicalWeight &w2) |
template<class WeightType , class IntType > | |
CompactLatticeWeightTpl< WeightType, IntType > | Plus (const CompactLatticeWeightTpl< WeightType, IntType > &w1, const CompactLatticeWeightTpl< WeightType, IntType > &w2) |
template<class WeightType , class IntType > | |
CompactLatticeWeightTpl< WeightType, IntType > | Times (const CompactLatticeWeightTpl< WeightType, IntType > &w1, const CompactLatticeWeightTpl< WeightType, IntType > &w2) |
template<class WeightType , class IntType > | |
CompactLatticeWeightTpl< WeightType, IntType > | Divide (const CompactLatticeWeightTpl< WeightType, IntType > &w1, const CompactLatticeWeightTpl< WeightType, IntType > &w2, DivideType div=DIVIDE_ANY) |
template<class WeightType , class IntType > | |
std::ostream & | operator<< (std::ostream &strm, const CompactLatticeWeightTpl< WeightType, IntType > &w) |
template<class WeightType , class IntType > | |
std::istream & | operator>> (std::istream &strm, CompactLatticeWeightTpl< WeightType, IntType > &w) |
template<class Weight , class IntType , class ScaleFloatType > | |
CompactLatticeWeightTpl< Weight, IntType > | ScaleTupleWeight (const CompactLatticeWeightTpl< Weight, IntType > &w, const std::vector< std::vector< ScaleFloatType > > &scale) |
Scales the pair (a, b) of floating-point weights inside a CompactLatticeWeight by premultiplying it (viewed as a vector) by a 2x2 matrix "scale". More... | |
template<class Float1 , class Float2 > | |
void | ConvertLatticeWeight (const LatticeWeightTpl< Float1 > &w_in, LatticeWeightTpl< Float2 > *w_out) |
Define some ConvertLatticeWeight functions that are used in various lattice conversions... More... | |
template<class Float1 , class Float2 , class Int > | |
void | ConvertLatticeWeight (const CompactLatticeWeightTpl< LatticeWeightTpl< Float1 >, Int > &w_in, CompactLatticeWeightTpl< LatticeWeightTpl< Float2 >, Int > *w_out) |
template<class Float1 , class Float2 > | |
void | ConvertLatticeWeight (const LatticeWeightTpl< Float1 > &w_in, TropicalWeightTpl< Float2 > *w_out) |
template<class Float > | |
double | ConvertToCost (const LatticeWeightTpl< Float > &w) |
template<class Float , class Int > | |
double | ConvertToCost (const CompactLatticeWeightTpl< LatticeWeightTpl< Float >, Int > &w) |
template<class Float > | |
double | ConvertToCost (const TropicalWeightTpl< Float > &w) |
template<class Arc , class Int > | |
void | PreDeterminize (MutableFst< Arc > *fst, typename Arc::Label first_new_sym, std::vector< Int > *symsOut) |
template<class Label > | |
void | CreateNewSymbols (SymbolTable *input_sym_table, int nSym, std::string prefix, std::vector< Label > *symsOut) |
template<class Arc > | |
void | AddSelfLoops (MutableFst< Arc > *fst, std::vector< typename Arc::Label > &isyms, std::vector< typename Arc::Label > &osyms) |
AddSelfLoops is a function you will probably want to use alongside PreDeterminize, to add self-loops to any FSTs that you compose on the left hand side of the one modified by PreDeterminize. More... | |
template<class Arc > | |
int64 | DeleteISymbols (MutableFst< Arc > *fst, std::vector< typename Arc::Label > isyms) |
template<class Arc > | |
Arc::StateId | CreateSuperFinal (MutableFst< Arc > *fst) |
template<class Arc > | |
void | TestPreDeterminize () |
template<class Arc > | |
void | TestAddSelfLoops () |
template<class Arc > | |
void | PruneSpecial (const Fst< Arc > &ifst, VectorFst< Arc > *ofst, typename Arc::Weight beam, size_t max_states=0) |
The function PruneSpecial is like the standard OpenFst function "prune", except it does not expand the entire "ifst"- this is useful for cases where ifst is an on-demand FST such as a ComposeFst and we don't want to visit it all. More... | |
static void | TestPruneSpecial () |
static void | TestPushSpecial () |
void | PushSpecial (VectorFst< StdArc > *fst, float delta) |
template<class Arc > | |
VectorFst< Arc > * | RandFst (RandFstOptions opts=RandFstOptions()) |
Returns a random FST. More... | |
template<class Arc > | |
VectorFst< Arc > * | RandPairFst (RandFstOptions opts=RandFstOptions()) |
Returns a random FST. More... | |
template<class Arc > | |
void | RemoveEpsLocal (MutableFst< Arc > *fst) |
RemoveEpsLocal remove some (but not necessarily all) epsilons in an FST, using an algorithm that is guaranteed to never increase the number of arcs in the FST (and will also never increase the number of states). More... | |
void | RemoveEpsLocalSpecial (MutableFst< StdArc > *fst) |
As RemoveEpsLocal but takes care to preserve stochasticity when cast to LogArc. More... | |
template<class Arc > | |
static void | TestRemoveEpsLocal () |
static void | TestRemoveEpsLocalSpecial () |
template<class Arc > | |
void | TestTableMatcher (bool connect, bool left) |
template<class Arc > | |
void | TestTableMatcherCacheLeft (bool connect) |
template<class Arc > | |
void | TestTableMatcherCacheRight (bool connect) |
template<class Arc > | |
void | TableCompose (const Fst< Arc > &ifst1, const Fst< Arc > &ifst2, MutableFst< Arc > *ofst, const TableComposeOptions &opts=TableComposeOptions()) |
template<class Arc > | |
void | TableCompose (const Fst< Arc > &ifst1, const Fst< Arc > &ifst2, MutableFst< Arc > *ofst, TableComposeCache< Fst< Arc > > *cache) |
template<class Arc > | |
void | TestFactor () |
static ConstFst< StdArc > * | ReadConstFstFromStream (std::istream &is) |
static void | InputDeterminizeSingleState (StdArc::StateId s, VectorFst< StdArc > *fst) |
This utility function input-determinizes a specified state s of the FST 'fst'. More... | |
void | PrepareForGrammarFst (int32 nonterm_phones_offset, VectorFst< StdArc > *fst) |
This function prepares 'ifst' for use in GrammarFst: it ensures that it has the expected properties, changing it slightly as needed. More... | |
void | CopyToVectorFst (GrammarFst *grammar_fst, VectorFst< StdArc > *vector_fst) |
This function copies a GrammarFst to a VectorFst (intended mostly for testing and comparison purposes). More... | |
template<class T > | |
ArcticWeightTpl< T > | Plus (const ArcticWeightTpl< T > &w1, const ArcticWeightTpl< T > &w2) |
ArcticWeightTpl< float > | Plus (const ArcticWeightTpl< float > &w1, const ArcticWeightTpl< float > &w2) |
ArcticWeightTpl< double > | Plus (const ArcticWeightTpl< double > &w1, const ArcticWeightTpl< double > &w2) |
template<class T > | |
ArcticWeightTpl< T > | Times (const ArcticWeightTpl< T > &w1, const ArcticWeightTpl< T > &w2) |
ArcticWeightTpl< float > | Times (const ArcticWeightTpl< float > &w1, const ArcticWeightTpl< float > &w2) |
ArcticWeightTpl< double > | Times (const ArcticWeightTpl< double > &w1, const ArcticWeightTpl< double > &w2) |
template<class T > | |
ArcticWeightTpl< T > | Divide (const ArcticWeightTpl< T > &w1, const ArcticWeightTpl< T > &w2, DivideType typ=DIVIDE_ANY) |
ArcticWeightTpl< float > | Divide (const ArcticWeightTpl< float > &w1, const ArcticWeightTpl< float > &w2, DivideType typ=DIVIDE_ANY) |
ArcticWeightTpl< double > | Divide (const ArcticWeightTpl< double > &w1, const ArcticWeightTpl< double > &w2, DivideType typ=DIVIDE_ANY) |
template<class Arc > | |
void | TestDeterminizeLatticePruned () |
template<class Arc > | |
void | TestDeterminizeLatticePruned2 () |
template<class Weight , class IntType > | |
bool | DeterminizeLatticePruned (const ExpandedFst< ArcTpl< Weight > > &ifst, double beam, MutableFst< ArcTpl< CompactLatticeWeightTpl< Weight, IntType > > > *ofst, DeterminizeLatticePrunedOptions opts) |
template<class Weight > | |
bool | DeterminizeLatticePruned (const ExpandedFst< ArcTpl< Weight > > &ifst, double prune, MutableFst< ArcTpl< Weight > > *ofst, DeterminizeLatticePrunedOptions opts=DeterminizeLatticePrunedOptions()) |
This function implements the normal version of DeterminizeLattice, in which the output strings are represented using sequences of arcs, where all but the first one has an epsilon on the input side. More... | |
template<class Weight > | |
ArcTpl< Weight >::Label | DeterminizeLatticeInsertPhones (const kaldi::TransitionModel &trans_model, MutableFst< ArcTpl< Weight > > *fst) |
This function takes in lattices and inserts phones at phone boundaries. More... | |
template<class Weight > | |
void | DeterminizeLatticeDeletePhones (typename ArcTpl< Weight >::Label first_phone_label, MutableFst< ArcTpl< Weight > > *fst) |
This function takes in lattices and deletes "phones" from them. More... | |
template void | DeterminizeLatticeDeletePhones (ArcTpl< kaldi::LatticeWeight >::Label first_phone_label, MutableFst< ArcTpl< kaldi::LatticeWeight > > *fst) |
template<class Weight , class IntType > | |
bool | DeterminizeLatticePhonePrunedFirstPass (const kaldi::TransitionModel &trans_model, double beam, MutableFst< ArcTpl< Weight > > *fst, const DeterminizeLatticePrunedOptions &opts) |
This function does a first pass determinization with phone symbols inserted at phone boundary. More... | |
template<class Weight , class IntType > | |
bool | DeterminizeLatticePhonePruned (const kaldi::TransitionModel &trans_model, MutableFst< ArcTpl< Weight > > *ifst, double prune, MutableFst< ArcTpl< CompactLatticeWeightTpl< Weight, IntType > > > *ofst, DeterminizeLatticePhonePrunedOptions opts=DeterminizeLatticePhonePrunedOptions()) |
"Destructive" version of DeterminizeLatticePhonePruned() where the input lattice might be changed. More... | |
template<class Weight , class IntType > | |
bool | DeterminizeLatticePhonePruned (const kaldi::TransitionModel &trans_model, const ExpandedFst< ArcTpl< Weight > > &ifst, double prune, MutableFst< ArcTpl< CompactLatticeWeightTpl< Weight, IntType > > > *ofst, DeterminizeLatticePhonePrunedOptions opts=DeterminizeLatticePhonePrunedOptions()) |
This function is a wrapper of DeterminizeLatticePhonePrunedFirstPass() and DeterminizeLatticePruned(). More... | |
bool | DeterminizeLatticePhonePrunedWrapper (const kaldi::TransitionModel &trans_model, MutableFst< kaldi::LatticeArc > *ifst, double prune, MutableFst< kaldi::CompactLatticeArc > *ofst, DeterminizeLatticePhonePrunedOptions opts=DeterminizeLatticePhonePrunedOptions()) |
This function is a wrapper of DeterminizeLatticePhonePruned() that works for Lattice type FSTs. More... | |
template bool | DeterminizeLatticePruned< kaldi::LatticeWeight > (const ExpandedFst< kaldi::LatticeArc > &ifst, double prune, MutableFst< kaldi::CompactLatticeArc > *ofst, DeterminizeLatticePrunedOptions opts) |
template bool | DeterminizeLatticePruned< kaldi::LatticeWeight > (const ExpandedFst< kaldi::LatticeArc > &ifst, double prune, MutableFst< kaldi::LatticeArc > *ofst, DeterminizeLatticePrunedOptions opts) |
template bool | DeterminizeLatticePhonePruned< kaldi::LatticeWeight, kaldi::int32 > (const kaldi::TransitionModel &trans_model, const ExpandedFst< kaldi::LatticeArc > &ifst, double prune, MutableFst< kaldi::CompactLatticeArc > *ofst, DeterminizeLatticePhonePrunedOptions opts) |
template bool | DeterminizeLatticePhonePruned< kaldi::LatticeWeight, kaldi::int32 > (const kaldi::TransitionModel &trans_model, MutableFst< kaldi::LatticeArc > *ifst, double prune, MutableFst< kaldi::CompactLatticeArc > *ofst, DeterminizeLatticePhonePrunedOptions opts) |
template<class Weight , class IntType > | |
bool | MinimizeCompactLattice (MutableFst< ArcTpl< CompactLatticeWeightTpl< Weight, IntType > > > *clat, float delta=fst::kDelta) |
This function minimizes the compact lattice. More... | |
template bool | MinimizeCompactLattice< kaldi::LatticeWeight, kaldi::int32 > (MutableFst< kaldi::CompactLatticeArc > *clat, float delta) |
template<class Weight , class IntType > | |
bool | PushCompactLatticeStrings (MutableFst< ArcTpl< CompactLatticeWeightTpl< Weight, IntType > > > *clat) |
This function pushes the transition-ids as far towards the start as they will go. More... | |
template<class Weight , class IntType > | |
bool | PushCompactLatticeWeights (MutableFst< ArcTpl< CompactLatticeWeightTpl< Weight, IntType > > > *clat) |
This function pushes the weights in the CompactLattice so that all states except possibly the start state, have Weight components (of type LatticeWeight) that "sum to one" in the LatticeWeight (i.e. More... | |
template bool | PushCompactLatticeStrings< kaldi::LatticeWeight, kaldi::int32 > (MutableFst< kaldi::CompactLatticeArc > *clat) |
template bool | PushCompactLatticeWeights< kaldi::LatticeWeight, kaldi::int32 > (MutableFst< kaldi::CompactLatticeArc > *clat) |
static void | InputDeterminizeSingleState (StdArc::StateId s, VectorFst< StdArc > *fst) |
template<class Arc , class I > | |
void | RemoveArcsWithSomeInputSymbols (const std::vector< I > &symbols_in, VectorFst< Arc > *fst) |
template<class Arc , class I > | |
void | PenalizeArcsWithSomeInputSymbols (const std::vector< I > &symbols_in, float penalty, VectorFst< Arc > *fst) |
ConstFst< StdArc > * | ReadAsConstFst (std::string rxfilename) |
bool | PrintProxyFstPath (const VectorFst< StdArc > &proxy, vector< vector< StdArc::Label > > *path, vector< StdArc::Weight > *weight, StdArc::StateId cur_state, vector< StdArc::Label > cur_path, StdArc::Weight cur_weight) |
For an extended explanation of the framework of which grammar-fsts are a part, please see Support for grammars and graphs with on-the-fly parts. (i.e.
../doc/grammar.dox).
This header implements a special FST type which we use in that framework; it is a lightweight wrapper which stitches together several FSTs and makes them look, to the decoder code, like a single FST. It is a bit like OpenFst's Replace() function, but with support for left-biphone context.
typedef ArcticWeightTpl<float> ArcticWeight |
Definition at line 84 of file arctic-weight.h.
Definition at line 28 of file lattice-weight-test.cc.
typedef CompactLatticeWeightTpl<LatticeWeight, int32> CompactLatticeWeight |
Definition at line 32 of file lattice-weight-test.cc.
typedef CompactLatticeWeightCommonDivisorTpl<LatticeWeight, int32> CompactLatticeWeightCommonDivisor |
Definition at line 35 of file lattice-weight-test.cc.
typedef fst::StdArc::Label Label |
Definition at line 57 of file deterministic-fst-test.cc.
typedef LatticeWeightTpl<BaseFloat> LatticeWeight |
Definition at line 30 of file lattice-weight-test.cc.
typedef fst::StdArc::StateId StateId |
Definition at line 58 of file deterministic-fst-test.cc.
typedef unsigned char StatePropertiesType |
typedef fst::StdArc StdArc |
Definition at line 56 of file deterministic-fst-test.cc.
typedef fst::StdVectorFst StdVectorFst |
Definition at line 59 of file deterministic-fst-test.cc.
typedef VectorFstTplHolder<StdArc> VectorFstHolder |
Definition at line 151 of file kaldi-fst-io.h.
typedef fst::StdArc::Weight Weight |
Definition at line 60 of file deterministic-fst-test.cc.
anonymous enum |
Enumerator | |
---|---|
kStateHasEpsilonArcsEntering | |
kStateHasNonEpsilonArcsEntering | |
kStateHasEpsilonArcsLeaving | |
kStateHasNonEpsilonArcsLeaving |
Definition at line 27 of file epsilon-property.h.
enum NonterminalValues |
An anonymous enum to define some values for symbols used in our grammar-fst framework.
Please understand this with reference to the documentation in Support for grammars and graphs with on-the-fly parts. (../doc/grammar.dox). This enum defines the values of nonterminal-related symbols in phones.txt. They are not the actual values– they will be shifted by adding the value nonterm_phones_offset which is passed in by the command-line flag –nonterm-phones-offset.
Enumerator | |
---|---|
kNontermBos | |
kNontermBegin | |
kNontermEnd | |
kNontermReenter | |
kNontermUserDefined | |
kNontermMediumNumber | |
kNontermBigNumber |
Definition at line 68 of file grammar-context-fst.h.
enum StatePropertiesEnum |
Enumerator | |
---|---|
kStateFinal | |
kStateInitial | |
kStateArcsIn | |
kStateMultipleArcsIn | |
kStateArcsOut | |
kStateMultipleArcsOut | |
kStateOlabelsOut | |
kStateIlabelsOut |
Definition at line 112 of file factor.h.
|
inline |
Definition at line 138 of file lattice-utils.h.
Referenced by DiscriminativeSupervisionSplitter::CreateRangeLattice(), kaldi::DecodeUtterance(), kaldi::DecodeUtteranceLatticeFaster(), kaldi::DecodeUtteranceLatticeIncremental(), kaldi::DecodeUtteranceLatticeSimple(), main(), DeterminizeLatticeTask::operator()(), DecodeUtteranceLatticeFasterClass::operator()(), DiscriminativeSupervisionSplitter::PrepareLattice(), and NnetBatchDecoder::ProcessOutputUtterance().
void AddSelfLoops | ( | MutableFst< Arc > * | fst, |
std::vector< typename Arc::Label > & | isyms, | ||
std::vector< typename Arc::Label > & | osyms | ||
) |
AddSelfLoops is a function you will probably want to use alongside PreDeterminize, to add self-loops to any FSTs that you compose on the left hand side of the one modified by PreDeterminize.
This function inserts loops with "special symbols" [e.g. #0, #1] into an FST. This is done at each final state and each state with non-epsilon output symbols on at least one arc out of it. This is to ensure that these symbols, when inserted into the input side of an FST we will compose with on the right, can "pass through" this FST.
At input, isyms and osyms must be vectors of the same size n, corresponding to symbols that currently do not exist in 'fst'. For each state in n that has non-epsilon symbols on the output side of arcs leaving it, or which is a final state, this function inserts n self-loops with unit weight and one of the n pairs of symbols on its input and output.
Definition at line 599 of file pre-determinize-inl.h.
References rnnlm::i, and rnnlm::n.
Referenced by TestAddSelfLoops().
void AddSubsequentialLoop | ( | StdArc::Label | subseq_symbol, |
MutableFst< StdArc > * | fst | ||
) |
Modifies an FST so that it transuces the same paths, but the input side of the paths can all have the subsequential symbol '$' appended to them any number of times (we could easily specify the number of times, but accepting any number of repetitions is just more convenient).
The actual way we do this is for each final state, we add a transition with weight equal to the final-weight of that state, with input-symbol '$' and output-symbols <eps>, and ending in a new super-final state that has unit final-probability and a unit-weight self-loop with '$' on its input and <eps> on its output. The reason we don't just add a loop to each final-state has to do with preserving stochasticity (see Preserving stochasticity and testing it). We keep the final-probability in all the original final-states rather than setting them to zero, so the resulting FST can accept zero '$' symbols at the end (in case we had no right context).
Definition at line 297 of file context-fst.cc.
References rnnlm::i.
Referenced by ComposeContext(), main(), and TrainingGraphCompiler::TrainingGraphCompiler().
void ApplyProbabilityScale | ( | float | scale, |
MutableFst< Arc > * | fst | ||
) |
ApplyProbabilityScale is applicable to FSTs in the log or tropical semiring.
It multiplies the arc and final weights by "scale" [this is not the Mul operation of the semiring, it's actual multiplication, which is equivalent to taking a power in the semiring].
Definition at line 771 of file fstext-utils-inl.h.
Referenced by kaldi::GetHmmAsFsa(), main(), and MinimizeEncoded().
|
inline |
Definition at line 389 of file lattice-weight.h.
References LatticeWeightTpl< FloatType >::Value1(), and LatticeWeightTpl< FloatType >::Value2().
Referenced by DeterminizerStar< F >::EpsilonClosure::AddOneElement(), ApproxEqual(), CompactLatticeWeightTest(), CompactLatticeMinimizer< Weight, IntType >::Equivalent(), IsStochasticFst(), LatticeWeightTest(), DeterminizerStar< F >::SubsetEqual::operator()(), LatticeDeterminizerPruned< Weight, IntType >::SubsetEqual::operator()(), LatticeDeterminizer< Weight, IntType >::SubsetEqual::operator()(), TestBackoffAndCache(), TestCompose(), TestRemoveEpsLocalSpecial(), TestRemoveUselessArcs(), and TestShortestPath().
|
inline |
Definition at line 570 of file lattice-weight.h.
References ApproxEqual(), CompactLatticeWeightTpl< WeightType, IntType >::String(), and CompactLatticeWeightTpl< WeightType, IntType >::Weight().
Definition at line 94 of file kaldi-fst-io.cc.
References KALDI_ASSERT.
Referenced by main().
|
static |
Definition at line 71 of file context-fst-test.cc.
References GetLinearSymbolSequence(), rnnlm::i, kaldi::IsSorted(), and rnnlm::j.
ClearSymbols sets all the symbols on the input and/or output side of the FST to zero, as specified.
It does not alter the symbol tables.
Definition at line 742 of file fstext-utils-inl.h.
Referenced by MakeLoopFstCompare().
bool CompactLatticeHasAlignment | ( | const ExpandedFst< ArcTpl< CompactLatticeWeightTpl< Weight, Int > > > & | fst | ) |
Returns true if lattice has alignments, i.e.
it has any nonempty strings inside its weights.
Definition at line 244 of file lattice-utils-inl.h.
Referenced by LatticeScale().
void fst::CompactLatticeWeightTest | ( | ) |
Definition at line 126 of file lattice-weight-test.cc.
References ApproxEqual(), Compare(), Divide(), rnnlm::i, KALDI_ASSERT, CompactLatticeWeightTpl< WeightType, IntType >::Member(), CompactLatticeWeightTpl< WeightType, IntType >::One(), Plus(), CompactLatticeWeightTpl< WeightType, IntType >::Quantize(), RandomCompactLatticeWeight(), CompactLatticeWeightTpl< WeightType, IntType >::Read(), Times(), and CompactLatticeWeightTpl< WeightType, IntType >::Zero().
Referenced by main().
|
inline |
Compare returns -1 if w1 < w2, +1 if w1 > w2, and 0 if w1 == w2.
Definition at line 294 of file lattice-weight.h.
References LatticeWeightTpl< FloatType >::Value1(), and LatticeWeightTpl< FloatType >::Value2().
Referenced by CompactLatticeWeightTest(), Compare(), LatticeDeterminizerPruned< Weight, IntType >::Compare(), LatticeDeterminizer< Weight, IntType >::Compare(), PruneSpecialClass< Arc >::Done(), LatticeDeterminizerPruned< Weight, IntType >::EpsilonClosure(), LatticeDeterminizer< Weight, IntType >::EpsilonClosure(), LatticeWeightTest(), LatticeDeterminizer< Weight, IntType >::MakeSubsetUnique(), NaturalLess< LatticeWeightTpl< FloatType > >::operator()(), NaturalLess< LatticeWeightTpl< float > >::operator()(), NaturalLess< LatticeWeightTpl< double > >::operator()(), NaturalLess< CompactLatticeWeightTpl< LatticeWeightTpl< FloatType >, IntType > >::operator()(), NaturalLess< CompactLatticeWeightTpl< LatticeWeightTpl< float >, int32 > >::operator()(), NaturalLess< CompactLatticeWeightTpl< LatticeWeightTpl< double >, int32 > >::operator()(), PruneSpecialClass< Arc >::Task::operator<(), Plus(), LatticeDeterminizer< Weight, IntType >::ProcessFinal(), and PruneSpecialClass< Arc >::ProcessState().
|
inline |
Definition at line 591 of file lattice-weight.h.
References Compare(), rnnlm::i, CompactLatticeWeightTpl< WeightType, IntType >::String(), and CompactLatticeWeightTpl< WeightType, IntType >::Weight().
|
inline |
Definition at line 653 of file lattice-weight.h.
void fst::ComposeContext | ( | const std::vector< int32 > & | disambig_syms, |
int32 | context_width, | ||
int32 | central_position, | ||
VectorFst< StdArc > * | ifst, | ||
VectorFst< StdArc > * | ofst, | ||
std::vector< std::vector< int32 > > * | ilabels_out, | ||
bool | project_ifst = false |
||
) |
Used in the command-line tool fstcomposecontext.
It creates a context FST and composes it on the left with "ifst" to make "ofst". It outputs the label information to ilabels_out. "ifst" is mutable because we need to add the subsequential loop.
[in] | disambig_syms | List of disambiguation symbols, e.g. the integer ids of #0, #1, #2 ... in the phones.txt. |
[in] | context_width | Size of context window, e.g. 3 for triphone. |
[in] | central_position | Central position in phonetic context window (zero-based index), e.g. 1 for triphone. |
[in,out] | ifst | The FST we are composing with C (e.g. LG.fst), mustable because we need to add the subsequential loop to it. |
[out] | ofst | Composed output FST (would be CLG.fst). |
[out] | ilabels_out | Vector, indexed by ilabel of CLG.fst, providing information about the meaning of that ilabel; see "http://kaldi-asr.org/doc/tree_externals.html#tree_ilabel". |
[in] | project_ifst | This is intended only to be set to true in the program 'fstmakecontextfst'... if true, it will project on the input after adding the subsequential loop to 'ifst', which allows us to reconstruct the context fst C.fst. |
Definition at line 246 of file context-fst.cc.
References AddSubsequentialLoop(), ComposeDeterministicOnDemandInverse(), GetInputSymbols(), rnnlm::i, KALDI_ASSERT, and InverseContextFst::SwapIlabelInfo().
Referenced by main().
void fst::ComposeContext | ( | const std::vector< int32 > & | disambig_syms, |
int32 | context_width, | ||
int32 | central_position, | ||
VectorFst< StdArc > * | ifst, | ||
VectorFst< StdArc > * | ofst, | ||
std::vector< std::vector< int32 > > * | ilabels_out, | ||
bool | project_ifst = false |
||
) |
Used in the command-line tool fstcomposecontext.
It creates a context FST and composes it on the left with "ifst" to make "ofst". It outputs the label information to ilabels_out. "ifst" is mutable because we need to add the subsequential loop.
[in] | disambig_syms | List of disambiguation symbols, e.g. the integer ids of #0, #1, #2 ... in the phones.txt. |
[in] | context_width | Size of context window, e.g. 3 for triphone. |
[in] | central_position | Central position in phonetic context window (zero-based index), e.g. 1 for triphone. |
[in,out] | ifst | The FST we are composing with C (e.g. LG.fst), mustable because we need to add the subsequential loop to it. |
[out] | ofst | Composed output FST (would be CLG.fst). |
[out] | ilabels_out | Vector, indexed by ilabel of CLG.fst, providing information about the meaning of that ilabel; see "http://kaldi-asr.org/doc/tree_externals.html#tree_ilabel". |
[in] | project_ifst | This is intended only to be set to true in the program 'fstmakecontextfst'... if true, it will project on the input after adding the subsequential loop to 'ifst', which allows us to reconstruct the context fst C.fst. |
Definition at line 246 of file context-fst.cc.
References AddSubsequentialLoop(), ComposeDeterministicOnDemandInverse(), GetInputSymbols(), rnnlm::i, KALDI_ASSERT, and InverseContextFst::SwapIlabelInfo().
Referenced by main().
void fst::ComposeContextLeftBiphone | ( | int32 | nonterm_phones_offset, |
const std::vector< int32 > & | disambig_syms, | ||
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" framework (see The ContextFst object, i.e.
../doc/grammar.dox, for more details). This does not take the 'context_width' and 'central_position' arguments because they are assumed to be 2 and 1 respectively (meaning, left-biphone phonetic context).
This function creates a context FST and composes it on the left with "ifst" to make "ofst".
[in] | nonterm_phones_offset | The integer id of the symbol #nonterm_bos in the phones.txt file. You can just set this to a large value (like 1 million) if you are not actually using nonterminals (e.g. for testing purposes). |
[in] | disambig_syms | List of disambiguation symbols, e.g. the integer ids of #0, #1, #2 ... in the phones.txt. |
[in,out] | ifst | The FST we are composing with C (e.g. LG.fst). |
[out] | ofst | Composed output FST (would be CLG.fst). |
[out] | ilabels | Vector, indexed by ilabel of CLG.fst, providing information about the meaning of that ilabel; see The ilabel_info object (http://kaldi-asr.org/doc/tree_externals.html#tree_ilabel) and also Special symbols in CLG.fst (http://kaldi-asr.org/doc/grammar#grammar_special_clg). |
Definition at line 196 of file grammar-context-fst.cc.
References ComposeDeterministicOnDemandInverse(), GetInputSymbols(), rnnlm::i, and InverseLeftBiphoneContextFst::SwapIlabelInfo().
Referenced by GetEncodingMultiple(), and main().
void fst::ComposeContextLeftBiphone | ( | int32 | nonterm_phones_offset, |
const std::vector< int32 > & | disambig_syms, | ||
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" framework (see The ContextFst object, i.e.
../doc/grammar.dox, for more details). This does not take the 'context_width' and 'central_position' arguments because they are assumed to be 2 and 1 respectively (meaning, left-biphone phonetic context).
This function creates a context FST and composes it on the left with "ifst" to make "ofst".
[in] | nonterm_phones_offset | The integer id of the symbol #nonterm_bos in the phones.txt file. You can just set this to a large value (like 1 million) if you are not actually using nonterminals (e.g. for testing purposes). |
[in] | disambig_syms | List of disambiguation symbols, e.g. the integer ids of #0, #1, #2 ... in the phones.txt. |
[in,out] | ifst | The FST we are composing with C (e.g. LG.fst). |
[out] | ofst | Composed output FST (would be CLG.fst). |
[out] | ilabels | Vector, indexed by ilabel of CLG.fst, providing information about the meaning of that ilabel; see The ilabel_info object (http://kaldi-asr.org/doc/tree_externals.html#tree_ilabel) and also Special symbols in CLG.fst (http://kaldi-asr.org/doc/grammar#grammar_special_clg). |
Definition at line 196 of file grammar-context-fst.cc.
References ComposeDeterministicOnDemandInverse(), GetInputSymbols(), rnnlm::i, and InverseLeftBiphoneContextFst::SwapIlabelInfo().
Referenced by GetEncodingMultiple(), and main().
void ComputeStateInfo | ( | const VectorFst< Arc > & | fst, |
std::vector< char > * | epsilon_info | ||
) |
This function will set epsilon_info to have size equal to the NumStates() of the FST, containing a logical-or of the enum values kStateHasEpsilonArcsEntering, kStateHasNonEpsilonArcsEntering, kStateHasEpsilonArcsLeaving, and kStateHasNonEpsilonArcsLeaving.
The meaning should be obvious. Note: an epsilon arc is defined as an arc where ilabel == olabel == 0.
Definition at line 28 of file epsilon-property-inl.h.
References kStateHasEpsilonArcsEntering, kStateHasEpsilonArcsLeaving, kStateHasNonEpsilonArcsEntering, and kStateHasNonEpsilonArcsLeaving.
Referenced by kaldi::CreateFactorTransducer(), EnsureEpsilonProperty(), and TestEnsureEpsilonProperty().
void ConvertFstToLattice | ( | const ExpandedFst< ArcTpl< TropicalWeight > > & | ifst, |
MutableFst< ArcTpl< LatticeWeightTpl< Real > > > * | ofst | ||
) |
Converts TropicalWeight to LatticeWeight (puts all the weight on the first float in the lattice's pair).
Definition at line 266 of file lattice-utils-inl.h.
Referenced by ConvertLattice().
void ConvertLattice | ( | const ExpandedFst< ArcTpl< Weight > > & | ifst, |
MutableFst< ArcTpl< CompactLatticeWeightTpl< Weight, Int > > > * | ofst, | ||
bool | invert = true |
||
) |
Convert lattice from a normal FST to a CompactLattice FST.
This is a bit like converting to the Gallic semiring, except the semiring behaves in a different way (designed to take the best path). Note: the ilabels end up as the symbols on the arcs of the output acceptor, and the olabels go to the strings. To make it the other way around (useful for the speech-recognition application), set invert=true [the default].
Definition at line 33 of file lattice-utils-inl.h.
References Factor(), and KALDI_PARANOID_ASSERT.
Referenced by ConvertLattice(), kaldi::ConvertLatticeToUnweightedAcceptor(), kaldi::ConvertToCompactLattice(), kaldi::ConvertToLattice(), DiscriminativeExampleSplitter::CreateOutputLattice(), kaldi::DecodeUtteranceLatticeIncremental(), DiscriminativeExampleSplitter::DoExcise(), kaldi::nnet2::ExampleToPdfPost(), kaldi::GetDiagnosticsAndPrintOutput(), NnetDiscriminativeUpdater::LatticeComputations(), kaldi::LatticeToString(), main(), MinimumBayesRisk::MinimumBayesRisk(), DiscriminativeExampleSplitter::PrepareLattice(), kaldi::RandCompactLattice(), kaldi::SentenceLevelConfidence(), kaldi::TestCompactLatticeTableCross(), TestConvert2(), kaldi::TestLatticeTableCross(), kaldi::TestWordAlignedLattice(), and kaldi::TestWordAlignLatticeLexicon().
void fst::ConvertLattice | ( | const ExpandedFst< ArcTpl< LatticeWeightTpl< float > > > & | ifst, |
MutableFst< ArcTpl< CompactLatticeWeightTpl< LatticeWeightTpl< double >, Int > > > * | ofst | ||
) |
Definition at line 87 of file lattice-utils.h.
References ConvertLattice().
void ConvertLattice | ( | const ExpandedFst< ArcTpl< CompactLatticeWeightTpl< Weight, Int > > > & | ifst, |
MutableFst< ArcTpl< Weight > > * | ofst, | ||
bool | invert = true |
||
) |
Convert lattice CompactLattice format to Lattice.
This is a bit like converting from the Gallic semiring. As for any CompactLattice, "ifst" must be an acceptor (i.e., ilabels and olabels should be identical). If invert=false, the labels on "ifst" become the ilabels on "ofst" and the strings in the weights of "ifst" becomes the olabels. If invert=true [default], this is reversed (useful for speech recognition lattices; our standard non-compact format has the words on the output side to match HCLG).
Definition at line 89 of file lattice-utils-inl.h.
References rnnlm::n, and kaldi::swap().
void fst::ConvertLattice | ( | const ExpandedFst< ArcTpl< LatticeWeightTpl< double > > > & | ifst, |
MutableFst< ArcTpl< CompactLatticeWeightTpl< LatticeWeightTpl< float >, Int > > > * | ofst | ||
) |
Definition at line 96 of file lattice-utils.h.
References ConvertLattice().
void fst::ConvertLattice | ( | const ExpandedFst< ArcTpl< CompactLatticeWeightTpl< LatticeWeightTpl< double >, Int > > > & | ifst, |
MutableFst< ArcTpl< LatticeWeightTpl< float > > > * | ofst | ||
) |
Converts CompactLattice with double to Lattice with float.
Definition at line 105 of file lattice-utils.h.
References ConvertLattice().
void fst::ConvertLattice | ( | const ExpandedFst< ArcTpl< CompactLatticeWeightTpl< LatticeWeightTpl< float >, Int > > > & | ifst, |
MutableFst< ArcTpl< LatticeWeightTpl< double > > > * | ofst | ||
) |
Converts CompactLattice with float to Lattice with double.
Definition at line 114 of file lattice-utils.h.
References ConvertFstToLattice(), and ConvertLattice().
void ConvertLattice | ( | const ExpandedFst< ArcTpl< WeightIn > > & | ifst, |
MutableFst< ArcTpl< WeightOut > > * | ofst | ||
) |
Convert between CompactLattices and Lattices of different floating point types...
this works between any pair of weight types for which ConvertLatticeWeight is defined (c.f. lattice-weight.h), and also includes conversion from LatticeWeight to TropicalWeight.
Definition at line 157 of file lattice-utils-inl.h.
References ConvertLatticeWeight(), and KALDI_PARANOID_ASSERT.
|
inline |
Define some ConvertLatticeWeight functions that are used in various lattice conversions...
make them all templates, some with no arguments, since some must be templates.
Definition at line 819 of file lattice-weight.h.
References LatticeWeightTpl< FloatType >::SetValue1(), LatticeWeightTpl< FloatType >::SetValue2(), LatticeWeightTpl< FloatType >::Value1(), and LatticeWeightTpl< FloatType >::Value2().
Referenced by ConvertLattice().
|
inline |
Definition at line 827 of file lattice-weight.h.
|
inline |
Definition at line 838 of file lattice-weight.h.
References Times(), LatticeWeightTpl< FloatType >::Value1(), and LatticeWeightTpl< FloatType >::Value2().
void ConvertNbestToVector | ( | const Fst< Arc > & | fst, |
std::vector< VectorFst< Arc > > * | fsts_out | ||
) |
This function converts an FST with a special structure, which is output by the OpenFst functions ShortestPath and RandGen, and converts them into a std::vector of separate FSTs.
This special structure is that the only state that has more than one (arcs-out or final-prob) is the start state. fsts_out is resized to the appropriate size.
Definition at line 221 of file fstext-utils-inl.h.
References KALDI_ASSERT.
Referenced by main(), MinimizeEncoded(), NbestAsFsts(), and kaldi::TestWordAlignLatticeLexicon().
|
inline |
Definition at line 847 of file lattice-weight.h.
References LatticeWeightTpl< FloatType >::Value1(), and LatticeWeightTpl< FloatType >::Value2().
Referenced by LatticeIncrementalDeterminizer::AddArcToClat(), kaldi::CompactLatticeLimitDepth(), kaldi::CompactLatticeShortestPath(), PrunedCompactLatticeComposer::ComputeBackwardCosts(), LatticeDeterminizerPruned< Weight, IntType >::ComputeBackwardWeight(), PrunedCompactLatticeComposer::ComputeForwardCosts(), kaldi::ComputeLatticeAlphasAndBetas(), PrunedCompactLatticeComposer::ComputeLatticeStateInfo(), LatticeDeterminizerPruned< Weight, IntType >::InitialToStateId(), kaldi::LatticeForwardBackward(), kaldi::LatticeForwardBackwardMpeVariants(), main(), ArcPosteriorComputer::OutputPosteriors(), LatticeIncrementalDeterminizer::ProcessArcsFromChunkStartState(), LatticeDeterminizerPruned< Weight, IntType >::ProcessFinal(), PrunedCompactLatticeComposer::ProcessQueueElement(), PrunedCompactLatticeComposer::ProcessTransition(), LatticeDeterminizerPruned< Weight, IntType >::ProcessTransition(), LatticeDeterminizerPruned< Weight, IntType >::ProcessTransitions(), kaldi::PruneLattice(), and kaldi::SentenceLevelConfidence().
|
inline |
Definition at line 852 of file lattice-weight.h.
|
inline |
Definition at line 857 of file lattice-weight.h.
void CopyToVectorFst | ( | GrammarFst * | grammar_fst, |
VectorFst< StdArc > * | vector_fst | ||
) |
This function copies a GrammarFst to a VectorFst (intended mostly for testing and comparison purposes).
GrammarFst doesn't actually inherit from class Fst, so we can't just construct an FST from the GrammarFst.
grammar_fst gets expanded by this call, and although we could make it a const reference (because the ArcIterator does actually use const_cast), we make it a non-const pointer to emphasize that this call does change grammar_fst.
Definition at line 988 of file grammar-fst.cc.
References ArcIterator< GrammarFst >::Done(), GrammarFst::Final(), GrammarFstArc::ilabel, ArcIterator< GrammarFst >::Next(), GrammarFstArc::nextstate, GrammarFstArc::olabel, GrammarFst::Start(), ArcIterator< GrammarFst >::Value(), and GrammarFstArc::weight.
Referenced by main().
StdVectorFst* fst::CreateBackoffFst | ( | ) |
Definition at line 64 of file deterministic-fst-test.cc.
Referenced by TestBackoffAndCache(), and TestCompose().
void CreateFactorFst | ( | const std::vector< std::vector< I > > & | sequences, |
MutableFst< Arc > * | fst | ||
) |
The function CreateFactorFst will create an FST that expands out the "factors" that are the indices of the "sequences" array, into linear sequences of symbols.
There is a single start and end state (state 0), and for each nonzero index i into the array "sequences", there is an arc from state 0 that has output-label i, and enters a chain of states with output epsilons and input labels corresponding to the remaining elements of the sequences, terminating again in state 0. This FST is output-deterministic and sorted on olabel. Composing an FST on the left with the output of this function, should be the same as calling "ExpandInputSequences". Use TableCompose (see table-matcher.h) for efficiency.
Definition at line 250 of file factor-inl.h.
References rnnlm::i, and KALDI_ASSERT_IS_INTEGER_TYPE.
Referenced by Factor(), and TestFactor().
SymbolTable* fst::CreateILabelInfoSymbolTable | ( | const std::vector< std::vector< int32 > > & | ilabel_info, |
const SymbolTable & | phones_symtab, | ||
std::string | separator, | ||
std::string | disambig_prefix | ||
) |
The following function is mainly of use for printing and debugging.
Definition at line 345 of file context-fst.cc.
References rnnlm::i, rnnlm::j, KALDI_ASSERT, and KALDI_ERR.
Referenced by main().
SymbolTable* fst::CreateILabelInfoSymbolTable | ( | const vector< vector< int32 > > & | info, |
const SymbolTable & | phones_symtab, | ||
std::string | separator, | ||
std::string | initial_disambig | ||
) |
The following function is mainly of use for printing and debugging.
Definition at line 345 of file context-fst.cc.
References rnnlm::i, rnnlm::j, KALDI_ASSERT, and KALDI_ERR.
Referenced by main().
void CreateMapFst | ( | const std::vector< I > & | symbol_map, |
MutableFst< Arc > * | fst | ||
) |
CreateMapFst will create an FST representing this symbol_map.
The FST has a single loop state with single-arc loops with isymbol = symbol_map[i], osymbol = i. The resulting FST applies this map to the input symbols of something we compose with it on the right. Must have symbol_map[0] == 0.
Definition at line 285 of file factor-inl.h.
References KALDI_ASSERT_IS_INTEGER_TYPE.
Referenced by main().
void CreateNewSymbols | ( | SymbolTable * | input_sym_table, |
int | nSym, | ||
std::string | prefix, | ||
std::vector< Label > * | symsOut | ||
) |
Definition at line 581 of file pre-determinize-inl.h.
References rnnlm::i.
Referenced by TestAddSelfLoops().
StdVectorFst* fst::CreateResultFst | ( | ) |
Definition at line 91 of file deterministic-fst-test.cc.
Referenced by TestBackoffAndCache(), and TestCompose().
Arc::StateId CreateSuperFinal | ( | MutableFst< Arc > * | fst | ) |
Definition at line 687 of file pre-determinize-inl.h.
Referenced by LatticeLexiconWordAligner::LatticeLexiconWordAligner(), LatticePhoneAligner::LatticePhoneAligner(), LatticeWordAligner::LatticeWordAligner(), main(), PreDeterminize(), and MinimumBayesRisk::PrepareLatticeAndInitStats().
|
inline |
Returns a default 2x2 matrix scaling factor for LatticeWeight.
Definition at line 130 of file lattice-utils.h.
Referenced by ScaleLattice(), and TestScalePair().
int64 DeleteISymbols | ( | MutableFst< Arc > * | fst, |
std::vector< typename Arc::Label > | isyms | ||
) |
Definition at line 651 of file pre-determinize-inl.h.
References rnnlm::i.
Referenced by TestDeterminize(), TestMinimize(), and TestPreDeterminize().
void fst::DeleteTestFst | ( | StdVectorFst * | fst | ) |
Definition at line 114 of file deterministic-fst-test.cc.
|
inline |
Definition at line 388 of file fstext-utils-inl.h.
Referenced by main().
template void fst::DeterminizeLatticeDeletePhones | ( | ArcTpl< kaldi::LatticeWeight >::Label | first_phone_label, |
MutableFst< ArcTpl< kaldi::LatticeWeight > > * | fst | ||
) |
template bool fst::DeterminizeLatticePhonePruned< kaldi::LatticeWeight, kaldi::int32 > | ( | const kaldi::TransitionModel & | trans_model, |
const ExpandedFst< kaldi::LatticeArc > & | ifst, | ||
double | prune, | ||
MutableFst< kaldi::CompactLatticeArc > * | ofst, | ||
DeterminizeLatticePhonePrunedOptions | opts | ||
) |
template bool fst::DeterminizeLatticePhonePruned< kaldi::LatticeWeight, kaldi::int32 > | ( | const kaldi::TransitionModel & | trans_model, |
MutableFst< kaldi::LatticeArc > * | ifst, | ||
double | prune, | ||
MutableFst< kaldi::CompactLatticeArc > * | ofst, | ||
DeterminizeLatticePhonePrunedOptions | opts | ||
) |
bool fst::DeterminizeLatticePhonePrunedFirstPass | ( | const kaldi::TransitionModel & | trans_model, |
double | beam, | ||
MutableFst< ArcTpl< Weight > > * | fst, | ||
const DeterminizeLatticePrunedOptions & | opts | ||
) |
This function does a first pass determinization with phone symbols inserted at phone boundary.
It uses a transition model to work out the transition-id to phone map. First, phones will be inserted into the word level lattice. Second, determinization will be applied on top of the phone + word lattice. Finally, the inserted phones will be removed, converting the lattice back to a word level lattice. The output lattice of this pass is not deterministic, since we remove the phone symbols as a last step. It is supposed to be followed by another pass of determinization at the word level. It could also be useful for some other applications such as fMLLR estimation, confidence estimation, discriminative training, etc.
Definition at line 1393 of file determinize-lattice-pruned.cc.
References DeterminizeLatticeDeletePhones(), and DeterminizeLatticeInsertPhones().
template bool fst::DeterminizeLatticePruned< kaldi::LatticeWeight > | ( | const ExpandedFst< kaldi::LatticeArc > & | ifst, |
double | prune, | ||
MutableFst< kaldi::CompactLatticeArc > * | ofst, | ||
DeterminizeLatticePrunedOptions | opts | ||
) |
template bool fst::DeterminizeLatticePruned< kaldi::LatticeWeight > | ( | const ExpandedFst< kaldi::LatticeArc > & | ifst, |
double | prune, | ||
MutableFst< kaldi::LatticeArc > * | ofst, | ||
DeterminizeLatticePrunedOptions | opts | ||
) |
|
inline |
Definition at line 371 of file fstext-utils-inl.h.
References DeterminizeStar().
Referenced by TrainingGraphCompiler::CompileGraph(), TrainingGraphCompiler::CompileGraphs(), and main().
|
inline |
Definition at line 125 of file arctic-weight.h.
|
inline |
Definition at line 137 of file arctic-weight.h.
|
inline |
Definition at line 143 of file arctic-weight.h.
|
inline |
Definition at line 370 of file lattice-weight.h.
References KALDI_WARN, LatticeWeightTpl< FloatType >::Value1(), LatticeWeightTpl< FloatType >::Value2(), and LatticeWeightTpl< FloatType >::Zero().
Referenced by CompactLatticeWeightTest(), Divide(), LatticeWeightTest(), LatticeDeterminizerPruned< Weight, IntType >::NormalizeSubset(), LatticeDeterminizer< Weight, IntType >::NormalizeSubset(), DeterminizerStar< F >::ProcessTransition(), PushCompactLatticeWeights(), RemoveEpsLocalClass< Arc, ReweightPlus >::RemoveEpsPattern1(), RemoveEpsLocalClass< Arc, ReweightPlus >::Reweight(), and TestRemoveEpsLocalSpecial().
|
inline |
Definition at line 689 of file lattice-weight.h.
References Divide(), KALDI_ERR, CompactLatticeWeightTpl< WeightType, IntType >::String(), CompactLatticeWeightTpl< WeightType, IntType >::Weight(), and CompactLatticeWeightTpl< WeightType, IntType >::Zero().
void EnsureEpsilonProperty | ( | VectorFst< Arc > * | fst | ) |
This function modifies the fst (while maintaining equivalence) in such a way that, after the modification, all states of the FST which have epsilon-arcs entering them, have no non-epsilon arcs entering them, and all states which have epsilon-arcs leaving them, have no non-epsilon arcs leaving them.
It does this by creating extra states and adding extra epsilon transitions. An epsilon arc is defined as an arc where both the ilabel and the olabel are epsilons. This function may fail with KALDI_ASSERT for certain cyclic FSTs, but is safe in the acyclic case.
new_state_vec is for those states that have both epsilon and non-epsilon arcs entering. For these states, we'll create a new state for the non-epsilon arcs to enter and put it in this array, and we'll put an epsilon transition from the new state to the old state.
First modify arcs to point to states in new_state_vec when necessary.
Now handle the situation where states have both epsilon and non-epsilon arcs leaving.
Definition at line 49 of file epsilon-property-inl.h.
References ComputeStateInfo(), kStateHasEpsilonArcsEntering, kStateHasEpsilonArcsLeaving, kStateHasNonEpsilonArcsEntering, and kStateHasNonEpsilonArcsLeaving.
Referenced by main(), and TestEnsureEpsilonProperty().
bool EqualAlign | ( | const Fst< Arc > & | ifst, |
typename Arc::StateId | length, | ||
int | rand_seed, | ||
MutableFst< Arc > * | ofst, | ||
int | num_retries = 10 |
||
) |
EqualAlign is similar to RandGen, but it generates a sequence with exactly "length" input symbols.
It returns true on success, false on failure (failure is partly random but should never happen in practice for normal speech models.) It generates a random path through the input FST, finds out which subset of the states it visits along the way have self-loops with inupt symbols on them, and outputs a path with exactly enough self-loops to have the requested number of input symbols. Note that EqualAlign does not use the probabilities on the FST. It just uses equal probabilities in the first stage of selection (since the output will anyway not be a truly random sample from the FST). The input fst "ifst" must be connected or this may enter an infinite loop.
Definition at line 803 of file fstext-utils-inl.h.
References FindSelfLoopWithILabel(), rnnlm::i, rnnlm::j, KALDI_ASSERT, KALDI_WARN, and kaldi::RandInt().
Referenced by main(), MinimizeEncoded(), and TestEqualAlign().
void ExpandInputSequences | ( | const std::vector< std::vector< I > > & | sequences, |
MutableFst< Arc > * | fst | ||
) |
ExpandInputSequences expands out the input symbols into sequences of input symbols.
It creates linear chains of states for each arc that had >1 augmented symbol on it. It also sets the input symbol table to NULL, since in case you did have a symbol table there it would no longer be valid. It leaves any weight and output symbols on the first arc of the chain.
Definition at line 163 of file factor-inl.h.
References KALDI_ASSERT_IS_INTEGER_TYPE, and rnnlm::n.
Referenced by TestFactor().
void Factor | ( | const Fst< Arc > & | fst, |
MutableFst< Arc > * | ofst, | ||
std::vector< std::vector< I > > * | symbols | ||
) |
Factor identifies linear chains of states with an olabel (if any) only on the first arc of the chain, and possibly a sequence of ilabels; it outputs an FST with different symbols on the input that represent sequences of the original input symbols; it outputs the mapping from the new symbol to sequences of original symbols, as "symbols" [zero is reserved for epsilon].
As a side effect it also sorts the FST in depth-first order. Factor will usually do the best job when the olabels have been pushed to the left, i.e. if you make a call like
Push<Arc, REWEIGHT_TO_INITIAL>(fsta, &fstb, kPushLabels);
This is because it only creates a chain with olabels on the first arc of the chain (or a chain with no olabels). [it's possible to construct cases where pushing makes things worse, though]. After Factor, the composition of *ofst with the result of calling CreateFactorFst(*symbols) should be equivalent to fst. Alternatively, calling ExpandInputSequences with ofst and *symbols would produce something equivalent to fst.
Definition at line 69 of file factor-inl.h.
References GetStateProperties(), rnnlm::i, KALDI_ASSERT_IS_INTEGER_TYPE, kStateArcsIn, kStateArcsOut, kStateIlabelsOut, and Times().
Referenced by ConvertLattice(), Factor(), and TestFactor().
void Factor | ( | const Fst< Arc > & | fst, |
MutableFst< Arc > * | ofst1, | ||
MutableFst< Arc > * | ofst2 | ||
) |
This is a more conventional interface of Factor that outputs the result as two FSTs.
Definition at line 154 of file factor-inl.h.
References CreateFactorFst(), and Factor().
bool fst::FileExists | ( | std::string | strFilename | ) |
Definition at line 31 of file deterministic-fst-test.cc.
ssize_t fst::FindSelfLoopWithILabel | ( | const Fst< Arc > & | fst, |
typename Arc::StateId | s | ||
) |
Definition at line 794 of file fstext-utils-inl.h.
Referenced by EqualAlign().
Returns true if and only if the FST is such that the input symbols on arcs exiting any given state all have the same value.
If end_is_epsilon, treat end-state as an epsilon output arc [i.e. ensure end-states cannot have non-epsilon output transitions.]
Definition at line 497 of file fstext-utils-inl.h.
References FollowingInputSymbolsAreSameClass().
Referenced by MinimizeEncoded(), and TestMakeSymbolsSame().
Definition at line 504 of file fstext-utils-inl.h.
Referenced by FollowingInputSymbolsAreSame(), MinimizeEncoded(), and TestMakeSymbolsSameClass().
|
static |
Definition at line 34 of file context-fst-test.cc.
References rnnlm::i, and kaldi::Rand().
|
static |
Definition at line 124 of file context-fst-test.cc.
References rnnlm::i, KALDI_ASSERT, kaldi::Rand(), and kaldi::RandUniform().
|
inline |
Definition at line 90 of file grammar-context-fst.h.
References ComposeContextLeftBiphone(), and kNontermMediumNumber.
Referenced by GrammarFst::DecodeSymbol(), GrammarFst::ExpandState(), GrammarFstPreparer::FixArcsToFinalStates(), GrammarFstPreparer::GetCategoryOfArc(), kaldi::GetHTransducer(), GrammarFstPreparer::IsEntryState(), GrammarFstPreparer::MaybeAddFinalProbToState(), and GrammarFstPreparer::NeedEpsilons().
void GetInputSymbols | ( | const Fst< Arc > & | fst, |
bool | include_eps, | ||
std::vector< I > * | symbols | ||
) |
GetInputSymbols gets the list of symbols on the input of fst (including epsilon, if include_eps == true), as a sorted, unique list.
Definition at line 97 of file fstext-utils-inl.h.
References kaldi::CopySetToVector(), KALDI_ASSERT, and KALDI_ASSERT_IS_INTEGER_TYPE.
Referenced by ComposeContext(), ComposeContextLeftBiphone(), kaldi::CreateEditDistance(), kaldi::GetRandomAlignmentForPhone(), and TestMakeLinearAcceptor().
bool GetLinearSymbolSequence | ( | const Fst< Arc > & | fst, |
std::vector< I > * | isymbols_out, | ||
std::vector< I > * | osymbols_out, | ||
typename Arc::Weight * | tot_weight_out | ||
) |
GetLinearSymbolSequence gets the symbol sequence from a linear FST.
If the FST is not just a linear sequence, it returns false. If it is a linear sequence (including the empty FST), it returns true. In this case it outputs the symbol sequences as "isymbols_out" and "osymbols_out" (removing epsilons), and the total weight as "tot_weight". The total weight will be Weight::Zero() if the FST is empty. If any of the output pointers are NULL, it does not create that output.
Definition at line 178 of file fstext-utils-inl.h.
References Times().
Referenced by kaldi::AlignUtteranceWrapper(), CheckPhones(), kaldi::DecodeUtterance(), DecodeUtterance(), kaldi::DecodeUtteranceLatticeFaster(), kaldi::DecodeUtteranceLatticeIncremental(), kaldi::DecodeUtteranceLatticeSimple(), OnlineFasterDecoder::EndOfUtterance(), kaldi::GetDiagnosticsAndPrintOutput(), kaldi::LatticeToString(), main(), kaldi::MaybeDoSanityCheck(), MinimizeEncoded(), MinimumBayesRisk::MinimumBayesRisk(), NnetBatchDecoder::ProcessOutputUtterance(), TestEqualAlign(), TestMakeLinearAcceptor(), and DecodeUtteranceLatticeFasterClass::~DecodeUtteranceLatticeFasterClass().
void GetOutputSymbols | ( | const Fst< Arc > & | fst, |
bool | include_eps, | ||
std::vector< I > * | symbols | ||
) |
GetOutputSymbols gets the list of symbols on the output of fst (including epsilon, if include_eps == true)
Definition at line 76 of file fstext-utils-inl.h.
References kaldi::CopySetToVector(), KALDI_ASSERT, and KALDI_ASSERT_IS_INTEGER_TYPE.
Referenced by kaldi::CreateEditDistance().
void GetStateProperties | ( | const Fst< Arc > & | fst, |
typename Arc::StateId | max_state, | ||
std::vector< StatePropertiesType > * | props | ||
) |
This function works out various properties of the states in the FST, using the bit properties defined in StatePropertiesEnum.
Definition at line 37 of file factor-inl.h.
References kStateArcsIn, kStateArcsOut, kStateFinal, kStateIlabelsOut, kStateInitial, kStateMultipleArcsIn, kStateMultipleArcsOut, and kStateOlabelsOut.
Referenced by Factor().
void GetSymbols | ( | const SymbolTable & | symtab, |
bool | include_eps, | ||
std::vector< I > * | syms_out | ||
) |
|
inline |
Definition at line 147 of file lattice-utils.h.
Referenced by main().
Arc::Label HighestNumberedInputSymbol | ( | const Fst< Arc > & | fst | ) |
Returns the highest numbered input symbol id of the FST (or zero for an empty FST.
Definition at line 54 of file fstext-utils-inl.h.
Referenced by DeterminizeLatticeInsertPhones(), main(), SafeDeterminizeMinimizeWrapper(), SafeDeterminizeWrapper(), TestDeterminizeStarInLog(), and TestPreDeterminize().
Arc::Label HighestNumberedOutputSymbol | ( | const Fst< Arc > & | fst | ) |
Returns the highest numbered output symbol id of the FST (or zero for an empty FST.
Definition at line 41 of file fstext-utils-inl.h.
Referenced by LatticeWordAligner::LatticeWordAligner().
|
static |
Definition at line 31 of file fstdeterminizestart.cc.
References rnnlm::i, and kaldi::LogAdd().
|
static |
This utility function input-determinizes a specified state s of the FST 'fst'.
(This input-determinizes while treating epsilon as a real symbol, although for the application we expect to use it, there won't be epsilons).
What this function does is: for any symbol i that appears as the ilabel of more than one arc leaving state s of FST 'fst', it creates an additional state, it creates a new state t with epsilon-input transitions leaving it for each of those multiple arcs leaving state s; it deletes the original arcs leaving state s; and it creates a single arc leaving state s to the newly created state with the ilabel i on it. It sets the weights as necessary to preserve equivalence and also to ensure that if, prior to this modification, the FST was stochastic when cast to the log semiring (see IsStochasticInLog()), it still will be. I.e. when interpreted as negative logprobs, the weight from state s to t would be the sum of the weights on the original arcs leaving state s.
This is used as a very cheap solution when preparing FSTs for the grammar decoder, to ensure that there is only one entry-state to the sub-FST for each phonetic left-context; this keeps the grammar-FST code (i.e. the code that stitches them together) simple. Of course it will tend to introduce unnecessary epsilons, and if we were careful we might be able to remove some of those, but this wouldn't have a substantial impact on overall decoder performance so we don't bother.
Definition at line 472 of file grammar-fst.cc.
References rnnlm::i, and kaldi::LogAdd().
Referenced by main(), and GrammarFstPreparer::Prepare().
|
inline |
Definition at line 1173 of file fstext-utils-inl.h.
References ApproxEqual(), and Plus().
Referenced by IsStochasticFstInLog(), main(), MinimizeEncoded(), RhoCompose(), and TestRemoveEpsLocalSpecial().
|
inline |
This function returns true if, in the semiring of the FST, the sum (within the semiring) of all the arcs out of each state in the FST is one, to within delta.
After MakeStochasticFst, this should be true (for a connected FST).
fst | [in] the FST that we are testing. |
delta | [in] the tolerance to within which we test equality to 1. |
min_sum | [out] if non, NULL, contents will be set to the minimum sum of weights. |
max_sum | [out] if non, NULL, contents will be set to the maximum sum of weights. |
Definition at line 1135 of file fstext-utils-inl.h.
References ApproxEqual(), and Plus().
|
inline |
Definition at line 1215 of file fstext-utils-inl.h.
References IsStochasticFst(), and KALDI_ERR.
Referenced by main(), MinimizeEncoded(), and TestPushSpecial().
|
inline |
Definition at line 156 of file lattice-utils.h.
References CompactLatticeHasAlignment(), RemoveAlignmentsFromCompactLattice(), and ScaleLattice().
Referenced by main().
void fst::LatticeWeightTest | ( | ) |
Definition at line 64 of file lattice-weight-test.cc.
References ApproxEqual(), kaldi::AssertEqual(), Compare(), Divide(), rnnlm::i, KALDI_ASSERT, LatticeWeightTpl< FloatType >::Member(), LatticeWeightTpl< BaseFloat >::One(), Plus(), LatticeWeightTpl< FloatType >::Quantize(), RandomLatticeWeight(), LatticeWeightTpl< FloatType >::Read(), LatticeWeightTpl< FloatType >::Reverse(), Times(), LatticeWeightTpl< FloatType >::Value1(), LatticeWeightTpl< FloatType >::Value2(), and LatticeWeightTpl< BaseFloat >::Zero().
Referenced by main().
void MakeFollowingInputSymbolsSame | ( | bool | end_is_epsilon, |
MutableFst< Arc > * | fst | ||
) |
MakeFollowingInputSymbolsSame ensures that all arcs exiting any given fst state have the same input symbol.
It does this by detecting states that have differing input symbols on arcs that exit it, and inserting, for each of the following arcs with non-epsilon input symbol, a new dummy state that has an input-epsilon link from the fst state. The output symbol and weight stay on the link to the dummy state (in order to keep the FST output-deterministic and stochastic, if it already was). If end_is_epsilon, treat "being a final-state" like having an epsilon output link.
Definition at line 610 of file fstext-utils-inl.h.
References MakeFollowingInputSymbolsSameClass().
Referenced by MinimizeEncoded(), and TestMakeSymbolsSame().
void MakeFollowingInputSymbolsSameClass | ( | bool | end_is_epsilon, |
MutableFst< Arc > * | fst, | ||
const F & | f | ||
) |
As MakeFollowingInputSymbolsSame, but takes a functor object that maps labels to classes.
Definition at line 616 of file fstext-utils-inl.h.
References rnnlm::i, and rnnlm::j.
Referenced by kaldi::AddSelfLoopsNoReorder(), MakeFollowingInputSymbolsSame(), MinimizeEncoded(), and TestMakeSymbolsSameClass().
void MakeLinearAcceptor | ( | const std::vector< I > & | labels, |
MutableFst< Arc > * | ofst | ||
) |
Creates unweighted linear acceptor from symbol sequence.
Definition at line 311 of file fstext-utils-inl.h.
References rnnlm::i.
Referenced by TrainingGraphCompiler::CompileGraphFromText(), TrainingGraphCompiler::CompileGraphsFromText(), main(), MinimizeEncoded(), and TestMakeLinearAcceptor().
void MakeLinearAcceptorWithAlternatives | ( | const std::vector< std::vector< I > > & | labels, |
MutableFst< Arc > * | ofst | ||
) |
Creates an unweighted acceptor with a linear structure, with alternatives at each position.
Epsilon is treated like a normal symbol here. Each position in "labels" must have at least one alternative.
Definition at line 290 of file fstext-utils-inl.h.
References rnnlm::i, rnnlm::j, and KALDI_ASSERT.
Referenced by MinimizeEncoded().
VectorFst< Arc > * MakeLoopFst | ( | const std::vector< const ExpandedFst< Arc > * > & | fsts | ) |
MakeLoopFst creates an FST that has a state that is both initial and final (weight == Weight::One()), and for each non-NULL pointer fsts[i], it has an arc out whose output-symbol is i and which goes to a sub-graph whose input language is equivalent to fsts[i], where the final-state becomes a transition to the loop-state.
Each fst in "fsts" should be an acceptor. The fst MakeLoopFst returns is output-deterministic, but not output-epsilon free necessarily, and arcs are sorted on output label. Note: if some of the pointers in the input vector "fsts" have the same value, "MakeLoopFst" uses this to speed up the computation. Formally: suppose I is the set of indexes i such that fsts[i] != NULL. Let L[i] be the language that the acceptor fsts[i] accepts. Let the language K be the set of input-output pairs i:l such that i in I and l in L[i]. Then the FST returned by MakeLoopFst accepts the language K*, where * is the Kleene closure (CLOSURE_STAR) of K. We could have implemented this via a combination of "project", "concat", "union" and "closure". But that FST would have been less well optimized and would have a lot of final-states.
Definition at line 669 of file fstext-utils-inl.h.
References rnnlm::i, and KALDI_ASSERT.
Referenced by kaldi::GetHTransducer(), MinimizeEncoded(), and TestMakeLoopFst().
VectorFst<Arc>* fst::MakeLoopFstCompare | ( | const vector< const ExpandedFst< Arc > *> & | fsts | ) |
Definition at line 281 of file fstext-utils-test.cc.
References ClearSymbols(), fst::pre_determinize_helpers::Closure(), and rnnlm::i.
Referenced by TestMakeLoopFst().
void MakePrecedingInputSymbolsSame | ( | bool | start_is_epsilon, |
MutableFst< Arc > * | fst | ||
) |
MakePrecedingInputSymbolsSame ensures that all arcs entering any given fst state have the same input symbol.
It does this by detecting states that have differing input symbols going in, and inserting, for each of the preceding arcs with non-epsilon input symbol, a new dummy state that has an epsilon link to the fst state. If "start_is_epsilon", ensure that start-state can have only epsilon-links into it.
Definition at line 528 of file fstext-utils-inl.h.
References MakePrecedingInputSymbolsSameClass().
Referenced by MinimizeEncoded(), and TestMakeSymbolsSame().
void MakePrecedingInputSymbolsSameClass | ( | bool | start_is_epsilon, |
MutableFst< Arc > * | fst, | ||
const F & | f | ||
) |
As MakePrecedingInputSymbolsSame, but takes a functor object that maps labels to classes.
Definition at line 534 of file fstext-utils-inl.h.
References ConstIntegerSet< I >::count(), rnnlm::i, and KALDI_ASSERT.
Referenced by kaldi::AddSelfLoopsReorder(), MakePrecedingInputSymbolsSame(), MinimizeEncoded(), and TestMakeSymbolsSameClass().
void MapInputSymbols | ( | const std::vector< I > & | symbol_mapping, |
MutableFst< Arc > * | fst | ||
) |
Definition at line 168 of file fstext-utils-inl.h.
References KALDI_ASSERT_IS_INTEGER_TYPE.
Referenced by MinimizeEncoded(), and TestFactor().
bool MinimizeCompactLattice | ( | MutableFst< ArcTpl< CompactLatticeWeightTpl< Weight, IntType > > > * | clat, |
float | delta = fst::kDelta |
||
) |
This function minimizes the compact lattice.
It is to be called after determinization (see ./determinize-lattice-pruned.h) and pushing (see ./push-lattice.h). If the lattice is not determinized and pushed this function will not combine as many states as it could, but it won't crash. Returns true on success, and false if it failed due to topological sorting failing. The output will be topologically sorted.
Definition at line 274 of file minimize-lattice.cc.
References CompactLatticeMinimizer< Weight, IntType >::Minimize().
Referenced by main(), DeterminizeLatticeTask::operator()(), and kaldi::TestMinimizeCompactLattice().
template bool fst::MinimizeCompactLattice< kaldi::LatticeWeight, kaldi::int32 > | ( | MutableFst< kaldi::CompactLatticeArc > * | clat, |
float | delta | ||
) |
void fst::MinimizeEncoded | ( | VectorFst< Arc > * | fst, |
float | delta = kDelta |
||
) |
Definition at line 114 of file fstext-utils.h.
References ApplyProbabilityScale(), ConvertNbestToVector(), EqualAlign(), FollowingInputSymbolsAreSame(), FollowingInputSymbolsAreSameClass(), GetLinearSymbolSequence(), IsStochasticFst(), IsStochasticFstInLog(), MakeFollowingInputSymbolsSame(), MakeFollowingInputSymbolsSameClass(), MakeLinearAcceptor(), MakeLinearAcceptorWithAlternatives(), MakeLoopFst(), MakePrecedingInputSymbolsSame(), MakePrecedingInputSymbolsSameClass(), MapInputSymbols(), rnnlm::n, NbestAsFsts(), PhiCompose(), PrecedingInputSymbolsAreSame(), PrecedingInputSymbolsAreSameClass(), PropagateFinal(), RemoveSomeInputSymbols(), RemoveUselessArcs(), RemoveWeights(), RhoCompose(), SafeDeterminizeMinimizeWrapper(), SafeDeterminizeMinimizeWrapperInLog(), and SafeDeterminizeWrapper().
Referenced by TrainingGraphCompiler::CompileGraph(), TrainingGraphCompiler::CompileGraphs(), main(), SafeDeterminizeMinimizeWrapper(), and SafeDeterminizeMinimizeWrapperInLog().
void NbestAsFsts | ( | const Fst< Arc > & | fst, |
size_t | n, | ||
std::vector< VectorFst< Arc > > * | fsts_out | ||
) |
Takes the n-shortest-paths (using ShortestPath), but outputs the result as a vector of up to n fsts.
This function will size the "fsts_out" vector to however many paths it got (which will not exceed n). n must be >= 1.
Definition at line 279 of file fstext-utils-inl.h.
References ConvertNbestToVector(), and KALDI_ASSERT.
Referenced by MinimizeEncoded(), kaldi::SentenceLevelConfidence(), and TestMakeLinearAcceptor().
Arc::StateId NumArcs | ( | const ExpandedFst< Arc > & | fst | ) |
Returns the total number of arcs in an FST.
Definition at line 67 of file fstext-utils-inl.h.
Referenced by kaldi::DeterminizeLatticeWrapper(), main(), and TrivialFactorWeightFstImpl< A, F >::NumArcs().
|
inline |
Definition at line 277 of file lattice-weight.h.
References LatticeWeightTpl< FloatType >::Value1(), and LatticeWeightTpl< FloatType >::Value2().
|
inline |
Definition at line 564 of file lattice-weight.h.
References CompactLatticeWeightTpl< WeightType, IntType >::String(), and CompactLatticeWeightTpl< WeightType, IntType >::Weight().
|
inline |
Definition at line 397 of file lattice-weight.h.
References LatticeWeightTpl< FloatType >::WriteFloatType().
|
inline |
|
inline |
Definition at line 267 of file lattice-weight.h.
References LatticeWeightTpl< FloatType >::Value1(), and LatticeWeightTpl< FloatType >::Value2().
Referenced by DiscriminativeSupervision::DiscriminativeSupervision(), and ArpaLmCompilerImplInterface::~ArpaLmCompilerImplInterface().
|
inline |
Definition at line 558 of file lattice-weight.h.
References CompactLatticeWeightTpl< WeightType, IntType >::String(), and CompactLatticeWeightTpl< WeightType, IntType >::Weight().
|
inline |
Definition at line 407 of file lattice-weight.h.
References LatticeWeightTpl< FloatType >::ReadNoParen().
|
inline |
Definition at line 742 of file lattice-weight.h.
References rnnlm::i, CompactLatticeWeightTpl< WeightType, IntType >::SetString(), and CompactLatticeWeightTpl< WeightType, IntType >::SetWeight().
void fst::PenalizeArcsWithSomeInputSymbols | ( | const std::vector< I > & | symbols_in, |
float | penalty, | ||
VectorFst< Arc > * | fst | ||
) |
Definition at line 58 of file fstrmsymbols.cc.
References ConstIntegerSet< I >::count(), and Times().
Referenced by main().
void PhiCompose | ( | const Fst< Arc > & | fst1, |
const Fst< Arc > & | fst2, | ||
typename Arc::Label | phi_label, | ||
MutableFst< Arc > * | ofst | ||
) |
Definition at line 1021 of file fstext-utils-inl.h.
References KALDI_ASSERT.
Referenced by main(), and MinimizeEncoded().
|
inline |
Definition at line 87 of file arctic-weight.h.
|
inline |
Definition at line 92 of file arctic-weight.h.
|
inline |
Definition at line 97 of file arctic-weight.h.
|
inline |
Definition at line 311 of file lattice-weight.h.
References Compare().
Referenced by DeterminizerStar< F >::EpsilonClosure::AddOneElement(), CompactLatticeWeightTest(), DeterminizerStar< F >::EpsilonClosure::GetEpsilonClosure(), IsStochasticFst(), LatticeWeightTest(), LatticeDeterminizerPruned< Weight, IntType >::NormalizeSubset(), LatticeDeterminizer< Weight, IntType >::NormalizeSubset(), ReweightPlusDefault< Weight >::operator()(), ReweightPlusLogArc::operator()(), CompactLatticeWeightCommonDivisorTpl< BaseWeightType, IntType >::operator()(), LatticePhoneAligner::ProcessFinal(), LatticeWordAligner::ProcessFinal(), DeterminizerStar< F >::ProcessFinal(), DeterminizerStar< F >::ProcessTransition(), PushCompactLatticeWeights(), RemoveEpsLocalClass< Arc, ReweightPlus >::RemoveEpsPattern1(), RemoveEpsLocalClass< Arc, ReweightPlus >::RemoveEpsPattern2(), LatticeIncrementalDeterminizer::SetFinalCosts(), kaldi::TestPushCompactLatticeWeights(), TestRemoveEpsLocalSpecial(), and kaldi::UnitTestAddOuterProductPlusMinus().
|
inline |
Definition at line 664 of file lattice-weight.h.
References Compare().
Returns true if and only if the FST is such that the input symbols on arcs entering any given state all have the same value.
if "start_is_epsilon", treat start-state as an epsilon input arc [i.e. ensure only epsilon can enter start-state].
Definition at line 460 of file fstext-utils-inl.h.
References PrecedingInputSymbolsAreSameClass().
Referenced by MinimizeEncoded(), and TestMakeSymbolsSame().
bool PrecedingInputSymbolsAreSameClass | ( | bool | start_is_epsilon, |
const Fst< Arc > & | fst, | ||
const F & | f | ||
) |
This is as PrecedingInputSymbolsAreSame, but with a functor f that maps labels to classes.
The function tests whether the symbols preceding any given state are in the same class. Formally, f is of a type F that has an operator of type F::Result F::operator() (F::Arg a) const; where F::Result is an integer type and F::Arc can be constructed from Arc::Label. this must apply to valid labels and also to kNoLabel (so we can have a marker for the invalid labels.
Definition at line 466 of file fstext-utils-inl.h.
Referenced by MinimizeEncoded(), PrecedingInputSymbolsAreSame(), and TestMakeSymbolsSameClass().
void PreDeterminize | ( | MutableFst< Arc > * | fst, |
typename Arc::Label | first_new_sym, | ||
std::vector< Int > * | symsOut | ||
) |
Definition at line 317 of file pre-determinize-inl.h.
References fst::pre_determinize_helpers::Closure(), fst::pre_determinize_helpers::CopySetToVector(), CreateSuperFinal(), rnnlm::i, fst::pre_determinize_helpers::InsertMember(), KALDI_ASSERT, KALDI_ERR, KALDI_VLOG, and rnnlm::n.
Referenced by SafeDeterminizeMinimizeWrapper(), SafeDeterminizeWrapper(), TestDeterminize(), TestDeterminizeStarInLog(), TestFactor(), TestMinimize(), TestPreDeterminize(), and TestPush().
This function prepares 'ifst' for use in GrammarFst: it ensures that it has the expected properties, changing it slightly as needed.
'ifst' is expected to be a fully compiled HCLG graph that is intended to be used in GrammarFst. The user will most likely want to copy it to the ConstFst type after calling this function.
The following describes what this function does, and the reasons why it has to do these things:
[in] | nonterm_phones_offset | The integer id of the symbols #nonterm_bos in the phones.txt file. |
[in,out] | fst | The FST to be (slightly) modified. |
Definition at line 982 of file grammar-fst.cc.
References GrammarFstPreparer::Prepare().
Referenced by main().
void fst::Print | ( | const Fst< Arc > & | fst, |
std::string | message | ||
) |
Definition at line 362 of file fstext-utils-test.cc.
Referenced by TransitionModel::GetPhones(), MaxChangeStats::MaxChangeStats(), NnetDiscriminativeStats::NnetDiscriminativeStats(), DiscriminativeObjectiveInfo::PrintAll(), SplitExampleStats::SplitExampleStats(), and GeneralDescriptor::~GeneralDescriptor().
bool PrintProxyFstPath | ( | const VectorFst< StdArc > & | proxy, |
vector< vector< StdArc::Label > > * | path, | ||
vector< StdArc::Weight > * | weight, | ||
StdArc::StateId | cur_state, | ||
vector< StdArc::Label > | cur_path, | ||
StdArc::Weight | cur_weight | ||
) |
Definition at line 30 of file generate-proxy-keywords.cc.
References Times().
Referenced by main().
void PropagateFinal | ( | typename Arc::Label | phi_label, |
MutableFst< Arc > * | fst | ||
) |
Definition at line 1084 of file fstext-utils-inl.h.
References KALDI_WARN, and PropagateFinalInternal().
Referenced by main(), and MinimizeEncoded().
void fst::PropagateFinalInternal | ( | typename Arc::Label | phi_label, |
typename Arc::StateId | s, | ||
MutableFst< Arc > * | fst | ||
) |
Definition at line 1051 of file fstext-utils-inl.h.
References KALDI_ASSERT, and Times().
Referenced by PropagateFinal().
void fst::PruneCompactLattice | ( | Weight | beam, |
MutableFst< ArcTpl< CompactLatticeWeightTpl< Weight, Int > > > * | fst | ||
) |
Referenced by LatticeToStdMapper< Real >::Properties().
void PruneSpecial | ( | const Fst< Arc > & | ifst, |
VectorFst< Arc > * | ofst, | ||
typename Arc::Weight | beam, | ||
size_t | max_states = 0 |
||
) |
The function PruneSpecial is like the standard OpenFst function "prune", except it does not expand the entire "ifst"- this is useful for cases where ifst is an on-demand FST such as a ComposeFst and we don't want to visit it all.
It supports pruning either to a specified beam (if beam is not One()), or to a specified max_states (if max_states is > 0). One of the two must be specified.
Requirements:
Definition at line 161 of file prune-special-inl.h.
Referenced by main().
bool PushCompactLatticeStrings | ( | MutableFst< ArcTpl< CompactLatticeWeightTpl< Weight, IntType > > > * | clat | ) |
This function pushes the transition-ids as far towards the start as they will go.
It can be useful prior to lattice-align-words (for non-linear lattices). We can't use the generic OpenFst "push" function because it uses the sum as the divisor, which is not appropriate in this case (a+b generally won't divide a or b in this semiring). It returns true on success, false if it failed due to TopSort failing, which should never happen, but we handle it gracefully by just leaving the lattice the same. This function used to be called just PushCompactLattice.
Definition at line 210 of file push-lattice.cc.
References CompactLatticePusher< Weight, IntType >::Push().
Referenced by main(), DeterminizeLatticeTask::operator()(), kaldi::TestMinimizeCompactLattice(), and kaldi::TestPushCompactLatticeStrings().
template bool fst::PushCompactLatticeStrings< kaldi::LatticeWeight, kaldi::int32 > | ( | MutableFst< kaldi::CompactLatticeArc > * | clat | ) |
bool PushCompactLatticeWeights | ( | MutableFst< ArcTpl< CompactLatticeWeightTpl< Weight, IntType > > > * | clat | ) |
This function pushes the weights in the CompactLattice so that all states except possibly the start state, have Weight components (of type LatticeWeight) that "sum to one" in the LatticeWeight (i.e.
interpreting the weights as negated log-probs). It returns true on success, false if it failed due to TopSort failing, which should never happen, but we handle it gracefully by just leaving the lattice the same.
Definition at line 217 of file push-lattice.cc.
References Divide(), KALDI_ASSERT, KALDI_WARN, Plus(), Times(), and CompactLatticeWeightTpl< WeightType, IntType >::Zero().
Referenced by main(), DeterminizeLatticeTask::operator()(), kaldi::TestMinimizeCompactLattice(), and kaldi::TestPushCompactLatticeWeights().
template bool fst::PushCompactLatticeWeights< kaldi::LatticeWeight, kaldi::int32 > | ( | MutableFst< kaldi::CompactLatticeArc > * | clat | ) |
Definition at line 91 of file fstext-utils.h.
Definition at line 226 of file push-special.cc.
Referenced by main(), and TestPushSpecial().
VectorFst<Arc>* fst::RandFst | ( | RandFstOptions | opts = RandFstOptions() | ) |
Returns a random FST.
Useful for randomized algorithm testing. Only works if weight can be constructed from float.
Definition at line 56 of file rand-fst.h.
References rnnlm::i, rnnlm::j, and kaldi::Rand().
CompactLatticeWeight fst::RandomCompactLatticeWeight | ( | ) |
Definition at line 51 of file lattice-weight-test.cc.
References rnnlm::i, kaldi::Rand(), RandomLatticeWeight(), and LatticeWeightTpl< BaseFloat >::Zero().
Referenced by CompactLatticeWeightTest().
LatticeWeight fst::RandomLatticeWeight | ( | ) |
Definition at line 38 of file lattice-weight-test.cc.
References kaldi::Rand(), kaldi::RandGauss(), and LatticeWeightTpl< BaseFloat >::Zero().
Referenced by LatticeWeightTest(), and RandomCompactLatticeWeight().
VectorFst<Arc>* fst::RandPairFst | ( | RandFstOptions | opts = RandFstOptions() | ) |
Returns a random FST.
Useful for randomized algorithm testing. Only works if weight can be constructed from a pair of floats
Definition at line 108 of file rand-fst.h.
References rnnlm::i, rnnlm::j, and kaldi::Rand().
fst::VectorFst< fst::StdArc > * ReadAndPrepareLmFst | ( | std::string | rxfilename | ) |
Definition at line 125 of file kaldi-fst-io.cc.
References ReadFstKaldi().
Referenced by main().
ConstFst<StdArc>* fst::ReadAsConstFst | ( | std::string | rxfilename | ) |
Definition at line 32 of file make-grammar-fst.cc.
References ReadFstKaldiGeneric().
Referenced by main().
|
static |
Definition at line 406 of file grammar-fst.cc.
References KALDI_ERR.
Referenced by GrammarFst::Read().
VectorFst< StdArc > * ReadFstKaldi | ( | std::string | rxfilename | ) |
Definition at line 29 of file kaldi-fst-io.cc.
References KALDI_ERR, kaldi::PrintableRxfilename(), and Input::Stream().
void fst::ReadFstKaldi | ( | std::string | rxfilename, |
VectorFst< StdArc > * | ofst | ||
) |
void ReadFstKaldi | ( | std::istream & | is, |
bool | binary, | ||
VectorFst< Arc > * | fst | ||
) |
Definition at line 73 of file kaldi-fst-io-inl.h.
References kaldi::ConvertStringToInteger(), rnnlm::d, KALDI_ERR, kaldi::SplitStringToIntegers(), kaldi::SplitStringToVector(), and StrToWeight().
Referenced by main(), VectorFstTplHolder< Arc >::Read(), ReadAndPrepareLmFst(), and ReadFstKaldi().
void fst::ReadFstKaldi | ( | std::string | rxfilename, |
fst::StdVectorFst * | ofst | ||
) |
Definition at line 109 of file kaldi-fst-io.cc.
References ReadFstKaldi().
Definition at line 45 of file kaldi-fst-io.cc.
References KALDI_ERR, KALDI_WARN, kaldi::PrintableRxfilename(), and Input::Stream().
Referenced by main(), and ReadAsConstFst().
void fst::ReadILabelInfo | ( | std::istream & | is, |
bool | binary, | ||
std::vector< std::vector< int32 > > * | ilabel_info | ||
) |
Utility function for reading ilabel-info vectors from disk.
Definition at line 335 of file context-fst.cc.
References rnnlm::i, kaldi::ReadBasicType(), and kaldi::ReadIntegerVector().
Referenced by main(), and TestContextFst().
void fst::ReadILabelInfo | ( | std::istream & | is, |
bool | binary, | ||
vector< vector< int32 > > * | info | ||
) |
Utility function for reading ilabel-info vectors from disk.
Definition at line 335 of file context-fst.cc.
References rnnlm::i, kaldi::ReadBasicType(), and kaldi::ReadIntegerVector().
Referenced by main(), and TestContextFst().
void RemoveAlignmentsFromCompactLattice | ( | MutableFst< ArcTpl< CompactLatticeWeightTpl< Weight, Int > > > * | fst | ) |
Removes state-level alignments (the strings that are part of the weights).
Definition at line 222 of file lattice-utils-inl.h.
Referenced by LatticeScale(), main(), and MinimumBayesRisk::MinimumBayesRisk().
void fst::RemoveArcsWithSomeInputSymbols | ( | const std::vector< I > & | symbols_in, |
VectorFst< Arc > * | fst | ||
) |
Definition at line 33 of file fstrmsymbols.cc.
References ConstIntegerSet< I >::count(), and KALDI_WARN.
Referenced by main().
void RemoveEpsLocal | ( | MutableFst< Arc > * | fst | ) |
RemoveEpsLocal remove some (but not necessarily all) epsilons in an FST, using an algorithm that is guaranteed to never increase the number of arcs in the FST (and will also never increase the number of states).
The algorithm is not optimal but is reasonably clever. It does not just remove epsilon arcs;it also combines pairs of input-epsilon and output-epsilon arcs into one. The algorithm preserves equivalence and stochasticity in the given semiring. If you want to preserve stochasticity in a different semiring (e.g. log), then use RemoveEpsLocalSpecial, which only works for StdArc but which preserves stochasticity, where possible (*) in the LogArc sense. The reason that we can't just cast to a different semiring is that in that case we would no longer be able to guarantee equivalence in the original semiring (this arises from what happens when we combine identical arcs). (*) by "where possible".. there are situations where we wouldn't be able to preserve stochasticity in the LogArc sense while maintaining equivalence in the StdArc sense, so in these situations we maintain equivalence.
Definition at line 309 of file remove-eps-local-inl.h.
Referenced by TrainingGraphCompiler::CompileGraph(), TrainingGraphCompiler::CompileGraphs(), SimpleDecoder::GetBestPath(), FasterDecoder::GetBestPath(), BiglmFasterDecoder::GetBestPath(), kaldi::GetHmmAsFsa(), main(), OnlineFasterDecoder::MakeLattice(), ArpaLmCompiler::RemoveRedundantStates(), SafeDeterminizeMinimizeWrapper(), SafeDeterminizeMinimizeWrapperInLog(), TestRemoveEpsLocal(), and OnlineFasterDecoder::TracebackNFrames().
|
inline |
As RemoveEpsLocal but takes care to preserve stochasticity when cast to LogArc.
Definition at line 314 of file remove-eps-local-inl.h.
Referenced by main(), and TestRemoveEpsLocalSpecial().
void RemoveSomeInputSymbols | ( | const std::vector< I > & | to_remove, |
MutableFst< Arc > * | fst | ||
) |
RemoveSomeInputSymbols removes any symbol that appears in "to_remove", from the input side of the FST, replacing them with epsilon.
Definition at line 119 of file fstext-utils-inl.h.
References KALDI_ASSERT_IS_INTEGER_TYPE.
Referenced by TrainingGraphCompiler::CompileGraph(), TrainingGraphCompiler::CompileGraphs(), main(), MinimizeEncoded(), LatticeWordAligner::RemoveEpsilonsFromLattice(), LatticeLexiconWordAligner::RemoveEpsilonsFromLattice(), SafeDeterminizeMinimizeWrapper(), SafeDeterminizeWrapper(), and WordAlignedLatticeTester::TestEquivalent().
void RemoveUselessArcs | ( | MutableFst< Arc > * | fst | ) |
Definition at line 950 of file fstext-utils-inl.h.
References rnnlm::j, KALDI_ASSERT, and KALDI_VLOG.
Referenced by MinimizeEncoded(), and TestRemoveUselessArcs().
void RemoveWeights | ( | MutableFst< Arc > * | ifst | ) |
Definition at line 434 of file fstext-utils-inl.h.
Referenced by kaldi::DifferenceWrapper(), main(), MinimizeEncoded(), and TestAcceptorMinimize().
void RhoCompose | ( | const Fst< Arc > & | fst1, |
const Fst< Arc > & | fst2, | ||
typename Arc::Label | rho_label, | ||
MutableFst< Arc > * | ofst | ||
) |
Definition at line 1096 of file fstext-utils-inl.h.
References IsStochasticFst(), and KALDI_ASSERT.
Referenced by MinimizeEncoded().
void SafeDeterminizeMinimizeWrapper | ( | MutableFst< Arc > * | ifst, |
VectorFst< Arc > * | ofst, | ||
float | delta = kDelta |
||
) |
SafeDeterminizeMinimizeWapper is as SafeDeterminizeWrapper except that it also minimizes (encoded minimization, which is safe).
This algorithm will destroy "ifst".
Definition at line 357 of file fstext-utils-inl.h.
References DeterminizeStar(), HighestNumberedInputSymbol(), MinimizeEncoded(), PreDeterminize(), RemoveEpsLocal(), and RemoveSomeInputSymbols().
Referenced by MinimizeEncoded(), and TestSafeDeterminizeWrapper().
|
inline |
SafeDeterminizeMinimizeWapperInLog is as SafeDeterminizeMinimizeWrapper except it first casts tothe log semiring.
Definition at line 408 of file fstext-utils-inl.h.
References MinimizeEncoded(), RemoveEpsLocal(), and SafeDeterminizeWrapper().
Referenced by MinimizeEncoded(), and TestSafeDeterminizeWrapper().
void SafeDeterminizeWrapper | ( | MutableFst< Arc > * | ifst, |
MutableFst< Arc > * | ofst, | ||
float | delta = kDelta |
||
) |
Does PreDeterminize and DeterminizeStar and then removes the disambiguation symbols.
This is a form of determinization that will never blow up. Note that ifst is non-const and can be considered to be destroyed by this operation. Does not do epsilon removal (RemoveEpsLocal)– this is so it's safe to cast to log and do this, and maintain equivalence in tropical.
Definition at line 345 of file fstext-utils-inl.h.
References DeterminizeStar(), HighestNumberedInputSymbol(), PreDeterminize(), and RemoveSomeInputSymbols().
Referenced by MinimizeEncoded(), SafeDeterminizeMinimizeWrapperInLog(), SafeDeterminizeWrapperInLog(), and TestSafeDeterminizeWrapper().
|
inline |
Definition at line 421 of file fstext-utils-inl.h.
References SafeDeterminizeWrapper().
void ScaleLattice | ( | const std::vector< std::vector< ScaleFloat > > & | scale, |
MutableFst< ArcTpl< Weight > > * | fst | ||
) |
Scales the pairs of weights in LatticeWeight or CompactLatticeWeight by viewing the pair (a, b) as a 2-vector and pre-multiplying by the 2x2 matrix in "scale".
E.g. typically scale would equal [ 1 0; 0 acwt ] if we want to scale the acoustics by "acwt".
Definition at line 197 of file lattice-utils-inl.h.
References DefaultLatticeScale(), and ScaleTupleWeight().
Referenced by DiscriminativeSupervisionSplitter::CreateRangeLattice(), kaldi::DecodeUtterance(), kaldi::DecodeUtteranceLatticeFaster(), kaldi::DecodeUtteranceLatticeIncremental(), kaldi::DecodeUtteranceLatticeSimple(), LatticeScale(), main(), DeterminizeLatticeTask::operator()(), DecodeUtteranceLatticeFasterClass::operator()(), DiscriminativeSupervisionSplitter::PrepareLattice(), NnetBatchDecoder::ProcessOutputUtterance(), and TestScalePair().
|
inline |
Definition at line 232 of file lattice-weight.h.
References LatticeWeightTpl< FloatType >::Value1(), and LatticeWeightTpl< FloatType >::Value2().
Referenced by ScaleLattice(), and ScaleTupleWeight().
|
inline |
Definition at line 249 of file lattice-weight.h.
|
inline |
Scales the pair (a, b) of floating-point weights inside a CompactLatticeWeight by premultiplying it (viewed as a vector) by a 2x2 matrix "scale".
Assumes there is a ScaleTupleWeight function that applies to "Weight"; this currently only works if Weight equals LatticeWeightTpl<FloatType> for some FloatType.
Definition at line 808 of file lattice-weight.h.
References ScaleTupleWeight(), CompactLatticeWeightTpl< WeightType, IntType >::String(), and CompactLatticeWeightTpl< WeightType, IntType >::Weight().
Definition at line 63 of file kaldi-fst-io-inl.h.
Referenced by ReadFstKaldi().
void fst::TableCompose | ( | const Fst< Arc > & | ifst1, |
const Fst< Arc > & | ifst2, | ||
MutableFst< Arc > * | ofst, | ||
const TableComposeOptions & | opts = TableComposeOptions() |
||
) |
Definition at line 315 of file table-matcher.h.
Referenced by TrainingGraphCompiler::CompileGraph(), TrainingGraphCompiler::CompileGraphs(), main(), TestTableMatcher(), TestTableMatcherCacheLeft(), and TestTableMatcherCacheRight().
void fst::TableCompose | ( | const Fst< Arc > & | ifst1, |
const Fst< Arc > & | ifst2, | ||
MutableFst< Arc > * | ofst, | ||
TableComposeCache< Fst< Arc > > * | cache | ||
) |
Definition at line 348 of file table-matcher.h.
References TableMatcher< F, BackoffMatcher >::Copy().
void fst::TestAcceptorMinimize | ( | ) |
Definition at line 198 of file fstext-utils-test.cc.
References kaldi::Rand(), and RemoveWeights().
void fst::TestAddSelfLoops | ( | ) |
Definition at line 143 of file pre-determinize-test.cc.
References AddSelfLoops(), CreateNewSymbols(), and kaldi::Rand().
void fst::TestBackoffAndCache | ( | ) |
Definition at line 148 of file deterministic-fst-test.cc.
References ApproxEqual(), CreateBackoffFst(), CreateResultFst(), CacheDeterministicOnDemandFst< Arc >::Final(), and CacheDeterministicOnDemandFst< Arc >::GetArc().
Referenced by main().
void fst::TestCompose | ( | ) |
Definition at line 183 of file deterministic-fst-test.cc.
References ApproxEqual(), CreateBackoffFst(), CreateResultFst(), LmExampleDeterministicOnDemandFst< Arc >::Final(), LmExampleDeterministicOnDemandFst< Arc >::GetArc(), KALDI_ASSERT, CacheDeterministicOnDemandFst< Arc >::Start(), LmExampleDeterministicOnDemandFst< Arc >::Start(), and WalkSinglePath().
Referenced by main().
Definition at line 158 of file context-fst-test.cc.
References kaldi::AssertEqual(), ComposeDeterministicOnDemandInverse(), kaldi::CopySetToVector(), rnnlm::i, InverseContextFst::IlabelInfo(), kaldi::Rand(), kaldi::RandUniform(), ReadILabelInfo(), Input::Stream(), and WriteILabelInfo().
Referenced by main().
void fst::TestConvert | ( | bool | invert | ) |
Definition at line 26 of file lattice-utils-test.cc.
References rnnlm::i, and kaldi::Rand().
void fst::TestConvert2 | ( | ) |
Definition at line 114 of file lattice-utils-test.cc.
References ConvertLattice(), rnnlm::i, and kaldi::Rand().
void fst::TestConvertPair | ( | bool | invert | ) |
Definition at line 200 of file lattice-utils-test.cc.
References rnnlm::i, and kaldi::Rand().
void fst::TestDeterminize | ( | ) |
Definition at line 61 of file determinize-star-test.cc.
References DeleteISymbols(), DeterminizeStar(), rnnlm::i, rnnlm::j, PreDeterminize(), and kaldi::Rand().
void fst::TestDeterminize2 | ( | ) |
Definition at line 190 of file determinize-star-test.cc.
References RandFstOptions::acyclic, rnnlm::i, and kaldi::Rand().
void fst::TestDeterminizeGeneral | ( | ) |
Definition at line 34 of file determinize-star-test.cc.
References rnnlm::i, and kaldi::Rand().
void fst::TestDeterminizeLattice | ( | ) |
Definition at line 76 of file determinize-lattice-test.cc.
References RandFstOptions::allow_empty, rnnlm::i, DeterminizeLatticeOptions::max_mem, RandFstOptions::n_arcs, RandFstOptions::n_final, RandFstOptions::n_states, kaldi::Rand(), and RandFstOptions::weight_multiplier.
void fst::TestDeterminizeLattice2 | ( | ) |
Definition at line 144 of file determinize-lattice-test.cc.
References RandFstOptions::acyclic, and rnnlm::i.
void fst::TestDeterminizeLatticePruned | ( | ) |
Definition at line 36 of file determinize-lattice-pruned-test.cc.
References RandFstOptions::acyclic, RandFstOptions::allow_empty, rnnlm::i, KALDI_ASSERT, DeterminizeLatticePrunedOptions::max_arcs, DeterminizeLatticePrunedOptions::max_mem, DeterminizeLatticePrunedOptions::max_states, RandFstOptions::n_arcs, RandFstOptions::n_final, RandFstOptions::n_states, kaldi::PruneLattice(), kaldi::Rand(), and RandFstOptions::weight_multiplier.
void fst::TestDeterminizeLatticePruned2 | ( | ) |
Definition at line 117 of file determinize-lattice-pruned-test.cc.
References RandFstOptions::acyclic, and rnnlm::i.
void fst::TestDeterminizeStarInLog | ( | ) |
Definition at line 79 of file fstext-utils-test.cc.
References HighestNumberedInputSymbol(), and PreDeterminize().
void fst::TestEnsureEpsilonProperty | ( | ) |
Definition at line 27 of file epsilon-property-test.cc.
References RandFstOptions::acyclic, ComputeStateInfo(), EnsureEpsilonProperty(), rnnlm::i, kStateHasEpsilonArcsEntering, kStateHasEpsilonArcsLeaving, kStateHasNonEpsilonArcsEntering, kStateHasNonEpsilonArcsLeaving, and kaldi::Rand().
Referenced by main().
void fst::TestEqualAlign | ( | ) |
Definition at line 336 of file fstext-utils-test.cc.
References RandFstOptions::allow_empty, EqualAlign(), GetLinearSymbolSequence(), rnnlm::i, and kaldi::Rand().
|
static |
Definition at line 32 of file factor-test.cc.
References CreateFactorFst(), ExpandInputSequences(), Factor(), rnnlm::i, MapInputSymbols(), rnnlm::n, kaldi::Rand(), and kaldi::RandUniform().
void fst::TestFactor | ( | ) |
Definition at line 33 of file trivial-factor-weight-test.cc.
References DeterminizeStar(), rnnlm::i, StringRepository< Label, StringId >::IdOfEmpty(), StringRepository< Label, StringId >::IdOfLabel(), StringRepository< Label, StringId >::IdOfSeq(), rnnlm::j, PreDeterminize(), kaldi::Rand(), StringRepository< Label, StringId >::RemovePrefix(), StringRepository< Label, StringId >::SeqOfId(), and TestStringRepository().
void fst::TestLatticeStringRepository | ( | ) |
Definition at line 29 of file determinize-lattice-test.cc.
References LatticeStringRepository< IntType >::CommonPrefix(), LatticeStringRepository< IntType >::ConvertToVector(), LatticeStringRepository< IntType >::EmptyString(), rnnlm::i, LatticeStringRepository< IntType >::IsPrefixOf(), kaldi::Rand(), LatticeStringRepository< IntType >::ReduceToCommonPrefix(), and LatticeStringRepository< IntType >::Successor().
Referenced by main().
void fst::TestMakeLinearAcceptor | ( | ) |
Definition at line 32 of file fstext-utils-test.cc.
References GetInputSymbols(), GetLinearSymbolSequence(), rnnlm::i, rnnlm::j, KALDI_ASSERT, MakeLinearAcceptor(), NbestAsFsts(), kaldi::Rand(), and kaldi::SortAndUniq().
void fst::TestMakeLoopFst | ( | ) |
Definition at line 305 of file fstext-utils-test.cc.
References rnnlm::i, MakeLoopFst(), MakeLoopFstCompare(), and kaldi::Rand().
void fst::TestMakeSymbolsSame | ( | ) |
Definition at line 217 of file fstext-utils-test.cc.
References FollowingInputSymbolsAreSame(), MakeFollowingInputSymbolsSame(), MakePrecedingInputSymbolsSame(), PrecedingInputSymbolsAreSame(), and kaldi::Rand().
void fst::TestMakeSymbolsSameClass | ( | ) |
Definition at line 254 of file fstext-utils-test.cc.
References FollowingInputSymbolsAreSameClass(), MakeFollowingInputSymbolsSameClass(), MakePrecedingInputSymbolsSameClass(), PrecedingInputSymbolsAreSameClass(), and kaldi::Rand().
void fst::TestMinimize | ( | ) |
Definition at line 280 of file determinize-star-test.cc.
References DeleteISymbols(), DeterminizeStar(), rnnlm::i, rnnlm::j, PreDeterminize(), and kaldi::Rand().
void fst::TestPreDeterminize | ( | ) |
Definition at line 33 of file pre-determinize-test.cc.
References DeleteISymbols(), HighestNumberedInputSymbol(), rnnlm::i, rnnlm::j, PreDeterminize(), and kaldi::Rand().
|
static |
Definition at line 27 of file prune-special-test.cc.
References RandFstOptions::acyclic, KALDI_ASSERT, and kaldi::Rand().
Referenced by main().
void fst::TestPush | ( | ) |
Definition at line 202 of file determinize-star-test.cc.
References rnnlm::i, rnnlm::j, PreDeterminize(), and kaldi::Rand().
void fst::TestPushInLog | ( | ) |
Definition at line 182 of file fstext-utils-test.cc.
References kaldi::Rand().
|
static |
Definition at line 31 of file push-special-test.cc.
References IsStochasticFstInLog(), KALDI_ASSERT, KALDI_LOG, PushSpecial(), and kaldi::Rand().
Referenced by main().
|
static |
Definition at line 33 of file remove-eps-local-test.cc.
References rnnlm::i, kaldi::Rand(), kaldi::RandUniform(), and RemoveEpsLocal().
|
static |
Definition at line 113 of file remove-eps-local-test.cc.
References ApproxEqual(), Divide(), IsStochasticFst(), Plus(), kaldi::Rand(), and RemoveEpsLocalSpecial().
Referenced by main().
void fst::TestRemoveUselessArcs | ( | ) |
Definition at line 370 of file fstext-utils-test.cc.
References RandFstOptions::allow_empty, ApproxEqual(), rnnlm::i, and RemoveUselessArcs().
void fst::TestSafeDeterminizeWrapper | ( | ) |
Definition at line 90 of file fstext-utils-test.cc.
References rnnlm::i, rnnlm::j, KALDI_LOG, kaldi::Rand(), SafeDeterminizeMinimizeWrapper(), SafeDeterminizeMinimizeWrapperInLog(), and SafeDeterminizeWrapper().
void fst::TestScalePair | ( | bool | invert | ) |
Definition at line 234 of file lattice-utils-test.cc.
References DefaultLatticeScale(), rnnlm::i, kaldi::Rand(), and ScaleLattice().
void fst::TestShortestPath | ( | ) |
Definition at line 60 of file lattice-utils-test.cc.
References ApproxEqual(), and rnnlm::i.
void TestStringRepository | ( | ) |
Definition at line 447 of file determinize-star-test.cc.
References rnnlm::i, StringRepository< Label, StringId >::IdOfEmpty(), StringRepository< Label, StringId >::IdOfLabel(), StringRepository< Label, StringId >::IdOfSeq(), rnnlm::j, kaldi::Rand(), StringRepository< Label, StringId >::RemovePrefix(), and StringRepository< Label, StringId >::SeqOfId().
Referenced by TestFactor().
Definition at line 28 of file table-matcher-test.cc.
References TableComposeOptions::connect, TableMatcherOptions::min_table_size, kaldi::Rand(), TableComposeOptions::table_match_type, TableMatcherOptions::table_ratio, and TableCompose().
void fst::TestTableMatcherCacheLeft | ( | bool | connect | ) |
Definition at line 104 of file table-matcher-test.cc.
References rnnlm::i, kaldi::Rand(), TableComposeOptions::table_match_type, and TableCompose().
void fst::TestTableMatcherCacheRight | ( | bool | connect | ) |
Definition at line 173 of file table-matcher-test.cc.
References TableComposeOptions::connect, rnnlm::i, TableMatcherOptions::min_table_size, kaldi::Rand(), TableComposeOptions::table_match_type, TableMatcherOptions::table_ratio, and TableCompose().
|
inline |
Definition at line 103 of file arctic-weight.h.
|
inline |
Definition at line 114 of file arctic-weight.h.
|
inline |
Definition at line 119 of file arctic-weight.h.
|
inline |
Definition at line 362 of file lattice-weight.h.
References LatticeWeightTpl< FloatType >::Value1(), and LatticeWeightTpl< FloatType >::Value2().
Referenced by kaldi::AddSelfLoopsNoReorder(), kaldi::AddSelfLoopsReorder(), kaldi::AddTransitionProbs(), LatticeWordAligner::ComputationState::Advance(), LatticePhoneAligner::ComputationState::Advance(), LatticeLexiconWordAligner::ComputationState::Advance(), RemoveEpsLocalClass< Arc, ReweightPlus >::CanCombineArcs(), RemoveEpsLocalClass< Arc, ReweightPlus >::CanCombineFinal(), CompactLatticeWeightTest(), ComposeDeterministicOnDemand(), ComposeDeterministicOnDemandInverse(), ConvertLatticeWeight(), PruneSpecialClass< Arc >::Done(), LatticeDeterminizerPruned< Weight, IntType >::EpsilonClosure(), LatticeDeterminizer< Weight, IntType >::EpsilonClosure(), DeterminizerStar< F >::EpsilonClosure::ExpandOneElement(), Factor(), BackoffDeterministicOnDemandFst< Arc >::Final(), ComposeDeterministicOnDemandFst< Arc >::Final(), GrammarFstPreparer::FixArcsToFinalStates(), kaldi::GenerateActivePaths(), BackoffDeterministicOnDemandFst< Arc >::GetArc(), ComposeDeterministicOnDemandFst< Arc >::GetArc(), BiglmFasterDecoder::GetBestPath(), GetLinearSymbolSequence(), LatticeWeightTest(), main(), PushSpecialClass::ModifyFst(), PenalizeArcsWithSomeInputSymbols(), PrintProxyFstPath(), LatticeIncrementalDeterminizer::ProcessArcsFromChunkStartState(), LatticeBiglmFasterDecoder::ProcessEmitting(), DeterminizerStar< F >::ProcessFinal(), LatticeDeterminizerPruned< Weight, IntType >::ProcessFinal(), LatticeDeterminizer< Weight, IntType >::ProcessFinal(), PruneSpecialClass< Arc >::ProcessState(), PrunedCompactLatticeComposer::ProcessTransition(), LatticeDeterminizerPruned< Weight, IntType >::ProcessTransition(), LatticeDeterminizer< Weight, IntType >::ProcessTransition(), DeterminizerStar< F >::ProcessTransitions(), LatticeDeterminizerPruned< Weight, IntType >::ProcessTransitions(), LatticeDeterminizer< Weight, IntType >::ProcessTransitions(), PropagateFinalInternal(), BiglmFasterDecoder::PropagateLm(), LatticeBiglmFasterDecoder::PropagateLm(), PushCompactLatticeWeights(), BiglmFasterDecoder::ReachedFinal(), RemoveEpsLocalClass< Arc, ReweightPlus >::Reweight(), LatticeIncrementalDeterminizer::SetFinalCosts(), Times(), BiglmFasterDecoder::Token::Token(), LatticeIncrementalDeterminizer::TransferArcsToClat(), and WalkSinglePath().
|
inline |
Definition at line 671 of file lattice-weight.h.
References CompactLatticeWeightTpl< WeightType, IntType >::String(), Times(), CompactLatticeWeightTpl< WeightType, IntType >::Weight(), and CompactLatticeWeightTpl< WeightType, IntType >::Zero().
Weight fst::WalkSinglePath | ( | StdVectorFst * | ifst, |
DeterministicOnDemandFst< StdArc > * | dfst | ||
) |
Definition at line 120 of file deterministic-fst-test.cc.
References DeterministicOnDemandFst< Arc >::Final(), DeterministicOnDemandFst< Arc >::GetArc(), KALDI_LOG, DeterministicOnDemandFst< Arc >::Start(), and Times().
Referenced by TestCompose().
void WriteFstKaldi | ( | std::ostream & | os, |
bool | binary, | ||
const VectorFst< Arc > & | t | ||
) |
Definition at line 31 of file kaldi-fst-io-inl.h.
References KALDI_ERR.
Referenced by main(), and VectorFstTplHolder< Arc >::Write().
void WriteFstKaldi | ( | const VectorFst< StdArc > & | fst, |
std::string | wxfilename | ||
) |
Definition at line 115 of file kaldi-fst-io.cc.
References kaldi::PrintableWxfilename(), and Output::Stream().
void fst::WriteILabelInfo | ( | std::ostream & | os, |
bool | binary, | ||
const std::vector< std::vector< int32 > > & | ilabel_info | ||
) |
Utility function for writing ilabel-info vectors to disk.
Definition at line 325 of file context-fst.cc.
References rnnlm::i, kaldi::WriteBasicType(), and kaldi::WriteIntegerVector().
Referenced by main(), and TestContextFst().
void fst::WriteILabelInfo | ( | std::ostream & | os, |
bool | binary, | ||
const vector< vector< int32 > > & | info | ||
) |
Utility function for writing ilabel-info vectors to disk.
Definition at line 325 of file context-fst.cc.
References rnnlm::i, kaldi::WriteBasicType(), and kaldi::WriteIntegerVector().
Referenced by main(), and TestContextFst().