mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-09-11 11:25:40 +03:00
git-svn-id: https://mosesdecoder.svn.sourceforge.net/svnroot/mosesdecoder/trunk@1717 1f5c12ca-751b-0410-a591-d2e778427230
64 lines
1.2 KiB
C++
64 lines
1.2 KiB
C++
/*
|
|
* 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;
|
|
|
|
public:
|
|
ScoreData(Scorer& sc);
|
|
|
|
~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); }
|
|
|
|
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 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);
|
|
|
|
void loadnbest(const std::string &file);
|
|
|
|
};
|
|
|
|
|
|
#endif
|