parquet-converter commited on
Commit
e0eda1d
·
1 Parent(s): 15ba247

Update parquet files

Browse files
Files changed (5) hide show
  1. .gitattributes +0 -41
  2. README.md +0 -164
  3. dataset_infos.json +0 -1
  4. full/sciarg-train.parquet +3 -0
  5. sciarg.py +0 -368
.gitattributes DELETED
@@ -1,41 +0,0 @@
1
- *.7z filter=lfs diff=lfs merge=lfs -text
2
- *.arrow filter=lfs diff=lfs merge=lfs -text
3
- *.bin filter=lfs diff=lfs merge=lfs -text
4
- *.bz2 filter=lfs diff=lfs merge=lfs -text
5
- *.ftz filter=lfs diff=lfs merge=lfs -text
6
- *.gz filter=lfs diff=lfs merge=lfs -text
7
- *.h5 filter=lfs diff=lfs merge=lfs -text
8
- *.joblib filter=lfs diff=lfs merge=lfs -text
9
- *.lfs.* filter=lfs diff=lfs merge=lfs -text
10
- *.model filter=lfs diff=lfs merge=lfs -text
11
- *.msgpack filter=lfs diff=lfs merge=lfs -text
12
- *.npy filter=lfs diff=lfs merge=lfs -text
13
- *.npz filter=lfs diff=lfs merge=lfs -text
14
- *.onnx filter=lfs diff=lfs merge=lfs -text
15
- *.ot filter=lfs diff=lfs merge=lfs -text
16
- *.parquet filter=lfs diff=lfs merge=lfs -text
17
- *.pb filter=lfs diff=lfs merge=lfs -text
18
- *.pickle filter=lfs diff=lfs merge=lfs -text
19
- *.pkl filter=lfs diff=lfs merge=lfs -text
20
- *.pt filter=lfs diff=lfs merge=lfs -text
21
- *.pth filter=lfs diff=lfs merge=lfs -text
22
- *.rar filter=lfs diff=lfs merge=lfs -text
23
- saved_model/**/* filter=lfs diff=lfs merge=lfs -text
24
- *.tar.* filter=lfs diff=lfs merge=lfs -text
25
- *.tflite filter=lfs diff=lfs merge=lfs -text
26
- *.tgz filter=lfs diff=lfs merge=lfs -text
27
- *.wasm filter=lfs diff=lfs merge=lfs -text
28
- *.xz filter=lfs diff=lfs merge=lfs -text
29
- *.zip filter=lfs diff=lfs merge=lfs -text
30
- *.zstandard filter=lfs diff=lfs merge=lfs -text
31
- *tfevents* filter=lfs diff=lfs merge=lfs -text
32
- # Audio files - uncompressed
33
- *.pcm filter=lfs diff=lfs merge=lfs -text
34
- *.sam filter=lfs diff=lfs merge=lfs -text
35
- *.raw filter=lfs diff=lfs merge=lfs -text
36
- # Audio files - compressed
37
- *.aac filter=lfs diff=lfs merge=lfs -text
38
- *.flac filter=lfs diff=lfs merge=lfs -text
39
- *.mp3 filter=lfs diff=lfs merge=lfs -text
40
- *.ogg filter=lfs diff=lfs merge=lfs -text
41
- *.wav filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
README.md DELETED
@@ -1,164 +0,0 @@
1
- ---
2
- annotations_creators:
3
- - expert-generated
4
- language:
5
- - en
6
- language_creators:
7
- - expert-generated
8
- license: []
9
- multilinguality:
10
- - monolingual
11
- pretty_name: SciArg
12
- size_categories:
13
- - 1K<n<10K
14
- source_datasets:
15
- - dr inventor corpus
16
- tags:
17
- - argument mining
18
- - scientific text
19
- - relation extraction
20
- - argumentative discourse unit recognition
21
- task_categories:
22
- - token-classification
23
- task_ids: []
24
- ---
25
-
26
- # Dataset Card for "sciarg"
27
-
28
- ## Table of Contents
29
- - [Table of Contents](#table-of-contents)
30
- - [Dataset Description](#dataset-description)
31
- - [Dataset Summary](#dataset-summary)
32
- - [Supported Tasks and Leaderboards](#supported-tasks-and-leaderboards)
33
- - [Languages](#languages)
34
- - [Dataset Structure](#dataset-structure)
35
- - [Data Instances](#data-instances)
36
- - [Data Fields](#data-fields)
37
- - [Data Splits](#data-splits)
38
- - [Dataset Creation](#dataset-creation)
39
- - [Curation Rationale](#curation-rationale)
40
- - [Source Data](#source-data)
41
- - [Annotations](#annotations)
42
- - [Personal and Sensitive Information](#personal-and-sensitive-information)
43
- - [Considerations for Using the Data](#considerations-for-using-the-data)
44
- - [Social Impact of Dataset](#social-impact-of-dataset)
45
- - [Discussion of Biases](#discussion-of-biases)
46
- - [Other Known Limitations](#other-known-limitations)
47
- - [Additional Information](#additional-information)
48
- - [Dataset Curators](#dataset-curators)
49
- - [Licensing Information](#licensing-information)
50
- - [Citation Information](#citation-information)
51
- - [Contributions](#contributions)
52
-
53
- ## Dataset Description
54
-
55
- - **Homepage:** [https://github.com/anlausch/ArguminSci](https://github.com/anlausch/ArguminSci)
56
- - **Repository:** [https://github.com/anlausch/ArguminSci](https://github.com/anlausch/ArguminSci)
57
- - **Paper:** [An argument-annotated corpus of scientific publications](https://aclanthology.org/W18-5206.pdf)
58
- - **Leaderboard:** [More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
59
- - **Point of Contact:** [More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
60
-
61
- ### Dataset Summary
62
-
63
- The SciArg dataset is an extension of the Dr. Inventor corpus (Fisas et al., 2015, 2016) with an annotation layer containing
64
- fine-grained argumentative components and relations. It is the first argument-annotated corpus of scientific
65
- publications (in English), which allows for joint analyses of argumentation and other rhetorical dimensions of
66
- scientific writing.
67
-
68
- ### Supported Tasks and Leaderboards
69
-
70
- [More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
71
-
72
- ### Languages
73
-
74
- The language in the dataset is English.
75
-
76
- ## Dataset Structure
77
-
78
- ### Data Instances
79
-
80
- [More Information Needed]
81
-
82
- ### Data Fields
83
-
84
- - `document_id`: the base file name, e.g. "A28"
85
- - `text`: the parsed text of the scientific publication in the XML format
86
- - `text_bound_annotations`: span annotations that mark argumentative discourse units (ADUs). Each entry has the following fields: `offsets`, `text`, `type`, and `id`.
87
- - `relations`: binary relation annotations that mark the argumentative relations that hold between a head and a tail ADU. Each entry has the following fields: `id`, `head`, `tail`, and `type` where `head` and `tail` each have the fields: `ref_id` and `role`.
88
-
89
- ### Data Splits
90
-
91
- The dataset consists of a single `train` split that has 40 documents.
92
-
93
- ## Dataset Creation
94
-
95
- ### Curation Rationale
96
-
97
- [More Information Needed]
98
-
99
- ### Source Data
100
-
101
- #### Initial Data Collection and Normalization
102
-
103
- [More Information Needed]
104
-
105
- #### Who are the source language producers?
106
-
107
- [More Information Needed]
108
-
109
- ### Annotations
110
-
111
- #### Annotation process
112
-
113
- [More Information Needed]
114
-
115
- #### Who are the annotators?
116
-
117
- [More Information Needed]
118
-
119
- ### Personal and Sensitive Information
120
-
121
- [More Information Needed]
122
-
123
- ## Considerations for Using the Data
124
-
125
- ### Social Impact of Dataset
126
-
127
- [More Information Needed]
128
-
129
- ### Discussion of Biases
130
-
131
- [More Information Needed]
132
-
133
- ### Other Known Limitations
134
-
135
- [More Information Needed]
136
-
137
- ## Additional Information
138
-
139
- ### Dataset Curators
140
-
141
- [More Information Needed]
142
-
143
- ### Licensing Information
144
-
145
- [More Information Needed]
146
-
147
- ### Citation Information
148
-
149
- ```
150
- @inproceedings{lauscher2018b,
151
- title = {An argument-annotated corpus of scientific publications},
152
- booktitle = {Proceedings of the 5th Workshop on Mining Argumentation},
153
- publisher = {Association for Computational Linguistics},
154
- author = {Lauscher, Anne and Glava\v{s}, Goran and Ponzetto, Simone Paolo},
155
- address = {Brussels, Belgium},
156
- year = {2018},
157
- pages = {40–46}
158
- }
159
-
160
- ```
161
-
162
- ### Contributions
163
-
164
- Thanks to [@github-username](https://github.com/<github-username>) for adding this dataset.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
dataset_infos.json DELETED
@@ -1 +0,0 @@
1
- {"full": {"description": "This dataset is an extension of the Dr. Inventor corpus (Fisas et al., 2015, 2016) with an annotation layer containing \nfine-grained argumentative components and relations. It is the first argument-annotated corpus of scientific \npublications (in English), which allows for joint analyses of argumentation and other rhetorical dimensions of \nscientific writing.\n", "citation": "@inproceedings{lauscher2018b,\n title = {An argument-annotated corpus of scientific publications},\n booktitle = {Proceedings of the 5th Workshop on Mining Argumentation},\n publisher = {Association for Computational Linguistics},\n author = {Lauscher, Anne and Glava\u000b{s}, Goran and Ponzetto, Simone Paolo},\n address = {Brussels, Belgium},\n year = {2018},\n pages = {40\u201346}\n}\n", "homepage": "https://github.com/anlausch/ArguminSci", "license": "", "features": {"document_id": {"dtype": "string", "id": null, "_type": "Value"}, "text": {"dtype": "string", "id": null, "_type": "Value"}, "text_bound_annotations": [{"offsets": {"feature": [{"dtype": "int32", "id": null, "_type": "Value"}], "length": -1, "id": null, "_type": "Sequence"}, "text": {"dtype": "string", "id": null, "_type": "Value"}, "type": {"dtype": "string", "id": null, "_type": "Value"}, "id": {"dtype": "string", "id": null, "_type": "Value"}}], "relations": [{"id": {"dtype": "string", "id": null, "_type": "Value"}, "head": {"ref_id": {"dtype": "string", "id": null, "_type": "Value"}, "role": {"dtype": "string", "id": null, "_type": "Value"}}, "tail": {"ref_id": {"dtype": "string", "id": null, "_type": "Value"}, "role": {"dtype": "string", "id": null, "_type": "Value"}}, "type": {"dtype": "string", "id": null, "_type": "Value"}}]}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "sciarg", "config_name": "full", "version": "1.0.0", "splits": {"train": {"name": "train", "num_bytes": 3759081, "num_examples": 40, "dataset_name": "sciarg"}}, "download_checksums": {"http://data.dws.informatik.uni-mannheim.de/sci-arg/compiled_corpus.zip": {"num_bytes": 1129621, "checksum": "380274895b21a89c0e617d13e9d879e2a1ade64f8cc9a7657902debfe4156665"}}, "download_size": 1129621, "post_processing_size": null, "dataset_size": 3759081, "size_in_bytes": 4888702}}
 
 
full/sciarg-train.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:12dc70867bc92d2ecbe79a0e1eef28a3c36a6e4848d059afd5dce1eb6c26661e
3
+ size 1641604
sciarg.py DELETED
@@ -1,368 +0,0 @@
1
- import glob
2
- from dataclasses import dataclass
3
- from typing import Dict, List
4
- from pathlib import Path
5
-
6
- import datasets
7
-
8
-
9
- def remove_prefix(a: str, prefix: str) -> str:
10
- if a.startswith(prefix):
11
- a = a[len(prefix) :]
12
- return a
13
-
14
-
15
- def parse_brat_file(
16
- txt_file: Path,
17
- annotation_file_suffixes: List[str] = None,
18
- parse_notes: bool = False,
19
- ) -> Dict:
20
- """
21
- Parse a brat file into the schema defined below.
22
- `txt_file` should be the path to the brat '.txt' file you want to parse, e.g. 'data/1234.txt'
23
- Assumes that the annotations are contained in one or more of the corresponding '.a1', '.a2' or '.ann' files,
24
- e.g. 'data/1234.ann' or 'data/1234.a1' and 'data/1234.a2'.
25
- Will include annotator notes, when `parse_notes == True`.
26
- brat_features = datasets.Features(
27
- {
28
- "id": datasets.Value("string"),
29
- "document_id": datasets.Value("string"),
30
- "text": datasets.Value("string"),
31
- "text_bound_annotations": [ # T line in brat, e.g. type or event trigger
32
- {
33
- "offsets": datasets.Sequence([datasets.Value("int32")]),
34
- "text": datasets.Sequence(datasets.Value("string")),
35
- "type": datasets.Value("string"),
36
- "id": datasets.Value("string"),
37
- }
38
- ],
39
- "events": [ # E line in brat
40
- {
41
- "trigger": datasets.Value(
42
- "string"
43
- ), # refers to the text_bound_annotation of the trigger,
44
- "id": datasets.Value("string"),
45
- "type": datasets.Value("string"),
46
- "arguments": datasets.Sequence(
47
- {
48
- "role": datasets.Value("string"),
49
- "ref_id": datasets.Value("string"),
50
- }
51
- ),
52
- }
53
- ],
54
- "relations": [ # R line in brat
55
- {
56
- "id": datasets.Value("string"),
57
- "head": {
58
- "ref_id": datasets.Value("string"),
59
- "role": datasets.Value("string"),
60
- },
61
- "tail": {
62
- "ref_id": datasets.Value("string"),
63
- "role": datasets.Value("string"),
64
- },
65
- "type": datasets.Value("string"),
66
- }
67
- ],
68
- "equivalences": [ # Equiv line in brat
69
- {
70
- "id": datasets.Value("string"),
71
- "ref_ids": datasets.Sequence(datasets.Value("string")),
72
- }
73
- ],
74
- "attributes": [ # M or A lines in brat
75
- {
76
- "id": datasets.Value("string"),
77
- "type": datasets.Value("string"),
78
- "ref_id": datasets.Value("string"),
79
- "value": datasets.Value("string"),
80
- }
81
- ],
82
- "normalizations": [ # N lines in brat
83
- {
84
- "id": datasets.Value("string"),
85
- "type": datasets.Value("string"),
86
- "ref_id": datasets.Value("string"),
87
- "resource_name": datasets.Value(
88
- "string"
89
- ), # Name of the resource, e.g. "Wikipedia"
90
- "cuid": datasets.Value(
91
- "string"
92
- ), # ID in the resource, e.g. 534366
93
- "text": datasets.Value(
94
- "string"
95
- ), # Human readable description/name of the entity, e.g. "Barack Obama"
96
- }
97
- ],
98
- ### OPTIONAL: Only included when `parse_notes == True`
99
- "notes": [ # # lines in brat
100
- {
101
- "id": datasets.Value("string"),
102
- "type": datasets.Value("string"),
103
- "ref_id": datasets.Value("string"),
104
- "text": datasets.Value("string"),
105
- }
106
- ],
107
- },
108
- )
109
- """
110
-
111
- example = {}
112
- example["document_id"] = txt_file.with_suffix("").name
113
- with txt_file.open() as f:
114
- example["text"] = f.read()
115
-
116
- # If no specific suffixes of the to-be-read annotation files are given - take standard suffixes
117
- # for event extraction
118
- if annotation_file_suffixes is None:
119
- annotation_file_suffixes = [".a1", ".a2", ".ann"]
120
-
121
- if len(annotation_file_suffixes) == 0:
122
- raise AssertionError(
123
- "At least one suffix for the to-be-read annotation files should be given!"
124
- )
125
-
126
- ann_lines = []
127
- for suffix in annotation_file_suffixes:
128
- annotation_file = txt_file.with_suffix(suffix)
129
- if annotation_file.exists():
130
- with annotation_file.open() as f:
131
- ann_lines.extend(f.readlines())
132
-
133
- example["text_bound_annotations"] = []
134
- example["events"] = []
135
- example["relations"] = []
136
- example["equivalences"] = []
137
- example["attributes"] = []
138
- example["normalizations"] = []
139
-
140
- if parse_notes:
141
- example["notes"] = []
142
-
143
- for line in ann_lines:
144
- line = line.strip()
145
- if not line:
146
- continue
147
-
148
- if line.startswith("T"): # Text bound
149
- ann = {}
150
- fields = line.split("\t")
151
-
152
- ann["id"] = fields[0]
153
- ann["type"] = fields[1].split()[0]
154
- ann["offsets"] = []
155
- span_str = remove_prefix(fields[1], (ann["type"] + " "))
156
- text = fields[2]
157
- for span in span_str.split(";"):
158
- start, end = span.split()
159
- ann["offsets"].append([int(start), int(end)])
160
-
161
- # Heuristically split text of discontiguous entities into chunks
162
- ann["text"] = []
163
- if len(ann["offsets"]) > 1:
164
- i = 0
165
- for start, end in ann["offsets"]:
166
- chunk_len = end - start
167
- ann["text"].append(text[i : chunk_len + i])
168
- i += chunk_len
169
- while i < len(text) and text[i] == " ":
170
- i += 1
171
- else:
172
- ann["text"] = [text]
173
-
174
- example["text_bound_annotations"].append(ann)
175
-
176
- elif line.startswith("E"):
177
- ann = {}
178
- fields = line.split("\t")
179
-
180
- ann["id"] = fields[0]
181
-
182
- ann["type"], ann["trigger"] = fields[1].split()[0].split(":")
183
-
184
- ann["arguments"] = []
185
- for role_ref_id in fields[1].split()[1:]:
186
- argument = {
187
- "role": (role_ref_id.split(":"))[0],
188
- "ref_id": (role_ref_id.split(":"))[1],
189
- }
190
- ann["arguments"].append(argument)
191
-
192
- example["events"].append(ann)
193
-
194
- elif line.startswith("R"):
195
- ann = {}
196
- fields = line.split("\t")
197
-
198
- ann["id"] = fields[0]
199
- ann["type"] = fields[1].split()[0]
200
-
201
- ann["head"] = {
202
- "role": fields[1].split()[1].split(":")[0],
203
- "ref_id": fields[1].split()[1].split(":")[1],
204
- }
205
- ann["tail"] = {
206
- "role": fields[1].split()[2].split(":")[0],
207
- "ref_id": fields[1].split()[2].split(":")[1],
208
- }
209
-
210
- example["relations"].append(ann)
211
-
212
- # '*' seems to be the legacy way to mark equivalences,
213
- # but I couldn't find any info on the current way
214
- # this might have to be adapted dependent on the brat version
215
- # of the annotation
216
- elif line.startswith("*"):
217
- ann = {}
218
- fields = line.split("\t")
219
-
220
- ann["id"] = fields[0]
221
- ann["ref_ids"] = fields[1].split()[1:]
222
-
223
- example["equivalences"].append(ann)
224
-
225
- elif line.startswith("A") or line.startswith("M"):
226
- ann = {}
227
- fields = line.split("\t")
228
-
229
- ann["id"] = fields[0]
230
-
231
- info = fields[1].split()
232
- ann["type"] = info[0]
233
- ann["ref_id"] = info[1]
234
-
235
- if len(info) > 2:
236
- ann["value"] = info[2]
237
- else:
238
- ann["value"] = ""
239
-
240
- example["attributes"].append(ann)
241
-
242
- elif line.startswith("N"):
243
- ann = {}
244
- fields = line.split("\t")
245
-
246
- ann["id"] = fields[0]
247
- ann["text"] = fields[2]
248
-
249
- info = fields[1].split()
250
-
251
- ann["type"] = info[0]
252
- ann["ref_id"] = info[1]
253
- ann["resource_name"] = info[2].split(":")[0]
254
- ann["cuid"] = info[2].split(":")[1]
255
- example["normalizations"].append(ann)
256
-
257
- elif parse_notes and line.startswith("#"):
258
- ann = {}
259
- fields = line.split("\t")
260
-
261
- ann["id"] = fields[0]
262
- ann["text"] = fields[2] if len(fields) == 3 else None
263
-
264
- info = fields[1].split()
265
-
266
- ann["type"] = info[0]
267
- ann["ref_id"] = info[1]
268
- example["notes"].append(ann)
269
-
270
- return example
271
-
272
-
273
- _CITATION = """\
274
- @inproceedings{lauscher2018b,
275
- title = {An argument-annotated corpus of scientific publications},
276
- booktitle = {Proceedings of the 5th Workshop on Mining Argumentation},
277
- publisher = {Association for Computational Linguistics},
278
- author = {Lauscher, Anne and Glava\v{s}, Goran and Ponzetto, Simone Paolo},
279
- address = {Brussels, Belgium},
280
- year = {2018},
281
- pages = {40–46}
282
- }
283
- """
284
- _DESCRIPTION = """\
285
- The SciArg dataset is an extension of the Dr. Inventor corpus (Fisas et al., 2015, 2016) with an annotation layer containing
286
- fine-grained argumentative components and relations. It is the first argument-annotated corpus of scientific
287
- publications (in English), which allows for joint analyses of argumentation and other rhetorical dimensions of
288
- scientific writing.
289
- """
290
- _URL = "http://data.dws.informatik.uni-mannheim.de/sci-arg/compiled_corpus.zip"
291
- _HOMEPAGE = "https://github.com/anlausch/ArguminSci"
292
-
293
-
294
- @dataclass
295
- class SciArgConfig(datasets.BuilderConfig):
296
- data_url = _URL
297
- subdirectory_mapping = {"compiled_corpus": datasets.Split.TRAIN}
298
- filename_blacklist = [] #["A28"]
299
-
300
-
301
- class SciArg(datasets.GeneratorBasedBuilder):
302
- """Scientific Argument corpus"""
303
-
304
- DEFAULT_CONFIG_CLASS = SciArgConfig
305
-
306
- BUILDER_CONFIGS = [
307
- SciArgConfig(
308
- name="full",
309
- version="1.0.0",
310
- ),
311
- ]
312
-
313
- DEFAULT_CONFIG_NAME = "full"
314
-
315
- def _info(self) -> datasets.DatasetInfo:
316
- features = datasets.Features(
317
- {
318
- "document_id": datasets.Value("string"),
319
- "text": datasets.Value("string"),
320
- "text_bound_annotations": [
321
- {
322
- "offsets": datasets.Sequence([datasets.Value("int32")]),
323
- "text": datasets.Value("string"),
324
- "type": datasets.Value("string"),
325
- "id": datasets.Value("string"),
326
- }
327
- ],
328
- "relations": [
329
- {
330
- "id": datasets.Value("string"),
331
- "head": {
332
- "ref_id": datasets.Value("string"),
333
- "role": datasets.Value("string"),
334
- },
335
- "tail": {
336
- "ref_id": datasets.Value("string"),
337
- "role": datasets.Value("string"),
338
- },
339
- "type": datasets.Value("string"),
340
- }
341
- ],
342
- }
343
- )
344
-
345
- return datasets.DatasetInfo(
346
- description=_DESCRIPTION,
347
- features=features,
348
- homepage=_HOMEPAGE,
349
- citation=_CITATION,
350
- )
351
-
352
- def _split_generators(self, dl_manager) -> List[datasets.SplitGenerator]:
353
- """Returns SplitGenerators."""
354
- data_dir = self.config.data_dir or Path(dl_manager.download_and_extract(self.config.data_url))
355
-
356
- return [
357
- datasets.SplitGenerator(name=split, gen_kwargs={"filepath": data_dir / subdir})
358
- for subdir, split in self.config.subdirectory_mapping.items()
359
- ]
360
-
361
- def _generate_examples(self, filepath):
362
- for txt_file in glob.glob(filepath / "*.txt"):
363
-
364
- brat_parsed = parse_brat_file(Path(txt_file))
365
- if brat_parsed["document_id"] in self.config.filename_blacklist:
366
- continue
367
- relevant_subset = {f_name: brat_parsed[f_name] for f_name in self.info.features}
368
- yield brat_parsed["document_id"], relevant_subset