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-05-14 12:14:13 +0400
committernicolabertoldi <nicolabertoldi@1f5c12ca-751b-0410-a591-d2e778427230>2008-05-14 12:14:13 +0400
commit9c12330785cb5eb0a4b59d2810e4febfa884dd95 (patch)
tree619e28cdbc2638d01fb372d49e8f2ae43a9b64d1 /mert/ScoreArray.h
parent49891adeedd706dcd02d9d95cbea287caf5b72fb (diff)
I am adding new object for handling statistics forerror measures
git-svn-id: https://mosesdecoder.svn.sourceforge.net/svnroot/mosesdecoder/trunk@1633 1f5c12ca-751b-0410-a591-d2e778427230
Diffstat (limited to 'mert/ScoreArray.h')
-rw-r--r--mert/ScoreArray.h62
1 files changed, 62 insertions, 0 deletions
diff --git a/mert/ScoreArray.h b/mert/ScoreArray.h
new file mode 100644
index 000000000..67e6827fa
--- /dev/null
+++ b/mert/ScoreArray.h
@@ -0,0 +1,62 @@
+/*
+ * 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
+
+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 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 \ No newline at end of file