Datasets:
Tasks:
Text Classification
Modalities:
Text
Formats:
csv
Languages:
Russian
Size:
1K - 10K
Tags:
technical_support
License:
Delete TechnicalSupportCalls.py
Browse files- TechnicalSupportCalls.py +0 -62
TechnicalSupportCalls.py
DELETED
|
@@ -1,62 +0,0 @@
|
|
| 1 |
-
import csv
|
| 2 |
-
import datasets
|
| 3 |
-
from datasets.tasks import TextClassification
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
_DESCRIPTION = """\
|
| 7 |
-
Коллекция из более чем 2000 обращений в службу технической поддержки размеченная по 37 различным темам.
|
| 8 |
-
"""
|
| 9 |
-
|
| 10 |
-
_CITATION = """\
|
| 11 |
-
Отсутсвует
|
| 12 |
-
"""
|
| 13 |
-
|
| 14 |
-
_TRAIN_DOWNLOAD_URL = "https://huggingface.co/datasets/SIA86/TechnicalSupportCalls/blob/main/train.csv"
|
| 15 |
-
_TEST_DOWNLOAD_URL = "https://huggingface.co/datasets/SIA86/TechnicalSupportCalls/blob/main/test.csv"
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
class TechSuppCalls(datasets.GeneratorBasedBuilder):
|
| 19 |
-
"""Technical Support Calls topic classification dataset."""
|
| 20 |
-
|
| 21 |
-
def _info(self):
|
| 22 |
-
return datasets.DatasetInfo(
|
| 23 |
-
description=_DESCRIPTION,
|
| 24 |
-
features=datasets.Features(
|
| 25 |
-
{
|
| 26 |
-
"text": datasets.Value("string"),
|
| 27 |
-
"label": datasets.features.ClassLabel(num_classes=5, names=[
|
| 28 |
-
'Не работает почта ЕПС (единая почтовая система)',
|
| 29 |
-
'Отремонтировать МФУ (многофункциональное устройство)',
|
| 30 |
-
'Настроить почту на мобильном телефоне, смартфоне',
|
| 31 |
-
'Проблема с почтой (переполнен ящик, не отправляются письма)',
|
| 32 |
-
'Настроить принтер, МФУ (многофункциональное устройство)'
|
| 33 |
-
]),
|
| 34 |
-
}
|
| 35 |
-
),
|
| 36 |
-
homepage="https://huggingface.co/datasets/SIA86/TechnicalSupportCalls/tree/main",
|
| 37 |
-
citation=_CITATION,
|
| 38 |
-
task_templates=[TextClassification(text_column="text", label_column="label")],
|
| 39 |
-
)
|
| 40 |
-
|
| 41 |
-
def _split_generators(self, dl_manager):
|
| 42 |
-
train_path = dl_manager.download_and_extract(_TRAIN_DOWNLOAD_URL)
|
| 43 |
-
test_path = dl_manager.download_and_extract(_TEST_DOWNLOAD_URL)
|
| 44 |
-
return [
|
| 45 |
-
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": train_path}),
|
| 46 |
-
datasets.SplitGenerator(name=datasets.Split.TEST, gen_kwargs={"filepath": test_path}),
|
| 47 |
-
]
|
| 48 |
-
|
| 49 |
-
def _generate_examples(self, filepath):
|
| 50 |
-
"""Technical Support Calls examples."""
|
| 51 |
-
with open(filepath, encoding="utf-8") as csv_file:
|
| 52 |
-
csv_reader = csv.reader(
|
| 53 |
-
csv_file, quotechar='"', delimiter=",", quoting=csv.QUOTE_ALL, skipinitialspace=True
|
| 54 |
-
)
|
| 55 |
-
for id_, row in enumerate(csv_reader):
|
| 56 |
-
label, title, description = row
|
| 57 |
-
# Original labels are [1, 2, 3, 4] ->
|
| 58 |
-
# ['World', 'Sports', 'Business', 'Sci/Tech']
|
| 59 |
-
# Re-map to [0, 1, 2, 3].
|
| 60 |
-
label = int(label) - 1
|
| 61 |
-
text = " ".join((title, description))
|
| 62 |
-
yield id_, {"text": text, "label": label}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|