Dataset Viewer
The dataset viewer is not available for this dataset.
Unexpected token '<', "<html> <h"... is not valid JSON

Need help to make the dataset viewer work? Make sure to review how to configure the dataset viewer, and open a discussion for direct support.

hwu64

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.

Usage

It is intended to be used with our AutoIntent Library:

from autointent import Dataset

hwu64 = Dataset.from_hub("AutoIntent/hwu64")

Source

This dataset is taken from original work's github repository jianguoz/Few-Shot-Intent-Detection and formatted with our AutoIntent Library:

# define utils
import requests
from autointent import Dataset

def load_text_from_url(github_file: str):
    return requests.get(github_file).text

def convert_hwu64(hwu_utterances, hwu_labels):
    intent_names = sorted(set(hwu_labels))
    name_to_id = dict(zip(intent_names, range(len(intent_names)), strict=False))
    n_classes = len(intent_names)

    assert len(hwu_utterances) == len(hwu_labels)

    classwise_utterance_records = [[] for _ in range(n_classes)]
    intents = [
        {
            "id": i,
            "name": name,
            
        }
        for i, name in enumerate(intent_names)
    ]

    for txt, name in zip(hwu_utterances, hwu_labels, strict=False):
        intent_id = name_to_id[name]
        target_list = classwise_utterance_records[intent_id]
        target_list.append({"utterance": txt, "label": intent_id})

    utterances = [rec for lst in classwise_utterance_records for rec in lst]
    return {"intents": intents, split: utterances}

# load
file_url = "https://raw.githubusercontent.com/jianguoz/Few-Shot-Intent-Detection/refs/heads/main/Datasets/HWU64/train/label"
labels = load_text_from_url(file_url).split("\n")[:-1]
file_url = "https://raw.githubusercontent.com/jianguoz/Few-Shot-Intent-Detection/refs/heads/main/Datasets/HWU64/train/seq.in"
utterances = load_text_from_url(file_url).split("\n")[:-1]
# convert
hwu64_train = convert_hwu64(utterances, labels, "train")

file_url = "https://raw.githubusercontent.com/jianguoz/Few-Shot-Intent-Detection/refs/heads/main/Datasets/HWU64/test/label"
labels = load_text_from_url(file_url).split("\n")[:-1]
file_url = "https://raw.githubusercontent.com/jianguoz/Few-Shot-Intent-Detection/refs/heads/main/Datasets/HWU64/test/seq.in"
utterances = load_text_from_url(file_url).split("\n")[:-1]
# convert
hwu64_test = convert_hwu64(utterances, labels, "test")

hwu64_train["test"] = hwu64_test["test"]
dataset = Dataset.from_dict(hwu64_train)
Downloads last month
1,640