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

github.com/moses-smt/mosesdecoder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornicolabertoldi <nicolabertoldi@1f5c12ca-751b-0410-a591-d2e778427230>2008-06-05 21:03:54 +0400
committernicolabertoldi <nicolabertoldi@1f5c12ca-751b-0410-a591-d2e778427230>2008-06-05 21:03:54 +0400
commite94834012d0a73a35f722262c770bc44e58872fe (patch)
tree08f360c2348d11d7fb9039ed59eda22f02237e51 /mert/ScoreArray.h
parent8e96e68476e4e07108a6e83a3cd54c67858d8c18 (diff)
added facilities to read and write score statistics in binary format
moved facilities for feature names in FeatureData object git-svn-id: https://mosesdecoder.svn.sourceforge.net/svnroot/mosesdecoder/trunk@1824 1f5c12ca-751b-0410-a591-d2e778427230
Diffstat (limited to 'mert/ScoreArray.h')
-rw-r--r--mert/ScoreArray.h21
1 files changed, 12 insertions, 9 deletions
diff --git a/mert/ScoreArray.h b/mert/ScoreArray.h
index 95f6ef749..b3294b56f 100644
--- a/mert/ScoreArray.h
+++ b/mert/ScoreArray.h
@@ -28,10 +28,12 @@ class ScoreArray
{
protected:
scorearray_t array_;
+ std::string score_type;
+ size_t number_of_scores;
private:
std::string idx; // idx to identify the utterance, it can differ from the index inside the vector
- std::string score_type;
+
public:
ScoreArray();
@@ -52,22 +54,23 @@ public:
void merge(ScoreArray& e);
- inline std::string name(){ return score_type; };
- inline std::string name(std::string &sctype){ return score_type = sctype; };
+ inline std::string name() const{ return score_type; };
+ inline void name(std::string &sctype){ score_type = sctype; };
inline size_t size(){ return array_.size(); }
- inline size_t NumberOfScores(){ return (array_.size()>0)?array_.at(0).size():0; }
+ inline size_t NumberOfScores() const{ return number_of_scores; }
+ inline void NumberOfScores(size_t v){ number_of_scores = v; }
void savetxt(ofstream& outFile, const std::string& sctype);
void savebin(ofstream& outFile, const std::string& sctype);
void save(ofstream& outFile, const std::string& sctype, bool bin=false);
void save(const std::string &file, const std::string& sctype, bool bin=false);
inline void save(const std::string& sctype, bool bin=false){ save("/dev/stdout", sctype, bin); }
-
- void loadtxt(ifstream& inFile);
- void loadbin(ifstream& inFile);
- void load(ifstream& inFile, bool bin=false);
- void load(const std::string &file, bool bin=false);
+
+ void loadtxt(ifstream& inFile, size_t n);
+ void loadbin(ifstream& inFile, size_t n);
+ void load(ifstream& inFile);
+ void load(const std::string &file);
bool check_consistency();
};