Datasets:

Modalities:
Text
Formats:
parquet
Sub-tasks:
text-scoring
Languages:
English
ArXiv:
Libraries:
Datasets
pandas
License:
albertvillanova HF staff commited on
Commit
a6e43f2
·
verified ·
1 Parent(s): ffbd71a

Convert dataset to Parquet (#2)

Browse files

- Convert dataset to Parquet (7ae0d04f68d22beb3620fd32d82724280f9e1ae4)
- Delete loading script (c8b61dc6669df9b682214a78893b8ff75e573008)

Files changed (3) hide show
  1. README.md +8 -3
  2. data/train-00000-of-00001.parquet +3 -0
  3. has_part.py +0 -117
README.md CHANGED
@@ -35,10 +35,15 @@ dataset_info:
35
  sequence: string
36
  splits:
37
  - name: train
38
- num_bytes: 4363417
39
  num_examples: 49848
40
- download_size: 7437382
41
- dataset_size: 4363417
 
 
 
 
 
42
  ---
43
 
44
  # Dataset Card for [HasPart]
 
35
  sequence: string
36
  splits:
37
  - name: train
38
+ num_bytes: 4363297
39
  num_examples: 49848
40
+ download_size: 2069997
41
+ dataset_size: 4363297
42
+ configs:
43
+ - config_name: default
44
+ data_files:
45
+ - split: train
46
+ path: data/train-*
47
  ---
48
 
49
  # Dataset Card for [HasPart]
data/train-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c45c18098ee6e2b2aef98dd9f2671cb6427a0973510e2c43fbea83e5aae3c96e
3
+ size 2069997
has_part.py DELETED
@@ -1,117 +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
- """This dataset is a new knowledge-base (KB) of hasPart relationships, extracted from a large corpus of generic statements. Complementary to other resources available, it is the first which is all three of: accurate (90% precision), salient (covers relationships a person may mention), and has high coverage of common terms (approximated as within a 10 year old’s vocabulary), as well as having several times more hasPart entries than in the popular ontologies ConceptNet and WordNet. In addition, it contains information about quantifiers, argument modifiers, and links the entities to appropriate concepts in Wikipedia and WordNet."""
16
-
17
-
18
- import ast
19
- from collections import defaultdict
20
-
21
- import datasets
22
-
23
-
24
- _CITATION = """\
25
- @misc{bhakthavatsalam2020dogs,
26
- title={Do Dogs have Whiskers? A New Knowledge Base of hasPart Relations},
27
- author={Sumithra Bhakthavatsalam and Kyle Richardson and Niket Tandon and Peter Clark},
28
- year={2020},
29
- eprint={2006.07510},
30
- archivePrefix={arXiv},
31
- primaryClass={cs.CL}
32
- }
33
- """
34
-
35
- _DESCRIPTION = """\
36
- This dataset is a new knowledge-base (KB) of hasPart relationships, extracted from a large corpus of generic statements. Complementary to other resources available, it is the first which is all three of: accurate (90% precision), salient (covers relationships a person may mention), and has high coverage of common terms (approximated as within a 10 year old’s vocabulary), as well as having several times more hasPart entries than in the popular ontologies ConceptNet and WordNet. In addition, it contains information about quantifiers, argument modifiers, and links the entities to appropriate concepts in Wikipedia and WordNet.
37
- """
38
-
39
- _HOMEPAGE = "https://allenai.org/data/haspartkb"
40
-
41
- _LICENSE = ""
42
-
43
-
44
- TSV_ID = "1Ev4RqWcPsLI9rgOGAKh-_dFKqcEZ1u-G"
45
- FOLDER_ID = "1NzjXX46NnpxtgxBrkBWFiUbsXAMdd-lB"
46
- ID = TSV_ID
47
-
48
- _URL = f"https://drive.google.com/uc?export=download&id={ID}"
49
-
50
-
51
- class HasPart(datasets.GeneratorBasedBuilder):
52
- def _info(self):
53
- features = datasets.Features(
54
- {
55
- "arg1": datasets.features.Value("string"),
56
- "arg2": datasets.features.Value("string"),
57
- "score": datasets.features.Value("float64"),
58
- "wikipedia_primary_page": datasets.features.Sequence(datasets.features.Value("string")),
59
- "synset": datasets.features.Sequence(datasets.features.Value("string")),
60
- }
61
- )
62
-
63
- return datasets.DatasetInfo(
64
- description=_DESCRIPTION,
65
- features=features,
66
- supervised_keys=None,
67
- homepage=_HOMEPAGE,
68
- license=_LICENSE,
69
- citation=_CITATION,
70
- )
71
-
72
- def _split_generators(self, dl_manager):
73
- """Returns SplitGenerators."""
74
-
75
- dl_fp = dl_manager.download_and_extract(_URL)
76
-
77
- return [
78
- datasets.SplitGenerator(
79
- name=datasets.Split.TRAIN,
80
- gen_kwargs={
81
- "input_file": dl_fp,
82
- "split": "train",
83
- },
84
- ),
85
- ]
86
-
87
- def _parse_metadata(self, md):
88
- """metadata is a list of dicts in the tsv file, hence needs to be parsed using
89
- ast.literal_eval to convert to python objects.
90
-
91
- Note that metadata resulting in parsing error will be skipped
92
- """
93
- md = ast.literal_eval(md)
94
- dd = defaultdict(list)
95
-
96
- for entry in md:
97
- try:
98
- for k, v in entry.items():
99
- dd[k].append(v)
100
- except AttributeError:
101
- continue
102
- return dd
103
-
104
- def _generate_examples(self, input_file, split):
105
- """Yields examples."""
106
- with open(input_file, encoding="utf-8") as f:
107
- for id_, line in enumerate(f):
108
- _, arg1, arg2, score, metadata = line.split("\t")
109
- metadata = self._parse_metadata(metadata)
110
- example = {
111
- "arg1": arg1,
112
- "arg2": arg2,
113
- "score": float(score),
114
- "wikipedia_primary_page": metadata["wikipedia_primary_page"],
115
- "synset": metadata["synset"],
116
- }
117
- yield id_, example