2008-05-14 12:14:13 +04:00
|
|
|
/*
|
|
|
|
* 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"
|
2008-05-14 14:51:42 +04:00
|
|
|
#include "Scorer.h"
|
2008-05-14 12:14:13 +04:00
|
|
|
|
|
|
|
class ScoreData
|
|
|
|
{
|
|
|
|
protected:
|
|
|
|
vector<ScoreArray> array_;
|
|
|
|
|
|
|
|
private:
|
|
|
|
char databuf_[BUFSIZ];
|
|
|
|
size_t bufLen_;
|
2008-05-14 14:51:42 +04:00
|
|
|
Scorer* theScorer;
|
|
|
|
std::string score_type;
|
2008-05-14 12:14:13 +04:00
|
|
|
|
|
|
|
public:
|
2008-05-14 14:51:42 +04:00
|
|
|
ScoreData(Scorer& sc);
|
2008-05-14 12:14:13 +04:00
|
|
|
|
|
|
|
~ScoreData(){};
|
|
|
|
|
|
|
|
inline void clear() { array_.clear(); }
|
|
|
|
|
|
|
|
inline ScoreArray get(int i){ return array_.at(i); }
|
|
|
|
inline bool exists(int i){ return (i<array_.size())?true:false; }
|
|
|
|
|
|
|
|
inline ScoreStats get(int i, int j){ return array_.at(i).get(j); }
|
2008-05-14 14:51:42 +04:00
|
|
|
|
|
|
|
inline std::string name(){ return score_type; };
|
2008-05-14 12:14:13 +04:00
|
|
|
|
|
|
|
void add(ScoreArray e){ array_.push_back(e); }
|
|
|
|
void add(ScoreStats e, int sent_idx);
|
|
|
|
|
|
|
|
inline size_t size(){ return array_.size(); }
|
|
|
|
|
|
|
|
inline size_t memsize(){ return bufLen_; }
|
|
|
|
|
|
|
|
void savetxt(const std::string &file);
|
|
|
|
void savetxt(ofstream& outFile);
|
|
|
|
inline void savetxt(){ savetxt("/dev/stdout"); }
|
|
|
|
|
|
|
|
void loadtxt(ifstream& inFile);
|
|
|
|
void loadtxt(const std::string &file);
|
|
|
|
|
|
|
|
void loadnbest(const std::string &file);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|