FST  openfst-1.7.3
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 #include <utility>
10 
11 #include <fst/encode.h>
13 #include <fst/script/fst-class.h>
14 
15 namespace fst {
16 namespace script {
17 
18 using DecodeArgs1 = std::pair<MutableFstClass *, const std::string &>;
19 
20 template <class Arc>
21 void Decode(DecodeArgs1 *args) {
22  MutableFst<Arc> *fst = std::get<0>(*args)->GetMutableFst<Arc>();
23  std::unique_ptr<EncodeMapper<Arc>> decoder(
24  EncodeMapper<Arc>::Read(std::get<1>(*args), DECODE));
25  if (!decoder) {
27  return;
28  }
29  Decode(fst, *decoder);
30 }
31 
32 using DecodeArgs2 = std::pair<MutableFstClass *, const EncodeMapperClass &>;
33 
34 template <class Arc>
35 void Decode(DecodeArgs2 *args) {
36  MutableFst<Arc> *fst = std::get<0>(*args)->GetMutableFst<Arc>();
37  const EncodeMapper<Arc> &encoder =
38  *(std::get<1>(*args).GetEncodeMapper<Arc>());
39  Decode(fst, encoder);
40 }
41 
42 void Decode(MutableFstClass *fst, const std::string &coder_fname);
43 
44 void Decode(MutableFstClass *fst, const EncodeMapperClass &encoder);
45 
46 } // namespace script
47 } // namespace fst
48 
49 #endif // FST_SCRIPT_DECODE_H_
void Decode(DecodeArgs1 *args)
Definition: decode.h:21
std::pair< MutableFstClass *, const EncodeMapperClass & > DecodeArgs2
Definition: decode.h:32
std::pair< MutableFstClass *, const std::string & > DecodeArgs1
Definition: decode.h:18
constexpr uint64 kError
Definition: properties.h:34
virtual void SetProperties(uint64 props, uint64 mask)=0