Cambridge SMT System
TuneSet.h
Go to the documentation of this file.
1 //Copyright (c) 2012, University of Cambridge
2 //All rights reserved.
3 //
4 //Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met://
5 //
6 // * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
7 // * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
8 // * Neither the name of the University of Cambridge nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
9 //
10 //THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
11 
12 #ifndef TUNESET_H_
13 #define TUNESET_H_
14 
15 #include <vector>
16 #include <map>
17 
18 #include <fst/fstlib.h>
19 
20 #include "MertCommon.h"
21 
22 using std::vector;
23 using std::map;
24 
25 typedef map<Sid, TupleArcFst*> SidToVecArcFstMap;
26 typedef vector<Sid> SentenceList;
27 
28 class TuneSet {
29  public:
30  TuneSet();
31  ~TuneSet();
32  void Initialize (const bool use_cache);
33  TupleArcFst* GetVectorLattice (const Sid s, const bool use_cache) const;
34  SentenceList ids; // List of sentence IDs to process
35  private:
36  std::string m_pattern;
37  vector<TupleArcFst *> cachedLattices;
38  TupleArcFst* LoadLattice (const Sid s) const;
39 };
40 
41 #endif /* TUNESET_H_ */
~TuneSet()
Definition: TuneSet.cpp:27
TupleArcFst * GetVectorLattice(const Sid s, const bool use_cache) const
Definition: TuneSet.cpp:87
unsigned int Sid
Definition: MertCommon.h:45
void Initialize(const bool use_cache)
Definition: TuneSet.cpp:57
vector< Sid > SentenceList
Definition: TuneSet.h:26
SentenceList ids
Definition: TuneSet.h:34
map< Sid, TupleArcFst * > SidToVecArcFstMap
Definition: TuneSet.h:25
fst::VectorFst< TupleArc > TupleArcFst
TuneSet()
Definition: TuneSet.cpp:24