BLEUAlgorithm class
Static helpers for computing BLEU scores.
See: Papineni et al. (2002), and the NLTK reference implementation.
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
-
defaultBLEUWeights
→ List<
double> -
Default weights: uniform 0.25 for 1–4 gram.
final
Static Methods
-
brevityPenalty(
int closestRef, int hypLength) → double - Brevity penalty: penalizes hypotheses shorter than references.
-
closestRefLength(
List< List< references, int hypLength) → intString> > -
Returns the reference length closest to
hypLength. -
equalWeights(
int n) → List< double> -
Generates
nequal weights summing to 1.0. -
modifiedPrecision(
List< List< references, List<String> >String> hypothesis, {required int n}) → RationalNumber - Modified n-gram precision (clipped against reference counts).
-
sentenceBLEU(
List< List< references, List<String> >String> hypothesis, {List<double> ? weights, List<double> smoothingFunction(List<RationalNumber> , int)?}) → double - Computes the sentence-level BLEU score.