FST  openfst-1.7.2
OpenFst Library
fstlinear.cc
Go to the documentation of this file.
1 // See www.openfst.org for extensive documentation on this weighted
2 // finite-state transducer library.
3 
5 
6 #include <fst/flags.h>
7 
8 DEFINE_string(arc_type, "standard", "Output arc type");
9 
10 DEFINE_string(epsilon_symbol, "<eps>", "Epsilon symbol");
11 DEFINE_string(unknown_symbol, "<unk>", "Unknown word symbol");
12 
13 DEFINE_string(vocab, "", "Path to the vocabulary file");
14 DEFINE_string(out, "", "Path to the output binary");
15 
16 DEFINE_string(save_isymbols, "", "Save input symbol table to file");
17 DEFINE_string(save_fsymbols, "", "Save feature symbol table to file");
18 DEFINE_string(save_osymbols, "", "Save output symbol table to file");
19 
20 int main(int argc, char **argv) {
21  // TODO(wuke): more detailed usage
22  std::set_new_handler(FailedNewHandler);
23  SET_FLAGS(argv[0], &argc, &argv, true);
26 
27  if (argc == 1) {
28  ShowUsage();
29  return 1;
30  }
31 
32  fst::script::LinearCompile(FLAGS_arc_type, FLAGS_epsilon_symbol,
33  FLAGS_unknown_symbol, FLAGS_vocab, argv + 1,
34  argc - 1, FLAGS_out, FLAGS_save_isymbols,
35  FLAGS_save_fsymbols, FLAGS_save_osymbols);
36 }
void ShowUsage(bool long_usage=true)
Definition: flags.cc:124
void FailedNewHandler()
Definition: compat.cc:25
#define SET_FLAGS(usage, argc, argv, rmflags)
Definition: flags.h:214
int main(int argc, char **argv)
Definition: fstlinear.cc:20
bool ValidateEmptySymbol()
Definition: linearscript.cc:36
DEFINE_string(arc_type,"standard","Output arc type")
void LinearCompile(const string &arc_type, const string &epsilon_symbol, const string &unknown_symbol, const string &vocab, char **models, int models_len, const string &out, const string &save_isymbols, const string &save_fsymbols, const string &save_osymbols)
Definition: linearscript.cc:45
bool ValidateDelimiter()
Definition: linearscript.cc:30