Datasets:

Tasks:
Other
Modalities:
Text
Formats:
parquet
Languages:
English
ArXiv:
Libraries:
Datasets
Dask
License:
parquet-converter commited on
Commit
c8d889e
1 Parent(s): 4b387a0

Update parquet files

Browse files
README.md DELETED
@@ -1,302 +0,0 @@
1
- ---
2
- annotations_creators:
3
- - machine-generated
4
- language_creators:
5
- - found
6
- language:
7
- - en
8
- license:
9
- - cc-by-4.0
10
- multilinguality:
11
- - monolingual
12
- size_categories:
13
- - 10K<n<100K
14
- - 1M<n<10M
15
- source_datasets:
16
- - original
17
- task_categories:
18
- - other
19
- task_ids: []
20
- paperswithcode_id: genericskb
21
- pretty_name: GenericsKB
22
- configs:
23
- - generics_kb
24
- - generics_kb_best
25
- - generics_kb_simplewiki
26
- - generics_kb_waterloo
27
- tags:
28
- - knowledge-base
29
- dataset_info:
30
- - config_name: generics_kb_best
31
- features:
32
- - name: source
33
- dtype: string
34
- - name: term
35
- dtype: string
36
- - name: quantifier_frequency
37
- dtype: string
38
- - name: quantifier_number
39
- dtype: string
40
- - name: generic_sentence
41
- dtype: string
42
- - name: score
43
- dtype: float64
44
- splits:
45
- - name: train
46
- num_bytes: 99897719
47
- num_examples: 1020868
48
- download_size: 94850525
49
- dataset_size: 99897719
50
- - config_name: generics_kb
51
- features:
52
- - name: source
53
- dtype: string
54
- - name: term
55
- dtype: string
56
- - name: quantifier_frequency
57
- dtype: string
58
- - name: quantifier_number
59
- dtype: string
60
- - name: generic_sentence
61
- dtype: string
62
- - name: score
63
- dtype: float64
64
- splits:
65
- - name: train
66
- num_bytes: 348158966
67
- num_examples: 3433000
68
- download_size: 343284785
69
- dataset_size: 348158966
70
- - config_name: generics_kb_simplewiki
71
- features:
72
- - name: source_name
73
- dtype: string
74
- - name: sentence
75
- dtype: string
76
- - name: sentences_before
77
- sequence: string
78
- - name: sentences_after
79
- sequence: string
80
- - name: concept_name
81
- dtype: string
82
- - name: quantifiers
83
- sequence: string
84
- - name: id
85
- dtype: string
86
- - name: bert_score
87
- dtype: float64
88
- - name: headings
89
- sequence: string
90
- - name: categories
91
- sequence: string
92
- splits:
93
- - name: train
94
- num_bytes: 10039355
95
- num_examples: 12765
96
- download_size: 16437369
97
- dataset_size: 10039355
98
- - config_name: generics_kb_waterloo
99
- features:
100
- - name: source_name
101
- dtype: string
102
- - name: sentence
103
- dtype: string
104
- - name: sentences_before
105
- sequence: string
106
- - name: sentences_after
107
- sequence: string
108
- - name: concept_name
109
- dtype: string
110
- - name: quantifiers
111
- sequence: string
112
- - name: id
113
- dtype: string
114
- - name: bert_score
115
- dtype: float64
116
- splits:
117
- - name: train
118
- num_bytes: 4277214701
119
- num_examples: 3666725
120
- download_size: 0
121
- dataset_size: 4277214701
122
- ---
123
-
124
- # Dataset Card for Generics KB
125
-
126
- ## Table of Contents
127
- - [Dataset Description](#dataset-description)
128
- - [Dataset Summary](#dataset-summary)
129
- - [Supported Tasks and Leaderboards](#supported-tasks-and-leaderboards)
130
- - [Languages](#languages)
131
- - [Dataset Structure](#dataset-structure)
132
- - [Data Instances](#data-instances)
133
- - [Data Fields](#data-fields)
134
- - [Data Splits](#data-splits)
135
- - [Dataset Creation](#dataset-creation)
136
- - [Curation Rationale](#curation-rationale)
137
- - [Source Data](#source-data)
138
- - [Annotations](#annotations)
139
- - [Personal and Sensitive Information](#personal-and-sensitive-information)
140
- - [Considerations for Using the Data](#considerations-for-using-the-data)
141
- - [Social Impact of Dataset](#social-impact-of-dataset)
142
- - [Discussion of Biases](#discussion-of-biases)
143
- - [Other Known Limitations](#other-known-limitations)
144
- - [Additional Information](#additional-information)
145
- - [Dataset Curators](#dataset-curators)
146
- - [Licensing Information](#licensing-information)
147
- - [Citation Information](#citation-information)
148
- - [Contributions](#contributions)
149
-
150
- ## Dataset Description
151
-
152
- - **Homepage:** [Homepage](https://allenai.org/data/genericskb)
153
- - **Repository:** [Repository](https://drive.google.com/drive/folders/1vqfVXhJXJWuiiXbUa4rZjOgQoJvwZUoT)
154
- - **Paper:** [Paper](https://arxiv.org/pdf/2005.00660.pdf)
155
- - **Point of Contact:**[Sumithra Bhakthavatsalam]([email protected])
156
- [Chloe Anastasiades]([email protected])
157
- [Peter Clark]([email protected])
158
- Alternatively email_at [email protected]
159
-
160
-
161
- ### Dataset Summary
162
-
163
- Dataset contains a large (3.5M+ sentence) knowledge base of *generic sentences*. This is the first large resource to contain *naturally occurring* generic sentences, rich in high-quality, general, semantically complete statements. All GenericsKB sentences are annotated with their topical term, surrounding context (sentences), and a (learned) confidence. We also release GenericsKB-Best (1M+ sentences), containing the best-quality generics in GenericsKB augmented with selected, synthesized generics from WordNet and ConceptNet. This demonstrates that GenericsKB can be a useful resource for NLP applications, as well as providing data for linguistic studies of generics and their semantics.
164
-
165
- ### Supported Tasks and Leaderboards
166
-
167
- [More Information Needed]
168
-
169
- ### Languages
170
-
171
- The dataset is in English.
172
-
173
- ## Dataset Structure
174
-
175
- ### Data Instances
176
-
177
- The GENERICSKB contains 3,433,000 sentences. GENERICS-KB-BEST comprises of GENERICSKB generics with a score > 0.234, augmented with short generics synthesized from three other resources for all the terms (generic categories) in GENERICSKB- BEST. GENERICSKB-BEST contains 1,020,868 generics (774,621 from GENERICSKB plus 246,247 synthesized).
178
- SimpleWikipedia is a filtered scrape of SimpleWikipedia pages (simple.wikipedia.org). The Waterloo corpus is 280GB of English plain text, gathered by Charles Clarke (Univ. Waterloo) using a webcrawler in 2001 from .edu domains.
179
-
180
- ###### Sample SimpleWikipedia/ Waterloo config look like this
181
- ```
182
- {'source_name': 'SimpleWikipedia', 'sentence': 'Sepsis happens when the bacterium enters the blood and make it form tiny clots.', 'sentences_before': [], 'sentences_after': [], 'concept_name': 'sepsis', 'quantifiers': {}, 'id': 'SimpleWikipedia--tmp-sw-rs1-with-bug-fixes-initialprocessing-inputs-articles-with-clean-sentences-jsonl-c27816b298e1e0b5326916ee4e2fd0f1603caa77-100-Bubonic-plague--Different-kinds-of-the-same-disease--Septicemic-plague-0-0-039fbe9c11adde4ff9a829376ca7e0ed-1560874903-47882-/Users/chloea/Documents/aristo/commonsense/kbs/simplewikipedia/commonsense-filtered-good-rs1.jsonl-1f33b1e84018a2b1bfdf446f9a6491568b5585da-1561086091.8220549', 'bert_score': 0.8396177887916565}
183
- ```
184
- ###### Sample instance for Generics KB datasets look like this:
185
- ```
186
- {'source': 'Waterloo', 'term': 'aardvark', 'quantifier_frequency': '', 'quantifier_number': '', 'generic_sentence': 'Aardvarks are very gentle animals.', 'score': '0.36080607771873474'}
187
- {'source': 'TupleKB', 'term': 'aardvark', 'quantifier_frequency': '', 'quantifier_number': '', 'generic_sentence': 'Aardvarks dig burrows.', 'score': '1.0'}
188
- ```
189
- ### Data Fields
190
-
191
- The fields in GenericsKB-Best.tsv and GenericsKB.tsv are as follows:
192
- - `SOURCE`: denotes the source of the generic
193
- - `TERM`: denotes the category that is the topic of the generic.
194
- - `GENERIC SENTENCE`: is the sentence itself.
195
- - `SCORE`: Is the BERT-trained score, measuring the degree to which the generic represents a "useful, general truth" about the world (as judged by crowdworkers). Score ranges from 0 (worst) to 1 (best). Sentences with scores below 0.23 (corresponding to an "unsure" vote by crowdworkers) are in GenericsKB, but are not part of GenericsKB-Best due to their unreliability.
196
- - `QUANTIFIER_FREQUENCY`:For generics with explicit quantifiers (all, most, etc.) the quantifier is listed - Frequency contains values such as 'usually', 'often', 'frequently'
197
- - `QUANTIFIER_NUMBER`: For generics with explicit quantifiers (all, most, etc.) with values such as 'all'|'any'|'most'|'much'|'some' etc...
198
-
199
- The SimpleWiki/Waterloo generics from GenericsKB.tsv, but expanded to also include their surrounding context (before/after sentences). The Waterloo generics are the majority of GenericsKB. This zip file is 1.4GB expanding to 5.5GB.
200
- There is a json representation for every generic statement in the Generics KB. The generic statement is stored under the `sentence` field within the `knowledge` object. There is also a `bert_score` associated with each sentence which is the BERT-based classifier's score for the 'genericness' of the statement. This score is meant to reflect how much generalized world knowledge/commonsense the statement captures vs only being contextually meaningful.
201
- Detailed description of each of the fields:
202
-
203
- - `source_name`: The name of the corpus the generic statement was picked from.
204
- - `sentence`: The generic sentence.
205
- - `sentences_before`: Provides context information surrounding the generic statement from the original corpus.Up to five sentences preceding the generic sentence in the original corpus.
206
- - `sentences_after`: Up to five sentences following the generic sentence in the original corpus.
207
- - `concept_name`: A concept that is the subject of the generic statement.
208
- - `quantifiers`: The quantifiers for the key concept of the generic statement. There can be multiple quantifiers to allow for statements such as "All bats sometimes fly", where 'all' and 'sometimes' are both quantifiers reflecting number and frequency respectively.
209
- - `id`: Unique identifier for a generic statement in the kb.
210
- - `bert_score`: Score for the generic statement from the BERT-based generics classifier.
211
- <br>**Additional fields that apply only to SimpleWiki dataset**
212
- - `headings`: A breadcrumb of section/subsection headings from the top down to the location of the generic statement in the corpus. It applies to SimpleWikipedia which has a hierarchical structure.
213
- - `categories`:The listed categories under which the source article falls. Applies to SimpleWikipedia.
214
-
215
-
216
- ### Data Splits
217
-
218
- There are no splits.
219
-
220
- ## Dataset Creation
221
-
222
- ### Curation Rationale
223
-
224
- [More Information Needed]
225
-
226
- ### Source Data
227
-
228
- #### Initial Data Collection and Normalization
229
-
230
- Data was crawled. SimpleWikipedia is a filtered scrape of SimpleWikipedia pages (simple.wikipedia.org). The Waterloo corpus is 280GB of English plain text, gathered by Charles Clarke (Univ. Waterloo) using a webcrawler in 2001 from .edu domains.
231
-
232
- #### Who are the source language producers?
233
-
234
- [More Information Needed]
235
-
236
- ### Annotations
237
-
238
- #### Annotation process
239
-
240
- Bert was used to decide whether the sentence is useful or not. Every sentence has a bert score.
241
-
242
- #### Who are the annotators?
243
-
244
- No annotations were made.
245
-
246
- ### Personal and Sensitive Information
247
-
248
- [More Information Needed]
249
-
250
- ## Considerations for Using the Data
251
-
252
- ### Social Impact of Dataset
253
-
254
- [More Information Needed]
255
-
256
- ### Discussion of Biases
257
-
258
- [More Information Needed]
259
-
260
- ### Other Known Limitations
261
-
262
- [More Information Needed]
263
-
264
- ## Additional Information
265
-
266
- ### Dataset Curators
267
-
268
- [More Information Needed]
269
-
270
- ### Licensing Information
271
-
272
- The GenericsKB is available under the Creative Commons - Attribution 4.0 International - licence.
273
-
274
- As an informal summary, from https://creativecommons.org/licenses/by/4.0/, you are free to:
275
-
276
- Share ― copy and redistribute the material in any medium or format
277
- Adapt ― remix, transform, and build upon the material for any purpose, even commercially.
278
-
279
- under the following terms:
280
-
281
- Attribution ― You must give appropriate credit, provide a link to the license, and
282
- indicate if changes were made. You may do so in any reasonable manner,
283
- but not in any way that suggests the licensor endorses you or your use.
284
- No additional restrictions ― You may not apply legal terms or technological measures
285
- that legally restrict others from doing anything the license permits.
286
-
287
- For details, see https://creativecommons.org/licenses/by/4.0/ or the or the included
288
- file "Creative Commons ― Attribution 4.0 International ― CC BY 4.0.pdf" in this folder.
289
-
290
- ### Citation Information
291
- ```
292
- @InProceedings{huggingface:dataset,
293
- title = {GenericsKB: A Knowledge Base of Generic Statements},
294
- authors={Sumithra Bhakthavatsalam, Chloe Anastasiades, Peter Clark},
295
- year={2020},
296
- publisher = {Allen Institute for AI},
297
- }
298
- ```
299
-
300
- ### Contributions
301
-
302
- Thanks to [@bpatidar](https://github.com/bpatidar) for adding this dataset.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
dataset_infos.json DELETED
@@ -1 +0,0 @@
1
- {"generics_kb_best": {"description": "The GenericsKB contains 3.4M+ generic sentences about the world, i.e., sentences expressing general truths such as \"Dogs bark,\" and \"Trees remove carbon dioxide from the atmosphere.\" Generics are potentially useful as a knowledge source for AI systems requiring general world knowledge. The GenericsKB is the first large-scale resource containing naturally occurring generic sentences (as opposed to extracted or crowdsourced triples), and is rich in high-quality, general, semantically complete statements. Generics were primarily extracted from three large text sources, namely the Waterloo Corpus, selected parts of Simple Wikipedia, and the ARC Corpus. A filtered, high-quality subset is also available in GenericsKB-Best, containing 1,020,868 sentences. We recommend you start with GenericsKB-Best.\n", "citation": "@InProceedings{huggingface:dataset,\ntitle = {GenericsKB: A Knowledge Base of Generic Statements},\nauthors={Sumithra Bhakthavatsalam, Chloe Anastasiades, Peter Clark},\nyear={2020},\npublisher = {Allen Institute for AI},\n}\n", "homepage": "https://allenai.org/data/genericskb", "license": "cc-by-4.0", "features": {"source": {"dtype": "string", "id": null, "_type": "Value"}, "term": {"dtype": "string", "id": null, "_type": "Value"}, "quantifier_frequency": {"dtype": "string", "id": null, "_type": "Value"}, "quantifier_number": {"dtype": "string", "id": null, "_type": "Value"}, "generic_sentence": {"dtype": "string", "id": null, "_type": "Value"}, "score": {"dtype": "float64", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "builder_name": "generics_kb", "config_name": "generics_kb_best", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 99897719, "num_examples": 1020868, "dataset_name": "generics_kb"}}, "download_checksums": {"https://drive.google.com/u/0/uc?id=12DfIzoWyHIQqssgUgDvz3VG8_ScSh6ng&export=download": {"num_bytes": 94850525, "checksum": "0668b23c8b1579b6a76fcf48e04f3c9ea039ca9048a26848151d689deabb75e2"}}, "download_size": 94850525, "post_processing_size": null, "dataset_size": 99897719, "size_in_bytes": 194748244}, "generics_kb": {"description": "The GenericsKB contains 3.4M+ generic sentences about the world, i.e., sentences expressing general truths such as \"Dogs bark,\" and \"Trees remove carbon dioxide from the atmosphere.\" Generics are potentially useful as a knowledge source for AI systems requiring general world knowledge. The GenericsKB is the first large-scale resource containing naturally occurring generic sentences (as opposed to extracted or crowdsourced triples), and is rich in high-quality, general, semantically complete statements. Generics were primarily extracted from three large text sources, namely the Waterloo Corpus, selected parts of Simple Wikipedia, and the ARC Corpus. A filtered, high-quality subset is also available in GenericsKB-Best, containing 1,020,868 sentences. We recommend you start with GenericsKB-Best.\n", "citation": "@InProceedings{huggingface:dataset,\ntitle = {GenericsKB: A Knowledge Base of Generic Statements},\nauthors={Sumithra Bhakthavatsalam, Chloe Anastasiades, Peter Clark},\nyear={2020},\npublisher = {Allen Institute for AI},\n}\n", "homepage": "https://allenai.org/data/genericskb", "license": "cc-by-4.0", "features": {"source": {"dtype": "string", "id": null, "_type": "Value"}, "term": {"dtype": "string", "id": null, "_type": "Value"}, "quantifier_frequency": {"dtype": "string", "id": null, "_type": "Value"}, "quantifier_number": {"dtype": "string", "id": null, "_type": "Value"}, "generic_sentence": {"dtype": "string", "id": null, "_type": "Value"}, "score": {"dtype": "float64", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "builder_name": "generics_kb", "config_name": "generics_kb", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 348158966, "num_examples": 3433000, "dataset_name": "generics_kb"}}, "download_checksums": {"https://drive.google.com/u/0/uc?id=1UOIEzQTid7SzKx2tbwSSPxl7g-CjpoZa&export=download": {"num_bytes": 343284785, "checksum": "7ec2419e700b3425129032f75f0bb01887bdb84231526468751d6cc2a9b9e61e"}}, "download_size": 343284785, "post_processing_size": null, "dataset_size": 348158966, "size_in_bytes": 691443751}, "generics_kb_simplewiki": {"description": "The GenericsKB contains 3.4M+ generic sentences about the world, i.e., sentences expressing general truths such as \"Dogs bark,\" and \"Trees remove carbon dioxide from the atmosphere.\" Generics are potentially useful as a knowledge source for AI systems requiring general world knowledge. The GenericsKB is the first large-scale resource containing naturally occurring generic sentences (as opposed to extracted or crowdsourced triples), and is rich in high-quality, general, semantically complete statements. Generics were primarily extracted from three large text sources, namely the Waterloo Corpus, selected parts of Simple Wikipedia, and the ARC Corpus. A filtered, high-quality subset is also available in GenericsKB-Best, containing 1,020,868 sentences. We recommend you start with GenericsKB-Best.\n", "citation": "@InProceedings{huggingface:dataset,\ntitle = {GenericsKB: A Knowledge Base of Generic Statements},\nauthors={Sumithra Bhakthavatsalam, Chloe Anastasiades, Peter Clark},\nyear={2020},\npublisher = {Allen Institute for AI},\n}\n", "homepage": "https://allenai.org/data/genericskb", "license": "cc-by-4.0", "features": {"source_name": {"dtype": "string", "id": null, "_type": "Value"}, "sentence": {"dtype": "string", "id": null, "_type": "Value"}, "sentences_before": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "sentences_after": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "concept_name": {"dtype": "string", "id": null, "_type": "Value"}, "quantifiers": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "id": {"dtype": "string", "id": null, "_type": "Value"}, "bert_score": {"dtype": "float64", "id": null, "_type": "Value"}, "headings": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "categories": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}}, "post_processed": null, "supervised_keys": null, "builder_name": "generics_kb", "config_name": "generics_kb_simplewiki", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 10039355, "num_examples": 12765, "dataset_name": "generics_kb"}}, "download_checksums": {"https://drive.google.com/u/0/uc?id=1SpN9Qc7XRy5xs4tIfXkcLOEAP2IVaK15&export=download": {"num_bytes": 16437369, "checksum": "f6c0da9c9100172e8979907448497717d8ea1a50ee96aa2b81e447423c6cd0bb"}}, "download_size": 16437369, "post_processing_size": null, "dataset_size": 10039355, "size_in_bytes": 26476724}, "generics_kb_waterloo": {"description": "The GenericsKB contains 3.4M+ generic sentences about the world, i.e., sentences expressing general truths such as \"Dogs bark,\" and \"Trees remove carbon dioxide from the atmosphere.\" Generics are potentially useful as a knowledge source for AI systems requiring general world knowledge. The GenericsKB is the first large-scale resource containing naturally occurring generic sentences (as opposed to extracted or crowdsourced triples), and is rich in high-quality, general, semantically complete statements. Generics were primarily extracted from three large text sources, namely the Waterloo Corpus, selected parts of Simple Wikipedia, and the ARC Corpus. A filtered, high-quality subset is also available in GenericsKB-Best, containing 1,020,868 sentences. We recommend you start with GenericsKB-Best.\n", "citation": "@InProceedings{huggingface:dataset,\ntitle = {GenericsKB: A Knowledge Base of Generic Statements},\nauthors={Sumithra Bhakthavatsalam, Chloe Anastasiades, Peter Clark},\nyear={2020},\npublisher = {Allen Institute for AI},\n}\n", "homepage": "https://allenai.org/data/genericskb", "license": "cc-by-4.0", "features": {"source_name": {"dtype": "string", "id": null, "_type": "Value"}, "sentence": {"dtype": "string", "id": null, "_type": "Value"}, "sentences_before": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "sentences_after": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "concept_name": {"dtype": "string", "id": null, "_type": "Value"}, "quantifiers": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "id": {"dtype": "string", "id": null, "_type": "Value"}, "bert_score": {"dtype": "float64", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "builder_name": "generics_kb", "config_name": "generics_kb_waterloo", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 4277214701, "num_examples": 3666725, "dataset_name": "generics_kb"}}, "download_checksums": {}, "download_size": 0, "post_processing_size": null, "dataset_size": 4277214701, "size_in_bytes": 4277214701}}
 
 
generics_kb.py DELETED
@@ -1,231 +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
- """Generics KB: A Knowledge Base of Generic Statements"""
16
-
17
-
18
- import ast
19
- import csv
20
- import os
21
-
22
- import datasets
23
-
24
-
25
- # TODO: Add BibTeX citation
26
- # Find for instance the citation on arxiv or on the dataset repo/website
27
- _CITATION = """\
28
- @InProceedings{huggingface:dataset,
29
- title = {GenericsKB: A Knowledge Base of Generic Statements},
30
- authors={Sumithra Bhakthavatsalam, Chloe Anastasiades, Peter Clark},
31
- year={2020},
32
- publisher = {Allen Institute for AI},
33
- }
34
- """
35
-
36
- _DESCRIPTION = """\
37
- The GenericsKB contains 3.4M+ generic sentences about the world, i.e., sentences expressing general truths such as "Dogs bark," and "Trees remove carbon dioxide from the atmosphere." Generics are potentially useful as a knowledge source for AI systems requiring general world knowledge. The GenericsKB is the first large-scale resource containing naturally occurring generic sentences (as opposed to extracted or crowdsourced triples), and is rich in high-quality, general, semantically complete statements. Generics were primarily extracted from three large text sources, namely the Waterloo Corpus, selected parts of Simple Wikipedia, and the ARC Corpus. A filtered, high-quality subset is also available in GenericsKB-Best, containing 1,020,868 sentences. We recommend you start with GenericsKB-Best.
38
- """
39
-
40
- _HOMEPAGE = "https://allenai.org/data/genericskb"
41
-
42
- _LICENSE = "cc-by-4.0"
43
-
44
- _URL = "https://drive.google.com/u/0/uc?id={0}&export=download"
45
-
46
- _FILEPATHS = {
47
- "generics_kb_best": _URL.format("12DfIzoWyHIQqssgUgDvz3VG8_ScSh6ng"),
48
- "generics_kb": _URL.format("1UOIEzQTid7SzKx2tbwSSPxl7g-CjpoZa"),
49
- "generics_kb_simplewiki": _URL.format("1SpN9Qc7XRy5xs4tIfXkcLOEAP2IVaK15"),
50
- "generics_kb_waterloo": "cskb-waterloo-06-21-with-bert-scores.jsonl",
51
- }
52
-
53
-
54
- class GenericsKb(datasets.GeneratorBasedBuilder):
55
- """The GenericsKB is the first large-scale resource containing naturally occurring generic sentences, and is rich in high-quality, general, semantically complete statements."""
56
-
57
- VERSION = datasets.Version("1.0.0")
58
-
59
- BUILDER_CONFIGS = [
60
- datasets.BuilderConfig(
61
- name="generics_kb_best",
62
- version=VERSION,
63
- description="This is the default and recommended config.Comprises of GENERICSKB generics with a score > 0.234 ",
64
- ),
65
- datasets.BuilderConfig(
66
- name="generics_kb", version=VERSION, description="This GENERICSKB that contains 3,433,000 sentences."
67
- ),
68
- datasets.BuilderConfig(
69
- name="generics_kb_simplewiki",
70
- version=VERSION,
71
- description="SimpleWikipedia is a filtered scrape of SimpleWikipedia pages (simple.wikipedia.org)",
72
- ),
73
- datasets.BuilderConfig(
74
- name="generics_kb_waterloo",
75
- version=VERSION,
76
- description="The Waterloo corpus is 280GB of English plain text, gathered by Charles Clarke (Univ. Waterloo) using a webcrawler in 2001 from .edu domains.",
77
- ),
78
- ]
79
-
80
- @property
81
- def manual_download_instructions(self):
82
- return """\
83
- You need to manually download the files needed for the dataset config generics_kb_waterloo. The other configs like generics_kb_best don't need manual downloads.
84
- The <path/to/folder> can e.g. be `~/Downloads/GenericsKB`. Download the following required files from https://drive.google.com/drive/folders/1vqfVXhJXJWuiiXbUa4rZjOgQoJvwZUoT
85
- For working on "generics_kb_waterloo" data,
86
- 1. Manually download 'GenericsKB-Waterloo-WithContext.jsonl.zip' into your <path/to/folder>.Please ensure the filename is as is.
87
- The Waterloo is also generics from GenericsKB.tsv, but expanded to also include their surrounding context (before/after sentences). The Waterloo generics are the majority of GenericsKB. This zip file is 1.4GB expanding to 5.5GB.
88
- 2. Extract the GenericsKB-Waterloo-WithContext.jsonl.zip; It will create a file of 5.5 GB called cskb-waterloo-06-21-with-bert-scores.jsonl.
89
- Ensure you move this file into your <path/to/folder>.
90
-
91
- generics_kb can then be loaded using the following commands based on which data you want to work on. Data files must be present in the <path/to/folder> if using "generics_kb_waterloo" config.
92
- 1. `datasets.load_dataset("generics_kb","generics_kb_best")`.
93
- 2. `datasets.load_dataset("generics_kb","generics_kb")`
94
- 3. `datasets.load_dataset("generics_kb","generics_kb_simplewiki")`
95
- 4. `datasets.load_dataset("generics_kb","generics_kb_waterloo", data_dir="<path/to/folder>")`
96
-
97
- """
98
-
99
- DEFAULT_CONFIG_NAME = "generics_kb_best"
100
-
101
- def _info(self):
102
- if self.config.name == "generics_kb_waterloo" or self.config.name == "generics_kb_simplewiki":
103
-
104
- featuredict = {
105
- "source_name": datasets.Value("string"),
106
- "sentence": datasets.Value("string"),
107
- "sentences_before": datasets.Sequence(datasets.Value("string")),
108
- "sentences_after": datasets.Sequence(datasets.Value("string")),
109
- "concept_name": datasets.Value("string"),
110
- "quantifiers": datasets.Sequence(datasets.Value("string")),
111
- "id": datasets.Value("string"),
112
- "bert_score": datasets.Value("float64"),
113
- }
114
- if self.config.name == "generics_kb_simplewiki":
115
- featuredict["headings"] = datasets.Sequence(datasets.Value("string"))
116
- featuredict["categories"] = datasets.Sequence(datasets.Value("string"))
117
-
118
- features = datasets.Features(featuredict)
119
-
120
- else:
121
-
122
- features = datasets.Features(
123
- {
124
- "source": datasets.Value("string"),
125
- "term": datasets.Value("string"),
126
- "quantifier_frequency": datasets.Value("string"),
127
- "quantifier_number": datasets.Value("string"),
128
- "generic_sentence": datasets.Value("string"),
129
- "score": datasets.Value("float64"),
130
- }
131
- )
132
-
133
- return datasets.DatasetInfo(
134
- # This is the description that will appear on the datasets page.
135
- description=_DESCRIPTION,
136
- # This defines the different columns of the dataset and their types
137
- features=features, # Here we define them above because they are different between the two configurations
138
- # If there's a common (input, target) tuple from the features,
139
- # specify them here. They'll be used if as_supervised=True in
140
- # builder.as_dataset.
141
- supervised_keys=None,
142
- # Homepage of the dataset for documentation
143
- homepage=_HOMEPAGE,
144
- # License for the dataset if available
145
- license=_LICENSE,
146
- # Citation for the dataset
147
- citation=_CITATION,
148
- )
149
-
150
- def _split_generators(self, dl_manager):
151
-
152
- if self.config.name == "generics_kb_waterloo":
153
- data_dir = os.path.abspath(os.path.expanduser(dl_manager.manual_dir))
154
- # check if manual folder exists
155
- if not os.path.exists(data_dir):
156
- raise FileNotFoundError(
157
- f"{data_dir} does not exist. Make sure you insert a manual dir via `datasets.load_dataset('generics_kb', data_dir=...)`. Manual download instructions: {self.manual_download_instructions})"
158
- )
159
-
160
- # Check if required files exist in the folder
161
- filepath = os.path.join(data_dir, _FILEPATHS[self.config.name])
162
-
163
- if not os.path.exists(filepath):
164
- raise FileNotFoundError(
165
- f"{filepath} does not exist. Make sure you required files are present in {data_dir} `. Manual download instructions: {self.manual_download_instructions})"
166
- )
167
- else:
168
- filepath = dl_manager.download(_FILEPATHS[self.config.name])
169
-
170
- return [
171
- datasets.SplitGenerator(
172
- name=datasets.Split.TRAIN,
173
- # These kwargs will be passed to _generate_examples
174
- gen_kwargs={
175
- "filepath": filepath,
176
- },
177
- ),
178
- ]
179
-
180
- def _generate_examples(self, filepath):
181
- """Yields examples."""
182
-
183
- if self.config.name == "generics_kb_waterloo" or self.config.name == "generics_kb_simplewiki":
184
-
185
- with open(filepath, encoding="utf-8") as f:
186
- for id_, row in enumerate(f):
187
- data = ast.literal_eval(row)
188
-
189
- result = {
190
- "source_name": data["source"]["name"],
191
- "sentence": data["knowledge"]["sentence"],
192
- "sentences_before": data["knowledge"]["context"]["sentences_before"],
193
- "sentences_after": data["knowledge"]["context"]["sentences_after"],
194
- "concept_name": data["knowledge"]["key_concepts"][0]["concept_name"],
195
- "quantifiers": data["knowledge"]["key_concepts"][0]["quantifiers"],
196
- "id": data["id"],
197
- "bert_score": data["bert_score"],
198
- }
199
- if self.config.name == "generics_kb_simplewiki":
200
- result["headings"] = data["knowledge"]["context"]["headings"]
201
- result["categories"] = data["knowledge"]["context"]["categories"]
202
-
203
- yield id_, result
204
- else:
205
-
206
- with open(filepath, encoding="utf-8") as f:
207
- # Skip the header
208
- next(f)
209
-
210
- read_tsv = csv.reader(f, delimiter="\t")
211
-
212
- for id_, row in enumerate(read_tsv):
213
-
214
- quantifier = row[2]
215
- quantifier_frequency = ""
216
- quantifier_number = ""
217
-
218
- if quantifier != "":
219
- quantifier = ast.literal_eval(quantifier)
220
- if "frequency" in quantifier.keys():
221
- quantifier_frequency = quantifier["frequency"]
222
- if "number" in quantifier.keys():
223
- quantifier_number = quantifier["number"]
224
- yield id_, {
225
- "source": row[0],
226
- "term": row[1],
227
- "quantifier_frequency": quantifier_frequency,
228
- "quantifier_number": quantifier_number,
229
- "generic_sentence": row[3],
230
- "score": row[4],
231
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
generics_kb_simplewiki/generics_kb-train.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6b094220d4f883a5d052fb5d76c92fa428c5dd65c85bd155354763a2c7adb2d3
3
+ size 3895349