12#ifndef MLPACK_CORE_METRICS_BLEU_HPP
13#define MLPACK_CORE_METRICS_BLEU_HPP
50template <
typename ElemType = float,
51 typename PrecisionType = std::vector<ElemType>
61 BLEU(
const size_t maxOrder = 4);
98 template <
typename ReferenceCorpusType,
typename TranslationCorpusType>
99 ElemType
Evaluate(
const ReferenceCorpusType& referenceCorpus,
100 const TranslationCorpusType& translationCorpus,
101 const bool smooth =
false);
104 template<
typename Archive>
125 ElemType
Ratio()
const {
return ratio; }
128 PrecisionType
const&
Precisions()
const {
return precisions; }
137 template <
typename WordVector>
138 std::map<WordVector, size_t> GetNGrams(
const WordVector& segment);
148 ElemType brevityPenalty;
151 size_t translationLength;
154 size_t referenceLength;
160 PrecisionType precisions;
167#include "bleu_impl.hpp"
BLEU, or the Bilingual Evaluation Understudy, is an algorithm for evaluating the quality of text whic...
BLEU(const size_t maxOrder=4)
Create an instance of BLEU class.
ElemType Evaluate(const ReferenceCorpusType &referenceCorpus, const TranslationCorpusType &translationCorpus, const bool smooth=false)
Computes the BLEU Score.
size_t MaxOrder() const
Get the value of maximum length of tokens in n-grams.
PrecisionType const & Precisions() const
Get the precisions for corresponding order.
size_t ReferenceLength() const
Get the value of reference length.
ElemType BLEUScore() const
Get the BLEU Score.
size_t TranslationLength() const
Get the value of translation length.
ElemType Ratio() const
Get the ratio of translation to reference length ratio.
void serialize(Archive &ar, const unsigned int)
Serialize the metric.
ElemType BrevityPenalty() const
Get the brevity penalty.
size_t & MaxOrder()
Modify the value of maximum length of tokens in n-grams.
Linear algebra utility functions, generally performed on matrices or vectors.
The core includes that mlpack expects; standard C++ includes and Armadillo.