Spaces:
Sleeping
Sleeping
DoctorSlimm
commited on
Commit
·
b655778
1
Parent(s):
d9ea562
push
Browse files- kaushiks_criteria.py +22 -9
kaushiks_criteria.py
CHANGED
@@ -28,27 +28,40 @@ year={2020}
|
|
28 |
|
29 |
# TODO: Add description of the module here
|
30 |
_DESCRIPTION = """\
|
31 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
"""
|
33 |
|
34 |
|
35 |
# TODO: Add description of the arguments of the module here
|
36 |
_KWARGS_DESCRIPTION = """
|
37 |
-
Calculates how
|
38 |
Args:
|
39 |
-
predictions: list of
|
40 |
should be a string with tokens separated by spaces.
|
41 |
references: list of reference for each prediction. Each
|
42 |
reference should be a string with tokens separated by spaces.
|
|
|
43 |
Returns:
|
44 |
-
|
45 |
-
another_score: description of the second score,
|
46 |
Examples:
|
47 |
Examples should be written in doctest format, and should illustrate how
|
48 |
to use the function.
|
49 |
|
50 |
-
>>> my_new_module = evaluate.load("
|
51 |
-
>>> results = my_new_module.compute(
|
|
|
|
|
|
|
52 |
>>> print(results)
|
53 |
{'accuracy': 1.0}
|
54 |
"""
|
@@ -71,8 +84,8 @@ class kaushiks_criteria(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",
|
|
|
28 |
|
29 |
# TODO: Add description of the module here
|
30 |
_DESCRIPTION = """\
|
31 |
+
Evaluate structured output formatting for generated text.
|
32 |
+
- considers header / column / tag / key names
|
33 |
+
- DOES NOT consider the cell / row values
|
34 |
+
|
35 |
+
Formats:
|
36 |
+
- [] Custom
|
37 |
+
- [] Markdown tables
|
38 |
+
- [] HTML tables
|
39 |
+
- [] JSON
|
40 |
+
- [] XML
|
41 |
+
- [] CSV / TSV
|
42 |
"""
|
43 |
|
44 |
|
45 |
# TODO: Add description of the arguments of the module here
|
46 |
_KWARGS_DESCRIPTION = """
|
47 |
+
Calculates how well the `structure` of the predictions matches the `structure` of the references.
|
48 |
Args:
|
49 |
+
predictions: list of strings to score. Each predictions
|
50 |
should be a string with tokens separated by spaces.
|
51 |
references: list of reference for each prediction. Each
|
52 |
reference should be a string with tokens separated by spaces.
|
53 |
+
invariance: bool, whether to consider the order of the columns / tags / keys.
|
54 |
Returns:
|
55 |
+
kaushiks_criteria: kaushiks_criteria score.
|
|
|
56 |
Examples:
|
57 |
Examples should be written in doctest format, and should illustrate how
|
58 |
to use the function.
|
59 |
|
60 |
+
>>> my_new_module = evaluate.load("DoctorSlimm/kaushiks_criteria")
|
61 |
+
>>> results = my_new_module.compute(
|
62 |
+
references=['<table><tr><td>1</td><td>2</td></tr></table>'],
|
63 |
+
predictions=['<table><tr><td>1</td><td>2</td></tr></table>']
|
64 |
+
)
|
65 |
>>> print(results)
|
66 |
{'accuracy': 1.0}
|
67 |
"""
|
|
|
84 |
inputs_description=_KWARGS_DESCRIPTION,
|
85 |
# This defines the format of each prediction and reference
|
86 |
features=datasets.Features({
|
87 |
+
'predictions': datasets.Value('string'),
|
88 |
+
'references': datasets.Value('string'),
|
89 |
}),
|
90 |
# Homepage of the module for documentation
|
91 |
homepage="http://module.homepage",
|