Commit
•
c36ff88
0
Parent(s):
Update files from the datasets library (from 1.3.0)
Browse filesRelease notes: https://github.com/huggingface/datasets/releases/tag/1.3.0
- .gitattributes +27 -0
- README.md +170 -0
- dataset_infos.json +1 -0
- dummy/1.0.0/dummy_data.zip +3 -0
- freebase_qa.py +141 -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,170 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
annotations_creators:
|
3 |
+
- crowdsourced
|
4 |
+
language_creators:
|
5 |
+
- found
|
6 |
+
languages:
|
7 |
+
- en
|
8 |
+
licenses:
|
9 |
+
- unknown
|
10 |
+
multilinguality:
|
11 |
+
- monolingual
|
12 |
+
size_categories:
|
13 |
+
- 10K<n<100K
|
14 |
+
source_datasets:
|
15 |
+
- extended|trivia_qa
|
16 |
+
task_categories:
|
17 |
+
- question-answering
|
18 |
+
task_ids:
|
19 |
+
- open-domain-qa
|
20 |
+
---
|
21 |
+
|
22 |
+
# Dataset Card for FreebaseQA
|
23 |
+
|
24 |
+
## Table of Contents
|
25 |
+
- [Dataset Description](#dataset-description)
|
26 |
+
- [Dataset Summary](#dataset-summary)
|
27 |
+
- [Supported Tasks](#supported-tasks-and-leaderboards)
|
28 |
+
- [Languages](#languages)
|
29 |
+
- [Dataset Structure](#dataset-structure)
|
30 |
+
- [Data Instances](#data-instances)
|
31 |
+
- [Data Fields](#data-fields)
|
32 |
+
- [Data Splits](#data-splits)
|
33 |
+
- [Dataset Creation](#dataset-creation)
|
34 |
+
- [Curation Rationale](#curation-rationale)
|
35 |
+
- [Source Data](#source-data)
|
36 |
+
- [Annotations](#annotations)
|
37 |
+
- [Personal and Sensitive Information](#personal-and-sensitive-information)
|
38 |
+
- [Considerations for Using the Data](#considerations-for-using-the-data)
|
39 |
+
- [Social Impact of Dataset](#social-impact-of-dataset)
|
40 |
+
- [Discussion of Biases](#discussion-of-biases)
|
41 |
+
- [Other Known Limitations](#other-known-limitations)
|
42 |
+
- [Additional Information](#additional-information)
|
43 |
+
- [Dataset Curators](#dataset-curators)
|
44 |
+
- [Licensing Information](#licensing-information)
|
45 |
+
- [Citation Information](#citation-information)
|
46 |
+
- [Contributions](#contributions)
|
47 |
+
|
48 |
+
## Dataset Description
|
49 |
+
|
50 |
+
- **Homepage:**
|
51 |
+
- **Repository: [FreebaseQA repository](https://github.com/kelvin-jiang/FreebaseQA)**
|
52 |
+
- **Paper: [FreebaseQA ACL paper](https://www.aclweb.org/anthology/N19-1028.pdf)**
|
53 |
+
- **Leaderboard:**
|
54 |
+
- **Point of Contact: [Kelvin Jiang](https://github.com/kelvin-jiang)**
|
55 |
+
|
56 |
+
### Dataset Summary
|
57 |
+
|
58 |
+
FreebaseQA is a dataset for open-domain factoid question answering (QA) tasks over structured knowledge bases, like Freebase.
|
59 |
+
|
60 |
+
### Supported Tasks and Leaderboards
|
61 |
+
|
62 |
+
[More Information Needed]
|
63 |
+
|
64 |
+
### Languages
|
65 |
+
|
66 |
+
English
|
67 |
+
|
68 |
+
## Dataset Structure
|
69 |
+
|
70 |
+
### Data Instances
|
71 |
+
|
72 |
+
Here is an example from the dataset:
|
73 |
+
|
74 |
+
```
|
75 |
+
{'Parses': {'Answers': [{'AnswersMid': ['m.01npcx'], 'AnswersName': [['goldeneye']]}, {'AnswersMid': ['m.01npcx'], 'AnswersName': [['goldeneye']]}], 'InferentialChain': ['film.film_character.portrayed_in_films..film.performance.film', 'film.actor.film..film.performance.film'], 'Parse-Id': ['FreebaseQA-train-0.P0', 'FreebaseQA-train-0.P1'], 'PotentialTopicEntityMention': ['007', 'pierce brosnan'], 'TopicEntityMid': ['m.0clpml', 'm.018p4y'], 'TopicEntityName': ['james bond', 'pierce brosnan']}, 'ProcessedQuestion': "what was pierce brosnan's first outing as 007", 'Question-ID': 'FreebaseQA-train-0', 'RawQuestion': "What was Pierce Brosnan's first outing as 007?"}
|
76 |
+
```
|
77 |
+
|
78 |
+
### Data Fields
|
79 |
+
- `Question-ID`: a `string` feature representing ID of each question.
|
80 |
+
- `RawQuestion`: a `string` feature representing the original question collected from data sources.
|
81 |
+
- `ProcessedQuestion`: a `string` feature representing the question processed with some operations such as removal of trailing question mark and decapitalization.
|
82 |
+
- `Parses`: a dictionary feature representing the semantic parse(s) for the question containing:
|
83 |
+
- `Parse-Id`: a `string` feature representing the ID of each semantic parse.
|
84 |
+
- `PotentialTopicEntityMention`: a `string` feature representing the potential topic entity mention in the question.
|
85 |
+
- `TopicEntityName`: a `string` feature representing name or alias of the topic entity in the question from Freebase.
|
86 |
+
- `TopicEntityMid`: a `string` feature representing the Freebase MID of the topic entity in the question.
|
87 |
+
- `InferentialChain`: a `string` feature representing path from the topic entity node to the answer node in Freebase, labeled as a predicate.
|
88 |
+
- `Answers`: a dictionary feature representing the answer found from this parse containing:
|
89 |
+
- `AnswersMid`: a `string` feature representing the Freebase MID of the answer.
|
90 |
+
- `AnswersName`: a `list` of `string` features representing the answer string from the original question-answer pair.
|
91 |
+
### Data Splits
|
92 |
+
This data set contains 28,348 unique questions that are divided into three subsets: train (20,358), dev (3,994) and eval (3,996), formatted as JSON files: FreebaseQA-[train|dev|eval].json
|
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 |
+
The data set is generated by matching trivia-type question-answer pairs with subject-predicateobject triples in Freebase. For each collected question-answer pair, we first tag all entities in each question and search for relevant predicates that bridge a tagged entity with the answer in Freebase. Finally, human annotation is used to remove false positives in these matched triples.
|
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 |
+
Kelvin Jiang - Currently at University of Waterloo. Work was done at
|
142 |
+
York University.
|
143 |
+
|
144 |
+
### Licensing Information
|
145 |
+
|
146 |
+
[More Information Needed]
|
147 |
+
|
148 |
+
### Citation Information
|
149 |
+
|
150 |
+
```
|
151 |
+
@inproceedings{jiang-etal-2019-freebaseqa,
|
152 |
+
title = "{F}reebase{QA}: A New Factoid {QA} Data Set Matching Trivia-Style Question-Answer Pairs with {F}reebase",
|
153 |
+
author = "Jiang, Kelvin and
|
154 |
+
Wu, Dekun and
|
155 |
+
Jiang, Hui",
|
156 |
+
booktitle = "Proceedings of the 2019 Conference of the North {A}merican Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers)",
|
157 |
+
month = jun,
|
158 |
+
year = "2019",
|
159 |
+
address = "Minneapolis, Minnesota",
|
160 |
+
publisher = "Association for Computational Linguistics",
|
161 |
+
url = "https://www.aclweb.org/anthology/N19-1028",
|
162 |
+
doi = "10.18653/v1/N19-1028",
|
163 |
+
pages = "318--323",
|
164 |
+
abstract = "In this paper, we present a new data set, named FreebaseQA, for open-domain factoid question answering (QA) tasks over structured knowledge bases, like Freebase. The data set is generated by matching trivia-type question-answer pairs with subject-predicate-object triples in Freebase. For each collected question-answer pair, we first tag all entities in each question and search for relevant predicates that bridge a tagged entity with the answer in Freebase. Finally, human annotation is used to remove any false positive in these matched triples. Using this method, we are able to efficiently generate over 54K matches from about 28K unique questions with minimal cost. Our analysis shows that this data set is suitable for model training in factoid QA tasks beyond simpler questions since FreebaseQA provides more linguistically sophisticated questions than other existing data sets.",
|
165 |
+
}
|
166 |
+
```
|
167 |
+
|
168 |
+
### Contributions
|
169 |
+
|
170 |
+
Thanks to [@gchhablani](https://github.com/gchhablani) and [@anaerobeth](https://github.com/anaerobeth) for adding this dataset.
|
dataset_infos.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"default": {"description": "FreebaseQA is for open-domain factoid question answering (QA) tasks over structured knowledge bases, like Freebase The data set is generated by matching trivia-type question-answer pairs with subject-predicateobject triples in Freebase.\n", "citation": "@article{jiang2019freebaseqa,\n title={FreebaseQA: A New Factoid QA Dataset Matching Trivia-Style Question-Answer Pairs with Freebase},\n author={Jiang, Kelvin and Wu, Dekun and Jiang, Hui},\n journal={north american chapter of the association for computational linguistics},\n year={2019}\n}\n", "homepage": "https://github.com/kelvin-jiang/FreebaseQA", "license": "", "features": {"Question-ID": {"dtype": "string", "id": null, "_type": "Value"}, "RawQuestion": {"dtype": "string", "id": null, "_type": "Value"}, "ProcessedQuestion": {"dtype": "string", "id": null, "_type": "Value"}, "Parses": {"feature": {"Parse-Id": {"dtype": "string", "id": null, "_type": "Value"}, "PotentialTopicEntityMention": {"dtype": "string", "id": null, "_type": "Value"}, "TopicEntityName": {"dtype": "string", "id": null, "_type": "Value"}, "TopicEntityMid": {"dtype": "string", "id": null, "_type": "Value"}, "InferentialChain": {"dtype": "string", "id": null, "_type": "Value"}, "Answers": {"feature": {"AnswersMid": {"dtype": "string", "id": null, "_type": "Value"}, "AnswersName": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}}, "length": -1, "id": null, "_type": "Sequence"}}, "length": -1, "id": null, "_type": "Sequence"}}, "post_processed": null, "supervised_keys": null, "builder_name": "freebase_qa", "config_name": "default", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 10235375, "num_examples": 20358, "dataset_name": "freebase_qa"}, "test": {"name": "test", "num_bytes": 1987874, "num_examples": 3996, "dataset_name": "freebase_qa"}, "validation": {"name": "validation", "num_bytes": 1974114, "num_examples": 3994, "dataset_name": "freebase_qa"}}, "download_checksums": {"https://raw.githubusercontent.com/kelvin-jiang/FreebaseQA/master/FreebaseQA-train.json": {"num_bytes": 23888089, "checksum": "b9769a0040032e39a62bd4b0b99d7dfa1a3fe29c2108dbf6245f62874d0d4753"}, "https://raw.githubusercontent.com/kelvin-jiang/FreebaseQA/master/FreebaseQA-eval.json": {"num_bytes": 4660561, "checksum": "14d29d8180d2eaa44eda444debba08f292f42337e098e5b717455e462d278451"}, "https://raw.githubusercontent.com/kelvin-jiang/FreebaseQA/master/FreebaseQA-dev.json": {"num_bytes": 4656349, "checksum": "ec08abf2b0d89eca6eac02f6f5ae72f46211c256aadb51760e252eafce14e961"}}, "download_size": 33204999, "post_processing_size": null, "dataset_size": 14197363, "size_in_bytes": 47402362}}
|
dummy/1.0.0/dummy_data.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:4e7367eaa9d4ed859e88768c9900b7a8c40f4392e3a8ff5c6641dfa40a1dd62b
|
3 |
+
size 3368
|
freebase_qa.py
ADDED
@@ -0,0 +1,141 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
"""FreebaseQA: A Trivia-type QA Data Set over the Freebase Knowledge Graph"""
|
16 |
+
|
17 |
+
|
18 |
+
import json
|
19 |
+
|
20 |
+
import datasets
|
21 |
+
|
22 |
+
|
23 |
+
_CITATION = """\
|
24 |
+
@article{jiang2019freebaseqa,
|
25 |
+
title={FreebaseQA: A New Factoid QA Dataset Matching Trivia-Style Question-Answer Pairs with Freebase},
|
26 |
+
author={Jiang, Kelvin and Wu, Dekun and Jiang, Hui},
|
27 |
+
journal={north american chapter of the association for computational linguistics},
|
28 |
+
year={2019}
|
29 |
+
}
|
30 |
+
"""
|
31 |
+
|
32 |
+
_DESCRIPTION = """\
|
33 |
+
FreebaseQA is for open-domain factoid question answering (QA) tasks over structured knowledge bases, like Freebase The data set is generated by matching trivia-type question-answer pairs with subject-predicateobject triples in Freebase.
|
34 |
+
"""
|
35 |
+
|
36 |
+
_HOMEPAGE = "https://github.com/kelvin-jiang/FreebaseQA"
|
37 |
+
|
38 |
+
_LICENSE = ""
|
39 |
+
|
40 |
+
|
41 |
+
_REPO = "https://raw.githubusercontent.com/kelvin-jiang/FreebaseQA/master/"
|
42 |
+
|
43 |
+
_URLs = {
|
44 |
+
"train": _REPO + "FreebaseQA-train.json",
|
45 |
+
"eval": _REPO + "FreebaseQA-eval.json",
|
46 |
+
"dev": _REPO + "FreebaseQA-dev.json",
|
47 |
+
}
|
48 |
+
|
49 |
+
|
50 |
+
class FreebaseQA(datasets.GeneratorBasedBuilder):
|
51 |
+
"""FreebaseQA: A Trivia-type QA Data Set over the Freebase Knowledge Graph"""
|
52 |
+
|
53 |
+
VERSION = datasets.Version("1.0.0")
|
54 |
+
|
55 |
+
def _info(self):
|
56 |
+
features = datasets.Features(
|
57 |
+
{
|
58 |
+
"Question-ID": datasets.Value("string"),
|
59 |
+
"RawQuestion": datasets.Value("string"),
|
60 |
+
"ProcessedQuestion": datasets.Value("string"),
|
61 |
+
"Parses": datasets.Sequence(
|
62 |
+
{
|
63 |
+
"Parse-Id": datasets.Value("string"),
|
64 |
+
"PotentialTopicEntityMention": datasets.Value("string"),
|
65 |
+
"TopicEntityName": datasets.Value("string"),
|
66 |
+
"TopicEntityMid": datasets.Value("string"),
|
67 |
+
"InferentialChain": datasets.Value("string"),
|
68 |
+
"Answers": datasets.Sequence(
|
69 |
+
{
|
70 |
+
"AnswersMid": datasets.Value("string"),
|
71 |
+
"AnswersName": datasets.Sequence(datasets.Value("string")),
|
72 |
+
}
|
73 |
+
),
|
74 |
+
}
|
75 |
+
),
|
76 |
+
}
|
77 |
+
)
|
78 |
+
|
79 |
+
return datasets.DatasetInfo(
|
80 |
+
description=_DESCRIPTION,
|
81 |
+
features=features,
|
82 |
+
supervised_keys=None,
|
83 |
+
homepage=_HOMEPAGE,
|
84 |
+
license=_LICENSE,
|
85 |
+
citation=_CITATION,
|
86 |
+
)
|
87 |
+
|
88 |
+
def _split_generators(self, dl_manager):
|
89 |
+
"""Returns SplitGenerators."""
|
90 |
+
data_dir = dl_manager.download_and_extract(_URLs)
|
91 |
+
|
92 |
+
return [
|
93 |
+
datasets.SplitGenerator(
|
94 |
+
name=datasets.Split.TRAIN,
|
95 |
+
gen_kwargs={"filepath": data_dir["train"]},
|
96 |
+
),
|
97 |
+
datasets.SplitGenerator(
|
98 |
+
name=datasets.Split.TEST,
|
99 |
+
gen_kwargs={"filepath": data_dir["eval"]},
|
100 |
+
),
|
101 |
+
datasets.SplitGenerator(
|
102 |
+
name=datasets.Split.VALIDATION,
|
103 |
+
gen_kwargs={
|
104 |
+
"filepath": data_dir["dev"],
|
105 |
+
},
|
106 |
+
),
|
107 |
+
]
|
108 |
+
|
109 |
+
def _generate_examples(self, filepath):
|
110 |
+
""" Yields examples. """
|
111 |
+
|
112 |
+
with open(filepath, encoding="utf-8") as f:
|
113 |
+
dataset = json.load(f)
|
114 |
+
|
115 |
+
if "Questions" in dataset:
|
116 |
+
for data in dataset["Questions"]:
|
117 |
+
id_ = data["Question-ID"]
|
118 |
+
parses = []
|
119 |
+
|
120 |
+
for item in data["Parses"]:
|
121 |
+
answers = [answer for answer in item["Answers"]]
|
122 |
+
|
123 |
+
parses.append(
|
124 |
+
{
|
125 |
+
"Parse-Id": item["Parse-Id"],
|
126 |
+
"PotentialTopicEntityMention": item["PotentialTopicEntityMention"],
|
127 |
+
"TopicEntityName": item["TopicEntityName"],
|
128 |
+
"TopicEntityMid": item["TopicEntityMid"],
|
129 |
+
"InferentialChain": item["InferentialChain"],
|
130 |
+
"Answers": answers,
|
131 |
+
},
|
132 |
+
)
|
133 |
+
|
134 |
+
question = {
|
135 |
+
"Question-ID": data["Question-ID"],
|
136 |
+
"RawQuestion": data["RawQuestion"],
|
137 |
+
"ProcessedQuestion": data["ProcessedQuestion"],
|
138 |
+
"Parses": parses,
|
139 |
+
}
|
140 |
+
|
141 |
+
yield id_, question
|