34 "Applies an FST to another FST, treating the second as a log-linear " 38 usage +=
" in.fst linear.fst [out.fst]\n";
40 SET_FLAGS(usage.c_str(), &argc, &argv,
true);
41 if (argc < 3 || argc > 4) {
46 std::string in_name = strcmp(argv[1],
"-") != 0 ? argv[1] :
"";
47 std::string linear_name =
48 (argc > 2 && (strcmp(argv[2],
"-") != 0)) ? argv[2] :
"";
49 std::string out_name =
50 (argc > 3 && (strcmp(argv[3],
"-") != 0)) ? argv[3] :
"";
52 if (in_name.empty() && linear_name.empty()) {
53 LOG(ERROR) << argv[0] <<
": Can't take both inputs from standard input.";
68 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)