nltk.metrics.accuracy

nltk.metrics.accuracy(reference, test)[source]

Given a list of reference values and a corresponding list of test values, return the fraction of corresponding values that are equal. In particular, return the fraction of indices 0<i<=len(test) such that test[i] == reference[i].

Parameters
  • reference (list) – An ordered list of reference values.

  • test (list) – A list of values to compare against the corresponding reference values.

Raises

ValueError – If reference and length do not have the same length.