FST  openfst-1.7.3
OpenFst Library
push.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/push.h>
5 
6 #include <fst/script/fst-class.h>
8 
9 namespace fst {
10 namespace script {
11 
12 void Push(MutableFstClass *fst, ReweightType rew_type, float delta,
13  bool remove_total_weight) {
14  PushArgs1 args(fst, rew_type, delta, remove_total_weight);
15  Apply<Operation<PushArgs1>>("Push", fst->ArcType(), &args);
16 }
17 
18 void Push(const FstClass &ifst, MutableFstClass *ofst, uint32 flags,
19  ReweightType rew_type, float delta) {
20  if (!internal::ArcTypesMatch(ifst, *ofst, "Push")) {
21  ofst->SetProperties(kError, kError);
22  return;
23  }
24  PushArgs2 args(ifst, ofst, flags, rew_type, delta);
25  Apply<Operation<PushArgs2>>("Push", ifst.ArcType(), &args);
26 }
27 
31 
35 
36 } // namespace script
37 } // namespace fst
ReweightType
Definition: reweight.h:18
const std::string & ArcType() const final
Definition: fst-class.h:298
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< MutableFstClass *, ReweightType, float, bool > PushArgs1
Definition: push.h:15
uint32_t uint32
Definition: types.h:31
void Push(PushArgs1 *args)
Definition: push.h:18
constexpr uint64 kError
Definition: properties.h:34
void SetProperties(uint64 props, uint64 mask)
Definition: fst-class.h:465
std::tuple< const FstClass &, MutableFstClass *, uint32, ReweightType, float > PushArgs2
Definition: push.h:24