1 2 // Licensed under the Apache License, Version 2.0 (the "License"); 3 // you may not use this file except in compliance with the License. 4 // You may obtain a copy of the License at 5 // 6 // http://www.apache.org/licenses/LICENSE-2.0 7 // 8 // Unless required by applicable law or agreed to in writing, software 9 // distributed under the License is distributed on an "AS IS" BASIS, 10 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 // See the License for the specific language governing permissions and 12 // limitations under the License. 13 // 14 // Copyright 2005-2010 Google, Inc. 15 // Author: jpr (at) google.com (Jake Ratkiewicz) 16 17 #include <fst/script/fst-class.h> 18 #include <fst/script/script-impl.h> 19 #include <fst/script/prune.h> 20 21 namespace fst { 22 namespace script { 23 24 25 // 1 26 void Prune(MutableFstClass *fst, const PruneOptions &opts) { 27 PruneArgs1 args(fst, opts); 28 29 Apply<Operation<PruneArgs1> >("Prune", fst->ArcType(), &args); 30 } 31 32 // 2 33 void Prune(const FstClass &ifst, MutableFstClass *fst, 34 const PruneOptions &opts) { 35 PruneArgs2 args(ifst, fst, opts); 36 37 Apply<Operation<PruneArgs2> >("Prune", fst->ArcType(), &args); 38 } 39 40 // 3 41 void Prune(const FstClass &ifst, 42 MutableFstClass *ofst, 43 const WeightClass& weight_threshold, 44 int64 state_threshold, float delta) { 45 PruneArgs3 args(ifst, ofst, weight_threshold, state_threshold, delta); 46 47 Apply<Operation<PruneArgs3> >("Prune", ifst.ArcType(), &args); 48 } 49 50 // 4 51 void Prune(MutableFstClass *fst, const WeightClass& weight_threshold, 52 int64 state_threshold, float delta) { 53 PruneArgs4 args(fst, weight_threshold, state_threshold, delta); 54 55 Apply<Operation<PruneArgs4> >("Prune", fst->ArcType(), &args); 56 } 57 58 // 1 59 REGISTER_FST_OPERATION(Prune, StdArc, PruneArgs1); 60 REGISTER_FST_OPERATION(Prune, LogArc, PruneArgs1); 61 REGISTER_FST_OPERATION(Prune, Log64Arc, PruneArgs1); 62 // 2 63 REGISTER_FST_OPERATION(Prune, StdArc, PruneArgs2); 64 REGISTER_FST_OPERATION(Prune, LogArc, PruneArgs2); 65 REGISTER_FST_OPERATION(Prune, Log64Arc, PruneArgs2); 66 // 3 67 REGISTER_FST_OPERATION(Prune, StdArc, PruneArgs3); 68 REGISTER_FST_OPERATION(Prune, LogArc, PruneArgs3); 69 REGISTER_FST_OPERATION(Prune, Log64Arc, PruneArgs3); 70 // 4 71 REGISTER_FST_OPERATION(Prune, StdArc, PruneArgs4); 72 REGISTER_FST_OPERATION(Prune, LogArc, PruneArgs4); 73 REGISTER_FST_OPERATION(Prune, Log64Arc, PruneArgs4); 74 75 } // namespace script 76 } // namespace fst 77