Datasets:

Modalities:
Text
Formats:
parquet
Sub-tasks:
extractive-qa
Languages:
Korean
ArXiv:
Libraries:
Datasets
pandas
License:
albertvillanova HF staff commited on
Commit
88ab0d8
1 Parent(s): 384b81d

Delete loading script

Browse files
Files changed (1) hide show
  1. squad_kor_v1.py +0 -122
squad_kor_v1.py DELETED
@@ -1,122 +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
-
16
- """KorQuAD v1.0:The Korean Question Answering Dataset"""
17
-
18
-
19
- import json
20
-
21
- import datasets
22
- from datasets.tasks import QuestionAnsweringExtractive
23
-
24
-
25
- _CITATION = """\
26
- @article{lim2019korquad1,
27
- title={Korquad1. 0: Korean qa dataset for machine reading comprehension},
28
- author={Lim, Seungyoung and Kim, Myungji and Lee, Jooyoul},
29
- journal={arXiv preprint arXiv:1909.07005},
30
- year={2019}
31
- }
32
- """
33
-
34
- _DESCRIPTION = """\
35
- KorQuAD 1.0 is a large-scale Korean dataset for machine reading comprehension task consisting of human generated questions for Wikipedia articles. We benchmark the data collecting process of SQuADv1.0 and crowdsourced 70,000+ question-answer pairs. 1,637 articles and 70,079 pairs of question answers were collected. 1,420 articles are used for the training set, 140 for the dev set, and 77 for the test set. 60,407 question-answer pairs are for the training set, 5,774 for the dev set, and 3,898 for the test set.
36
- """
37
- _HOMEPAGE = "https://korquad.github.io/KorQuad%201.0/"
38
- _LICENSE = "CC BY-ND 2.0 KR"
39
-
40
- _URL = "https://korquad.github.io/dataset/"
41
- _URLS = {
42
- "train": _URL + "KorQuAD_v1.0_train.json",
43
- "dev": _URL + "KorQuAD_v1.0_dev.json",
44
- }
45
-
46
-
47
- class SquadKorV1(datasets.GeneratorBasedBuilder):
48
- """KorQuAD 1.0 dataset"""
49
-
50
- VERSION = datasets.Version("1.0.0")
51
- BUILDER_CONFIGS = [
52
- datasets.BuilderConfig(
53
- name="squad_kor_v1",
54
- version=VERSION,
55
- description=_DESCRIPTION,
56
- ),
57
- ]
58
-
59
- def _info(self):
60
- return datasets.DatasetInfo(
61
- description=_DESCRIPTION,
62
- features=datasets.Features(
63
- {
64
- "id": datasets.Value("string"),
65
- "title": datasets.Value("string"),
66
- "context": datasets.Value("string"),
67
- "question": datasets.Value("string"),
68
- "answers": datasets.features.Sequence(
69
- {
70
- "text": datasets.Value("string"),
71
- "answer_start": datasets.Value("int32"),
72
- }
73
- ),
74
- }
75
- ),
76
- supervised_keys=None,
77
- homepage=_HOMEPAGE,
78
- license=_LICENSE,
79
- citation=_CITATION,
80
- task_templates=[
81
- QuestionAnsweringExtractive(
82
- question_column="question", context_column="context", answers_column="answers"
83
- )
84
- ],
85
- )
86
-
87
- def _split_generators(self, dl_manager):
88
- """Returns SplitGenerators."""
89
- # download and extract URLs
90
- urls_to_download = _URLS
91
- downloaded_files = dl_manager.download_and_extract(urls_to_download)
92
-
93
- return [
94
- datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": downloaded_files["train"]}),
95
- datasets.SplitGenerator(name=datasets.Split.VALIDATION, gen_kwargs={"filepath": downloaded_files["dev"]}),
96
- ]
97
-
98
- def _generate_examples(self, filepath):
99
- """Yields examples."""
100
- with open(filepath, encoding="utf-8") as f:
101
- squad = json.load(f)
102
- for example in squad["data"]:
103
- title = example.get("title", "").strip()
104
- for paragraph in example["paragraphs"]:
105
- context = paragraph["context"].strip()
106
- for qa in paragraph["qas"]:
107
- question = qa["question"].strip()
108
- id_ = qa["id"]
109
-
110
- answer_starts = [answer["answer_start"] for answer in qa["answers"]]
111
- answers = [answer["text"].strip() for answer in qa["answers"]]
112
-
113
- yield id_, {
114
- "title": title,
115
- "context": context,
116
- "question": question,
117
- "id": id_,
118
- "answers": {
119
- "answer_start": answer_starts,
120
- "text": answers,
121
- },
122
- }