Datasets:
voorhs
commited on
Commit
·
92a74cd
1
Parent(s):
97737e5
add dataset card
Browse files
README.md
CHANGED
@@ -42,3 +42,66 @@ configs:
|
|
42 |
- split: intents
|
43 |
path: intents/intents-*
|
44 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
- split: intents
|
43 |
path: intents/intents-*
|
44 |
---
|
45 |
+
|
46 |
+
# hwu64
|
47 |
+
|
48 |
+
This is a text classification dataset. It is intended for machine learning research and experimentation.
|
49 |
+
|
50 |
+
This dataset is obtained via formatting another publicly available data to be compatible with our [AutoIntent Library](https://deeppavlov.github.io/AutoIntent/index.html).
|
51 |
+
|
52 |
+
## Usage
|
53 |
+
|
54 |
+
It is intended to be used with our [AutoIntent Library](https://deeppavlov.github.io/AutoIntent/index.html):
|
55 |
+
|
56 |
+
```python
|
57 |
+
from autointent import Dataset
|
58 |
+
|
59 |
+
dream = Dataset.from_datasets("AutoIntent/banking77")
|
60 |
+
```
|
61 |
+
|
62 |
+
## Source
|
63 |
+
|
64 |
+
This dataset is taken from original work's github repository `jianguoz/Few-Shot-Intent-Detection` and formatted with our [AutoIntent Library](https://deeppavlov.github.io/AutoIntent/index.html):
|
65 |
+
|
66 |
+
```python
|
67 |
+
# define utils
|
68 |
+
import requests
|
69 |
+
from autointent import Dataset
|
70 |
+
|
71 |
+
def load_text_from_url(github_file: str):
|
72 |
+
return requests.get(github_file).text
|
73 |
+
|
74 |
+
def convert_hwu64(hwu_utterances, hwu_labels):
|
75 |
+
intent_names = sorted(set(hwu_labels))
|
76 |
+
name_to_id = dict(zip(intent_names, range(len(intent_names)), strict=False))
|
77 |
+
n_classes = len(intent_names)
|
78 |
+
|
79 |
+
assert len(hwu_utterances) == len(hwu_labels)
|
80 |
+
|
81 |
+
classwise_utterance_records = [[] for _ in range(n_classes)]
|
82 |
+
intents = [
|
83 |
+
{
|
84 |
+
"id": i,
|
85 |
+
"name": name,
|
86 |
+
|
87 |
+
}
|
88 |
+
for i, name in enumerate(intent_names)
|
89 |
+
]
|
90 |
+
|
91 |
+
for txt, name in zip(hwu_utterances, hwu_labels, strict=False):
|
92 |
+
intent_id = name_to_id[name]
|
93 |
+
target_list = classwise_utterance_records[intent_id]
|
94 |
+
target_list.append({"utterance": txt, "label": intent_id})
|
95 |
+
|
96 |
+
utterances = [rec for lst in classwise_utterance_records for rec in lst]
|
97 |
+
return Dataset.from_dict({"intents": intents, "train": utterances})
|
98 |
+
|
99 |
+
# load
|
100 |
+
file_url = "https://raw.githubusercontent.com/jianguoz/Few-Shot-Intent-Detection/refs/heads/main/Datasets/HWU64/train/label"
|
101 |
+
labels = load_text_from_url(file_url).split("\n")[:-1]
|
102 |
+
file_url = "https://raw.githubusercontent.com/jianguoz/Few-Shot-Intent-Detection/refs/heads/main/Datasets/HWU64/train/seq.in"
|
103 |
+
utterances = load_text_from_url(file_url).split("\n")[:-1]
|
104 |
+
|
105 |
+
# convert
|
106 |
+
hwu64_converted = convert_hwu64(utterances, labels)
|
107 |
+
```
|