Cambridge SMT System
IntervalData.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 GENERICINTERVALBOUNDARY_H_
13 #define GENERICINTERVALBOUNDARY_H_
14 
15 #include "BleuStats.h"
16 #include "MertCommon.h"
17 
18 template<typename ErrorStats>
19 class IntervalData {
20  public:
21  typedef typename ErrorStats::Error Error;
22 
24 
25  IntervalData (Sid sentence, const double gamma, ErrorStats errorStats,
26  const double deltaScore = 0.0, const double deltaExpScore = 0.0) :
27  sentence (sentence), gamma (gamma), errorStats (errorStats), deltaScore (
29  0.0) {
30  }
31  ;
32  Sid sentence;
33  ErrorStats errorStats;
34  double gamma;
35  double deltaScore; // delta of translation score
36  double score; // sum of translation score
37  double deltaExpScore; // delta of expected translation score
38  double expScore; // sum of expected translation score
39 
40  friend ostream& operator<< (ostream& os, const IntervalData<ErrorStats>& id) {
41  Error error = id.errorStats.ComputeError();
42  os << id.sentence << " " << std::fixed << std::setprecision (
43  8) << id.gamma << " "
44  << std::setprecision (4) << error << " " << std::setprecision (8)
45  << id.expScore << " " << id.score << '\t'
46  << id.errorStats;
47  return os;
48  }
49 };
50 
51 template<typename IntervalBoundary>
52 bool IntervalBoundarySortPredicate (const IntervalBoundary& ib1,
53  const IntervalBoundary& ib2);
54 
55 #endif /* GENERICINTERVALBOUNDARY_H_ */
ErrorStats errorStats
Definition: IntervalData.h:33
double deltaExpScore
Definition: IntervalData.h:37
ErrorStats::Error Error
Definition: IntervalData.h:21
unsigned int Sid
Definition: MertCommon.h:45
bool IntervalBoundarySortPredicate(const IntervalBoundary &ib1, const IntervalBoundary &ib2)
Definition: ErrorSurface.h:29
double deltaScore
Definition: IntervalData.h:35
double gamma
Definition: IntervalData.h:34
IntervalData(Sid sentence, const double gamma, ErrorStats errorStats, const double deltaScore=0.0, const double deltaExpScore=0.0)
Definition: IntervalData.h:25
double expScore
Definition: IntervalData.h:38
double score
Definition: IntervalData.h:36