Skip to content

Commit

Permalink
allow multiple references for f1 strings metric (#1225)
Browse files Browse the repository at this point in the history
allow multiple refs

Co-authored-by: Elron Bandel <elronbandel@gmail.com>
  • Loading branch information
ShirApp and elronbandel committed Sep 26, 2024
1 parent 984ea8f commit 1209e32
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/unitxt/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -4741,7 +4741,7 @@ class F1Strings(InstanceMetric):
main_score = "f1_strings"
reduction_map = {"mean": ["f1_strings"]}
prediction_type = str
single_reference_per_prediction = True
single_reference_per_prediction = False
_requirements_list = {
"spacy": "Please pip install spacy",
}
Expand All @@ -4764,7 +4764,7 @@ def compute(
prediction: str,
task_data: List[Dict],
) -> dict:
doc_ref = self.nlp(references[0])
doc_ref = self.nlp(" ".join(references))
set_ref = Counter([token.text.lower() for token in doc_ref])
doc_pred = self.nlp(prediction)
set_pred = Counter([token.text.lower() for token in doc_pred])
Expand Down

0 comments on commit 1209e32

Please sign in to comment.