FST  openfst-1.7.3
OpenFst Library
disambiguate.cc
Go to the documentation of this file.
1 // See www.openfst.org for extensive documentation on this weighted
2 // finite-state transducer library.
3 
5 
6 #include <fst/script/fst-class.h>
8 
9 namespace fst {
10 namespace script {
11 
12 void Disambiguate(const FstClass &ifst, MutableFstClass *ofst,
13  const DisambiguateOptions &opts) {
14  if (!internal::ArcTypesMatch(ifst, *ofst, "Disambiguate") ||
15  !ofst->WeightTypesMatch(opts.weight_threshold, "Disambiguate")) {
16  ofst->SetProperties(kError, kError);
17  return;
18  }
19  DisambiguateArgs args(ifst, ofst, opts);
20  Apply<Operation<DisambiguateArgs>>("Disambiguate", ifst.ArcType(), &args);
21 }
22 
26 
27 } // namespace script
28 } // namespace fst
bool WeightTypesMatch(const WeightClass &weight, const std::string &op_name) const
Definition: fst-class.cc:93
const std::string & ArcType() const final
Definition: fst-class.h:298
void Disambiguate(DisambiguateArgs *args)
Definition: disambiguate.h:36
REGISTER_FST_OPERATION(Compress, StdArc, CompressArgs)
bool ArcTypesMatch(const M &m, const N &n, const std::string &op_name)
Definition: script-impl.h:177
std::tuple< const FstClass &, MutableFstClass *, const DisambiguateOptions & > DisambiguateArgs
Definition: disambiguate.h:33
constexpr uint64 kError
Definition: properties.h:34
void SetProperties(uint64 props, uint64 mask)
Definition: fst-class.h:465
const WeightClass & weight_threshold
Definition: disambiguate.h:19