Welcome to mirror list, hosted at ThFree Co, Russian Federation.

ScoreData.h « mert - github.com/moses-smt/mosesdecoder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: d8d4a80ced1176e95155406f4586559d522b9f56 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/*
 *  ScoreData.h
 *  met - Minimum Error Training
 *
 *  Created by Nicola Bertoldi on 13/05/08.
 *
 */

#ifndef SCORE_DATA_H
#define SCORE_DATA_H

using namespace std;

#include <limits>
#include <vector>
#include <iostream>

#include "Util.h"
#include "ScoreArray.h"

class Scorer;

class ScoreData
{
protected:
	vector<ScoreArray> array_;
	
private:
	Scorer* theScorer;	
	std::string score_type;
	size_t number_of_scores;
	
public:
	ScoreData(Scorer& sc);
	
	~ScoreData(){};
		
	inline void clear() { array_.clear(); }
	
	inline ScoreArray get(int i){ return array_.at(i); }
	inline bool exists(unsigned int i){ return (i<array_.size())?true:false; }

	inline ScoreStats get(int i, int j){ return array_.at(i).get(j); }
	
	inline std::string name(){ return score_type; };

	void add(const ScoreArray& e){ array_.push_back(e); }
	void add(const ScoreStats& e, int sent_idx);
	
	inline size_t ScoreSize(){ return number_of_scores; }
	inline size_t size(){ return array_.size(); }
	
	void save(const std::string &file, bool bin=false);
	void save(ofstream& outFile, bool bin=false);
	inline void save(bool bin=false){ save("/dev/stdout", bin); }

	void load(ifstream& inFile);
	void load(const std::string &file);
};


#endif