yzha commited on
Commit
6496905
1 Parent(s): 889e704
Files changed (1) hide show
  1. ctc_eval.py +4 -3
ctc_eval.py CHANGED
@@ -84,12 +84,13 @@ class CTC_Eval(evaluate.EvaluationModule):
84
  def _download_and_prepare(self, dl_manager):
85
  """Optional: download external resources useful to compute the scores"""
86
  # TODO: Download external resources if needed
87
- pass
 
88
 
89
  def _compute(self, predictions, references):
90
  """Returns the scores"""
91
  # TODO: Compute the different scores of the module
92
- accuracy = sum(i == j for i, j in zip(predictions, references)) / len(predictions)
93
  return {
94
- "accuracy": accuracy,
95
  }
 
84
  def _download_and_prepare(self, dl_manager):
85
  """Optional: download external resources useful to compute the scores"""
86
  # TODO: Download external resources if needed
87
+ from ctc_score import StyleTransferScorer, SummarizationScorer, DialogScorer
88
+ self.scorer = SummarizationScorer(align='D-cnndm')
89
 
90
  def _compute(self, predictions, references):
91
  """Returns the scores"""
92
  # TODO: Compute the different scores of the module
93
+ ctc_score = self.scorer.score(doc=references, refs=[], hypo=predictions, aspect='consistency')
94
  return {
95
+ "ctc_score": ctc_score,
96
  }