Datasets:

Languages:
English
License:

Convert dataset to Parquet

#2
by martinsr - opened
README.md CHANGED
@@ -49,12 +49,10 @@ dataset_info:
49
  num_examples: 300
50
  download_size: 6120469
51
  dataset_size: 4822850
52
- - config_name: wi
53
  features:
54
  - name: id
55
  dtype: string
56
- - name: userid
57
- dtype: string
58
  - name: cefr
59
  dtype: string
60
  - name: text
@@ -68,18 +66,17 @@ dataset_info:
68
  - name: text
69
  dtype: string
70
  splits:
71
- - name: train
72
- num_bytes: 4375795
73
- num_examples: 3000
74
  - name: validation
75
- num_bytes: 447055
76
- num_examples: 300
77
- download_size: 6120469
78
- dataset_size: 4822850
79
- - config_name: locness
80
  features:
81
  - name: id
82
  dtype: string
 
 
83
  - name: cefr
84
  dtype: string
85
  - name: text
@@ -93,14 +90,28 @@ dataset_info:
93
  - name: text
94
  dtype: string
95
  splits:
 
 
 
96
  - name: validation
97
- num_bytes: 138176
98
- num_examples: 50
99
- download_size: 6120469
100
- dataset_size: 138176
101
  config_names:
102
  - locness
103
  - wi
 
 
 
 
 
 
 
 
 
 
 
104
  ---
105
 
106
  # Dataset Card for Cambridge English Write & Improve + LOCNESS Dataset
 
49
  num_examples: 300
50
  download_size: 6120469
51
  dataset_size: 4822850
52
+ - config_name: locness
53
  features:
54
  - name: id
55
  dtype: string
 
 
56
  - name: cefr
57
  dtype: string
58
  - name: text
 
66
  - name: text
67
  dtype: string
68
  splits:
 
 
 
69
  - name: validation
70
+ num_bytes: 138148
71
+ num_examples: 50
72
+ download_size: 98824
73
+ dataset_size: 138148
74
+ - config_name: wi
75
  features:
76
  - name: id
77
  dtype: string
78
+ - name: userid
79
+ dtype: string
80
  - name: cefr
81
  dtype: string
82
  - name: text
 
90
  - name: text
91
  dtype: string
92
  splits:
93
+ - name: train
94
+ num_bytes: 4375764
95
+ num_examples: 3000
96
  - name: validation
97
+ num_bytes: 447023
98
+ num_examples: 300
99
+ download_size: 2736060
100
+ dataset_size: 4822787
101
  config_names:
102
  - locness
103
  - wi
104
+ configs:
105
+ - config_name: locness
106
+ data_files:
107
+ - split: validation
108
+ path: locness/validation-*
109
+ - config_name: wi
110
+ data_files:
111
+ - split: train
112
+ path: wi/train-*
113
+ - split: validation
114
+ path: wi/validation-*
115
  ---
116
 
117
  # Dataset Card for Cambridge English Write & Improve + LOCNESS Dataset
locness/validation-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9cce6e49ca3db387b8863febd428386d93b9fc5a0235a887817f5853992f30aa
3
+ size 98824
wi/train-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cddb1fbc48d690a0187550d67056df6154285f1d4372420bdfc0a19f94893c64
3
+ size 2467978
wi/validation-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:62cde9aa03ac3f82d9ab55687935bfe825651763933a4eddb69e5981086f4212
3
+ size 268082
wi_locness.py DELETED
@@ -1,234 +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
- """Write & Improve (Yannakoudakis et al., 2018) is an online web platform that assists non-native
16
- English students with their writing. Specifically, students from around the world submit letters,
17
- stories, articles and essays in response to various prompts, and the W&I system provides instant
18
- feedback. Since W&I went live in 2014, W&I annotators have manually annotated some of these
19
- submissions and assigned them a CEFR level.
20
-
21
- The LOCNESS corpus (Granger, 1998) consists of essays written by native English students.
22
- It was originally compiled by researchers at the Centre for English Corpus Linguistics at the
23
- University of Louvain. Since native English students also sometimes make mistakes, we asked
24
- the W&I annotators to annotate a subsection of LOCNESS so researchers can test the effectiveness
25
- of their systems on the full range of English levels and abilities."""
26
-
27
-
28
- import json
29
-
30
- import datasets
31
-
32
-
33
- _CITATION = """\
34
- @inproceedings{bryant-etal-2019-bea,
35
- title = "The {BEA}-2019 Shared Task on Grammatical Error Correction",
36
- author = "Bryant, Christopher and
37
- Felice, Mariano and
38
- Andersen, {\\O}istein E. and
39
- Briscoe, Ted",
40
- booktitle = "Proceedings of the Fourteenth Workshop on Innovative Use of NLP for Building Educational Applications",
41
- month = aug,
42
- year = "2019",
43
- address = "Florence, Italy",
44
- publisher = "Association for Computational Linguistics",
45
- url = "https://www.aclweb.org/anthology/W19-4406",
46
- doi = "10.18653/v1/W19-4406",
47
- pages = "52--75",
48
- abstract = "This paper reports on the BEA-2019 Shared Task on Grammatical Error Correction (GEC). As with the CoNLL-2014 shared task, participants are required to correct all types of errors in test data. One of the main contributions of the BEA-2019 shared task is the introduction of a new dataset, the Write{\\&}Improve+LOCNESS corpus, which represents a wider range of native and learner English levels and abilities. Another contribution is the introduction of tracks, which control the amount of annotated data available to participants. Systems are evaluated in terms of ERRANT F{\\_}0.5, which allows us to report a much wider range of performance statistics. The competition was hosted on Codalab and remains open for further submissions on the blind test set.",
49
- }
50
- """
51
-
52
- _DESCRIPTION = """\
53
- Write & Improve (Yannakoudakis et al., 2018) is an online web platform that assists non-native
54
- English students with their writing. Specifically, students from around the world submit letters,
55
- stories, articles and essays in response to various prompts, and the W&I system provides instant
56
- feedback. Since W&I went live in 2014, W&I annotators have manually annotated some of these
57
- submissions and assigned them a CEFR level.
58
- """
59
-
60
- _HOMEPAGE = "https://www.cl.cam.ac.uk/research/nl/bea2019st/#data"
61
-
62
- _LICENSE = ""
63
-
64
- # The HuggingFace dataset library don't host the datasets but only point to the original files
65
- # This can be an arbitrary nested dict/list of URLs (see below in `_split_generators` method)
66
- _URL = "https://www.cl.cam.ac.uk/research/nl/bea2019st/data/wi+locness_v2.1.bea19.tar.gz"
67
-
68
-
69
- class WiLocness(datasets.GeneratorBasedBuilder):
70
- """\
71
- Write & Improve (Yannakoudakis et al., 2018) is an online web platform that assists non-native
72
- English students with their writing. Specifically, students from around the world submit letters,
73
- stories, articles and essays in response to various prompts, and the W&I system provides instant
74
- feedback. Since W&I went live in 2014, W&I annotators have manually annotated some of these
75
- submissions and assigned them a CEFR level."""
76
-
77
- VERSION = datasets.Version("1.1.0")
78
-
79
- # This is an example of a dataset with multiple configurations.
80
- # If you don't want/need to define several sub-sets in your dataset,
81
- # just remove the BUILDER_CONFIG_CLASS and the BUILDER_CONFIGS attributes.
82
-
83
- # If you need to make complex sub-parts in the datasets with configurable options
84
- # You can create your own builder configuration class to store attribute, inheriting from datasets.BuilderConfig
85
- # BUILDER_CONFIG_CLASS = MyBuilderConfig
86
-
87
- # You will be able to load one or the other configurations in the following list with
88
- # data = datasets.load_dataset('my_dataset', 'first_domain')
89
- # data = datasets.load_dataset('my_dataset', 'second_domain')
90
- BUILDER_CONFIGS = [
91
- datasets.BuilderConfig(
92
- name="wi",
93
- version=VERSION,
94
- description="This part of the dataset includes the Write & Improve data for levels A, B and C",
95
- ),
96
- datasets.BuilderConfig(
97
- name="locness",
98
- version=VERSION,
99
- description="This part of the dataset includes the Locness part of the W&I-Locness dataset",
100
- ),
101
- ]
102
-
103
- # DEFAULT_CONFIG_NAME = "first_domain" # It's not mandatory to have a default configuration. Just use one if it make sense.
104
-
105
- def _info(self):
106
- if self.config.name == "wi":
107
- features = datasets.Features(
108
- {
109
- "id": datasets.Value("string"),
110
- "userid": datasets.Value("string"),
111
- "cefr": datasets.Value("string"),
112
- "text": datasets.Value("string"),
113
- "edits": datasets.Sequence(
114
- {
115
- "start": datasets.Value("int32"),
116
- "end": datasets.Value("int32"),
117
- "text": datasets.Value("string"),
118
- }
119
- ),
120
- }
121
- )
122
- elif self.config.name == "locness":
123
- features = datasets.Features(
124
- {
125
- "id": datasets.Value("string"),
126
- "cefr": datasets.Value("string"),
127
- "text": datasets.Value("string"),
128
- "edits": datasets.Sequence(
129
- {
130
- "start": datasets.Value("int32"),
131
- "end": datasets.Value("int32"),
132
- "text": datasets.Value("string"),
133
- }
134
- ),
135
- }
136
- )
137
- else:
138
- assert False
139
- return datasets.DatasetInfo(
140
- # This is the description that will appear on the datasets page.
141
- description=_DESCRIPTION,
142
- # This defines the different columns of the dataset and their types
143
- features=features, # Here we define them above because they are different between the two configurations
144
- # If there's a common (input, target) tuple from the features,
145
- # specify them here. They'll be used if as_supervised=True in
146
- # builder.as_dataset.
147
- supervised_keys=None,
148
- # Homepage of the dataset for documentation
149
- homepage=_HOMEPAGE,
150
- # License for the dataset if available
151
- license=_LICENSE,
152
- # Citation for the dataset
153
- citation=_CITATION,
154
- )
155
-
156
- def _split_generators(self, dl_manager):
157
- """Returns SplitGenerators."""
158
-
159
- # dl_manager is a datasets.download.DownloadManager that can be used to download and extract URLs
160
- # It can accept any type or nested list/dict and will give back the same structure with the url replaced with path to local files.
161
- # By default the archives will be extracted and a path to a cached folder where they are extracted is returned instead of the archive
162
- archive = dl_manager.download(_URL)
163
- data_dir = "wi+locness/json"
164
-
165
- if self.config.name == "wi":
166
- return [
167
- datasets.SplitGenerator(
168
- name=datasets.Split.TRAIN,
169
- # These kwargs will be passed to _generate_examples
170
- gen_kwargs={"data_dir": data_dir, "split": "train", "files": dl_manager.iter_archive(archive)},
171
- ),
172
- datasets.SplitGenerator(
173
- name=datasets.Split.VALIDATION,
174
- # These kwargs will be passed to _generate_examples
175
- gen_kwargs={
176
- "data_dir": data_dir,
177
- "split": "validation",
178
- "files": dl_manager.iter_archive(archive),
179
- },
180
- ),
181
- ]
182
- elif self.config.name == "locness":
183
- return [
184
- datasets.SplitGenerator(
185
- name=datasets.Split.VALIDATION,
186
- # These kwargs will be passed to _generate_examples
187
- gen_kwargs={
188
- "data_dir": data_dir,
189
- "split": "validation",
190
- "files": dl_manager.iter_archive(archive),
191
- },
192
- ),
193
- ]
194
- else:
195
- assert False
196
-
197
- def _generate_examples(self, data_dir, split, files):
198
- """Yields examples."""
199
-
200
- if split == "validation":
201
- split = "dev"
202
-
203
- if self.config.name == "wi":
204
- levels = ["A", "B", "C"]
205
- elif self.config.name == "locness":
206
- levels = ["N"]
207
- else:
208
- assert False
209
- filepaths = [f"{data_dir}/{level}.{split}.json" for level in levels]
210
- id_ = 0
211
- for path, fp in files:
212
- if not filepaths:
213
- break
214
- if path in filepaths:
215
- filepaths.remove(path)
216
- for line in fp:
217
- o = json.loads(line.decode("utf-8"))
218
-
219
- edits = []
220
- for (start, end, text) in o["edits"][0][1:][0]:
221
- edits.append({"start": start, "end": end, "text": text})
222
-
223
- out = {
224
- "id": o["id"],
225
- "cefr": o["cefr"],
226
- "text": o["text"],
227
- "edits": edits,
228
- }
229
-
230
- if self.config.name == "wi":
231
- out["userid"] = o.get("userid", "")
232
-
233
- yield id_, out
234
- id_ += 1