MosesTuning::BleuScorer Class Reference

#include <BleuScorer.h>

Inheritance diagram for MosesTuning::BleuScorer:

Inheritance graph
[legend]
Collaboration diagram for MosesTuning::BleuScorer:

Collaboration graph
[legend]

List of all members.

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< ScoreStatsType > &comps) const
virtual std::size_t NumberOfScores () const
void CalcBleuStats (const Reference &ref, const std::string &text, ScoreStats &entry) const
int CalcReferenceLength (const Reference &ref, std::size_t length) const
ReferenceLengthType GetReferenceLengthType () const
void SetReferenceLengthType (ReferenceLengthType type)
const std::vector< Reference * > & GetReferences () const
virtual float getReferenceLength (const std::vector< ScoreStatsType > &totals) const
size_t CountNgrams (const std::string &line, NgramCounts &counts, unsigned int n, bool is_testing=false) const
void DumpCounts (std::ostream *os, const NgramCounts &counts) const
bool OpenReferenceStream (std::istream *is, std::size_t file_id)
void ProcessReferenceLine (const std::string &line, Reference *ref) const
bool GetNextReferenceFromStreams (std::vector< boost::shared_ptr< std::ifstream > > &referenceStreams, Reference &ref) const

Static Public Member Functions

static std::vector< float > ScoreNbestList (const std::string &scoreFile, const std::string &featureFile)

Protected Member Functions

 BleuScorer (const std::string &name, const std::string &config)
 BleuScorer (const BleuScorer &)
BleuScoreroperator= (const BleuScorer &)

Protected Attributes

ReferenceLengthType m_ref_length_type
ScopedVector< Referencem_references


Detailed Description

Bleu scoring

Definition at line 24 of file BleuScorer.h.


Member Enumeration Documentation

Enumerator:
AVERAGE 
CLOSEST 
SHORTEST 

Definition at line 27 of file BleuScorer.h.


Constructor & Destructor Documentation

MosesTuning::BleuScorer::BleuScorer ( const std::string &  config = ""  )  [explicit]

MosesTuning::BleuScorer::~BleuScorer (  ) 

Definition at line 52 of file BleuScorer.cpp.

MosesTuning::BleuScorer::BleuScorer ( const std::string &  name,
const std::string &  config 
) [inline, protected]

Definition at line 87 of file BleuScorer.h.

MosesTuning::BleuScorer::BleuScorer ( const BleuScorer  )  [protected]


Member Function Documentation

void MosesTuning::BleuScorer::CalcBleuStats ( const Reference ref,
const std::string &  text,
ScoreStats entry 
) const

int MosesTuning::BleuScorer::CalcReferenceLength ( const Reference ref,
std::size_t  length 
) const

Definition at line 220 of file BleuScorer.cpp.

References AVERAGE, MosesTuning::Reference::CalcAverage(), MosesTuning::Reference::CalcClosest(), MosesTuning::Reference::CalcShortest(), CLOSEST, m_ref_length_type, SHORTEST, and UTIL_THROW2.

Referenced by CalcBleuStats().

Here is the call graph for this function:

Here is the caller graph for this function:

virtual statscore_t MosesTuning::BleuScorer::calculateScore ( const std::vector< ScoreStatsType > &  totals  )  const [virtual]

Calculate the actual score.

Implements MosesTuning::StatisticsBasedScorer.

Referenced by BOOST_AUTO_TEST_CASE().

Here is the caller graph for this function:

size_t MosesTuning::BleuScorer::CountNgrams ( const std::string &  line,
NgramCounts counts,
unsigned int  n,
bool  is_testing = false 
) const

Count the ngrams of each type, up to the given length in the input line.

Referenced by BOOST_AUTO_TEST_CASE(), CalcBleuStats(), and ProcessReferenceLine().

Here is the caller graph for this function:

void MosesTuning::BleuScorer::DumpCounts ( std::ostream *  os,
const NgramCounts counts 
) const

bool MosesTuning::BleuScorer::GetNextReferenceFromStreams ( std::vector< boost::shared_ptr< std::ifstream > > &  referenceStreams,
Reference ref 
) const

Definition at line 153 of file BleuScorer.cpp.

References MosesTuning::Scorer::preprocessSentence(), and ProcessReferenceLine().

Referenced by main().

Here is the call graph for this function:

Here is the caller graph for this function:

virtual float MosesTuning::BleuScorer::getReferenceLength ( const std::vector< ScoreStatsType > &  totals  )  const [inline, virtual]

Based on vector of sufficient statistics, return length of reference.

Reimplemented from MosesTuning::StatisticsBasedScorer.

Definition at line 61 of file BleuScorer.h.

References MosesTuning::kBleuNgramOrder.

ReferenceLengthType MosesTuning::BleuScorer::GetReferenceLengthType (  )  const [inline]

Definition at line 49 of file BleuScorer.h.

References m_ref_length_type.

Referenced by BOOST_AUTO_TEST_CASE().

Here is the caller graph for this function:

const std::vector<Reference*>& MosesTuning::BleuScorer::GetReferences (  )  const [inline]

Definition at line 57 of file BleuScorer.h.

References MosesTuning::ScopedVector< T >::get(), and m_references.

Here is the call graph for this function:

virtual std::size_t MosesTuning::BleuScorer::NumberOfScores (  )  const [inline, virtual]

Return the number of statistics needed for the computation of the score.

Implements MosesTuning::Scorer.

Definition at line 41 of file BleuScorer.h.

References MosesTuning::kBleuNgramOrder.

bool MosesTuning::BleuScorer::OpenReferenceStream ( std::istream *  is,
std::size_t  file_id 
)

Reimplemented in MosesTuning::BleuDocScorer.

BleuScorer& MosesTuning::BleuScorer::operator= ( const BleuScorer  )  [protected]

virtual void MosesTuning::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 MosesTuning::Scorer.

Reimplemented in MosesTuning::BleuDocScorer.

Referenced by BOOST_AUTO_TEST_CASE().

Here is the caller graph for this function:

void MosesTuning::BleuScorer::ProcessReferenceLine ( const std::string &  line,
Reference ref 
) const

static std::vector<float> MosesTuning::BleuScorer::ScoreNbestList ( const std::string &  scoreFile,
const std::string &  featureFile 
) [static]

virtual void MosesTuning::BleuScorer::setReferenceFiles ( const std::vector< std::string > &  referenceFiles  )  [virtual]

Set the reference files. This must be called before prepareStats().

Reimplemented from MosesTuning::Scorer.

void MosesTuning::BleuScorer::SetReferenceLengthType ( ReferenceLengthType  type  )  [inline]

Definition at line 53 of file BleuScorer.h.

References m_ref_length_type.

Referenced by BOOST_AUTO_TEST_CASE().

Here is the caller graph for this function:


Member Data Documentation

Definition at line 84 of file BleuScorer.h.

Referenced by GetReferences().


The documentation for this class was generated from the following files:

Generated on Thu Jul 6 00:34:13 2017 for Moses by  doxygen 1.5.9