diff options
author | nicolabertoldi <nicolabertoldi@1f5c12ca-751b-0410-a591-d2e778427230> | 2008-05-14 11:57:45 +0400 |
---|---|---|
committer | nicolabertoldi <nicolabertoldi@1f5c12ca-751b-0410-a591-d2e778427230> | 2008-05-14 11:57:45 +0400 |
commit | 49891adeedd706dcd02d9d95cbea287caf5b72fb (patch) | |
tree | ad7fb21bcf5ed7ee502dd6f090c0a1acea99b61b /mert/FeatureArray.h | |
parent | d25d1914c365e6c3f6644586574da6459d4348e3 (diff) |
I am starting the improvement of Minimum Error Training scritps
git-svn-id: https://mosesdecoder.svn.sourceforge.net/svnroot/mosesdecoder/trunk@1632 1f5c12ca-751b-0410-a591-d2e778427230
Diffstat (limited to 'mert/FeatureArray.h')
-rw-r--r-- | mert/FeatureArray.h | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/mert/FeatureArray.h b/mert/FeatureArray.h new file mode 100644 index 000000000..269ab6eeb --- /dev/null +++ b/mert/FeatureArray.h @@ -0,0 +1,63 @@ +/* + * FeatureArray.h + * met - Minimum Error Training + * + * Created by Nicola Bertoldi on 13/05/08. + * + */ + +#ifndef FEATURE_ARRAY_H +#define FEATURE_ARRAY_H + +#define FEATURES_BEGIN "FEATURES_BEGIN_0" +#define FEATURES_END "FEATURES_END_0" + +using namespace std; + +#include <limits> +#include <vector> +#include <iostream> +#include <fstream> + +#include "Util.h" +#include "FeatureStats.h" + +class FeatureArray +{ +protected: + vector<FeatureStats> array_; + +private: + char databuf_[BUFSIZ]; + size_t bufLen_; + size_t idx; // idx to identify the utterance + +public: + FeatureArray(); + + ~FeatureArray(){}; + + inline void clear() { array_.clear(); } + + inline size_t getIndex(){ return idx; } + inline void setIndex(size_t value){ idx=value; } + + inline FeatureStats get(int i){ return array_.at(i); } + void add(FeatureStats 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 |