133     using namespace kaldi;
   135     typedef kaldi::int64 int64;
   136     using fst::SymbolTable;
   137     using fst::VectorFst;
   141         "Copy lattices (e.g. useful for changing to text mode or changing\n"   142         "format to standard from compact lattice.)\n"   143         "The --include and --exclude options can be used to copy only a subset "   144         "of lattices, where are the --include option specifies the "   145         "whitelisted utterances that would be copied and --exclude option "   146         "specifies the blacklisted utterances that would not be copied.\n"   147         "Only one of --include and --exclude can be supplied.\n"   148         "Usage: lattice-copy [options] lattice-rspecifier lattice-wspecifier\n"   149         " e.g.: lattice-copy --write-compact=false ark:1.lats ark,t:text.lats\n"   150         "See also: lattice-scale, lattice-to-fst, and\n"   151         "   the script egs/wsj/s5/utils/convert_slf.pl\n";
   154     bool write_compact = 
true, ignore_missing = 
false;
   155     std::string include_rxfilename;
   156     std::string exclude_rxfilename;
   158     po.Register(
"write-compact", &write_compact, 
"If true, write in normal (compact) form.");
   159     po.Register(
"include", &include_rxfilename,
   160                 "Text file, the first field of each "   161                 "line being interpreted as the "   162                 "utterance-id whose lattices will be included");
   163     po.Register(
"exclude", &exclude_rxfilename,
   164                 "Text file, the first field of each "   165                 "line being interpreted as an utterance-id "   166                 "whose lattices will be excluded");
   167     po.Register(
"ignore-missing", &ignore_missing,
   168                 "Exit with status 0 even if no lattices are copied");
   172     if (po.NumArgs() != 2) {
   177     std::string lats_rspecifier = po.GetArg(1),
   178         lats_wspecifier = po.GetArg(2);
   182     bool sorted = opts.
sorted;
   190       if (include_rxfilename != 
"") {
   191         if (exclude_rxfilename != 
"") {
   192           KALDI_ERR << 
"should not have both --exclude and --include option!";
   195             &lattice_reader, &lattice_writer,
   196             true, ignore_missing, sorted);
   197       } 
else if (exclude_rxfilename != 
"") {
   199             &lattice_reader, &lattice_writer,
   200             false, ignore_missing);
   203       for (; !lattice_reader.Done(); lattice_reader.Next(), n_done++)
   204         lattice_writer.Write(lattice_reader.Key(), lattice_reader.Value());
   209       if (include_rxfilename != 
"") {
   210         if (exclude_rxfilename != 
"") {
   211           KALDI_ERR << 
"should not have both --exclude and --include option!";
   214             &lattice_reader, &lattice_writer,
   215             true, ignore_missing, sorted);
   216       } 
else if (exclude_rxfilename != 
"") {
   218             &lattice_reader, &lattice_writer,
   219             true, ignore_missing);
   222       for (; !lattice_reader.Done(); lattice_reader.Next(), n_done++)
   223         lattice_writer.Write(lattice_reader.Key(), lattice_reader.Value());
   225     KALDI_LOG << 
"Done copying " << n_done << 
" lattices.";
   227     if (ignore_missing) 
return 0;
   229     return (n_done != 0 ? 0 : 1);
   230   } 
catch(
const std::exception &e) {
   231     std::cerr << e.what();
 This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
 
int32 CopySubsetLattices(std::string filename, SequentialLatticeReader *lattice_reader, LatticeWriter *lattice_writer, bool include=true, bool ignore_missing=false, bool sorted=false)
 
A templated class for writing objects to an archive or script file; see The Table concept...
 
RspecifierType ClassifyRspecifier(const std::string &rspecifier, std::string *rxfilename, RspecifierOptions *opts)
 
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...