import decimal


def recall(qtd_true_positives, list_of_true_positive_documents, ref=0):
	"""
	TP / (TP + FN)
	TP - True Positive
	FN - False Negative - a document is positive but was classified as negative
	"""

	fn = 0
	for d in list_of_true_positive_documents:
		if d.predicted_polarity < ref:
			fn = fn + 1
	qtd_true_positives = decimal.Decimal(qtd_true_positives)
	fn = decimal.Decimal(fn)
	return (qtd_true_positives / (qtd_true_positives + fn))