Datasets:

Languages:
English
Size Categories:
1K<n<10K
Language Creators:
found
Annotations Creators:
expert-generated
ArXiv:
License:
albertvillanova HF staff commited on
Commit
c98b927
1 Parent(s): 876ca3d

Delete loading script

Browse files
Files changed (1) hide show
  1. jfleg.py +0 -144
jfleg.py DELETED
@@ -1,144 +0,0 @@
1
- # coding=utf-8
2
- # Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
3
- #
4
- # Licensed under the Apache License, Version 2.0 (the "License");
5
- # you may not use this file except in compliance with the License.
6
- # You may obtain a copy of the License at
7
- #
8
- # http://www.apache.org/licenses/LICENSE-2.0
9
- #
10
- # Unless required by applicable law or agreed to in writing, software
11
- # distributed under the License is distributed on an "AS IS" BASIS,
12
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- # See the License for the specific language governing permissions and
14
- # limitations under the License.
15
- """JFLEG dataset."""
16
-
17
-
18
- import datasets
19
-
20
-
21
- _CITATION = """\
22
- @InProceedings{napoles-sakaguchi-tetreault:2017:EACLshort,
23
- author = {Napoles, Courtney
24
- and Sakaguchi, Keisuke
25
- and Tetreault, Joel},
26
- title = {JFLEG: A Fluency Corpus and Benchmark for Grammatical Error Correction},
27
- booktitle = {Proceedings of the 15th Conference of the European Chapter of the
28
- Association for Computational Linguistics: Volume 2, Short Papers},
29
- month = {April},
30
- year = {2017},
31
- address = {Valencia, Spain},
32
- publisher = {Association for Computational Linguistics},
33
- pages = {229--234},
34
- url = {http://www.aclweb.org/anthology/E17-2037}
35
- }
36
- @InProceedings{heilman-EtAl:2014:P14-2,
37
- author = {Heilman, Michael
38
- and Cahill, Aoife
39
- and Madnani, Nitin
40
- and Lopez, Melissa
41
- and Mulholland, Matthew
42
- and Tetreault, Joel},
43
- title = {Predicting Grammaticality on an Ordinal Scale},
44
- booktitle = {Proceedings of the 52nd Annual Meeting of the
45
- Association for Computational Linguistics (Volume 2: Short Papers)},
46
- month = {June},
47
- year = {2014},
48
- address = {Baltimore, Maryland},
49
- publisher = {Association for Computational Linguistics},
50
- pages = {174--180},
51
- url = {http://www.aclweb.org/anthology/P14-2029}
52
- }
53
- """
54
-
55
- _DESCRIPTION = """\
56
- JFLEG (JHU FLuency-Extended GUG) is an English grammatical error correction (GEC) corpus.
57
- It is a gold standard benchmark for developing and evaluating GEC systems with respect to
58
- fluency (extent to which a text is native-sounding) as well as grammaticality.
59
-
60
- For each source document, there are four human-written corrections (ref0 to ref3).
61
- """
62
-
63
- _HOMEPAGE = "https://github.com/keisks/jfleg"
64
-
65
- _LICENSE = "CC BY-NC-SA 4.0"
66
-
67
- _URLs = {
68
- "dev": {
69
- "src": "https://raw.githubusercontent.com/keisks/jfleg/master/dev/dev.src",
70
- "ref0": "https://raw.githubusercontent.com/keisks/jfleg/master/dev/dev.ref0",
71
- "ref1": "https://raw.githubusercontent.com/keisks/jfleg/master/dev/dev.ref1",
72
- "ref2": "https://raw.githubusercontent.com/keisks/jfleg/master/dev/dev.ref2",
73
- "ref3": "https://raw.githubusercontent.com/keisks/jfleg/master/dev/dev.ref3",
74
- },
75
- "test": {
76
- "src": "https://raw.githubusercontent.com/keisks/jfleg/master/test/test.src",
77
- "ref0": "https://raw.githubusercontent.com/keisks/jfleg/master/test/test.ref0",
78
- "ref1": "https://raw.githubusercontent.com/keisks/jfleg/master/test/test.ref1",
79
- "ref2": "https://raw.githubusercontent.com/keisks/jfleg/master/test/test.ref2",
80
- "ref3": "https://raw.githubusercontent.com/keisks/jfleg/master/test/test.ref3",
81
- },
82
- }
83
-
84
-
85
- class Jfleg(datasets.GeneratorBasedBuilder):
86
- """JFLEG (JHU FLuency-Extended GUG) grammatical error correction dataset."""
87
-
88
- VERSION = datasets.Version("1.0.0")
89
-
90
- def _info(self):
91
- return datasets.DatasetInfo(
92
- description=_DESCRIPTION,
93
- features=datasets.Features(
94
- {"sentence": datasets.Value("string"), "corrections": datasets.Sequence(datasets.Value("string"))}
95
- ),
96
- supervised_keys=None,
97
- homepage=_HOMEPAGE,
98
- license=_LICENSE,
99
- citation=_CITATION,
100
- )
101
-
102
- def _split_generators(self, dl_manager):
103
- """Returns SplitGenerators."""
104
-
105
- downloaded_dev = dl_manager.download_and_extract(_URLs["dev"])
106
- downloaded_test = dl_manager.download_and_extract(_URLs["test"])
107
-
108
- return [
109
- datasets.SplitGenerator(
110
- name=datasets.Split.VALIDATION,
111
- gen_kwargs={
112
- "filepath": downloaded_dev,
113
- "split": "dev",
114
- },
115
- ),
116
- datasets.SplitGenerator(
117
- name=datasets.Split.TEST,
118
- gen_kwargs={"filepath": downloaded_test, "split": "test"},
119
- ),
120
- ]
121
-
122
- def _generate_examples(self, filepath, split):
123
- """Yields examples."""
124
-
125
- source_file = filepath["src"]
126
- with open(source_file, encoding="utf-8") as f:
127
- source_sentences = f.read().split("\n")
128
- num_source = len(source_sentences)
129
-
130
- corrections = []
131
- for n in range(0, 4):
132
- correction_file = filepath[f"ref{n}"]
133
- with open(correction_file, encoding="utf-8") as f:
134
- correction_sentences = f.read().split("\n")
135
- num_correction = len(correction_sentences)
136
-
137
- assert len(correction_sentences) == len(
138
- source_sentences
139
- ), f"Sizes do not match: {num_source} vs {num_correction} for {source_file} vs {correction_file}."
140
- corrections.append(correction_sentences)
141
-
142
- corrected_sentences = list(zip(*corrections))
143
- for id_, source_sentence in enumerate(source_sentences):
144
- yield id_, {"sentence": source_sentence, "corrections": corrected_sentences[id_]}