blinoff commited on
Commit
587abc5
1 Parent(s): ecc4714

Create medical_qa_ru_data.py

Browse files
Files changed (1) hide show
  1. medical_qa_ru_data.py +69 -0
medical_qa_ru_data.py ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ """Russian Q&A posts from a medical related forum"""
16
+
17
+
18
+ import csv
19
+
20
+ import datasets
21
+
22
+ _DESCRIPTION = """\
23
+ This dataset contains 190,335 Russian Q&A posts from a medical related forum.
24
+ """
25
+
26
+ #_HOMEPAGE = "??"
27
+
28
+ _LICENSE = ""
29
+
30
+
31
+ _URL = "??"
32
+
33
+
34
+ class MedicalQARuData(datasets.GeneratorBasedBuilder):
35
+ def _info(self):
36
+ features = datasets.Features(
37
+ {
38
+ "date": datasets.Value("string"),
39
+ "categ": datasets.Value("string"),
40
+ "theme": datasets.Value("string"),
41
+ "desc": datasets.Value("string"),
42
+ "ans": datasets.Value("string"),
43
+ "spec10": datasets.Value("string"),
44
+ }
45
+ )
46
+ return datasets.DatasetInfo(
47
+ description=_DESCRIPTION,
48
+ features=features,
49
+ license=_LICENSE,
50
+ citation=_CITATION,
51
+ )
52
+
53
+ def _split_generators(self, dl_manager):
54
+ data_file = dl_manager.download_and_extract(_URL)
55
+ return [datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": data_file})]
56
+
57
+ def _generate_examples(self, filepath):
58
+ """Yields examples."""
59
+ with open(filepath, encoding="utf-8") as f:
60
+ data = csv.reader(f)
61
+ for id_, row in enumerate(data):
62
+ yield id_, {
63
+ "date": row[0],
64
+ "categ": row[1],
65
+ "theme": row[2],
66
+ "desc": row[3],
67
+ "ans": row[4],
68
+ "spec10": row[5],
69
+ }