29     using namespace kaldi;
    32     typedef kaldi::uint64 uint64;
    35         "Take a union of the indexed lattices. The input index is in "    36         " the T*T*T semiring and\n"    37         "the output index is also in the T*T*T semiring. At the end of "    38         "this program, encoded\n"    39         "epsilon removal, determinization and minimization will be applied.\n"    41         "Usage: kws-index-union [options]  index-rspecifier index-wspecifier\n"    42         " e.g.: kws-index-union ark:input.idx ark:global.idx\n";
    47     bool skip_opt = 
false;
    48     int32 max_states = -1;
    49     po.Register(
"strict", &strict,
    50         "Will allow 0 lattice if it is set to false.");
    51     po.Register(
"skip-optimization", &skip_opt,
    52         "Skip optimization if it's set to true.");
    53     po.Register(
"max-states", &max_states,
    54         "Maximum states for DeterminizeStar.");
    58     if (po.NumArgs() < 2 || po.NumArgs() > 3) {
    63     std::string index_rspecifier = po.GetArg(1),
    64         index_wspecifier = po.GetOptArg(2);
    67                                                 index_reader(index_rspecifier);
    69                                                 index_writer(index_wspecifier);
    73     for (; !index_reader.Done(); index_reader.Next()) {
    74       std::string key = index_reader.Key();
    76       index_reader.FreeCurrent();
    78       Union(&global_index, index);
    83     if (skip_opt == 
false) {
    86       EncodeMapper<KwsLexicographicArc> encoder(kEncodeLabels, ENCODE);
    87       Encode(&ifst, &encoder);
    90       } 
catch(
const std::exception &e) {
    92                    << 
" (should affect speed of search but not results)";
    95       Minimize(&global_index, static_cast<KwsLexicographicFst*>(NULL), kDelta, 
true);
    96       Decode(&global_index, encoder);
    98       KALDI_LOG << 
"Skipping index optimization...";
   102     index_writer.Write(
"global", global_index);
   104     KALDI_LOG << 
"Done " << n_done << 
" indices";
   106       return (n_done != 0 ? 0 : 1);
   109   } 
catch(
const std::exception &e) {
   110     std::cerr << e.what();
 This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
 
For an extended explanation of the framework of which grammar-fsts are a part, please see Support for...
 
A templated class for writing objects to an archive or script file; see The Table concept...
 
fst::VectorFst< KwsLexicographicArc > KwsLexicographicFst
 
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...
 
bool DeterminizeStar(F &ifst, MutableFst< typename F::Arc > *ofst, float delta, bool *debug_ptr, int max_states, bool allow_partial)
This function implements the normal version of DeterminizeStar, in which the output strings are repre...