fstdeterminizelog.cc File Reference
#include "base/kaldi-common.h"
#include "util/kaldi-io.h"
#include "util/parse-options.h"
#include "util/text-utils.h"
#include "fst/fstlib.h"
#include "fstext/fstext-utils.h"
#include "fstext/kaldi-fst-io.h"
Include dependency graph for fstdeterminizelog.cc:

Go to the source code of this file.

Functions

int main (int argc, char *argv[])
 

Function Documentation

◆ main()

int main ( int  argc,
char *  argv[] 
)

Definition at line 29 of file fstdeterminizelog.cc.

References fst::DeterminizeInLog(), ParseOptions::GetOptArg(), ParseOptions::NumArgs(), ParseOptions::PrintUsage(), ParseOptions::Read(), fst::ReadFstKaldi(), and fst::WriteFstKaldi().

29  {
30  try {
31  using namespace kaldi;
32  using namespace fst;
33  using kaldi::int32;
34 
35  const char *usage =
36  "Determinizes in the log semiring\n"
37  "\n"
38  "Usage: fstdeterminizelog [in.fst [out.fst] ]\n"
39  "\n"
40  "See also fstdeterminizestar\n";
41 
42  ParseOptions po(usage);
43  po.Read(argc, argv);
44 
45  if (po.NumArgs() > 2) {
46  po.PrintUsage();
47  exit(1);
48  }
49 
50  std::string fst_in_filename = po.GetOptArg(1),
51  fst_out_filename = po.GetOptArg(2);
52 
53  VectorFst<StdArc> *fst = ReadFstKaldi(fst_in_filename);
54 
55  DeterminizeInLog(fst);
56 
57  WriteFstKaldi(*fst, fst_out_filename);
58  delete fst;
59  return 0;
60  } catch(const std::exception &e) {
61  std::cerr << e.what();
62  return -1;
63  }
64 }
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
Definition: chain.dox:20
For an extended explanation of the framework of which grammar-fsts are a part, please see Support for...
Definition: graph.dox:21
void DeterminizeInLog(VectorFst< StdArc > *fst)
kaldi::int32 int32
The class ParseOptions is for parsing command-line options; see Parsing command-line options for more...
Definition: parse-options.h:36
void WriteFstKaldi(std::ostream &os, bool binary, const VectorFst< Arc > &t)
void ReadFstKaldi(std::istream &is, bool binary, VectorFst< Arc > *fst)