Updating module
Browse files
.ipynb_checkpoints/rouge_mn-checkpoint.py
CHANGED
@@ -71,8 +71,8 @@ class rouge_mn(evaluate.Metric):
|
|
71 |
inputs_description=_KWARGS_DESCRIPTION,
|
72 |
# This defines the format of each prediction and reference
|
73 |
features=datasets.Features({
|
74 |
-
'predictions': datasets.Value('
|
75 |
-
'references': datasets.Value('
|
76 |
}),
|
77 |
# Homepage of the module for documentation
|
78 |
homepage="http://module.homepage",
|
@@ -90,6 +90,5 @@ class rouge_mn(evaluate.Metric):
|
|
90 |
rouge = Rouge()
|
91 |
scores = rouge.get_scores(predictions, references)[0]
|
92 |
result = {key: scores[key]['f'] for key in scores.keys()}
|
93 |
-
|
94 |
-
|
95 |
return result
|
|
|
71 |
inputs_description=_KWARGS_DESCRIPTION,
|
72 |
# This defines the format of each prediction and reference
|
73 |
features=datasets.Features({
|
74 |
+
'predictions': datasets.Value('string'),
|
75 |
+
'references': datasets.Value('string'),
|
76 |
}),
|
77 |
# Homepage of the module for documentation
|
78 |
homepage="http://module.homepage",
|
|
|
90 |
rouge = Rouge()
|
91 |
scores = rouge.get_scores(predictions, references)[0]
|
92 |
result = {key: scores[key]['f'] for key in scores.keys()}
|
93 |
+
|
|
|
94 |
return result
|
.ipynb_checkpoints/tests-checkpoint.py
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
test_cases = [
|
2 |
+
{
|
3 |
+
"predictions": [0, 0],
|
4 |
+
"references": [1, 1],
|
5 |
+
"result": {"metric_score": 0}
|
6 |
+
},
|
7 |
+
{
|
8 |
+
"predictions": [1, 1],
|
9 |
+
"references": [1, 1],
|
10 |
+
"result": {"metric_score": 1}
|
11 |
+
},
|
12 |
+
{
|
13 |
+
"predictions": [1, 0],
|
14 |
+
"references": [1, 1],
|
15 |
+
"result": {"metric_score": 0.5}
|
16 |
+
}
|
17 |
+
]
|
rouge_mn.py
CHANGED
@@ -71,8 +71,8 @@ class rouge_mn(evaluate.Metric):
|
|
71 |
inputs_description=_KWARGS_DESCRIPTION,
|
72 |
# This defines the format of each prediction and reference
|
73 |
features=datasets.Features({
|
74 |
-
'predictions': datasets.Value('
|
75 |
-
'references': datasets.Value('
|
76 |
}),
|
77 |
# Homepage of the module for documentation
|
78 |
homepage="http://module.homepage",
|
@@ -90,6 +90,5 @@ class rouge_mn(evaluate.Metric):
|
|
90 |
rouge = Rouge()
|
91 |
scores = rouge.get_scores(predictions, references)[0]
|
92 |
result = {key: scores[key]['f'] for key in scores.keys()}
|
93 |
-
|
94 |
-
|
95 |
return result
|
|
|
71 |
inputs_description=_KWARGS_DESCRIPTION,
|
72 |
# This defines the format of each prediction and reference
|
73 |
features=datasets.Features({
|
74 |
+
'predictions': datasets.Value('string'),
|
75 |
+
'references': datasets.Value('string'),
|
76 |
}),
|
77 |
# Homepage of the module for documentation
|
78 |
homepage="http://module.homepage",
|
|
|
90 |
rouge = Rouge()
|
91 |
scores = rouge.get_scores(predictions, references)[0]
|
92 |
result = {key: scores[key]['f'] for key in scores.keys()}
|
93 |
+
|
|
|
94 |
return result
|