Spaces:
Runtime error
Runtime error
libraxiong
commited on
Update oppo_refuse_match.py
Browse files- oppo_refuse_match.py +6 -5
oppo_refuse_match.py
CHANGED
@@ -27,7 +27,7 @@ Returns the rate at which the input predicted strings exactly match the refuse l
|
|
27 |
|
28 |
_KWARGS_DESCRIPTION = """
|
29 |
Args:
|
30 |
-
predictions: List of predicted texts.
|
31 |
|
32 |
Returns:
|
33 |
exact_match: Dictionary containing oppo_refuse_match rate. Possible values are 0 or 1
|
@@ -61,7 +61,8 @@ class OppoRefuseMatch(evaluate.Metric):
|
|
61 |
patterns = [
|
62 |
r"There is no", r"no", r"non-existent", r"not a", r"none"
|
63 |
]
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
|
|
|
27 |
|
28 |
_KWARGS_DESCRIPTION = """
|
29 |
Args:
|
30 |
+
predictions: List of predicted texts. -> [prediction] only one
|
31 |
|
32 |
Returns:
|
33 |
exact_match: Dictionary containing oppo_refuse_match rate. Possible values are 0 or 1
|
|
|
61 |
patterns = [
|
62 |
r"There is no", r"no", r"non-existent", r"not a", r"none"
|
63 |
]
|
64 |
+
score_list=0
|
65 |
+
for prediction in predictions:
|
66 |
+
if has_answer(prediction,patterns):
|
67 |
+
score_list+=1
|
68 |
+
return {"oppo_refuse_match": score_list/len(predictions)}
|