FST  openfst-1.7.2
OpenFst Library
encode.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/encode.h>
6 #include <fst/script/encode.h>
8 
9 namespace fst {
10 namespace script {
11 
12 void Encode(MutableFstClass *fst, uint32 flags, bool reuse_encoder,
13  const string &coder_fname) {
14  EncodeArgs1 args(fst, flags, reuse_encoder, coder_fname);
15  Apply<Operation<EncodeArgs1>>("Encode", fst->ArcType(), &args);
16 }
17 
19  if (!internal::ArcTypesMatch(*fst, *encoder, "Encode")) {
21  return;
22  }
23  EncodeArgs2 args(fst, encoder);
24  Apply<Operation<EncodeArgs2>>("Encode", fst->ArcType(), &args);
25 }
26 
30 
34 
35 } // namespace script
36 } // namespace fst
void Encode(EncodeArgs1 *args)
Definition: encode.h:22
std::tuple< MutableFstClass *, uint32, bool, const string & > EncodeArgs1
Definition: encode.h:19
const string & ArcType() const final
Definition: fst-class.h:290
REGISTER_FST_OPERATION(Compress, StdArc, CompressArgs)
bool ArcTypesMatch(const M &m, const N &n, const string &op_name)
Definition: script-impl.h:176
std::pair< MutableFstClass *, EncodeMapperClass * > EncodeArgs2
Definition: encode.h:34
uint32_t uint32
Definition: types.h:31
constexpr uint64 kError
Definition: properties.h:33
void SetProperties(uint64 props, uint64 mask)
Definition: fst-class.h:452