Datasets:

Modalities:
Text
Formats:
parquet
Languages:
Chinese
ArXiv:
Libraries:
Datasets
pandas
License:
albertvillanova HF staff commited on
Commit
7aa834e
1 Parent(s): 48d5f78

Delete loading script

Browse files
Files changed (1) hide show
  1. c3.py +0 -149
c3.py DELETED
@@ -1,149 +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
- """C3 Parallel Corpora"""
16
-
17
-
18
- import json
19
-
20
- import datasets
21
-
22
-
23
- _CITATION = """\
24
- @article{sun2019investigating,
25
- title={Investigating Prior Knowledge for Challenging Chinese Machine Reading Comprehension},
26
- author={Sun, Kai and Yu, Dian and Yu, Dong and Cardie, Claire},
27
- journal={Transactions of the Association for Computational Linguistics},
28
- year={2020},
29
- url={https://arxiv.org/abs/1904.09679v3}
30
- }
31
- """
32
-
33
- _DESCRIPTION = """\
34
- Machine reading comprehension tasks require a machine reader to answer questions relevant to the given document. In this paper, we present the first free-form multiple-Choice Chinese machine reading Comprehension dataset (C^3), containing 13,369 documents (dialogues or more formally written mixed-genre texts) and their associated 19,577 multiple-choice free-form questions collected from Chinese-as-a-second-language examinations.
35
- We present a comprehensive analysis of the prior knowledge (i.e., linguistic, domain-specific, and general world knowledge) needed for these real-world problems. We implement rule-based and popular neural methods and find that there is still a significant performance gap between the best performing model (68.5%) and human readers (96.0%), especially on problems that require prior knowledge. We further study the effects of distractor plausibility and data augmentation based on translated relevant datasets for English on model performance. We expect C^3 to present great challenges to existing systems as answering 86.8% of questions requires both knowledge within and beyond the accompanying document, and we hope that C^3 can serve as a platform to study how to leverage various kinds of prior knowledge to better understand a given written or orally oriented text.
36
- """
37
-
38
- _URL = "https://raw.githubusercontent.com/nlpdata/c3/master/data/"
39
-
40
-
41
- class C3Config(datasets.BuilderConfig):
42
- """BuilderConfig for NewDataset"""
43
-
44
- def __init__(self, type_, **kwargs):
45
- """
46
-
47
- Args:
48
- pair: the language pair to consider
49
- zip_file: The location of zip file containing original data
50
- **kwargs: keyword arguments forwarded to super.
51
- """
52
- self.type_ = type_
53
- super().__init__(**kwargs)
54
-
55
-
56
- class C3(datasets.GeneratorBasedBuilder):
57
- """C3 is the first free-form multiple-Choice Chinese machine reading Comprehension dataset, containing 13,369 documents (dialogues or more formally written mixed-genre texts) and their associated 19,577 multiple-choice free-form questions collected from Chinese-as-a-second language examinations."""
58
-
59
- VERSION = datasets.Version("1.0.0")
60
-
61
- # This is an example of a dataset with multiple configurations.
62
- # If you don't want/need to define several sub-sets in your dataset,
63
- # just remove the BUILDER_CONFIG_CLASS and the BUILDER_CONFIGS attributes.
64
- BUILDER_CONFIG_CLASS = C3Config
65
- BUILDER_CONFIGS = [
66
- C3Config(
67
- name="mixed",
68
- description="Mixed genre questions",
69
- version=datasets.Version("1.0.0"),
70
- type_="mixed",
71
- ),
72
- C3Config(
73
- name="dialog",
74
- description="Dialog questions",
75
- version=datasets.Version("1.0.0"),
76
- type_="dialog",
77
- ),
78
- ]
79
-
80
- def _info(self):
81
- return datasets.DatasetInfo(
82
- # This is the description that will appear on the datasets page.
83
- description=_DESCRIPTION,
84
- # datasets.features.FeatureConnectors
85
- features=datasets.Features(
86
- {
87
- "documents": datasets.Sequence(datasets.Value("string")),
88
- "document_id": datasets.Value("string"),
89
- "questions": datasets.Sequence(
90
- {
91
- "question": datasets.Value("string"),
92
- "answer": datasets.Value("string"),
93
- "choice": datasets.Sequence(datasets.Value("string")),
94
- }
95
- ),
96
- }
97
- ),
98
- # If there's a common (input, target) tuple from the features,
99
- # specify them here. They'll be used if as_supervised=True in
100
- # builder.as_dataset.
101
- supervised_keys=None,
102
- # Homepage of the dataset for documentation
103
- homepage="https://github.com/nlpdata/c3",
104
- citation=_CITATION,
105
- )
106
-
107
- def _split_generators(self, dl_manager):
108
- # m or d
109
- T = self.config.type_[0]
110
- files = [_URL + f"c3-{T}-{split}.json" for split in ["train", "test", "dev"]]
111
- dl_dir = dl_manager.download_and_extract(files)
112
-
113
- return [
114
- datasets.SplitGenerator(
115
- name=datasets.Split.TRAIN,
116
- # These kwargs will be passed to _generate_examples
117
- gen_kwargs={
118
- "filename": dl_dir[0],
119
- "split": "train",
120
- },
121
- ),
122
- datasets.SplitGenerator(
123
- name=datasets.Split.TEST,
124
- # These kwargs will be passed to _generate_examples
125
- gen_kwargs={
126
- "filename": dl_dir[1],
127
- "split": "test",
128
- },
129
- ),
130
- datasets.SplitGenerator(
131
- name=datasets.Split.VALIDATION,
132
- # These kwargs will be passed to _generate_examples
133
- gen_kwargs={
134
- "filename": dl_dir[2],
135
- "split": "dev",
136
- },
137
- ),
138
- ]
139
-
140
- def _generate_examples(self, filename, split):
141
- """Yields examples."""
142
- with open(filename, "r", encoding="utf-8") as sf:
143
- data = json.load(sf)
144
- for id_, (documents, questions, document_id) in enumerate(data):
145
- yield id_, {
146
- "documents": documents,
147
- "questions": questions,
148
- "document_id": document_id,
149
- }