nltk.translate.metrics module¶
- nltk.translate.metrics.alignment_error_rate(reference, hypothesis, possible=None)[source]¶
Return the Alignment Error Rate (AER) of an alignment with respect to a “gold standard” reference alignment. Return an error rate between 0.0 (perfect alignment) and 1.0 (no alignment).
>>> from nltk.translate import Alignment >>> ref = Alignment([(0, 0), (1, 1), (2, 2)]) >>> test = Alignment([(0, 0), (1, 2), (2, 1)]) >>> alignment_error_rate(ref, test) 0.6666666666666667