|
#pragma once |
|
|
|
#include <ostream> |
|
#include <string> |
|
#include <vector> |
|
|
|
#include "Types.h" |
|
#include "ScoreData.h" |
|
#include "StatisticsBasedScorer.h" |
|
#include "ScopedVector.h" |
|
#include "BleuScorer.h" |
|
|
|
namespace MosesTuning |
|
{ |
|
|
|
|
|
|
|
|
|
|
|
|
|
class BleuDocScorer : public BleuScorer |
|
{ |
|
public: |
|
|
|
explicit BleuDocScorer(const std::string& config = ""); |
|
~BleuDocScorer(); |
|
|
|
virtual void prepareStats(std::size_t sid, const std::string& text, ScoreStats& entry); |
|
virtual statscore_t calculateScore(const std::vector<int>& comps) const; |
|
|
|
int CalcReferenceLength(std::size_t doc_id, std::size_t sentence_id, std::size_t length); |
|
|
|
|
|
virtual bool OpenReferenceStream(std::istream* is, std::size_t file_id); |
|
|
|
private: |
|
ReferenceLengthType m_ref_length_type; |
|
|
|
|
|
ScopedVector<ScopedVector<Reference> > m_references; |
|
|
|
|
|
BleuDocScorer(const BleuDocScorer&); |
|
BleuDocScorer& operator=(const BleuDocScorer&); |
|
|
|
std::vector<std::string> splitDoc(const std::string& text); |
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|