Home | History | Annotate | Download | only in fst

Lines Matching refs:FST

1 // matcher-fst.h
19 // Class to add a matcher to an FST.
24 #include <fst/add-on.h>
25 #include <fst/const-fst.h>
26 #include <fst/lookahead-matcher.h>
29 namespace fst {
42 // Matcher(const F &fst, MatchType type, MatcherData *data);
70 typedef AddOnImpl<typename M::FST, D> Impl;
74 // Class to add a matcher M to an Fst F. Creates a new Fst of type name N.
75 // Optional function object I can be used to initialize the Fst.
87 typedef F FST;
96 explicit MatcherFst(const F &fst)
97 : ImplToExpandedFst<Impl>(CreateImpl(fst, N)) {}
99 explicit MatcherFst(const Fst<Arc> &fst)
100 : ImplToExpandedFst<Impl>(CreateImpl(fst, N)) {}
102 // See Fst<>::Copy() for doc.
103 MatcherFst(const MatcherFst<F, M, N, I> &fst, bool safe = false)
104 : ImplToExpandedFst<Impl>(fst, safe) {}
106 // Get a copy of this MatcherFst. See Fst<>::Copy() for further doc.
130 return Fst<Arc>::WriteFile(filename);
158 static Impl *CreateImpl(const F &fst, const string &name) {
159 M imatcher(fst, MATCH_INPUT);
160 M omatcher(fst, MATCH_OUTPUT);
162 Impl *impl = new Impl(fst, name);
169 static Impl *CreateImpl(const Fst<Arc> &fst, const string &name) {
170 F ffst(fst);
181 void operator=(const MatcherFst<F, M, N, I> &fst); // disallow
189 explicit StateIterator(const MatcherFst<F, M, N, I> &fst) :
190 StateIterator<F>(fst.GetImpl()->GetFst()) {}
198 ArcIterator(const MatcherFst<F, M, N, I> &fst, typename F::Arc::StateId s)
199 : ArcIterator<F>(fst.GetImpl()->GetFst(), s) {}
207 typedef MatcherFst<F, M, N, I> FST;
212 Matcher(const FST &fst, MatchType match_type) {
213 matcher_ = fst.InitMatcher(match_type);
216 Matcher(const Matcher<FST> &matcher) {
222 Matcher<FST> *Copy() const {
223 return new Matcher<FST>(*this);
246 typedef MatcherFst<F, M, N, I> FST;
252 LookAheadMatcher(const FST &fst, MatchType match_type) {
253 matcher_ = fst.InitMatcher(match_type);
256 LookAheadMatcher(const LookAheadMatcher<FST> &matcher, bool safe = false) {
263 LookAheadMatcher<FST> *Copy(bool safe = false) const {
264 return new LookAheadMatcher<FST>(*this, safe);
273 const FST &GetFst() const { return matcher_->GetFst(); }
282 bool LookAheadFst(const Fst<Arc> &fst, StateId s) {
283 return matcher_->LookAheadFst(fst, s);
292 void InitLookAheadFst(const Fst<Arc>& fst, bool copy = false) {
293 matcher_->InitLookAheadFst(fst, copy);
299 void operator=(const LookAheadMatcher<FST> &); // disallow
357 } // namespace fst