system HF staff commited on
Commit
6515582
0 Parent(s):

Update files from the datasets library (from 1.2.0)

Browse files

Release notes: https://github.com/huggingface/datasets/releases/tag/1.2.0

.gitattributes ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ *.bin.* filter=lfs diff=lfs merge=lfs -text
5
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.model filter=lfs diff=lfs merge=lfs -text
12
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
13
+ *.onnx filter=lfs diff=lfs merge=lfs -text
14
+ *.ot filter=lfs diff=lfs merge=lfs -text
15
+ *.parquet filter=lfs diff=lfs merge=lfs -text
16
+ *.pb filter=lfs diff=lfs merge=lfs -text
17
+ *.pt filter=lfs diff=lfs merge=lfs -text
18
+ *.pth filter=lfs diff=lfs merge=lfs -text
19
+ *.rar filter=lfs diff=lfs merge=lfs -text
20
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
21
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
22
+ *.tflite filter=lfs diff=lfs merge=lfs -text
23
+ *.tgz filter=lfs diff=lfs merge=lfs -text
24
+ *.xz filter=lfs diff=lfs merge=lfs -text
25
+ *.zip filter=lfs diff=lfs merge=lfs -text
26
+ *.zstandard filter=lfs diff=lfs merge=lfs -text
27
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,168 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ annotations_creators:
3
+ - expert-generated
4
+ language_creators:
5
+ - expert-generated
6
+ languages:
7
+ - en
8
+ licenses:
9
+ - mit
10
+ multilinguality:
11
+ - monolingual
12
+ size_categories:
13
+ - 10K<n<100K
14
+ source_datasets:
15
+ - original
16
+ task_categories:
17
+ - structure-prediction
18
+ task_ids:
19
+ - coreference-resolution
20
+ - named-entity-recognition
21
+ - parsing
22
+ ---
23
+
24
+ # Dataset Card for Wino_Bias dataset
25
+
26
+ ## Table of Contents
27
+ - [Dataset Description](#dataset-description)
28
+ - [Dataset Summary](#dataset-summary)
29
+ - [Supported Tasks](#supported-tasks-and-leaderboards)
30
+ - [Languages](#languages)
31
+ - [Dataset Structure](#dataset-structure)
32
+ - [Data Instances](#data-instances)
33
+ - [Data Fields](#data-instances)
34
+ - [Data Splits](#data-instances)
35
+ - [Dataset Creation](#dataset-creation)
36
+ - [Curation Rationale](#curation-rationale)
37
+ - [Source Data](#source-data)
38
+ - [Annotations](#annotations)
39
+ - [Personal and Sensitive Information](#personal-and-sensitive-information)
40
+ - [Considerations for Using the Data](#considerations-for-using-the-data)
41
+ - [Social Impact of Dataset](#social-impact-of-dataset)
42
+ - [Discussion of Biases](#discussion-of-biases)
43
+ - [Other Known Limitations](#other-known-limitations)
44
+ - [Additional Information](#additional-information)
45
+ - [Dataset Curators](#dataset-curators)
46
+ - [Licensing Information](#licensing-information)
47
+ - [Citation Information](#citation-information)
48
+
49
+ ## Dataset Description
50
+
51
+ - **Homepage:** [WinoBias](https://uclanlp.github.io/corefBias/overview)
52
+ - **Repository:**
53
+ - **Paper:** [Arxiv](https://arxiv.org/abs/1804.06876)
54
+ - **Leaderboard:**
55
+ - **Point of Contact:**
56
+
57
+ ### Dataset Summary
58
+
59
+ WinoBias, a Winograd-schema dataset for coreference resolution focused on gender bias.
60
+ The corpus contains Winograd-schema style sentences with entities corresponding to people
61
+ referred by their occupation (e.g. the nurse, the doctor, the carpenter).
62
+
63
+ ### Supported Tasks and Leaderboards
64
+
65
+ The underlying task is coreference resolution. But it also support NER and POS tasks.
66
+
67
+ ### Languages
68
+
69
+ English
70
+
71
+ ## Dataset Structure
72
+
73
+ ### Data Instances
74
+
75
+ [More Information Needed]
76
+
77
+ ### Data Fields
78
+
79
+ - document_id = This is a variation on the document filename
80
+ - part_number = Some files are divided into multiple parts numbered as 000, 001, 002, ... etc.
81
+ - word_num = This is the word index of the word in that sentence.
82
+ - tokens = This is the token as segmented/tokenized in the Treebank.
83
+ - pos_tags = This is the Penn Treebank style part of speech. When parse information is missing, all part of speeches except the one for which there is some sense or proposition annotation are marked with a XX tag. The verb is marked with just a VERB tag.
84
+ - parse_bit = This is the bracketed structure broken before the first open parenthesis in the parse, and the word/part-of-speech leaf replaced with a *. The full parse can be created by substituting the asterix with the "([pos] [word])" string (or leaf) and concatenating the items in the rows of that column. When the parse information is missing, the first word of a sentence is tagged as "(TOP*" and the last word is tagged as "*)" and all intermediate words are tagged with a "*".
85
+ - predicate_lemma = The predicate lemma is mentioned for the rows for which we have semantic role information or word sense information. All other rows are marked with a "-".
86
+ - predicate_framenet_id = This is the PropBank frameset ID of the predicate in predicate_lemma.
87
+ - word_sense = This is the word sense of the word in Column tokens.
88
+ - speaker = This is the speaker or author name where available.
89
+ - ner_tags = These columns identifies the spans representing various named entities. For documents which do not have named entity annotation, each line is represented with an "*".
90
+ - verbal_predicates = There is one column each of predicate argument structure information for the predicate mentioned in predicate_lemma. If there are no predicates tagged in a sentence this is a single column with all rows marked with an "*".
91
+
92
+ ### Data Splits
93
+
94
+ Single Split available
95
+
96
+ ## Dataset Creation
97
+
98
+ ### Curation Rationale
99
+
100
+ [More Information Needed]
101
+
102
+ ### Source Data
103
+
104
+ #### Initial Data Collection and Normalization
105
+
106
+ [More Information Needed]
107
+
108
+ #### Who are the source language producers?
109
+
110
+ [More Information Needed]
111
+
112
+ ### Annotations
113
+
114
+ #### Annotation process
115
+
116
+ [More Information Needed]
117
+
118
+ #### Who are the annotators?
119
+
120
+ [More Information Needed]
121
+
122
+ ### Personal and Sensitive Information
123
+
124
+ [More Information Needed]
125
+
126
+ ## Considerations for Using the Data
127
+
128
+ ### Social Impact of Dataset
129
+
130
+ [More Information Needed]
131
+
132
+ ### Discussion of Biases
133
+
134
+ Gender Bias is discussed with the help of this dataset.
135
+
136
+ ### Other Known Limitations
137
+
138
+ [More Information Needed]
139
+
140
+ ## Additional Information
141
+
142
+ ### Dataset Curators
143
+
144
+ [More Information Needed]
145
+
146
+ ### Licensing Information
147
+
148
+ MIT Licence
149
+
150
+ ### Citation Information
151
+
152
+ @article{DBLP:journals/corr/abs-1804-06876,
153
+ author = {Jieyu Zhao and
154
+ Tianlu Wang and
155
+ Mark Yatskar and
156
+ Vicente Ordonez and
157
+ Kai{-}Wei Chang},
158
+ title = {Gender Bias in Coreference Resolution: Evaluation and Debiasing Methods},
159
+ journal = {CoRR},
160
+ volume = {abs/1804.06876},
161
+ year = {2018},
162
+ url = {http://arxiv.org/abs/1804.06876},
163
+ archivePrefix = {arXiv},
164
+ eprint = {1804.06876},
165
+ timestamp = {Mon, 13 Aug 2018 16:47:01 +0200},
166
+ biburl = {https://dblp.org/rec/journals/corr/abs-1804-06876.bib},
167
+ bibsource = {dblp computer science bibliography, https://dblp.org}
168
+ }
dataset_infos.json ADDED
@@ -0,0 +1 @@
 
1
+ {"wino_bias": {"description": "WinoBias, a Winograd-schema dataset for coreference resolution focused on gender bias.\nThe corpus contains Winograd-schema style sentences with entities corresponding to people\nreferred by their occupation (e.g. the nurse, the doctor, the carpenter).\n", "citation": "@article{DBLP:journals/corr/abs-1804-06876,\n author = {Jieyu Zhao and\n Tianlu Wang and\n Mark Yatskar and\n Vicente Ordonez and\n Kai{-}Wei Chang},\n title = {Gender Bias in Coreference Resolution: Evaluation and Debiasing Methods},\n journal = {CoRR},\n volume = {abs/1804.06876},\n year = {2018},\n url = {http://arxiv.org/abs/1804.06876},\n archivePrefix = {arXiv},\n eprint = {1804.06876},\n timestamp = {Mon, 13 Aug 2018 16:47:01 +0200},\n biburl = {https://dblp.org/rec/journals/corr/abs-1804-06876.bib},\n bibsource = {dblp computer science bibliography, https://dblp.org}\n}\n", "homepage": "https://uclanlp.github.io/corefBias/overview", "license": "MIT License (https://github.com/uclanlp/corefBias/blob/master/LICENSE)", "features": {"document_id": {"dtype": "string", "id": null, "_type": "Value"}, "part_number": {"dtype": "string", "id": null, "_type": "Value"}, "word_number": {"feature": {"dtype": "int32", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "tokens": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "pos_tags": {"feature": {"num_classes": 54, "names": ["\"", "''", "#", "$", "(", ")", ",", ".", ":", "``", "CC", "CD", "DT", "EX", "FW", "IN", "JJ", "JJR", "JJS", "LS", "MD", "NN", "NNP", "NNPS", "NNS", "NN|SYM", "PDT", "POS", "PRP", "PRP$", "RB", "RBR", "RBS", "RP", "SYM", "TO", "UH", "VB", "VBD", "VBG", "VBN", "VBP", "VBZ", "WDT", "WP", "WP$", "WRB", "HYPH", "XX", "NFP", "AFX", "ADD", "-LRB-", "-RRB-"], "names_file": null, "id": null, "_type": "ClassLabel"}, "length": -1, "id": null, "_type": "Sequence"}, "parse_bit": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "predicate_lemma": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "predicate_framenet_id": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "word_sense": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "speaker": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "ner_tags": {"feature": {"num_classes": 38, "names": ["B-PERSON", "I-PERSON", "B-NORP", "I-NORP", "B-FAC", "I-FAC", "B-ORG", "I-ORG", "B-GPE", "I-GPE", "B-LOC", "I-LOC", "B-PRODUCT", "I-PRODUCT", "B-EVENT", "I-EVENT", "B-WORK_OF_ART", "I-WORK_OF_ART", "B-LAW", "I-LAW", "B-LANGUAGE", "I-LANGUAGE", "B-DATE", "I-DATE", "B-TIME", "I-TIME", "B-PERCENT", "I-PERCENT", "B-MONEY", "I-MONEY", "B-QUANTITY", "I-QUANTITY", "B-ORDINAL", "I-ORDINAL", "B-CARDINAL", "I-CARDINAL", "*", "0"], "names_file": null, "id": null, "_type": "ClassLabel"}, "length": -1, "id": null, "_type": "Sequence"}, "verbal_predicates": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}}, "post_processed": null, "supervised_keys": null, "builder_name": "wino_bias", "config_name": "wino_bias", "version": {"version_str": "4.0.0", "description": null, "major": 4, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 173899234, "num_examples": 150335, "dataset_name": "wino_bias"}}, "download_checksums": {"https://drive.google.com/uc?export=download&id=14Im3BnNl-d2fYETYmiH5yq6eFGLVC3g0": {"num_bytes": 268725744, "checksum": "139a6511bcb9761f6306bba7d151bde6ec7ec82cc9c593127b848df8af5f68a1"}}, "download_size": 268725744, "post_processing_size": null, "dataset_size": 173899234, "size_in_bytes": 442624978}}
dummy/wino_bias/4.0.0/dummy_data.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a5c20b4ec3916367f3f8b88384e3c6bde4aefdedfa670cbfb241f05e0156411c
3
+ size 764
wino_bias.py ADDED
@@ -0,0 +1,313 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ """WinoBias: Winograd-schema dataset for detecting gender bias"""
16
+
17
+ from __future__ import absolute_import, division, print_function
18
+
19
+ import datasets
20
+
21
+
22
+ _CITATION = """\
23
+ @article{DBLP:journals/corr/abs-1804-06876,
24
+ author = {Jieyu Zhao and
25
+ Tianlu Wang and
26
+ Mark Yatskar and
27
+ Vicente Ordonez and
28
+ Kai{-}Wei Chang},
29
+ title = {Gender Bias in Coreference Resolution: Evaluation and Debiasing Methods},
30
+ journal = {CoRR},
31
+ volume = {abs/1804.06876},
32
+ year = {2018},
33
+ url = {http://arxiv.org/abs/1804.06876},
34
+ archivePrefix = {arXiv},
35
+ eprint = {1804.06876},
36
+ timestamp = {Mon, 13 Aug 2018 16:47:01 +0200},
37
+ biburl = {https://dblp.org/rec/journals/corr/abs-1804-06876.bib},
38
+ bibsource = {dblp computer science bibliography, https://dblp.org}
39
+ }
40
+ """
41
+
42
+ _DESCRIPTION = """\
43
+ WinoBias, a Winograd-schema dataset for coreference resolution focused on gender bias.
44
+ The corpus contains Winograd-schema style sentences with entities corresponding to people
45
+ referred by their occupation (e.g. the nurse, the doctor, the carpenter).
46
+ """
47
+
48
+ _HOMEPAGE = "https://uclanlp.github.io/corefBias/overview"
49
+
50
+ _LICENSE = "MIT License (https://github.com/uclanlp/corefBias/blob/master/LICENSE)"
51
+
52
+ _URL = "https://drive.google.com/uc?export=download&id=14Im3BnNl-d2fYETYmiH5yq6eFGLVC3g0"
53
+
54
+
55
+ class WinoBias(datasets.GeneratorBasedBuilder):
56
+ """WinoBias: Winograd-schema dataset for detecting gender bias"""
57
+
58
+ VERSION = datasets.Version("4.0.0")
59
+
60
+ # This is an example of a dataset with multiple configurations.
61
+ # If you don't want/need to define several sub-sets in your dataset,
62
+ # just remove the BUILDER_CONFIG_CLASS and the BUILDER_CONFIGS attributes.
63
+
64
+ # If you need to make complex sub-parts in the datasets with configurable options
65
+ # You can create your own builder configuration class to store attribute, inheriting from datasets.BuilderConfig
66
+ # BUILDER_CONFIG_CLASS = MyBuilderConfig
67
+
68
+ # You will be able to load one or the other configurations in the following list with
69
+ # data = datasets.load_dataset('my_dataset', 'first_domain')
70
+ # data = datasets.load_dataset('my_dataset', 'second_domain')
71
+ BUILDER_CONFIGS = [
72
+ datasets.BuilderConfig(
73
+ name="wino_bias",
74
+ version=VERSION,
75
+ description="WinoBias: Winograd-schema dataset for detecting gender bias",
76
+ ),
77
+ ]
78
+
79
+ def _info(self):
80
+ return datasets.DatasetInfo(
81
+ # This is the description that will appear on the datasets page.
82
+ description=_DESCRIPTION,
83
+ # This defines the different columns of the dataset and their types
84
+ # Info about features for this: http://cemantix.org/data/ontonotes.html
85
+ features=datasets.Features(
86
+ {
87
+ "document_id": datasets.Value("string"),
88
+ "part_number": datasets.Value("string"),
89
+ "word_number": datasets.Sequence(datasets.Value("int32")),
90
+ "tokens": datasets.Sequence(datasets.Value("string")),
91
+ "pos_tags": datasets.Sequence(
92
+ datasets.features.ClassLabel(
93
+ names=[
94
+ '"',
95
+ "''",
96
+ "#",
97
+ "$",
98
+ "(",
99
+ ")",
100
+ ",",
101
+ ".",
102
+ ":",
103
+ "``",
104
+ "CC",
105
+ "CD",
106
+ "DT",
107
+ "EX",
108
+ "FW",
109
+ "IN",
110
+ "JJ",
111
+ "JJR",
112
+ "JJS",
113
+ "LS",
114
+ "MD",
115
+ "NN",
116
+ "NNP",
117
+ "NNPS",
118
+ "NNS",
119
+ "NN|SYM",
120
+ "PDT",
121
+ "POS",
122
+ "PRP",
123
+ "PRP$",
124
+ "RB",
125
+ "RBR",
126
+ "RBS",
127
+ "RP",
128
+ "SYM",
129
+ "TO",
130
+ "UH",
131
+ "VB",
132
+ "VBD",
133
+ "VBG",
134
+ "VBN",
135
+ "VBP",
136
+ "VBZ",
137
+ "WDT",
138
+ "WP",
139
+ "WP$",
140
+ "WRB",
141
+ "HYPH",
142
+ "XX",
143
+ "NFP",
144
+ "AFX",
145
+ "ADD",
146
+ "-LRB-",
147
+ "-RRB-",
148
+ ]
149
+ )
150
+ ),
151
+ "parse_bit": datasets.Sequence(datasets.Value("string")),
152
+ "predicate_lemma": datasets.Sequence(datasets.Value("string")),
153
+ "predicate_framenet_id": datasets.Sequence(datasets.Value("string")),
154
+ "word_sense": datasets.Sequence(datasets.Value("string")),
155
+ "speaker": datasets.Sequence(datasets.Value("string")),
156
+ "ner_tags": datasets.Sequence(
157
+ datasets.features.ClassLabel(
158
+ names=[
159
+ "B-PERSON",
160
+ "I-PERSON",
161
+ "B-NORP",
162
+ "I-NORP",
163
+ "B-FAC",
164
+ "I-FAC",
165
+ "B-ORG",
166
+ "I-ORG",
167
+ "B-GPE",
168
+ "I-GPE",
169
+ "B-LOC",
170
+ "I-LOC",
171
+ "B-PRODUCT",
172
+ "I-PRODUCT",
173
+ "B-EVENT",
174
+ "I-EVENT",
175
+ "B-WORK_OF_ART",
176
+ "I-WORK_OF_ART",
177
+ "B-LAW",
178
+ "I-LAW",
179
+ "B-LANGUAGE",
180
+ "I-LANGUAGE",
181
+ "B-DATE",
182
+ "I-DATE",
183
+ "B-TIME",
184
+ "I-TIME",
185
+ "B-PERCENT",
186
+ "I-PERCENT",
187
+ "B-MONEY",
188
+ "I-MONEY",
189
+ "B-QUANTITY",
190
+ "I-QUANTITY",
191
+ "B-ORDINAL",
192
+ "I-ORDINAL",
193
+ "B-CARDINAL",
194
+ "I-CARDINAL",
195
+ "*",
196
+ "0",
197
+ ]
198
+ )
199
+ ),
200
+ "verbal_predicates": datasets.Sequence(datasets.Value("string")),
201
+ }
202
+ ),
203
+ supervised_keys=None,
204
+ # Homepage of the dataset for documentation
205
+ homepage=_HOMEPAGE,
206
+ # License for the dataset if available
207
+ license=_LICENSE,
208
+ # Citation for the dataset
209
+ citation=_CITATION,
210
+ )
211
+
212
+ def _split_generators(self, dl_manager):
213
+ """Returns SplitGenerators."""
214
+ data_dir = dl_manager.download_and_extract(_URL)
215
+ return [
216
+ datasets.SplitGenerator(
217
+ name=datasets.Split.TRAIN,
218
+ # These kwargs will be passed to _generate_examples
219
+ gen_kwargs={"filepath": data_dir},
220
+ )
221
+ ]
222
+
223
+ def _generate_examples(self, filepath):
224
+ """ Yields examples. """
225
+ with open(filepath, encoding="utf-8") as f:
226
+ id_ = 0
227
+ document_id = None
228
+ part_number = 0
229
+ word_num = []
230
+ tokens = []
231
+ pos_tags = []
232
+ parse_bit = []
233
+ predicate_lemma = []
234
+ predicate_framenet_id = []
235
+ word_sense = []
236
+ speaker = []
237
+ ner_tags = []
238
+ ner_start = False
239
+ verbal_predicates = []
240
+ for line in f:
241
+ if line.startswith("#begin") or line.startswith("#end"):
242
+ continue
243
+ elif not line.strip():
244
+ id_ += 1
245
+ yield str(id_), {
246
+ "document_id": document_id,
247
+ "part_number": part_number,
248
+ "word_number": word_num,
249
+ "tokens": tokens,
250
+ "pos_tags": pos_tags,
251
+ "parse_bit": parse_bit,
252
+ "predicate_lemma": predicate_lemma,
253
+ "predicate_framenet_id": predicate_framenet_id,
254
+ "word_sense": word_sense,
255
+ "speaker": speaker,
256
+ "ner_tags": ner_tags,
257
+ "verbal_predicates": verbal_predicates,
258
+ }
259
+ word_num = []
260
+ tokens = []
261
+ pos_tags = []
262
+ parse_bit = []
263
+ predicate_lemma = []
264
+ predicate_framenet_id = []
265
+ word_sense = []
266
+ speaker = []
267
+ ner_tags = []
268
+ verbal_predicates = []
269
+ else:
270
+ splits = [s for s in line.split(" ") if s]
271
+ if len(splits) > 7:
272
+ document_id = splits[0]
273
+ part_number = splits[1]
274
+ word_num.append(splits[2])
275
+ tokens.append(splits[3])
276
+ pos_tags.append(splits[4])
277
+ parse_bit.append(splits[5])
278
+ predicate_lemma.append(splits[6])
279
+ predicate_framenet_id.append(splits[7])
280
+ word_sense.append(splits[8])
281
+ speaker.append(splits[9])
282
+ ner_word = splits[10]
283
+ if ")" in ner_word and ner_start:
284
+ ner_start = False
285
+ ner_word = "0"
286
+ if "(" in ner_word:
287
+ ner_start = True
288
+ ner_word = ner_word.strip(" ").replace("(", "B-").replace("*", "").replace(")", "")
289
+ start_word = ner_word.strip(" ").replace("B-", "")
290
+ if ner_start:
291
+ if ner_word.strip(" ") == "*":
292
+ ner_word = "I-" + start_word
293
+ ner_tags.append(ner_word)
294
+ word_is_verbal_predicate = any(["(V" in x for x in splits[11:-1]])
295
+ if word_is_verbal_predicate:
296
+ verbal_predicates.append(splits[3])
297
+ if tokens:
298
+ # add the last one
299
+ id_ += 1
300
+ yield str(id_), {
301
+ "document_id": document_id,
302
+ "part_number": part_number,
303
+ "word_number": word_num,
304
+ "tokens": tokens,
305
+ "pos_tags": pos_tags,
306
+ "parse_bit": parse_bit,
307
+ "predicate_lemma": predicate_lemma,
308
+ "predicate_framenet_id": predicate_framenet_id,
309
+ "word_sense": word_sense,
310
+ "speaker": speaker,
311
+ "ner_tags": ner_tags,
312
+ "verbal_predicates": verbal_predicates,
313
+ }