38 "Two FSTs are isomorphic iff the exit status is zero.\n\n Usage: ";
40 usage +=
" in1.fst in2.fst\n";
42 SET_FLAGS(usage.c_str(), &argc, &argv,
true);
48 const std::string in1_name = strcmp(argv[1],
"-") == 0 ?
"" : argv[1];
49 const std::string in2_name = strcmp(argv[2],
"-") == 0 ?
"" : argv[2];
51 if (in1_name.empty() && in2_name.empty()) {
52 LOG(ERROR) << argv[0] <<
": Can't take both inputs from standard input";
56 std::unique_ptr<FstClass> ifst1(FstClass::Read(in1_name));
59 std::unique_ptr<FstClass> ifst2(FstClass::Read(in2_name));
62 const bool result =
s::Isomorphic(*ifst1, *ifst2, FST_FLAGS_delta);
63 if (!result)
VLOG(1) <<
"FSTs are not isomorphic";
65 return result ? 0 : 2;
void ShowUsage(bool long_usage=true)
int fstisomorphic_main(int argc, char **argv)
bool Isomorphic(FarReaderClass &reader1, FarReaderClass &reader2, float delta, std::string_view begin_key, std::string_view end_key)
#define SET_FLAGS(usage, argc, argv, rmflags)