File size: 2,849 Bytes
faa7f03
 
6e4e1db
faa7f03
 
 
 
 
 
c6226a7
 
 
2d3ba36
c6226a7
6e4e1db
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
faa7f03
 
 
 
 
6e4e1db
 
 
 
4bb5a2a
 
 
 
3f6cc20
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3fce8c6
3f6cc20
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
dataset_info:
- config_name: default
  features:
  - name: utterance
    dtype: string
  - name: label
    sequence: int64
  splits:
  - name: train
    num_bytes: 2163109
    num_examples: 16077
  download_size: 444270
  dataset_size: 2177768.2414629594
- config_name: intents
  features:
  - name: id
    dtype: int64
  - name: name
    dtype: string
  - 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: 387
    num_examples: 13
  download_size: 3096
  dataset_size: 387
configs:
- config_name: default
  data_files:
  - split: train
    path: data/train-*
- config_name: intents
  data_files:
  - split: intents
    path: intents/intents-*
task_categories:
- text-classification
language:
- en
---

# dstc3

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

dstc3 = Dataset.from_datasets("AutoIntent/dstc3")
```

## Source

This dataset is taken from `marcel-gohsen/dstc3` and formatted with our [AutoIntent Library](https://deeppavlov.github.io/AutoIntent/index.html):

```python
from datasets import load_dataset
from autointent import Dataset

# load original data
dstc3 = load_dataset("marcel-gohsen/dstc3")

# extract intent names
dstc3["test"] = dstc3["test"].filter(lambda example: example["transcript"] != "")
intent_names = sorted(set(name for intents in dstc3["test"]["intent"] for name in intents))
intent_names.remove("reqmore")
dstc3["test"].filter(lambda example: "reqmore" in example["intent"])
name_to_id = {name: i for i, name in enumerate(intent_names)}

# parse complicated dstc format
def transform(example: dict):
    return {
        "utterance": example["transcript"],
        "label": [name_to_id[intent_name] for intent_name in example["intent"] if intent_name != "reqmore"],
    }
dstc_converted = dstc3["test"].map(transform, remove_columns=dstc3["test"].features.keys())

# format to autointent.Dataset
intents = [{"id": i, "name": name} for i, name in enumerate(intent_names)]
utterances = []
oos_utterances = []
for rec in dstc_converted.to_list():
    if len(rec["label"]) == 0:
        rec.pop("label")
        oos_utterances.append(rec["utterance"])
    else:
        utterances.append(rec)
oos_records = [{"utterance": ut} for ut in set(oos_utterances)]
dstc_converted = Dataset.from_dict({"intents": intents, "train": utterances + oos_records})
```