Datasets:
Tasks:
Text Retrieval
Sub-tasks:
document-retrieval
Languages:
English
Size:
1K<n<10K
ArXiv:
License:
Commit
•
d05205d
1
Parent(s):
0ec4114
Update parquet files
Browse files- .gitattributes +0 -37
- README.md +0 -291
- dataset_infos.json +0 -1
- default/tne-test.parquet +3 -0
- default/tne-test_ood.parquet +3 -0
- default/tne-train.parquet +3 -0
- default/tne-validation.parquet +3 -0
- tne.py +0 -210
.gitattributes
DELETED
@@ -1,37 +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 |
-
*.onnx filter=lfs diff=lfs merge=lfs -text
|
13 |
-
*.ot filter=lfs diff=lfs merge=lfs -text
|
14 |
-
*.parquet filter=lfs diff=lfs merge=lfs -text
|
15 |
-
*.pb filter=lfs diff=lfs merge=lfs -text
|
16 |
-
*.pt filter=lfs diff=lfs merge=lfs -text
|
17 |
-
*.pth filter=lfs diff=lfs merge=lfs -text
|
18 |
-
*.rar filter=lfs diff=lfs merge=lfs -text
|
19 |
-
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
20 |
-
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
21 |
-
*.tflite filter=lfs diff=lfs merge=lfs -text
|
22 |
-
*.tgz filter=lfs diff=lfs merge=lfs -text
|
23 |
-
*.wasm 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
|
28 |
-
# Audio files - uncompressed
|
29 |
-
*.pcm filter=lfs diff=lfs merge=lfs -text
|
30 |
-
*.sam filter=lfs diff=lfs merge=lfs -text
|
31 |
-
*.raw filter=lfs diff=lfs merge=lfs -text
|
32 |
-
# Audio files - compressed
|
33 |
-
*.aac filter=lfs diff=lfs merge=lfs -text
|
34 |
-
*.flac filter=lfs diff=lfs merge=lfs -text
|
35 |
-
*.mp3 filter=lfs diff=lfs merge=lfs -text
|
36 |
-
*.ogg filter=lfs diff=lfs merge=lfs -text
|
37 |
-
*.wav filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
README.md
DELETED
@@ -1,291 +0,0 @@
|
|
1 |
-
---
|
2 |
-
annotations_creators:
|
3 |
-
- crowdsourced
|
4 |
-
language_creators:
|
5 |
-
- found
|
6 |
-
language:
|
7 |
-
- en
|
8 |
-
license:
|
9 |
-
- mit
|
10 |
-
multilinguality:
|
11 |
-
- monolingual
|
12 |
-
pretty_name: Text-based NP Enrichment
|
13 |
-
size_categories:
|
14 |
-
- 1K<n<10K
|
15 |
-
source_datasets:
|
16 |
-
- original
|
17 |
-
task_categories:
|
18 |
-
- text-retrieval
|
19 |
-
task_ids:
|
20 |
-
- document-retrieval
|
21 |
-
dataset_info:
|
22 |
-
features:
|
23 |
-
- name: id
|
24 |
-
dtype: string
|
25 |
-
- name: text
|
26 |
-
dtype: string
|
27 |
-
- name: tokens
|
28 |
-
sequence: string
|
29 |
-
- name: nps
|
30 |
-
list:
|
31 |
-
- name: text
|
32 |
-
dtype: string
|
33 |
-
- name: first_char
|
34 |
-
dtype: int32
|
35 |
-
- name: last_char
|
36 |
-
dtype: int32
|
37 |
-
- name: first_token
|
38 |
-
dtype: int32
|
39 |
-
- name: last_token
|
40 |
-
dtype: int32
|
41 |
-
- name: id
|
42 |
-
dtype: string
|
43 |
-
- name: np_relations
|
44 |
-
list:
|
45 |
-
- name: anchor
|
46 |
-
dtype: string
|
47 |
-
- name: complement
|
48 |
-
dtype: string
|
49 |
-
- name: preposition
|
50 |
-
dtype:
|
51 |
-
class_label:
|
52 |
-
names:
|
53 |
-
0: about
|
54 |
-
1: for
|
55 |
-
2: with
|
56 |
-
3: from
|
57 |
-
4: among
|
58 |
-
5: by
|
59 |
-
6: 'on'
|
60 |
-
7: at
|
61 |
-
8: during
|
62 |
-
9: of
|
63 |
-
10: member(s) of
|
64 |
-
11: in
|
65 |
-
12: after
|
66 |
-
13: under
|
67 |
-
14: to
|
68 |
-
15: into
|
69 |
-
16: before
|
70 |
-
17: near
|
71 |
-
18: outside
|
72 |
-
19: around
|
73 |
-
20: between
|
74 |
-
21: against
|
75 |
-
22: over
|
76 |
-
23: inside
|
77 |
-
- name: complement_coref_cluster_id
|
78 |
-
dtype: string
|
79 |
-
- name: coref
|
80 |
-
list:
|
81 |
-
- name: id
|
82 |
-
dtype: string
|
83 |
-
- name: members
|
84 |
-
sequence: string
|
85 |
-
- name: np_type
|
86 |
-
dtype:
|
87 |
-
class_label:
|
88 |
-
names:
|
89 |
-
0: standard
|
90 |
-
1: time/date/measurement
|
91 |
-
2: idiomatic
|
92 |
-
- name: metadata
|
93 |
-
struct:
|
94 |
-
- name: annotators
|
95 |
-
struct:
|
96 |
-
- name: coref_worker
|
97 |
-
dtype: int32
|
98 |
-
- name: consolidator_worker
|
99 |
-
dtype: int32
|
100 |
-
- name: np-relations_worker
|
101 |
-
sequence: int32
|
102 |
-
- name: url
|
103 |
-
dtype: string
|
104 |
-
- name: source
|
105 |
-
dtype: string
|
106 |
-
splits:
|
107 |
-
- name: train
|
108 |
-
num_bytes: 41308170
|
109 |
-
num_examples: 3988
|
110 |
-
- name: validation
|
111 |
-
num_bytes: 5495419
|
112 |
-
num_examples: 500
|
113 |
-
- name: test
|
114 |
-
num_bytes: 2203716
|
115 |
-
num_examples: 500
|
116 |
-
- name: test_ood
|
117 |
-
num_bytes: 2249352
|
118 |
-
num_examples: 509
|
119 |
-
download_size: 14194578
|
120 |
-
dataset_size: 51256657
|
121 |
-
---
|
122 |
-
|
123 |
-
# Dataset Card for Text-based NP Enrichment
|
124 |
-
|
125 |
-
## Table of Contents
|
126 |
-
- [Dataset Description](#dataset-description)
|
127 |
-
- [Dataset Summary](#dataset-summary)
|
128 |
-
- [Supported Tasks](#supported-tasks-and-leaderboards)
|
129 |
-
- [Languages](#languages)
|
130 |
-
- [Dataset Structure](#dataset-structure)
|
131 |
-
- [Data Instances](#data-instances)
|
132 |
-
- [Data Fields](#data-instances)
|
133 |
-
- [Data Splits](#data-instances)
|
134 |
-
- [Dataset Creation](#dataset-creation)
|
135 |
-
- [Curation Rationale](#curation-rationale)
|
136 |
-
- [Source Data](#source-data)
|
137 |
-
- [Annotations](#annotations)
|
138 |
-
- [Personal and Sensitive Information](#personal-and-sensitive-information)
|
139 |
-
- [Considerations for Using the Data](#considerations-for-using-the-data)
|
140 |
-
- [Social Impact of Dataset](#social-impact-of-dataset)
|
141 |
-
- [Discussion of Biases](#discussion-of-biases)
|
142 |
-
- [Other Known Limitations](#other-known-limitations)
|
143 |
-
- [Additional Information](#additional-information)
|
144 |
-
- [Dataset Curators](#dataset-curators)
|
145 |
-
- [Licensing Information](#licensing-information)
|
146 |
-
- [Citation Information](#citation-information)
|
147 |
-
|
148 |
-
## Dataset Description
|
149 |
-
|
150 |
-
- **Homepage:** https://yanaiela.github.io/TNE/
|
151 |
-
- **Repository:** https://github.com/yanaiela/TNE
|
152 |
-
- **Paper:** https://arxiv.org/abs/2109.12085
|
153 |
-
- **Leaderboard:** [TNE OOD](https://leaderboard.allenai.org/tne-ood/submissions/public)
|
154 |
-
[TNE](https://leaderboard.allenai.org/tne/submissions/public)
|
155 |
-
- **Point of Contact:** [Yanai Elazar](mailto:yanaiela@gmail.com)
|
156 |
-
|
157 |
-
### Dataset Summary
|
158 |
-
|
159 |
-
Text-based NP Enrichment (TNE) is a natural language understanding (NLU) task, which focus on relations between noun phrases (NPs) that can be mediated via prepositions. The dataset contains 5,497 documents, annotated exhaustively with all possible links between the NPs in each document.
|
160 |
-
|
161 |
-
The main data comes from WikiNews, which is used for train/dev/test. We also collected an additional set of 509 documents to serve as out of distribution (OOD) data points, from the Book Corpus, IMDB reviews and Reddit.
|
162 |
-
|
163 |
-
### Supported Tasks and Leaderboards
|
164 |
-
|
165 |
-
The data contain both the main data for the TNE task, as well as coreference resolution data.
|
166 |
-
There are two leaderboards for the TNE data, one for the standard test set, and another one for the OOD test set:
|
167 |
-
- [TNE Leaderboard](https://leaderboard.allenai.org/tne/submissions/public)
|
168 |
-
- [TNE OOD Leaderboard](https://leaderboard.allenai.org/tne-ood/submissions/public)
|
169 |
-
|
170 |
-
### Languages
|
171 |
-
|
172 |
-
The text in the dataset is in English, as spoken in the different domains we include. The associated BCP-47 code is `en`.
|
173 |
-
|
174 |
-
## Dataset Structure
|
175 |
-
|
176 |
-
### Data Instances
|
177 |
-
|
178 |
-
The original files are in a jsonl format, containing a dictionary of a single document, in each line.
|
179 |
-
Each document contain a different amount of labels, due to the different amount of NPs.
|
180 |
-
The test and ood splits come without the annotated labels.
|
181 |
-
|
182 |
-
### Data Fields
|
183 |
-
|
184 |
-
A document consists of:
|
185 |
-
|
186 |
-
* `id`: a unique identifier of a document, beginning with `r` and followed by a number
|
187 |
-
* `text`: the text of the document. The title and subtitles (if exists) are separated with two new lines. The paragraphs
|
188 |
-
are separated by a single new line.
|
189 |
-
* `tokens`: a list of string, containing the tokenized tokens
|
190 |
-
* `nps`: a list of dictionaries, containing the following entries:
|
191 |
-
* `text`: the text of the np
|
192 |
-
* `start_index`: an integer indicating the starting index in the text
|
193 |
-
* `end_index`: an integer indicating the ending index in the text
|
194 |
-
* `start_token`: an integer indicating the first token of the np out of the tokenized tokens
|
195 |
-
* `end_token`: an integer indicating the last token of the np out of the tokenized tokens
|
196 |
-
* `id`: the id of the np
|
197 |
-
* `np_relations`: these are the relation labels of the document. It is a list of dictionaries, where each
|
198 |
-
dictionary contains:
|
199 |
-
* `anchor`: the id of the anchor np
|
200 |
-
* `complement`: the id of the complement np
|
201 |
-
* `preposition`: the preposition that links between the anchor and the complement. This can take one out of 24 pre-defined preposition (23 + member(s)-of)
|
202 |
-
* `complement_coref_cluster_id`: the coreference id, which the complement is part of.
|
203 |
-
* `coref`: the coreference labels. It contains a list of dictionaries, where each dictionary contains:
|
204 |
-
* `id`: the id of the coreference cluster
|
205 |
-
* `members`: the ids of the nps members of such cluster
|
206 |
-
* `np_type`: the type of cluster. It can be either
|
207 |
-
* `standard`: regular coreference cluster
|
208 |
-
* `time/date/measurement`: a time / date / measurement np. These will be singletons.
|
209 |
-
* `idiomatic`: an idiomatic expression
|
210 |
-
* `metadata`: metadata of the document. It contains the following:
|
211 |
-
* `annotators`: a dictionary with anonymized annotators id
|
212 |
-
* `coref_worker`: the coreference worker id
|
213 |
-
* `consolidator_worker`: the consolidator worker id
|
214 |
-
* `np-relations_worker`: the np relations worker id
|
215 |
-
* `url`: the url where the document was taken from (not always existing)
|
216 |
-
* `source`: the original file name where the document was taken from
|
217 |
-
|
218 |
-
|
219 |
-
### Data Splits
|
220 |
-
|
221 |
-
The dataset is spread across four files, for the four different splits: train, dev, test and test_ood.
|
222 |
-
Additional details on the data statistics can be found in the [paper](https://arxiv.org/abs/2109.12085)
|
223 |
-
|
224 |
-
## Dataset Creation
|
225 |
-
|
226 |
-
### Curation Rationale
|
227 |
-
|
228 |
-
TNE was build as a new task for language understanding, focusing on extracting relations between nouns, moderated by prepositions.
|
229 |
-
|
230 |
-
### Source Data
|
231 |
-
|
232 |
-
#### Initial Data Collection and Normalization
|
233 |
-
|
234 |
-
[Needs More Information]
|
235 |
-
|
236 |
-
#### Who are the source language producers?
|
237 |
-
|
238 |
-
[Needs More Information]
|
239 |
-
|
240 |
-
### Annotations
|
241 |
-
|
242 |
-
#### Annotation process
|
243 |
-
|
244 |
-
[Needs More Information]
|
245 |
-
|
246 |
-
#### Who are the annotators?
|
247 |
-
|
248 |
-
[Needs More Information]
|
249 |
-
|
250 |
-
### Personal and Sensitive Information
|
251 |
-
|
252 |
-
[Needs More Information]
|
253 |
-
|
254 |
-
## Considerations for Using the Data
|
255 |
-
|
256 |
-
### Social Impact of Dataset
|
257 |
-
|
258 |
-
[Needs More Information]
|
259 |
-
|
260 |
-
### Discussion of Biases
|
261 |
-
|
262 |
-
[Needs More Information]
|
263 |
-
|
264 |
-
### Other Known Limitations
|
265 |
-
|
266 |
-
[Needs More Information]
|
267 |
-
|
268 |
-
## Additional Information
|
269 |
-
|
270 |
-
### Dataset Curators
|
271 |
-
|
272 |
-
The dataset was created by Yanai Elazar, Victoria Basmov, Yoav Goldberg, Reut Tsarfaty, during work done at Bar-Ilan University, and AI2.
|
273 |
-
|
274 |
-
### Licensing Information
|
275 |
-
|
276 |
-
The data is released under the MIT license.
|
277 |
-
|
278 |
-
### Citation Information
|
279 |
-
|
280 |
-
```bibtex
|
281 |
-
@article{tne,
|
282 |
-
author = {Elazar, Yanai and Basmov, Victoria and Goldberg, Yoav and Tsarfaty, Reut},
|
283 |
-
title = "{Text-based NP Enrichment}",
|
284 |
-
journal = {Transactions of the Association for Computational Linguistics},
|
285 |
-
year = {2022},
|
286 |
-
}
|
287 |
-
```
|
288 |
-
|
289 |
-
### Contributions
|
290 |
-
|
291 |
-
Thanks to [@yanaiela](https://github.com/yanaiela), who is also the first author of the paper, for adding this dataset.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dataset_infos.json
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
{"default": {"description": "TNE is an NLU task, which focus on relations between noun phrases (NPs) that can be mediated via prepositions.\nThe dataset contains 5,497 documents, annotated exhaustively with all possible links between the NPs in each document.\n", "citation": "@article{tne,\n author = {Elazar, Yanai and Basmov, Victoria and Goldberg, Yoav and Tsarfaty, Reut},\n title = \"{Text-based NP Enrichment}\",\n journal = {Transactions of the Association for Computational Linguistics},\n year = {2022},\n}\n", "homepage": "https://yanaiela.github.io/TNE/", "license": "MIT", "features": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "text": {"dtype": "string", "id": null, "_type": "Value"}, "tokens": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "nps": [{"text": {"dtype": "string", "id": null, "_type": "Value"}, "first_char": {"dtype": "int32", "id": null, "_type": "Value"}, "last_char": {"dtype": "int32", "id": null, "_type": "Value"}, "first_token": {"dtype": "int32", "id": null, "_type": "Value"}, "last_token": {"dtype": "int32", "id": null, "_type": "Value"}, "id": {"dtype": "string", "id": null, "_type": "Value"}}], "np_relations": [{"anchor": {"dtype": "string", "id": null, "_type": "Value"}, "complement": {"dtype": "string", "id": null, "_type": "Value"}, "preposition": {"num_classes": 24, "names": ["about", "for", "with", "from", "among", "by", "on", "at", "during", "of", "member(s) of", "in", "after", "under", "to", "into", "before", "near", "outside", "around", "between", "against", "over", "inside"], "id": null, "_type": "ClassLabel"}, "complement_coref_cluster_id": {"dtype": "string", "id": null, "_type": "Value"}}], "coref": [{"id": {"dtype": "string", "id": null, "_type": "Value"}, "members": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "np_type": {"num_classes": 3, "names": ["standard", "time/date/measurement", "idiomatic"], "id": null, "_type": "ClassLabel"}}], "metadata": {"annotators": {"coref_worker": {"dtype": "int32", "id": null, "_type": "Value"}, "consolidator_worker": {"dtype": "int32", "id": null, "_type": "Value"}, "np-relations_worker": {"feature": {"dtype": "int32", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}}, "url": {"dtype": "string", "id": null, "_type": "Value"}, "source": {"dtype": "string", "id": null, "_type": "Value"}}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "tne_dataset", "config_name": "default", "version": {"version_str": "1.1.0", "description": null, "major": 1, "minor": 1, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 41308170, "num_examples": 3988, "dataset_name": "tne_dataset"}, "validation": {"name": "validation", "num_bytes": 5495419, "num_examples": 500, "dataset_name": "tne_dataset"}, "test": {"name": "test", "num_bytes": 2203716, "num_examples": 500, "dataset_name": "tne_dataset"}, "test_ood": {"name": "test_ood", "num_bytes": 2249352, "num_examples": 509, "dataset_name": "tne_dataset"}}, "download_checksums": {"https://github.com/yanaiela/TNE/raw/main/data/train-v1.1.jsonl.gz": {"num_bytes": 11135145, "checksum": "d616372e92e6334dfddaaca3c7898f7aeed7b8827c9821aa555ad1d1a8e8eb1c"}, "https://github.com/yanaiela/TNE/raw/main/data/dev-v1.1.jsonl.gz": {"num_bytes": 1466591, "checksum": "3f3e466330908270ee742725c6b68f92b3243b988aa8b8c9bfef69ad8e68fe14"}, "https://github.com/yanaiela/TNE/raw/main/data/test_unlabeled-v1.1.jsonl.gz": {"num_bytes": 781824, "checksum": "a461ef30beba25feefbb1777ecb42e63a1ce20f3675e2c551a442c393f4118c7"}, "https://github.com/yanaiela/TNE/raw/main/data/ood_unlabeled-v1.1.jsonl.gz": {"num_bytes": 811018, "checksum": "9278c13c381f1f3b6623e599086984695c00e31840c121c2053d3f466f2d2170"}}, "download_size": 14194578, "post_processing_size": null, "dataset_size": 51256657, "size_in_bytes": 65451235}}
|
|
|
|
default/tne-test.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:e8b56c61c0998f788bdf0224e1580bda638c441a8b0a26a75c40cb934466291d
|
3 |
+
size 824207
|
default/tne-test_ood.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:d754afe4e9ebc30701741a0447e20d7355e65389c36581f059735db49e14e39f
|
3 |
+
size 854094
|
default/tne-train.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:4f1b7b004b987d148faa06e47989b3e512e2570b3ec3dde3fca69a880ac1b41d
|
3 |
+
size 8262895
|
default/tne-validation.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:51d2fcbb6a0444a194b2a66ea0b5198b4fa04bae59c0ea1840b08bcc05fc5ba6
|
3 |
+
size 1095824
|
tne.py
DELETED
@@ -1,210 +0,0 @@
|
|
1 |
-
# Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
|
2 |
-
#
|
3 |
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
4 |
-
# you may not use this file except in compliance with the License.
|
5 |
-
# You may obtain a copy of the License at
|
6 |
-
#
|
7 |
-
# http://www.apache.org/licenses/LICENSE-2.0
|
8 |
-
#
|
9 |
-
# Unless required by applicable law or agreed to in writing, software
|
10 |
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
11 |
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12 |
-
# See the License for the specific language governing permissions and
|
13 |
-
# limitations under the License.
|
14 |
-
"""TNE: Text-based NP Enrichment"""
|
15 |
-
|
16 |
-
import json
|
17 |
-
|
18 |
-
import datasets
|
19 |
-
|
20 |
-
|
21 |
-
# Find for instance the citation on arxiv or on the dataset repo/website
|
22 |
-
_CITATION = """\
|
23 |
-
@article{tne,
|
24 |
-
author = {Elazar, Yanai and Basmov, Victoria and Goldberg, Yoav and Tsarfaty, Reut},
|
25 |
-
title = "{Text-based NP Enrichment}",
|
26 |
-
journal = {Transactions of the Association for Computational Linguistics},
|
27 |
-
year = {2022},
|
28 |
-
}
|
29 |
-
"""
|
30 |
-
|
31 |
-
# You can copy an official description
|
32 |
-
_DESCRIPTION = """\
|
33 |
-
TNE is an NLU task, which focus on relations between noun phrases (NPs) that can be mediated via prepositions.
|
34 |
-
The dataset contains 5,497 documents, annotated exhaustively with all possible links between the NPs in each document.
|
35 |
-
"""
|
36 |
-
|
37 |
-
_HOMEPAGE = "https://yanaiela.github.io/TNE/"
|
38 |
-
|
39 |
-
_LICENSE = "MIT"
|
40 |
-
|
41 |
-
_VERSION = "v1.1"
|
42 |
-
|
43 |
-
# The HuggingFace Datasets library doesn't host the datasets but only points to the original files.
|
44 |
-
# This can be an arbitrary nested dict/list of URLs (see below in `_split_generators` method)
|
45 |
-
_URL = "https://github.com/yanaiela/TNE/raw/main/data/"
|
46 |
-
_URLS = {
|
47 |
-
"train": _URL + f"train-{_VERSION}.jsonl.gz",
|
48 |
-
"dev": _URL + f"dev-{_VERSION}.jsonl.gz",
|
49 |
-
"test_unlabeled": _URL + f"test_unlabeled-{_VERSION}.jsonl.gz",
|
50 |
-
"ood_unlabeled": _URL + f"ood_unlabeled-{_VERSION}.jsonl.gz",
|
51 |
-
}
|
52 |
-
|
53 |
-
|
54 |
-
class TNEDataset(datasets.GeneratorBasedBuilder):
|
55 |
-
"""TNE: Text-based NP Enrichment"""
|
56 |
-
|
57 |
-
VERSION = datasets.Version("1.1.0")
|
58 |
-
|
59 |
-
def _info(self):
|
60 |
-
features = datasets.Features(
|
61 |
-
{
|
62 |
-
"id": datasets.Value("string"),
|
63 |
-
"text": datasets.Value("string"),
|
64 |
-
"tokens": datasets.Sequence(datasets.Value("string")),
|
65 |
-
"nps": [
|
66 |
-
{
|
67 |
-
"text": datasets.Value("string"),
|
68 |
-
"first_char": datasets.Value("int32"),
|
69 |
-
"last_char": datasets.Value("int32"),
|
70 |
-
"first_token": datasets.Value("int32"),
|
71 |
-
"last_token": datasets.Value("int32"),
|
72 |
-
"id": datasets.Value("string"),
|
73 |
-
}
|
74 |
-
],
|
75 |
-
"np_relations": [
|
76 |
-
{
|
77 |
-
"anchor": datasets.Value("string"),
|
78 |
-
"complement": datasets.Value("string"),
|
79 |
-
"preposition": datasets.features.ClassLabel(
|
80 |
-
names=[
|
81 |
-
"about",
|
82 |
-
"for",
|
83 |
-
"with",
|
84 |
-
"from",
|
85 |
-
"among",
|
86 |
-
"by",
|
87 |
-
"on",
|
88 |
-
"at",
|
89 |
-
"during",
|
90 |
-
"of",
|
91 |
-
"member(s) of",
|
92 |
-
"in",
|
93 |
-
"after",
|
94 |
-
"under",
|
95 |
-
"to",
|
96 |
-
"into",
|
97 |
-
"before",
|
98 |
-
"near",
|
99 |
-
"outside",
|
100 |
-
"around",
|
101 |
-
"between",
|
102 |
-
"against",
|
103 |
-
"over",
|
104 |
-
"inside",
|
105 |
-
]
|
106 |
-
),
|
107 |
-
"complement_coref_cluster_id": datasets.Value("string"),
|
108 |
-
}
|
109 |
-
],
|
110 |
-
"coref": [
|
111 |
-
{
|
112 |
-
"id": datasets.Value("string"),
|
113 |
-
"members": datasets.Sequence(datasets.Value("string")),
|
114 |
-
"np_type": datasets.features.ClassLabel(
|
115 |
-
names=[
|
116 |
-
"standard",
|
117 |
-
"time/date/measurement",
|
118 |
-
"idiomatic",
|
119 |
-
]
|
120 |
-
),
|
121 |
-
}
|
122 |
-
],
|
123 |
-
"metadata": {
|
124 |
-
"annotators": {
|
125 |
-
"coref_worker": datasets.Value("int32"),
|
126 |
-
"consolidator_worker": datasets.Value("int32"),
|
127 |
-
"np-relations_worker": datasets.Sequence(datasets.Value("int32")),
|
128 |
-
},
|
129 |
-
"url": datasets.Value("string"),
|
130 |
-
"source": datasets.Value("string"),
|
131 |
-
},
|
132 |
-
}
|
133 |
-
)
|
134 |
-
|
135 |
-
return datasets.DatasetInfo(
|
136 |
-
# This is the description that will appear on the datasets page.
|
137 |
-
description=_DESCRIPTION,
|
138 |
-
# This defines the different columns of the dataset and their types
|
139 |
-
features=features, # Here we define them above because they are different between the two configurations
|
140 |
-
# If there's a common (input, target) tuple from the features, uncomment supervised_keys line below and
|
141 |
-
# specify them. They'll be used if as_supervised=True in builder.as_dataset.
|
142 |
-
# supervised_keys=("sentence", "label"),
|
143 |
-
# Homepage of the dataset for documentation
|
144 |
-
homepage=_HOMEPAGE,
|
145 |
-
# License for the dataset if available
|
146 |
-
license=_LICENSE,
|
147 |
-
# Citation for the dataset
|
148 |
-
citation=_CITATION,
|
149 |
-
)
|
150 |
-
|
151 |
-
def _split_generators(self, dl_manager):
|
152 |
-
urls = _URLS
|
153 |
-
data_dir = dl_manager.download_and_extract(urls)
|
154 |
-
|
155 |
-
return [
|
156 |
-
datasets.SplitGenerator(
|
157 |
-
name=datasets.Split.TRAIN,
|
158 |
-
# These kwargs will be passed to _generate_examples
|
159 |
-
gen_kwargs={
|
160 |
-
"filepath": data_dir["train"],
|
161 |
-
"split": "train",
|
162 |
-
},
|
163 |
-
),
|
164 |
-
datasets.SplitGenerator(
|
165 |
-
name=datasets.Split.VALIDATION,
|
166 |
-
# These kwargs will be passed to _generate_examples
|
167 |
-
gen_kwargs={
|
168 |
-
"filepath": data_dir["dev"],
|
169 |
-
"split": "dev",
|
170 |
-
},
|
171 |
-
),
|
172 |
-
datasets.SplitGenerator(
|
173 |
-
name=datasets.Split.TEST,
|
174 |
-
# These kwargs will be passed to _generate_examples
|
175 |
-
gen_kwargs={"filepath": data_dir["test_unlabeled"], "split": "test_unlabeled"},
|
176 |
-
),
|
177 |
-
datasets.SplitGenerator(
|
178 |
-
name=datasets.Split("test_ood"),
|
179 |
-
# These kwargs will be passed to _generate_examples
|
180 |
-
gen_kwargs={"filepath": data_dir["ood_unlabeled"], "split": "ood_unlabeled"},
|
181 |
-
),
|
182 |
-
]
|
183 |
-
|
184 |
-
# method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
|
185 |
-
def _generate_examples(self, filepath, split):
|
186 |
-
# The `key` is for legacy reasons (tfds) and is not important in itself, but must be unique for each example.
|
187 |
-
with open(filepath, "r", encoding="utf-8") as f:
|
188 |
-
for key, row in enumerate(f):
|
189 |
-
data = json.loads(row)
|
190 |
-
|
191 |
-
ex_id = data["id"]
|
192 |
-
text = data["text"]
|
193 |
-
tokens = data["tokens"]
|
194 |
-
nps = data["nps"]
|
195 |
-
if split in ["test_unlabeled", "ood_unlabeled"]:
|
196 |
-
np_relations = []
|
197 |
-
else:
|
198 |
-
np_relations = data["np_relations"]
|
199 |
-
coref = data["coref"]
|
200 |
-
metadata = data["metadata"]
|
201 |
-
|
202 |
-
yield key, {
|
203 |
-
"id": ex_id,
|
204 |
-
"text": text,
|
205 |
-
"tokens": tokens,
|
206 |
-
"nps": nps,
|
207 |
-
"np_relations": np_relations,
|
208 |
-
"coref": coref,
|
209 |
-
"metadata": metadata,
|
210 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|