31 "Applies an FST to another FST, treating the second as a log-linear " 35 usage +=
" in.fst linear.fst [out.fst]\n";
37 SET_FLAGS(usage.c_str(), &argc, &argv,
true);
38 if (argc < 3 || argc > 4) {
43 std::string in_name = strcmp(argv[1],
"-") != 0 ? argv[1] :
"";
44 std::string linear_name =
45 (argc > 2 && (strcmp(argv[2],
"-") != 0)) ? argv[2] :
"";
46 std::string out_name =
47 (argc > 3 && (strcmp(argv[3],
"-") != 0)) ? argv[3] :
"";
49 if (in_name.empty() && linear_name.empty()) {
50 LOG(ERROR) << argv[0] <<
": Can't take both inputs from standard input.";
65 return !ofst.
Write(out_name);
void ShowUsage(bool long_usage=true)
static Fst * Read(std::istream &strm, const FstReadOptions &opts)
bool Write(std::ostream &strm, const FstWriteOptions &opts) const override
void LogLinearApply(const Fst< A > &ifst, const Fst< A > &lfst, MutableFst< A > *ofst, bool normalize=true)
#define SET_FLAGS(usage, argc, argv, rmflags)
int fstloglinearapply_main(int argc, char **argv)