FST  openfst-1.6.1
OpenFst Library
difference.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 
4 #include <fst/script/fst-class.h>
7 
8 namespace fst {
9 namespace script {
10 
11 // 1
12 void Difference(const FstClass &ifst1, const FstClass &ifst2,
13  MutableFstClass *ofst, ComposeFilter compose_filter) {
14  if (!ArcTypesMatch(ifst1, ifst2, "Difference") ||
15  !ArcTypesMatch(*ofst, ifst1, "Difference")) {
16  ofst->SetProperties(kError, kError);
17  return;
18  }
19  DifferenceArgs1 args(ifst1, ifst2, ofst, compose_filter);
20  Apply<Operation<DifferenceArgs1>>("Difference", ifst1.ArcType(), &args);
21 }
22 
23 // 2
24 void Difference(const FstClass &ifst1, const FstClass &ifst2,
25  MutableFstClass *ofst, const ComposeOptions &copts) {
26  if (!ArcTypesMatch(ifst1, ifst2, "Difference") ||
27  !ArcTypesMatch(*ofst, ifst1, "Difference")) {
28  ofst->SetProperties(kError, kError);
29  return;
30  }
31  DifferenceArgs2 args(ifst1, ifst2, ofst, copts);
32  Apply<Operation<DifferenceArgs2>>("Difference", ifst1.ArcType(), &args);
33 }
34 
41 
42 } // namespace script
43 } // namespace fst
const string & ArcType() const override
Definition: fst-class.h:289
REGISTER_FST_OPERATION(Compress, StdArc, CompressArgs)
constexpr uint64 kError
Definition: properties.h:33
void Difference(DifferenceArgs1 *args)
Definition: difference.h:19
bool ArcTypesMatch(const M &m, const N &n, const string &op_name)
Definition: script-impl.h:177
void SetProperties(uint64 props, uint64 mask)
Definition: fst-class.h:455
ComposeFilter
Definition: compose.h:920