ckb commited on
Commit
f95c10c
1 Parent(s): 54a903b
Files changed (1) hide show
  1. unigram.py +2 -2
unigram.py CHANGED
@@ -78,7 +78,7 @@ class unigram(evaluate.Metric):
78
  )
79
 
80
 
81
- def _prec_recall_f1_score(pred_items, gold_items):
82
  """
83
  Compute precision, recall and f1 given a set of gold and prediction items.
84
  :param pred_items: iterable of predicted values
@@ -97,7 +97,7 @@ class unigram(evaluate.Metric):
97
  def _compute(self, predictions, references):
98
  """Returns the scores"""
99
  # TODO: Compute the different scores of the module
100
- score = sum(self._prec_recall_f1_score(i,j) for i, j in zip(predictions, references)) / len(predictions)
101
  return {
102
  "precision": score[0],
103
  "recall": score[1],
 
78
  )
79
 
80
 
81
+ def _prec_recall_f1_score(self, pred_items, gold_items):
82
  """
83
  Compute precision, recall and f1 given a set of gold and prediction items.
84
  :param pred_items: iterable of predicted values
 
97
  def _compute(self, predictions, references):
98
  """Returns the scores"""
99
  # TODO: Compute the different scores of the module
100
+ score = self._prec_recall_f1_score(i,j)
101
  return {
102
  "precision": score[0],
103
  "recall": score[1],