Go to the documentation of this file.
12 #ifndef MLPACK_CORE_METRICS_BLEU_HPP
13 #define MLPACK_CORE_METRICS_BLEU_HPP
50 template <
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"
size_t MaxOrder() const
Get the value of maximum length of tokens in n-grams.
The core includes that mlpack expects; standard C++ includes and Armadillo.
ElemType BrevityPenalty() const
Get the brevity penalty.
BLEU(const size_t maxOrder=4)
Create an instance of BLEU class.
ElemType BLEUScore() const
Get the BLEU Score.
void serialize(Archive &ar, const unsigned int)
Serialize the metric.
Linear algebra utility functions, generally performed on matrices or vectors.
size_t & MaxOrder()
Modify the value of maximum length of tokens in n-grams.
PrecisionType const & Precisions() const
Get the precisions for corresponding order.
size_t TranslationLength() const
Get the value of translation length.
BLEU, or the Bilingual Evaluation Understudy, is an algorithm for evaluating the quality of text whic...
ElemType Ratio() const
Get the ratio of translation to reference length ratio.
size_t ReferenceLength() const
Get the value of reference length.
ElemType Evaluate(const ReferenceCorpusType &referenceCorpus, const TranslationCorpusType &translationCorpus, const bool smooth=false)
Computes the BLEU Score.