diff options
author | Hieu Hoang <fishandfrolick@gmail.com> | 2012-06-22 21:19:16 +0400 |
---|---|---|
committer | Hieu Hoang <fishandfrolick@gmail.com> | 2012-06-22 21:19:16 +0400 |
commit | 7d19fe13ae613d07c3690f6849ce811726ce1169 (patch) | |
tree | b9cde99ea1b63716c3701bbb181b3805d30aeff2 /mert/PermutationScorer.h | |
parent | db06d9cf654997857b9a3c828643039656e8fe09 (diff) |
merge Lexi Birch's LRScore from mert_mtm5 branch
Diffstat (limited to 'mert/PermutationScorer.h')
-rw-r--r-- | mert/PermutationScorer.h | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/mert/PermutationScorer.h b/mert/PermutationScorer.h new file mode 100644 index 000000000..20e2ad927 --- /dev/null +++ b/mert/PermutationScorer.h @@ -0,0 +1,64 @@ +#ifndef __PERMUTATIONSCORER_H__ +#define __PERMUTATIONSCORER_H__ + +#include <algorithm> +#include <cmath> +#include <iostream> +#include <iterator> +#include <set> +#include <sstream> +#include <stdexcept> +#include <string> +#include <vector> +#include <limits.h> +#include "Types.h" +#include "ScoreData.h" +#include "Scorer.h" +#include "Permutation.h" +#include "SentenceLevelScorer.h" + +/** + * Permutation + **/ +class PermutationScorer: public SentenceLevelScorer +{ + +public: + PermutationScorer(const std::string &distanceMetric = "HAMMING", + const std::string &config = std::string()); + void setReferenceFiles(const std::vector<std::string>& referenceFiles); + void prepareStats(size_t sid, const std::string& text, ScoreStats& entry); + static const int SCORE_PRECISION; + + size_t NumberOfScores() const { + //cerr << "PermutationScorer number of scores: 1" << endl; + return 1; + }; + bool useAlignment() const { + //cout << "PermutationScorer::useAlignment returning true" << endl; + return true; + }; + +protected: + statscore_t calculateScore(const std::vector<statscore_t>& scores); + PermutationScorer(const PermutationScorer&); + ~PermutationScorer() {}; + PermutationScorer& operator=(const PermutationScorer&); + int getNumberWords (const std::string & line) const; + + distanceMetricReferenceChoice_t m_refChoiceStrategy; + distanceMetric_t m_distanceMetric; + + // data extracted from reference files + // A vector of permutations for each reference file + std::vector< std::vector<Permutation> > m_referencePerms; + std::vector<size_t> m_sourceLengths; + std::vector<std::string> m_referenceAlignments; + +private: +}; +//TODO need to read in floats for scores - necessary for selecting mean reference strategy and for BLEU? + + +#endif //__PERMUTATIONSCORER_H + |