File size: 1,934 Bytes
e3165ff
 
27ced4c
 
 
 
 
e3165ff
 
 
 
 
 
39581c9
e3165ff
 
27ced4c
 
e3165ff
 
 
 
 
 
 
 
 
 
25c5608
e3165ff
 
 
55b8b1e
 
 
6e6d4b4
e3165ff
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39581c9
 
 
 
e3165ff
 
 
39581c9
 
e3165ff
 
39581c9
 
 
 
e3165ff
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import datasets
import os
from datasets import Dataset, DatasetDict
import gzip
import json


_CITATION = """\
@misc{Conversations,
  author       = {Ilya Koziev},
  title        = {Russian-Language Dialogues Dataset},
  year         = {2025},
  publisher    = {Hugging Face},
  howpublished = {\\url{https://huggingface.co/datasets/inkoziev/Conversations}},
}
"""


_DESCRIPTION = """\
Russian-Language Dialogues Dataset
"""


class DatasetConfig(datasets.BuilderConfig):
    def __init__(self, **kwargs):
        super(DatasetConfig, self).__init__(**kwargs)



class Conversations(datasets.GeneratorBasedBuilder):
    BUILDER_CONFIG_CLASS = DatasetConfig
    BUILDER_CONFIGS = [
        DatasetConfig(name="Conversations",
                      version=datasets.Version("27.02.2025"),
                      description=_DESCRIPTION,
                      ),
    ]

    def _info(self):
        return datasets.DatasetInfo(
            description=_DESCRIPTION,
            features=datasets.Features(
               {
                   "domain": datasets.Value("string"),
                   "conversation": datasets.Value("string"),
               }
            ),
            supervised_keys=None,
            homepage="",
            citation=_CITATION,
        )

    def _split_generators(self, dl_manager):
        download_url = "https://huggingface.co/datasets/inkoziev/Conversations/resolve/main/conversations.jsonl.gz"
        #download_url = "/home/inkoziev/github/Conversations/conversations.jsonl.gz"
        path = dl_manager.download(download_url)
        return [
            datasets.SplitGenerator(
                name=datasets.Split.TRAIN,
                gen_kwargs={"datapath": path},
            )
        ]

    def _generate_examples(self, datapath):
        with gzip.open(datapath, "rt", encoding="utf-8") as f:
            for iline, line in enumerate(f):
                yield iline, json.loads(line)