58     using namespace kaldi;
    64     const int32 kDeltaOrder = 2;
    67         "Decode speech, using feature batches received over a network connection\n\n"    68         "Utterance segmentation is done on-the-fly.\n"    69         "Feature splicing/LDA transform is used, if the optional(last) argument "    71         "Otherwise delta/delta-delta(2-nd order) features are produced.\n\n"    72         "Usage: online-server-gmm-decode-faster [options] model-in"    73         "fst-in word-symbol-table silence-phones udp-port [lda-matrix-in]\n\n"    74         "Example: online-server-gmm-decode-faster --rt-min=0.3 --rt-max=0.5 "    75         "--max-active=4000 --beam=12.0 --acoustic-scale=0.0769 "    76         "model HCLG.fst words.txt '1:2:3:4:5' 1234 lda-matrix";
    79     int32 cmn_window = 600,
    81     int32 right_context = 4, left_context = 4;
    90     po.Register(
"left-context", &left_context, 
"Number of frames of left context");
    91     po.Register(
"right-context", &right_context, 
"Number of frames of right context");
    92     po.Register(
"acoustic-scale", &acoustic_scale,
    93                 "Scaling factor for acoustic likelihoods");
    94     po.Register(
"cmn-window", &cmn_window,
    95         "Number of feat. vectors used in the running average CMN calculation");
    96     po.Register(
"min-cmn-window", &min_cmn_window,
    97                 "Minumum CMN window used at start of decoding (adds "    98                 "latency only at start)");
   101     if (po.NumArgs() != 5 && po.NumArgs() != 6) {
   106     std::string model_rxfilename = po.GetArg(1),
   107         fst_rxfilename = po.GetArg(2),
   108         word_syms_filename = po.GetArg(3),
   109         silence_phones_str = po.GetArg(4),
   110         lda_mat_rspecifier = po.GetOptArg(6);
   111     int32 udp_port = atoi(po.GetArg(5).c_str());
   114     if (lda_mat_rspecifier != 
"") {
   116       Input ki(lda_mat_rspecifier, &binary_in);
   117       lda_transform.Read(ki.Stream(), binary_in);
   120     std::vector<int32> silence_phones;
   122         KALDI_ERR << 
"Invalid silence-phones string " << silence_phones_str;
   123     if (silence_phones.empty())
   130         Input ki(model_rxfilename, &binary);
   131         trans_model.
Read(ki.Stream(), binary);
   132         am_gmm.
Read(ki.Stream(), binary);
   135     fst::SymbolTable *word_syms = NULL;
   136     if (!(word_syms = fst::SymbolTable::ReadText(word_syms_filename)))
   137         KALDI_ERR << 
"Could not read symbol table from file "   138                     << word_syms_filename;
   149                                 silence_phones, trans_model);
   150     VectorFst<LatticeArc> out_fst;
   151     int32 feature_dim = mfcc_opts.
num_ceps; 
   156     if (lda_mat_rspecifier != 
"") {
   158                                &cmn_input, lda_transform,
   159                                left_context, right_context);
   162       opts.
order = kDeltaOrder;
   173     std::cerr << std::endl << 
"Listening on UDP port "   174               << udp_port << 
" ... " << std::endl;
   175     bool partial_res = 
false;
   178       std::vector<int32> word_ids;
   179       if (dstate & (decoder.kEndFeats | decoder.kEndUtt)) {
   180         decoder.FinishTraceBack(&out_fst);
   182                                      static_cast<vector<int32> *
>(0),
   184                                      static_cast<LatticeArc::Weight*>(0));
   186                           udp_input.descriptor(), udp_input.client_addr());
   189         if (decoder.PartialTraceback(&out_fst)) {
   191                                        static_cast<vector<int32> *
>(0),
   193                                        static_cast<LatticeArc::Weight*>(0));
   195                             udp_input.descriptor(), udp_input.client_addr());
   197             partial_res = (word_ids.size() > 0);
   202     delete feat_transform;
   206   } 
catch(
const std::exception& e) {
   207     std::cerr << e.what();
 This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
 
void Register(OptionsItf *opts, bool full)
 
MfccOptions contains basic options for computing MFCC features. 
 
For an extended explanation of the framework of which grammar-fsts are a part, please see Support for...
 
bool SplitStringToIntegers(const std::string &full, const char *delim, bool omit_empty_strings, std::vector< I > *out)
Split a string (e.g. 
 
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. 
 
The class ParseOptions is for parsing command-line options; see Parsing command-line options for more...
 
void Read(std::istream &is, bool binary)
 
fst::Fst< fst::StdArc > * ReadDecodeGraph(const std::string &filename)
 
void Register(OptionsItf *opts)
 
void Register(OptionsItf *opts)
 
void Read(std::istream &in_stream, bool binary)
 
void SendPartialResult(const std::vector< int32 > &words, const fst::SymbolTable *word_syms, const bool line_break, const int32 serv_sock, const sockaddr_in &client_addr)