#include <BleuScorer.h>
Public Types | |
enum | ReferenceLengthType { AVERAGE, CLOSEST, SHORTEST } |
Public Member Functions | |
BleuScorer (const std::string &config="") | |
~BleuScorer () | |
virtual void | setReferenceFiles (const std::vector< std::string > &referenceFiles) |
virtual void | prepareStats (std::size_t sid, const std::string &text, ScoreStats &entry) |
virtual statscore_t | calculateScore (const std::vector< int > &comps) const |
virtual std::size_t | NumberOfScores () const |
int | CalcReferenceLength (std::size_t sentence_id, std::size_t length) |
ReferenceLengthType | GetReferenceLengthType () const |
void | SetReferenceLengthType (ReferenceLengthType type) |
const std::vector< Reference * > & | GetReferences () const |
std::size_t | CountNgrams (const std::string &line, NgramCounts &counts, unsigned int n) |
void | DumpCounts (std::ostream *os, const NgramCounts &counts) const |
bool | OpenReference (const char *filename, std::size_t file_id) |
bool | OpenReferenceStream (std::istream *is, std::size_t file_id) |
Definition at line 21 of file BleuScorer.h.
BleuScorer::BleuScorer | ( | const std::string & | config = "" |
) | [explicit] |
BleuScorer::~BleuScorer | ( | ) |
Definition at line 44 of file BleuScorer.cpp.
int BleuScorer::CalcReferenceLength | ( | std::size_t | sentence_id, | |
std::size_t | length | |||
) |
virtual statscore_t BleuScorer::calculateScore | ( | const std::vector< int > & | totals | ) | const [virtual] |
Calculate the actual score.
Implements StatisticsBasedScorer.
Referenced by BOOST_AUTO_TEST_CASE(), and MergeScorer::calculateScore().
std::size_t BleuScorer::CountNgrams | ( | const std::string & | line, | |
NgramCounts & | counts, | |||
unsigned int | n | |||
) |
Count the ngrams of each type, up to the given length in the input line.
Referenced by BOOST_AUTO_TEST_CASE().
void BleuScorer::DumpCounts | ( | std::ostream * | os, | |
const NgramCounts & | counts | |||
) | const |
ReferenceLengthType BleuScorer::GetReferenceLengthType | ( | ) | const [inline] |
Definition at line 40 of file BleuScorer.h.
Referenced by BOOST_AUTO_TEST_CASE().
const std::vector<Reference*>& BleuScorer::GetReferences | ( | ) | const [inline] |
Definition at line 43 of file BleuScorer.h.
References ScopedVector< T >::get().
virtual std::size_t BleuScorer::NumberOfScores | ( | ) | const [inline, virtual] |
Return the number of statistics needed for the computation of the score.
Implements Scorer.
Definition at line 36 of file BleuScorer.h.
References kBleuNgramOrder.
Referenced by MergeScorer::calculateScore().
bool BleuScorer::OpenReference | ( | const char * | filename, | |
std::size_t | file_id | |||
) |
bool BleuScorer::OpenReferenceStream | ( | std::istream * | is, | |
std::size_t | file_id | |||
) |
virtual void BleuScorer::prepareStats | ( | std::size_t | sindex, | |
const std::string & | text, | |||
ScoreStats & | entry | |||
) | [virtual] |
Process the given guessed text, corresponding to the given reference sindex and add the appropriate statistics to the entry.
Reimplemented from Scorer.
Referenced by BOOST_AUTO_TEST_CASE().
virtual void BleuScorer::setReferenceFiles | ( | const std::vector< std::string > & | referenceFiles | ) | [virtual] |
Set the reference files. This must be called before prepareStats().
Reimplemented from Scorer.
void BleuScorer::SetReferenceLengthType | ( | ReferenceLengthType | type | ) | [inline] |
Definition at line 41 of file BleuScorer.h.
Referenced by BOOST_AUTO_TEST_CASE().