Datasets:
File size: 3,398 Bytes
cede5b5 c44de64 cede5b5 b5f2d78 ee9a3dd d09c258 c44de64 cede5b5 ee9a3dd d09c258 c44de64 cb8116f cede5b5 6db02db 517bd68 6db02db 36a30b1 6db02db 36a30b1 6db02db 36a30b1 6db02db 36a30b1 6db02db 36a30b1 6db02db 36a30b1 6db02db 36a30b1 cb8116f | 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 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | ---
dataset_info:
- config_name: default
features:
- name: utterance
dtype: string
- name: label
dtype: int64
splits:
- name: train
num_bytes: 1422940
num_examples: 15250
- name: validation
num_bytes: 286013
num_examples: 3100
- name: test
num_bytes: 517027
num_examples: 5500
download_size: 1202523
dataset_size: 2249306.8852459015
- config_name: intents
features:
- name: id
dtype: int64
- name: name
dtype: 'null'
- name: tags
sequence: 'null'
- name: regexp_full_match
sequence: 'null'
- name: regexp_partial_match
sequence: 'null'
- name: description
dtype: 'null'
splits:
- name: intents
num_bytes: 3000
num_examples: 150
download_size: 3651
dataset_size: 3000
configs:
- config_name: default
data_files:
- split: train
path: data/train-*
- split: validation
path: data/validation-*
- split: test
path: data/test-*
- config_name: intents
data_files:
- split: intents
path: intents/intents-*
task_categories:
- text-classification
language:
- ru
---
# Russian clinc150
This is a text classification dataset. It is intended for machine learning research and experimentation.
This dataset is obtained via formatting another publicly available data to be compatible with our [AutoIntent Library](https://deeppavlov.github.io/AutoIntent/index.html).
## Usage
It is intended to be used with our [AutoIntent Library](https://deeppavlov.github.io/AutoIntent/index.html):
```python
from autointent import Dataset
clinc150_ru = Dataset.from_hub("AutoIntent/clinc150_ru")
```
## Source
This dataset is taken from private github repository `LadaNikitina/clinc150` and formatted with our [AutoIntent Library](https://deeppavlov.github.io/AutoIntent/index.html):
```python
from autointent import Dataset
from autointent.schemas import Sample
from datasets import load_from_disk, Dataset as HFDataset
def convert_ruclinc150(clinc150_train: HFDataset, ood_index=42):
all_labels = sorted(clinc150_train.unique("intent"))
assert all_labels == list(range(151))
in_domain_samples = clinc150_train.filter(lambda x: x["intent"] != ood_index)
oos_samples = clinc150_train.filter(lambda x: x["intent"] == ood_index)
classwise_samples = [[] for _ in range(150)]
for batch in in_domain_samples.iter(batch_size=16, drop_last_batch=False):
for txt, intent_id in zip(batch["text"], batch["intent"], strict=False):
intent_id -= int(intent_id > ood_index)
target_list = classwise_samples[intent_id]
target_list.append({"utterance": txt, "label": intent_id})
train_samples = [sample for samples_from_one_class in classwise_samples for sample in samples_from_one_class]
oos_samples = [{"utterance": txt} for txt in oos_samples["text"]]
return [Sample(**sample) for sample in train_samples + oos_samples]
if __name__ == "__main__":
# git clone git@github.com:LadaNikitina/clinc150 data/RuClinc150
# rm -rf data/RuClinc150/.git
clinc150 = load_from_disk("data/RuClinc150")
train_samples = convert_ruclinc150(clinc150["train"])
val_samples = convert_ruclinc150(clinc150["validation"])
test_samples = convert_ruclinc150(clinc150["test"])
clinc150_converted = Dataset.from_dict(
{"train": train_samples, "validation": val_samples, "test": test_samples}
)
``` |