Delete loading script
Browse files- covid_dialogue.py +0 -105
covid_dialogue.py
DELETED
@@ -1,105 +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 |
-
"""Covid Dialog dataset in English and Chinese"""
|
16 |
-
|
17 |
-
|
18 |
-
import copy
|
19 |
-
import os
|
20 |
-
import re
|
21 |
-
import textwrap
|
22 |
-
|
23 |
-
import datasets
|
24 |
-
|
25 |
-
|
26 |
-
# BibTeX citation
|
27 |
-
_CITATION = """\
|
28 |
-
@article{ju2020CovidDialog,
|
29 |
-
title={CovidDialog: Medical Dialogue Datasets about COVID-19},
|
30 |
-
author={Ju, Zeqian and Chakravorty, Subrato and He, Xuehai and Chen, Shu and Yang, Xingyi and Xie, Pengtao},
|
31 |
-
journal={ https://github.com/UCSD-AI4H/COVID-Dialogue},
|
32 |
-
year={2020}
|
33 |
-
}
|
34 |
-
"""
|
35 |
-
|
36 |
-
# Official description of the dataset
|
37 |
-
_DESCRIPTION = textwrap.dedent(
|
38 |
-
"""
|
39 |
-
COVID-Dialogue-Dataset is amedical dialogue dataset about COVID-19 and other types of pneumonia.
|
40 |
-
Patients who are concerned that they may be infected by COVID-19 or other pneumonia consult doctors and doctors provide advice.
|
41 |
-
There are 603 consultations in English and 1393 consultations in Chinese.
|
42 |
-
"""
|
43 |
-
)
|
44 |
-
|
45 |
-
# Link to an official homepage for the dataset here
|
46 |
-
_HOMEPAGE = "https://github.com/UCSD-AI4H/COVID-Dialogue"
|
47 |
-
|
48 |
-
_LICENSE = ""
|
49 |
-
|
50 |
-
|
51 |
-
import datasets
|
52 |
-
import os
|
53 |
-
import json
|
54 |
-
|
55 |
-
|
56 |
-
class CovidDialogueHelm(datasets.GeneratorBasedBuilder):
|
57 |
-
VERSION = datasets.Version("1.0.0")
|
58 |
-
|
59 |
-
BUILDER_CONFIGS = [datasets.BuilderConfig(name="default", version=datasets.Version("1.0.0"), description=_DESCRIPTION)]
|
60 |
-
|
61 |
-
def _info(self):
|
62 |
-
features = datasets.Features(
|
63 |
-
{
|
64 |
-
"query": datasets.Value("string"),
|
65 |
-
"answer": datasets.Value("string"),
|
66 |
-
}
|
67 |
-
)
|
68 |
-
return datasets.DatasetInfo(
|
69 |
-
description=f"Covid Dialogue dataset, as preprocessed and shuffled in HELM",
|
70 |
-
features=features,
|
71 |
-
homepage=_HOMEPAGE,
|
72 |
-
license=_LICENSE,
|
73 |
-
citation=_CITATION,
|
74 |
-
)
|
75 |
-
|
76 |
-
def _split_generators(self, dl_manager):
|
77 |
-
test_target = dl_manager.download("test.source")
|
78 |
-
test_source = dl_manager.download("test.source")
|
79 |
-
train_source = dl_manager.download("train.source")
|
80 |
-
train_target = dl_manager.download("train.target")
|
81 |
-
val_source = dl_manager.download("val.source")
|
82 |
-
val_target = dl_manager.download("val.target")
|
83 |
-
|
84 |
-
return [
|
85 |
-
datasets.SplitGenerator(
|
86 |
-
name=datasets.Split.TRAIN,
|
87 |
-
gen_kwargs={"target": train_target, "source": train_source},
|
88 |
-
),
|
89 |
-
datasets.SplitGenerator(
|
90 |
-
name=datasets.Split.VALIDATION,
|
91 |
-
gen_kwargs={"target": val_target, "source": val_source},
|
92 |
-
),
|
93 |
-
datasets.SplitGenerator(
|
94 |
-
name=datasets.Split.TEST,
|
95 |
-
gen_kwargs={"target": test_target, "source": test_source},
|
96 |
-
),
|
97 |
-
]
|
98 |
-
|
99 |
-
# method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
|
100 |
-
def _generate_examples(self, source, target):
|
101 |
-
with open(source, encoding="utf-8") as f_source:
|
102 |
-
with open(target, encoding="utf-8") as f_target:
|
103 |
-
for idx, (s, t) in enumerate(zip(f_source, f_target)):
|
104 |
-
yield idx, {"query": s, "answer": t}
|
105 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|