FST  openfst-1.7.2
OpenFst Library
prune.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_PRUNE_H_
5 #define FST_SCRIPT_PRUNE_H_
6 
7 #include <tuple>
8 #include <utility>
9 
10 #include <fst/prune.h>
11 #include <fst/script/fst-class.h>
13 
14 namespace fst {
15 namespace script {
16 
17 using PruneArgs1 = std::tuple<const FstClass &, MutableFstClass *,
18  const WeightClass &, int64, float>;
19 
20 template <class Arc>
21 void Prune(PruneArgs1 *args) {
22  using Weight = typename Arc::Weight;
23  const Fst<Arc> &ifst = *(std::get<0>(*args).GetFst<Arc>());
24  MutableFst<Arc> *ofst = std::get<1>(*args)->GetMutableFst<Arc>();
25  const auto weight_threshold = *(std::get<2>(*args).GetWeight<Weight>());
26  Prune(ifst, ofst, weight_threshold, std::get<3>(*args), std::get<4>(*args));
27 }
28 
29 using PruneArgs2 = std::tuple<MutableFstClass *, const WeightClass &, int64,
30  float>;
31 
32 template <class Arc>
33 void Prune(PruneArgs2 *args) {
34  using Weight = typename Arc::Weight;
35  MutableFst<Arc> *fst = std::get<0>(*args)->GetMutableFst<Arc>();
36  const auto weight_threshold = *(std::get<1>(*args).GetWeight<Weight>());
37  Prune(fst, weight_threshold, std::get<2>(*args), std::get<3>(*args));
38 }
39 
40 void Prune(const FstClass &ifst, MutableFstClass *ofst,
41  const WeightClass &weight_threshold,
42  int64 state_threshold = kNoStateId,
43  float delta = kDelta);
44 
45 void Prune(MutableFstClass *fst, const WeightClass &weight_threshold,
46  int64 state_threshold = kNoStateId, float delta = kDelta);
47 
48 } // namespace script
49 } // namespace fst
50 
51 #endif // FST_SCRIPT_PRUNE_H_
std::tuple< const FstClass &, MutableFstClass *, const WeightClass &, int64, float > PruneArgs1
Definition: prune.h:18
std::tuple< MutableFstClass *, const WeightClass &, int64, float > PruneArgs2
Definition: prune.h:30
constexpr int kNoStateId
Definition: fst.h:180
int64_t int64
Definition: types.h:27
void Prune(PruneArgs1 *args)
Definition: prune.h:21
constexpr float kDelta
Definition: weight.h:109