8b852f688892ffa6b8a8f8bc4f74c3f7831ddc03
[platform/upstream/openfst.git] / src / include / fst / script / minimize.h
1 // See www.openfst.org for extensive documentation on this weighted
2 // finite-state transducer library.
3
4 #ifndef FST_SCRIPT_MINIMIZE_H_
5 #define FST_SCRIPT_MINIMIZE_H_
6
7 #include <tuple>
8
9 #include <fst/minimize.h>
10 #include <fst/script/fst-class.h>
11
12 namespace fst {
13 namespace script {
14
15 using MinimizeArgs = std::tuple<MutableFstClass *, MutableFstClass *, float,
16                                 bool>;
17
18 template <class Arc>
19 void Minimize(MinimizeArgs *args) {
20   MutableFst<Arc> *ofst1 = std::get<0>(*args)->GetMutableFst<Arc>();
21   MutableFst<Arc> *ofst2 = (std::get<1>(*args) ?
22                             std::get<1>(*args)->GetMutableFst<Arc>() :
23                             nullptr);
24   Minimize(ofst1, ofst2, std::get<2>(*args), std::get<3>(*args));
25 }
26
27 void Minimize(MutableFstClass *ofst1, MutableFstClass *ofst2 = nullptr,
28               float delta = kDelta, bool allow_nondet = false);
29
30 }  // namespace script
31 }  // namespace fst
32
33 #endif  // FST_SCRIPT_MINIMIZE_H_