Datasets:
Tasks:
Text Generation
Sub-tasks:
dialogue-modeling
Languages:
Russian
Size:
1M<n<10M
Tags:
conversations
License:
Upload Conversations.py
Browse files- Conversations.py +56 -7
Conversations.py
CHANGED
|
@@ -1,14 +1,63 @@
|
|
|
|
|
|
|
|
| 1 |
from datasets import Dataset, DatasetDict
|
| 2 |
import gzip
|
| 3 |
import json
|
| 4 |
|
| 5 |
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
|
|
|
|
|
|
|
|
|
| 12 |
|
| 13 |
|
| 14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import datasets
|
| 2 |
+
import os
|
| 3 |
from datasets import Dataset, DatasetDict
|
| 4 |
import gzip
|
| 5 |
import json
|
| 6 |
|
| 7 |
|
| 8 |
+
_CITATION = """\
|
| 9 |
+
@misc{Conversations,
|
| 10 |
+
author = {Ilya Koziev},
|
| 11 |
+
title = {Russian-Language Dialogues Dataset},
|
| 12 |
+
year = {2025},
|
| 13 |
+
publisher = {Hugging Face},
|
| 14 |
+
howpublished = {\url{https://huggingface.co/datasets/inkoziev/Conversations}},
|
| 15 |
+
}
|
| 16 |
+
"""
|
| 17 |
|
| 18 |
|
| 19 |
+
_DESCRIPTION = """\
|
| 20 |
+
Russian-Language Dialogues Dataset
|
| 21 |
+
"""
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
class DatasetConfig(datasets.BuilderConfig):
|
| 25 |
+
def __init__(self, **kwargs):
|
| 26 |
+
super(DatasetConfig, self).__init__(**kwargs)
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
class Conversations(datasets.GeneratorBasedBuilder):
|
| 30 |
+
BUILDER_CONFIG_CLASS = DatasetConfig
|
| 31 |
+
BUILDER_CONFIGS = [
|
| 32 |
+
DatasetConfig(name="Conversations", version=datasets.Version("27.02.2025"), description=_DESCRIPTION),
|
| 33 |
+
]
|
| 34 |
+
|
| 35 |
+
def _info(self):
|
| 36 |
+
return datasets.DatasetInfo(
|
| 37 |
+
description=_DESCRIPTION,
|
| 38 |
+
features=datasets.Features(
|
| 39 |
+
{
|
| 40 |
+
"domain": datasets.Value("string"),
|
| 41 |
+
"conversation": datasets.Value("string"),
|
| 42 |
+
}
|
| 43 |
+
),
|
| 44 |
+
supervised_keys=None,
|
| 45 |
+
homepage="",
|
| 46 |
+
citation=_CITATION,
|
| 47 |
+
)
|
| 48 |
+
|
| 49 |
+
def _split_generators(self,abc):
|
| 50 |
+
return [
|
| 51 |
+
datasets.SplitGenerator(
|
| 52 |
+
name=datasets.Split.TRAIN,
|
| 53 |
+
gen_kwargs={
|
| 54 |
+
'path': "conversations.jsonl.gz"
|
| 55 |
+
}
|
| 56 |
+
),
|
| 57 |
+
]
|
| 58 |
+
|
| 59 |
+
def _generate_examples(self, path):
|
| 60 |
+
with gzip.open(path, "rt", encoding="utf-8") as f:
|
| 61 |
+
for iline, line in f:
|
| 62 |
+
yield json.loads(line)
|
| 63 |
+
|