FST  openfst-1.6.1
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 // 1
13 void Encode(MutableFstClass *fst, uint32 flags, bool reuse_encoder,
14  const string &coder_fname) {
15  EncodeArgs1 args(fst, flags, reuse_encoder, coder_fname);
16  Apply<Operation<EncodeArgs1>>("Encode", fst->ArcType(), &args);
17 }
18 
19 // 2
21  if (fst->ArcType() != encoder->ArcType()) {
22  FSTERROR() << "FST and encoder with non-matching arc types passed to "
23  << "Encode:\n\t" << fst->ArcType() << " and "
24  << encoder->ArcType();
26  return;
27  }
28  EncodeArgs2 args(fst, encoder);
29  Apply<Operation<EncodeArgs2>>("Encode", fst->ArcType(), &args);
30 }
31 
35 
39 
40 } // namespace script
41 } // namespace fst
void Encode(EncodeArgs1 *args)
Definition: encode.h:23
const string & ArcType() const
const string & ArcType() const override
Definition: fst-class.h:289
REGISTER_FST_OPERATION(Compress, StdArc, CompressArgs)
#define FSTERROR()
Definition: util.h:32
uint32_t uint32
Definition: types.h:31
constexpr uint64 kError
Definition: properties.h:33
void SetProperties(uint64 props, uint64 mask)
Definition: fst-class.h:455