nltk.precision()

nltk.precision(reference, test)[source]

Given a set of reference values and a set of test values, return the fraction of test values that appear in the reference set. In particular, return card(reference intersection test)/card(test). If test is empty, then return None.

Parameters:
  • reference (set) – A set of reference values.
  • test (set) – A set of values to compare against the reference set.
Return type:

float or None