Delete ESPOSITO.py
Browse files- ESPOSITO.py +0 -92
ESPOSITO.py
DELETED
@@ -1,92 +0,0 @@
|
|
1 |
-
# Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
|
2 |
-
#
|
3 |
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
4 |
-
# you may not use this file except in compliance with the License.
|
5 |
-
# You may obtain a copy of the License at
|
6 |
-
#
|
7 |
-
# http://www.apache.org/licenses/LICENSE-2.0
|
8 |
-
#
|
9 |
-
# Unless required by applicable law or agreed to in writing, software
|
10 |
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
11 |
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12 |
-
# See the License for the specific language governing permissions and
|
13 |
-
# limitations under the License.
|
14 |
-
import os
|
15 |
-
|
16 |
-
import datasets
|
17 |
-
import pandas as pd
|
18 |
-
|
19 |
-
|
20 |
-
_CITATION = """\
|
21 |
-
"""
|
22 |
-
|
23 |
-
_DESCRIPTION = """\
|
24 |
-
"""
|
25 |
-
|
26 |
-
_LICENSE = "Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License"
|
27 |
-
|
28 |
-
domains = {
|
29 |
-
"Human Science": [
|
30 |
-
"Human Science",
|
31 |
-
"Art & Architecture",
|
32 |
-
],
|
33 |
-
"Medicine": [
|
34 |
-
"Medical Science",
|
35 |
-
"Veterinary Science",
|
36 |
-
],
|
37 |
-
"Science & engineering": [
|
38 |
-
"Agriculture & Natural Resources",
|
39 |
-
"Engineering & Technology",
|
40 |
-
"Basic Science",
|
41 |
-
],
|
42 |
-
}
|
43 |
-
|
44 |
-
|
45 |
-
class ESPOSITOConfig(datasets.BuilderConfig):
|
46 |
-
def __init__(self, **kwargs):
|
47 |
-
super().__init__(version=datasets.Version("1.0.0"), **kwargs)
|
48 |
-
|
49 |
-
|
50 |
-
class ESPOSITO(datasets.GeneratorBasedBuilder):
|
51 |
-
BUILDER_CONFIGS = [
|
52 |
-
ESPOSITOConfig(
|
53 |
-
name=domain,
|
54 |
-
)
|
55 |
-
for domain in domains.keys()
|
56 |
-
]
|
57 |
-
|
58 |
-
def _info(self):
|
59 |
-
features = datasets.Features(
|
60 |
-
{
|
61 |
-
"id":datasets.Value("int32"),
|
62 |
-
"question": datasets.Value("string"),
|
63 |
-
"A": datasets.Value("string"),
|
64 |
-
"B": datasets.Value("string"),
|
65 |
-
"C": datasets.Value("string"),
|
66 |
-
"D": datasets.Value("string"),
|
67 |
-
"answer": datasets.Value("string"),
|
68 |
-
"explanation":datasets.Value("string"),
|
69 |
-
}
|
70 |
-
)
|
71 |
-
return datasets.DatasetInfo(
|
72 |
-
description=_DESCRIPTION,
|
73 |
-
features=features,
|
74 |
-
homepage="",#_HOMEPAGE,
|
75 |
-
license=_LICENSE,
|
76 |
-
citation=_CITATION,
|
77 |
-
)
|
78 |
-
|
79 |
-
def _split_generators(self, dl_manager):
|
80 |
-
#data_dir = dl_manager.download_and_extract(_URL)
|
81 |
-
task_name = self.config.name
|
82 |
-
return []
|
83 |
-
|
84 |
-
|
85 |
-
def _generate_examples(self, filepath):
|
86 |
-
df = pd.read_csv(filepath,encoding="utf-8")
|
87 |
-
for i, instance in enumerate(df.to_dict(orient="records")):
|
88 |
-
if "answer" not in instance.keys():
|
89 |
-
instance["answer"]=""
|
90 |
-
if "explanation" not in instance.keys():
|
91 |
-
instance["explanation"]=""
|
92 |
-
yield i, instance
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|