FST  openfst-1.6.1
OpenFst Library
decode.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/decode.h>
8 
9 namespace fst {
10 namespace script {
11 
12 // 1: Decode using encoder on disk.
13 void Decode(MutableFstClass *fst, const string &coder_fname) {
14  DecodeArgs1 args(fst, coder_fname);
15  Apply<Operation<DecodeArgs1>>("Decode", fst->ArcType(), &args);
16 }
17 
18 // 2: Decode using an EncodeMapperClass.
19 void Decode(MutableFstClass *fst, const EncodeMapperClass &encoder) {
20  if (fst->ArcType() != encoder.ArcType()) {
21  FSTERROR() << "FST and encoder with non-matching arc types passed to "
22  << "Decode:\n\t" << fst->ArcType() << " and "
23  << encoder.ArcType();
25  return;
26  }
27  DecodeArgs2 args(fst, encoder);
28  Apply<Operation<DecodeArgs2>>("Decode", fst->ArcType(), &args);
29 }
30 
34 
38 
39 } // namespace script
40 } // namespace fst
void Decode(DecodeArgs1 *args)
Definition: decode.h:22
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
constexpr uint64 kError
Definition: properties.h:33
void SetProperties(uint64 props, uint64 mask)
Definition: fst-class.h:455