#ifndef __PERSCORER_H__ #define __PERSCORER_H__ #include #include #include #include #include #include "Types.h" #include "Scorer.h" using namespace std; class ScoreStats; /** * An implementation of position-independent word error rate. * This is defined as * 1 - (correct - max(0,output_length - ref_length)) / ref_length * In fact, we ignore the " 1 - " so that it can be maximised. */ class PerScorer: public StatisticsBasedScorer { public: explicit PerScorer(const string& config = ""); ~PerScorer(); virtual void setReferenceFiles(const vector& referenceFiles); virtual void prepareStats(size_t sid, const string& text, ScoreStats& entry); virtual size_t NumberOfScores() const { // cerr << "PerScorer: 3" << endl; return 3; } virtual float calculateScore(const vector& comps) const; void whoami() const { cerr << "I AM PerScorer" << std::endl; } private: // no copying allowed PerScorer(const PerScorer&); PerScorer& operator=(const PerScorer&); // data extracted from reference files vector m_ref_lengths; vector > m_ref_tokens; }; #endif // __PERSCORER_H__