You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

285 lines
6.3 KiB

  1. // Copyright 2005-2024 Google LLC
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the 'License');
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an 'AS IS' BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. //
  15. // See www.openfst.org for extensive documentation on this weighted
  16. // finite-state transducer library.
  17. //
  18. // This file contains declarations of classes in the Fst template library.
  19. #ifndef FST_FST_DECL_H_
  20. #define FST_FST_DECL_H_
  21. // Do not let Include-What-You-Use suggest this file.
  22. #include <sys/types.h>
  23. #include <cstdint>
  24. #include <memory> // for allocator<>
  25. #include <fst/windows_defs.inc>
  26. namespace fst {
  27. // Symbol table and iterator.
  28. class SymbolTable;
  29. class SymbolTableIterator;
  30. // Weight templates and weights.
  31. template <class T>
  32. class FloatWeightTpl;
  33. template <class T>
  34. class TropicalWeightTpl;
  35. template <class T>
  36. class LogWeightTpl;
  37. template <class T>
  38. class MinMaxWeightTpl;
  39. using FloatWeight = FloatWeightTpl<float>;
  40. using TropicalWeight = TropicalWeightTpl<float>;
  41. using LogWeight = LogWeightTpl<float>;
  42. using MinMaxWeight = MinMaxWeightTpl<float>;
  43. // Arc templates and arcs.
  44. template <class Weight, class Label = int, class StateId = int>
  45. struct ArcTpl;
  46. using StdArc = ArcTpl<TropicalWeight>;
  47. using LogArc = ArcTpl<LogWeight>;
  48. // Stores.
  49. template <class Element, class U>
  50. class CompactArcStore;
  51. template <class Arc>
  52. class DefaultCacheStore;
  53. // Compactors.
  54. template <class AC, class U, class S = CompactArcStore<typename AC::Element, U>>
  55. class CompactArcCompactor;
  56. // FST templates.
  57. template <class Arc, class Compactor, class CacheStore = DefaultCacheStore<Arc>>
  58. class CompactFst;
  59. // The Unsigned type is used to represent indices into the compact arc array.
  60. template <class Arc, class ArcCompactor, class Unsigned = uint32_t,
  61. class CompactStore =
  62. CompactArcStore<typename ArcCompactor::Element, Unsigned>,
  63. class CacheStore = DefaultCacheStore<Arc>>
  64. using CompactArcFst =
  65. CompactFst<Arc, CompactArcCompactor<ArcCompactor, Unsigned, CompactStore>,
  66. CacheStore>;
  67. template <class Arc, class U = uint32_t>
  68. class ConstFst;
  69. template <class Arc, class Weight, class Matcher>
  70. class EditFst;
  71. template <class Arc>
  72. class ExpandedFst;
  73. template <class Arc>
  74. class Fst;
  75. template <class Arc>
  76. class MutableFst;
  77. template <class Arc, class Allocator = std::allocator<Arc>>
  78. class VectorState;
  79. template <class Arc, class State = VectorState<Arc>>
  80. class VectorFst;
  81. template <class Arc, class U = ssize_t>
  82. class DefaultReplaceStateTable;
  83. // On-the-fly operations.
  84. template <class Arc, class Compare>
  85. class ArcSortFst;
  86. template <class Arc>
  87. class ClosureFst;
  88. template <class Arc, class Store = DefaultCacheStore<Arc>>
  89. class ComposeFst;
  90. template <class Arc>
  91. class ConcatFst;
  92. template <class Arc>
  93. class DeterminizeFst;
  94. template <class Arc>
  95. class DifferenceFst;
  96. template <class Arc>
  97. class IntersectFst;
  98. template <class Arc>
  99. class InvertFst;
  100. template <class AArc, class BArc, class Mapper>
  101. class ArcMapFst;
  102. template <class Arc>
  103. class ProjectFst;
  104. template <class AArc, class BArc, class Selector>
  105. class RandGenFst;
  106. template <class Arc>
  107. class RelabelFst;
  108. template <class Arc, class StateTable = DefaultReplaceStateTable<Arc>,
  109. class Store = DefaultCacheStore<Arc>>
  110. class ReplaceFst;
  111. template <class Arc>
  112. class RmEpsilonFst;
  113. template <class Arc>
  114. class UnionFst;
  115. // Heap.
  116. template <class T, class Compare>
  117. class Heap;
  118. // ArcCompactors.
  119. template <class Arc>
  120. class AcceptorCompactor;
  121. template <class Arc>
  122. class StringCompactor;
  123. template <class Arc>
  124. class UnweightedAcceptorCompactor;
  125. template <class Arc>
  126. class UnweightedCompactor;
  127. template <class Arc>
  128. class WeightedStringCompactor;
  129. // Compact Arc FSTs.
  130. template <class Arc, class U = uint32_t>
  131. using CompactStringFst = CompactArcFst<Arc, StringCompactor<Arc>, U>;
  132. template <class Arc, class U = uint32_t>
  133. using CompactWeightedStringFst =
  134. CompactArcFst<Arc, WeightedStringCompactor<Arc>, U>;
  135. template <class Arc, class U = uint32_t>
  136. using CompactAcceptorFst = CompactArcFst<Arc, AcceptorCompactor<Arc>, U>;
  137. template <class Arc, class U = uint32_t>
  138. using CompactUnweightedFst = CompactArcFst<Arc, UnweightedCompactor<Arc>, U>;
  139. template <class Arc, class U = uint32_t>
  140. using CompactUnweightedAcceptorFst =
  141. CompactArcFst<Arc, UnweightedAcceptorCompactor<Arc>, U>;
  142. // StdArc aliases for FSTs.
  143. using StdConstFst = ConstFst<StdArc>;
  144. using StdExpandedFst = ExpandedFst<StdArc>;
  145. using StdFst = Fst<StdArc>;
  146. using StdMutableFst = MutableFst<StdArc>;
  147. using StdVectorFst = VectorFst<StdArc>;
  148. // StdArc aliases for on-the-fly operations.
  149. template <class Compare>
  150. using StdArcSortFst = ArcSortFst<StdArc, Compare>;
  151. using StdClosureFst = ClosureFst<StdArc>;
  152. using StdComposeFst = ComposeFst<StdArc>;
  153. using StdConcatFst = ConcatFst<StdArc>;
  154. using StdDeterminizeFst = DeterminizeFst<StdArc>;
  155. using StdDifferenceFst = DifferenceFst<StdArc>;
  156. using StdIntersectFst = IntersectFst<StdArc>;
  157. using StdInvertFst = InvertFst<StdArc>;
  158. using StdProjectFst = ProjectFst<StdArc>;
  159. using StdRelabelFst = RelabelFst<StdArc>;
  160. using StdReplaceFst = ReplaceFst<StdArc>;
  161. using StdRmEpsilonFst = RmEpsilonFst<StdArc>;
  162. using StdUnionFst = UnionFst<StdArc>;
  163. // Filter states.
  164. template <class T>
  165. class IntegerFilterState;
  166. using CharFilterState = IntegerFilterState<signed char>;
  167. using ShortFilterState = IntegerFilterState<short>; // NOLINT
  168. using IntFilterState = IntegerFilterState<int>;
  169. // Matchers and filters.
  170. template <class FST>
  171. class Matcher;
  172. template <class Matcher1, class Matcher2 = Matcher1>
  173. class NullComposeFilter;
  174. template <class Matcher1, class Matcher2 = Matcher1>
  175. class TrivialComposeFilter;
  176. template <class Matcher1, class Matcher2 = Matcher1>
  177. class SequenceComposeFilter;
  178. template <class Matcher1, class Matcher2 = Matcher1>
  179. class AltSequenceComposeFilter;
  180. template <class Matcher1, class Matcher2 = Matcher1>
  181. class MatchComposeFilter;
  182. template <class Matcher1, class Matcher2 = Matcher1>
  183. class NoMatchComposeFilter;
  184. } // namespace fst
  185. #endif // FST_FST_DECL_H_