20 #include <fst/flags.h> 21 #include <fst/fst-decl.h> 28 "Specifies failure label (default: none)");
29 DEFINE_bool(reverse,
false,
"Perform in the reverse direction");
30 DEFINE_double(delta, fst::kShortestDelta,
"Convergence delta");
32 int main(
int argc,
char **argv) {
34 std::string usage =
"Computes the shortest distance with failure transitions";
35 usage +=
" in a stochastic FST.\n\n Usage: ";
37 usage +=
" [in.fst [out.fst]]\n";
39 SET_FLAGS(usage.c_str(), &argc, &argv,
true);
45 const std::string in_name = (argc > 1 && (strcmp(argv[1],
"-") != 0))
47 const std::string out_name = argc > 2 ? argv[2] :
"";
49 f::StdFst *
fst = f::StdFst::Read(in_name);
52 std::vector<f::StdArc::Weight> distance;
54 *fst, &distance, FST_FLAGS_phi_label,
55 FST_FLAGS_reverse, FST_FLAGS_delta);
56 if (!total_weight.Member())
DEFINE_int64(phi_label, fst::kNoLabel,"Specifies failure label (default: none)")
int main(int argc, char **argv)
void WriteWeights(std::ostream &strm, const std::vector< Weight > &weights)
Arc::Weight ShortestDistance(const fst::Fst< Arc > &fst, std::vector< typename Arc::Weight > *distance, typename Arc::Label phi_label=fst::kNoLabel, bool reverse=false, float delta=fst::kShortestDelta)
DEFINE_bool(reverse, false,"Perform in the reverse direction")
DEFINE_double(delta, fst::kShortestDelta,"Convergence delta")