Den4ikAI commited on
Commit
ae4b74c
1 Parent(s): 4a6fd98

Upload russian_dialogues_2.py

Browse files
Files changed (1) hide show
  1. russian_dialogues_2.py +52 -0
russian_dialogues_2.py ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Russian dialogues dataset"""
2
+
3
+
4
+ import json
5
+
6
+ import datasets
7
+
8
+ _DESCRIPTION = """\
9
+ Russian dialogues dataset
10
+ """
11
+
12
+ _HOMEPAGE = "https://huggingface.co/datasets/Den4ikAI/russian_dialogues_2"
13
+
14
+ _LICENSE = "mit"
15
+
16
+ _URLS = [
17
+ "https://huggingface.co/datasets/Den4ikAI/russian_dialogues_2/resolve/main/dataset.jsonl.gz"
18
+ ]
19
+
20
+
21
+ class YandexQ(datasets.GeneratorBasedBuilder):
22
+ VERSION = datasets.Version("0.1.0")
23
+
24
+ def _info(self):
25
+ return datasets.DatasetInfo(
26
+ description=_DESCRIPTION,
27
+ features=datasets.Features(
28
+ {
29
+ "sample": datasets.Value("string")
30
+ }
31
+ ),
32
+ homepage=_HOMEPAGE,
33
+ license=_LICENSE
34
+ )
35
+
36
+ def _split_generators(self, dl_manager):
37
+ data_dir = dl_manager.download_and_extract(_URLS)
38
+ return [
39
+ datasets.SplitGenerator(
40
+ name=datasets.Split.TRAIN,
41
+ gen_kwargs={
42
+ "filepath": data_dir[0],
43
+ "split": "train",
44
+ },
45
+ )
46
+ ]
47
+
48
+ def _generate_examples(self, filepath, split):
49
+ with open(filepath, 'r', encoding="utf-8") as f:
50
+ for i, line in enumerate(f):
51
+ data = json.loads(line)
52
+ yield i, data