FST  openfst-1.6.1
OpenFst Library
intersect.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>
5 #include <fst/script/intersect.h>
7 
8 namespace fst {
9 namespace script {
10 
11 // 1
12 void Intersect(const FstClass &ifst1, const FstClass &ifst2,
13  MutableFstClass *ofst, ComposeFilter compose_filter) {
14  if (!ArcTypesMatch(ifst1, ifst2, "Intersect") ||
15  !ArcTypesMatch(*ofst, ifst1, "Intersect")) {
16  ofst->SetProperties(kError, kError);
17  return;
18  }
19  IntersectArgs1 args(ifst1, ifst2, ofst, compose_filter);
20  Apply<Operation<IntersectArgs1>>("Intersect", ifst1.ArcType(), &args);
21 }
22 
23 // 2
24 void Intersect(const FstClass &ifst1, const FstClass &ifst2,
25  MutableFstClass *ofst, const ComposeOptions &copts) {
26  if (!ArcTypesMatch(ifst1, ifst2, "Intersect") ||
27  !ArcTypesMatch(*ofst, ifst1, "Intersect")) {
28  ofst->SetProperties(kError, kError);
29  return;
30  }
31  IntersectArgs2 args(ifst1, ifst2, ofst, copts);
32  Apply<Operation<IntersectArgs2>>("Intersect", ifst1.ArcType(), &args);
33 }
34 
38 
42 
43 } // namespace script
44 } // namespace fst
const string & ArcType() const override
Definition: fst-class.h:289
REGISTER_FST_OPERATION(Compress, StdArc, CompressArgs)
void Intersect(IntersectArgs1 *args)
Definition: intersect.h:19
constexpr uint64 kError
Definition: properties.h:33
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