19 #include <fst/flags.h> 23 #include <fst/vector-fst.h> 27 "Specifies failure label (default: none)");
29 "Specifies topology method, one of: " 31 DEFINE_int64(order, 3,
"Set maximal order of ngram model");
33 int main(
int argc,
char **argv) {
36 "Algorithms for constructing specific FST topologies.\n\n";
39 usage +=
" [in.fst [out.fst]]\n";
41 SET_FLAGS(usage.c_str(), &argc, &argv,
true);
48 (argc > 1 && (strcmp(argv[1],
"-") != 0)) ? argv[1] :
"";
49 std::string out_name = argc > 2 ? argv[2] :
"";
51 f::StdFst *ifst = f::StdFst::Read(in_name);
56 if (FST_FLAGS_method ==
"ngram") {
58 FST_FLAGS_phi_label, &ofst);
62 <<
": unknown topology method: " << FST_FLAGS_method;
66 if (!ofst.Write(out_name))
DEFINE_string(method,"ngram","Specifies topology method, one of: ""\"ngram\"")
DEFINE_int64(phi_label, fst::kNoLabel,"Specifies failure label (default: none)")
void FindNGrams(const fst::Fst< Arc > &ifst)
int main(int argc, char **argv)