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>
105 void serialize(Archive& ar,
const uint32_t version);
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 TranslationLength() const
Get the value of translation length.
Linear algebra utility functions, generally performed on matrices or vectors.
The core includes that mlpack expects; standard C++ includes and Armadillo.
ElemType BLEUScore() const
Get the BLEU Score.
void serialize(Archive &ar, const uint32_t version)
Serialize the metric.
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.
ElemType Ratio() const
Get the ratio of translation to reference length ratio.
BLEU(const size_t maxOrder=4)
Create an instance of BLEU class.
PrecisionType const & Precisions() const
Get the precisions for corresponding order.
size_t ReferenceLength() const
Get the value of reference length.
size_t & MaxOrder()
Modify the value of maximum length of tokens in n-grams.
BLEU, or the Bilingual Evaluation Understudy, is an algorithm for evaluating the quality of text whic...
ElemType BrevityPenalty() const
Get the brevity penalty.