FST  openfst-1.6.1
OpenFst Library
decode.h
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 #ifndef FST_SCRIPT_DECODE_H_
5 #define FST_SCRIPT_DECODE_H_
6 
7 #include <memory>
8 #include <string>
9 
10 #include <fst/encode.h>
11 #include <fst/script/arg-packs.h>
13 #include <fst/script/fst-class.h>
14 
15 namespace fst {
16 namespace script {
17 
18 // 1: Decode using encoder on disk.
20 
21 template <class Arc>
22 void Decode(DecodeArgs1 *args) {
23  MutableFst<Arc> *fst = args->arg1->GetMutableFst<Arc>();
24  std::unique_ptr<EncodeMapper<Arc>> decoder(EncodeMapper<Arc>::Read(args->arg2,
25  DECODE));
26  if (!decoder) {
28  return;
29  }
30  Decode(fst, *decoder);
31 }
32 
33 void Decode(MutableFstClass *fst, const string &coder_fname);
34 
35 // 2: Decode using an EncodeMapperClass.
37 
38 template <class Arc>
39 void Decode(DecodeArgs2 *args) {
40  MutableFst<Arc> *fst = args->arg1->GetMutableFst<Arc>();
41  const EncodeMapper<Arc> &encoder = *(args->arg2.GetEncodeMapper<Arc>());
42  Decode(fst, encoder);
43 }
44 
45 void Decode(MutableFstClass *fst, const EncodeMapperClass &encoder);
46 
47 } // namespace script
48 } // namespace fst
49 
50 #endif // FST_SCRIPT_DECODE_H_
void Decode(DecodeArgs1 *args)
Definition: decode.h:22
constexpr uint64 kError
Definition: properties.h:33
virtual void SetProperties(uint64 props, uint64 mask)=0