From 96a32415ab43377cf1575bd3f4f2980f58028209 Mon Sep 17 00:00:00 2001 From: Determinant Date: Fri, 14 Aug 2015 11:51:42 +0800 Subject: add implementation for kaldi io (by ymz) --- .../tools/openfst/include/fst/script/fstscript.h | 154 +++++++++++++++++++++ 1 file changed, 154 insertions(+) create mode 100644 kaldi_io/src/tools/openfst/include/fst/script/fstscript.h (limited to 'kaldi_io/src/tools/openfst/include/fst/script/fstscript.h') diff --git a/kaldi_io/src/tools/openfst/include/fst/script/fstscript.h b/kaldi_io/src/tools/openfst/include/fst/script/fstscript.h new file mode 100644 index 0000000..90e1e75 --- /dev/null +++ b/kaldi_io/src/tools/openfst/include/fst/script/fstscript.h @@ -0,0 +1,154 @@ + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Copyright 2005-2010 Google, Inc. +// Author: jpr@google.com (Jake Ratkiewicz) + +// Convenience file that includes all FstScript functionality + +#ifndef FST_SCRIPT_FSTSCRIPT_H_ +#define FST_SCRIPT_FSTSCRIPT_H_ + +// Major classes +#include +#include +#include + +// Templates like Operation< >, Apply< > +#include + +// Operations +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// +// REGISTER OPERATIONS +// + + +// This class is necessary because registering each of the operations +// separately overfills the stack, as there's so many of them. +namespace fst { +namespace script { +template +class AllFstOperationsRegisterer { + public: + AllFstOperationsRegisterer() { + RegisterBatch1(); + RegisterBatch2(); + } + + private: + void RegisterBatch1() { + REGISTER_FST_OPERATION(ArcSort, Arc, ArcSortArgs); + REGISTER_FST_OPERATION(Closure, Arc, ClosureArgs); + REGISTER_FST_OPERATION(CompileFst, Arc, FstCompileArgs); + REGISTER_FST_OPERATION(Compose, Arc, ComposeArgs1); + REGISTER_FST_OPERATION(Compose, Arc, ComposeArgs2); + REGISTER_FST_OPERATION(Concat, Arc, ConcatArgs1); + REGISTER_FST_OPERATION(Concat, Arc, ConcatArgs2); + REGISTER_FST_OPERATION(Connect, Arc, MutableFstClass); + REGISTER_FST_OPERATION(Convert, Arc, ConvertArgs); + REGISTER_FST_OPERATION(Decode, Arc, DecodeArgs); + REGISTER_FST_OPERATION(Determinize, Arc, DeterminizeArgs); + REGISTER_FST_OPERATION(Difference, Arc, DifferenceArgs1); + REGISTER_FST_OPERATION(Difference, Arc, DifferenceArgs2); + REGISTER_FST_OPERATION(DrawFst, Arc, FstDrawerArgs); + REGISTER_FST_OPERATION(Encode, Arc, EncodeArgs); + REGISTER_FST_OPERATION(EpsNormalize, Arc, EpsNormalizeArgs); + REGISTER_FST_OPERATION(Equal, Arc, EqualArgs); + REGISTER_FST_OPERATION(Equivalent, Arc, EquivalentArgs); + REGISTER_FST_OPERATION(PrintFstInfo, Arc, InfoArgs); + REGISTER_FST_OPERATION(Intersect, Arc, IntersectArgs1); + REGISTER_FST_OPERATION(Intersect, Arc, IntersectArgs2); + REGISTER_FST_OPERATION(Invert, Arc, MutableFstClass); + REGISTER_FST_OPERATION(Map, Arc, MapArgs); + REGISTER_FST_OPERATION(Minimize, Arc, MinimizeArgs); + } + + void RegisterBatch2() { + REGISTER_FST_OPERATION(PrintFst, Arc, FstPrinterArgs); + REGISTER_FST_OPERATION(Project, Arc, ProjectArgs); + REGISTER_FST_OPERATION(Prune, Arc, PruneArgs1); + REGISTER_FST_OPERATION(Prune, Arc, PruneArgs2); + REGISTER_FST_OPERATION(Prune, Arc, PruneArgs3); + REGISTER_FST_OPERATION(Prune, Arc, PruneArgs4); + REGISTER_FST_OPERATION(Push, Arc, PushArgs1); + REGISTER_FST_OPERATION(Push, Arc, PushArgs2); + REGISTER_FST_OPERATION(RandEquivalent, Arc, RandEquivalentArgs1); + REGISTER_FST_OPERATION(RandEquivalent, Arc, RandEquivalentArgs2); + REGISTER_FST_OPERATION(RandGen, Arc, RandGenArgs); + REGISTER_FST_OPERATION(Relabel, Arc, RelabelArgs1); + REGISTER_FST_OPERATION(Relabel, Arc, RelabelArgs2); + REGISTER_FST_OPERATION(Relabel, Arc, RelabelArgs3); + REGISTER_FST_OPERATION(Replace, Arc, ReplaceArgs); + REGISTER_FST_OPERATION(Reverse, Arc, ReverseArgs); + REGISTER_FST_OPERATION(Reweight, Arc, ReweightArgs); + REGISTER_FST_OPERATION(RmEpsilon, Arc, RmEpsilonArgs1); + REGISTER_FST_OPERATION(RmEpsilon, Arc, RmEpsilonArgs2); + REGISTER_FST_OPERATION(RmEpsilon, Arc, RmEpsilonArgs3); + REGISTER_FST_OPERATION(ShortestDistance, Arc, ShortestDistanceArgs1); + REGISTER_FST_OPERATION(ShortestDistance, Arc, ShortestDistanceArgs2); + REGISTER_FST_OPERATION(ShortestDistance, Arc, ShortestDistanceArgs3); + REGISTER_FST_OPERATION(ShortestPath, Arc, ShortestPathArgs1); + REGISTER_FST_OPERATION(ShortestPath, Arc, ShortestPathArgs2); + REGISTER_FST_OPERATION(Synchronize, Arc, SynchronizeArgs); + REGISTER_FST_OPERATION(TopSort, Arc, TopSortArgs); + REGISTER_FST_OPERATION(Union, Arc, UnionArgs); + REGISTER_FST_OPERATION(Verify, Arc, VerifyArgs); + } +}; +} // namespace script +} // namespace fst + + +#define REGISTER_FST_OPERATIONS(Arc) \ + AllFstOperationsRegisterer register_all_fst_operations ## Arc; + +#endif // FST_SCRIPT_FSTSCRIPT_H_ -- cgit v1.2.3