Cambridge SMT System
fstutils.ftcompose.hpp
Go to the documentation of this file.
1 // Licensed under the Apache License, Version 2.0 (the "License");
2 // you may not use these files except in compliance with the License.
3 // You may obtain a copy of the License at
4 //
5 // http://www.apache.org/licenses/LICENSE-2.0
6 //
7 // Unless required by applicable law or agreed to in writing, software
8 // distributed under the License is distributed on an "AS IS" BASIS,
9 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 // See the License for the specific language governing permissions and
11 // limitations under the License.
12 
13 // Copyright 2012 - Gonzalo Iglesias, AdriĆ  de Gispert, William Byrne
14 
15 #ifndef FTCOMPOSE_HPP
16 #define FTCOMPOSE_HPP
17 
25 namespace fst {
26 
34 template <class Arc>
35 ComposeFst<Arc> RPhiCompose ( const Fst<Arc>& fstlhs,
36  const Fst<Arc>& fstrhs,
37  const typename Arc::Label kSpecialLabel ) {
38  typedef PhiMatcher< Matcher< Fst<Arc> > > PM;
39  ComposeFstOptions<Arc, PM> copts (
40  CacheOptions(),
41  new PM ( fstlhs, MATCH_NONE, kNoLabel ),
42  new PM ( fstrhs, MATCH_INPUT, kSpecialLabel ) );
43  return ComposeFst<Arc> ( fstlhs, fstrhs, copts );
44 };
45 
54 template<class Arc>
55 inline ComposeFst<Arc> RRhoCompose ( const VectorFst<Arc>& fstlhs,
56  const VectorFst<Arc>& fstrhs,
57  const typename Arc::Label kSpecialLabel = RHO ) {
58  typedef RhoMatcher< Matcher< Fst<Arc> > > RM;
59  ComposeFstOptions<Arc, RM> copts (
60  CacheOptions(),
61  new RM ( fstlhs, MATCH_NONE, kNoLabel ),
62  new RM ( fstrhs, MATCH_INPUT, kSpecialLabel, MATCHER_REWRITE_ALWAYS ) );
63  // new RM(fstrhs, MATCH_INPUT, kSpecialLabel));
64  return ComposeFst<Arc> ( fstlhs, fstrhs, copts );
65 };
66 
67 }; //namespaces
68 
69 #endif
ComposeFst< Arc > RPhiCompose(const Fst< Arc > &fstlhs, const Fst< Arc > &fstrhs, const typename Arc::Label kSpecialLabel)
Performs composition with PHI, based on OpenFST matchers PHI transitions are expected on fstrhs...
Definition: fstio.hpp:27
ComposeFst< Arc > RRhoCompose(const VectorFst< Arc > &fstlhs, const VectorFst< Arc > &fstrhs, const typename Arc::Label kSpecialLabel=RHO)
Performs composition with RHO, based on OpenFST matchers RHO transitions are expected on fstrhs...
#define RHO