mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2025-01-07 12:10:36 +03:00
eb2d6e971d
git-svn-id: https://mosesdecoder.svn.sourceforge.net/svnroot/mosesdecoder/trunk@1636 1f5c12ca-751b-0410-a591-d2e778427230
66 lines
1.3 KiB
C++
66 lines
1.3 KiB
C++
/*
|
|
* ScoreArray.h
|
|
* met - Minimum Error Training
|
|
*
|
|
* Created by Nicola Bertoldi on 13/05/08.
|
|
*
|
|
*/
|
|
|
|
#ifndef SCORE_ARRAY_H
|
|
#define SCORE_ARRAY_H
|
|
|
|
#define SCORES_BEGIN "SCORES_BEGIN_0"
|
|
#define SCORES_END "SCORES_END_0"
|
|
|
|
using namespace std;
|
|
|
|
#include <limits>
|
|
#include <vector>
|
|
#include <iostream>
|
|
#include <fstream>
|
|
|
|
#include "Util.h"
|
|
#include "ScoreStats.h"
|
|
|
|
class ScoreArray
|
|
{
|
|
protected:
|
|
vector<ScoreStats> array_;
|
|
|
|
private:
|
|
char databuf_[BUFSIZ];
|
|
size_t bufLen_;
|
|
int idx; // idx to identify the utterance, it can differ from the index inside the vector
|
|
std::string score_type;
|
|
|
|
public:
|
|
ScoreArray();
|
|
|
|
~ScoreArray(){};
|
|
|
|
inline void clear() { array_.clear(); }
|
|
|
|
inline size_t getIndex(){ return idx; }
|
|
inline void setIndex(size_t value){ idx=value; }
|
|
|
|
inline ScoreStats get(int i){ return array_.at(i); }
|
|
void add(ScoreStats e){ array_.push_back(e); }
|
|
|
|
inline std::string name(){ return score_type; };
|
|
inline std::string name(std::string &sctype){ return score_type = sctype; };
|
|
|
|
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);
|
|
|
|
};
|
|
|
|
|
|
#endif |