Write equally spaced alignments of utterances (to get training started). 
   33     using namespace kaldi;
    35     using fst::SymbolTable;
    39     const char *usage = 
"Write equally spaced alignments of utterances "    40         "(to get training started)\n"    41         "Usage:  align-equal <tree-in> <model-in> <lexicon-fst-in> "    42         "<features-rspecifier> <transcriptions-rspecifier> <alignments-wspecifier>\n"    44         " align-equal 1.tree 1.mdl lex.fst scp:train.scp "    45         "'ark:sym2int.pl -f 2- words.txt text|' ark:equal.ali\n";
    48     std::string disambig_rxfilename;
    49     po.Register(
"read-disambig-syms", &disambig_rxfilename, 
"File containing "    50                 "list of disambiguation symbols in phone symbol table");
    53     if (po.NumArgs() != 6) {
    58     std::string tree_in_filename = po.GetArg(1);
    59     std::string model_in_filename = po.GetArg(2);
    60     std::string lex_in_filename = po.GetArg(3);
    61     std::string feature_rspecifier = po.GetArg(4);
    62     std::string transcript_rspecifier = po.GetArg(5);
    63     std::string alignment_wspecifier = po.GetArg(6);
    76     std::vector<int32> disambig_syms;
    77     if (disambig_rxfilename != 
"")
    79         KALDI_ERR << 
"fstcomposecontext: Could not read disambiguation symbols from "    80                   << disambig_rxfilename;
    97     int32 done = 0, no_transcript = 0, other_error = 0;
    98     for (; !feature_reader.Done(); feature_reader.Next()) {
    99       std::string key = feature_reader.Key();
   100       if (transcript_reader.HasKey(key)) {
   101         const std::vector<int32> &transcript = transcript_reader.Value(key);
   102         int32 num_frames = feature_reader.Value().NumRows();
   103         if (num_frames == 0) {
   104           KALDI_WARN << 
"Zero-length utterance for key " << key;
   108         VectorFst<StdArc> decode_fst;
   109         if (!gc.CompileGraphFromText(transcript, &decode_fst)) {
   110           KALDI_WARN << 
"Problem creating decoding graph for utterance "   111                      << key <<
" [serious error]";
   115         VectorFst<StdArc> path;
   118         if (
EqualAlign(decode_fst, num_frames, rand_seed, &path) ) {
   119           std::vector<int32> aligned_seq, 
words;
   124           alignment_writer.Write(key, aligned_seq);
   127           KALDI_WARN << 
"AlignEqual: did not align utterence " << key;
   131         KALDI_WARN << 
"AlignEqual: no transcript for utterance " << key;
   135     if (done != 0 && no_transcript == 0 && other_error == 0) {
   136       KALDI_LOG << 
"Success: done " << done << 
" utterances.";
   138       KALDI_WARN << 
"Computed " << done << 
" alignments; " << no_transcript
   139                  << 
" lacked transcripts, " << other_error
   140                  << 
" had other errors.";
   142     if (done != 0) 
return 0;
   144   } 
catch(
const std::exception &e) {
   145     std::cerr << e.what();
 
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
 
A templated class for writing objects to an archive or script file; see The Table concept...
 
A hashing function object for strings. 
 
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. 
 
void ReadKaldiObject(const std::string &filename, Matrix< float > *m)
 
Allows random access to a collection of objects in an archive or script file; see The Table concept...
 
bool EqualAlign(const Fst< Arc > &ifst, typename Arc::StateId length, int rand_seed, MutableFst< Arc > *ofst, int num_retries)
EqualAlign is similar to RandGen, but it generates a sequence with exactly "length" input symbols...
 
The class ParseOptions is for parsing command-line options; see Parsing command-line options for more...
 
A templated class for reading objects sequentially from an archive or script file; see The Table conc...
 
fst::StdArc::Weight Weight
 
#define KALDI_ASSERT(cond)
 
void ReadFstKaldi(std::istream &is, bool binary, VectorFst< Arc > *fst)
 
bool ReadIntegerVectorSimple(const std::string &rxfilename, std::vector< int32 > *list)
ReadFromList attempts to read this list of integers, one per line, from the given file...