|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"""DSTC11 Dataset.""" |
|
|
|
import json |
|
import datasets |
|
|
|
|
|
_CITATION = """\ |
|
@misc{gung2023natcs, |
|
title={NatCS: Eliciting Natural Customer Support Dialogues}, |
|
author={James Gung and Emily Moeng and Wesley Rose and Arshit Gupta and Yi Zhang and Saab Mansour}, |
|
year={2023}, |
|
eprint={2305.03007}, |
|
archivePrefix={arXiv}, |
|
primaryClass={cs.CL} |
|
} |
|
@misc{gung2023intent, |
|
title={Intent Induction from Conversations for Task-Oriented Dialogue Track at DSTC 11}, |
|
author={James Gung and Raphael Shu and Emily Moeng and Wesley Rose and Salvatore Romeo and Yassine Benajiba and Arshit Gupta and Saab Mansour and Yi Zhang}, |
|
year={2023}, |
|
eprint={2304.12982}, |
|
archivePrefix={arXiv}, |
|
primaryClass={cs.CL} |
|
} |
|
""" |
|
|
|
_DESCRIPTION = """ |
|
This repository contains data, relevant scripts and baseline code for the Dialog Systems Technology Challenge (DSTC11). |
|
""" |
|
|
|
_HOMEPAGE = "https://github.com/amazon-science/dstc11-track2-intent-induction" |
|
_URLs = { |
|
"validation": "development/dialogues.jsonl.gz", |
|
"test-banking": "test-banking/dialogues.jsonl.gz", |
|
"test-finance": "test-finance/dialogues.jsonl.gz", |
|
} |
|
|
|
class Dstc11(datasets.GeneratorBasedBuilder): |
|
"""Data from the DSTC 11 tasks.""" |
|
|
|
VERSION = datasets.Version("1.0.0") |
|
|
|
|
|
BUILDER_CONFIGS = [ |
|
datasets.BuilderConfig( |
|
name="data", |
|
version=datasets.Version("1.0.0"), |
|
description=_DESCRIPTION, |
|
), |
|
datasets.BuilderConfig(name="docs", version=datasets.Version("1.0.0"), description=_DESCRIPTION), |
|
] |
|
|
|
DEFAULT_CONFIG_NAME = "data" |
|
|
|
|
|
def _info(self): |
|
features=datasets.Features({ |
|
"dialogue_id": datasets.Value("string"), |
|
"turns": datasets.Sequence( |
|
datasets.Features({ |
|
"turn_id": datasets.Value("string"), |
|
"speaker_role": datasets.Value("string"), |
|
"utterance": datasets.Value("string"), |
|
"dialogue_acts": datasets.Sequence( |
|
datasets.Value("string") |
|
), |
|
"intents": datasets.Sequence( |
|
datasets.Value("string") |
|
), |
|
}) |
|
) |
|
}) |
|
return datasets.DatasetInfo( |
|
description=_DESCRIPTION, |
|
features=features, |
|
supervised_keys=None, |
|
citation=_CITATION, |
|
homepage=_HOMEPAGE) |
|
|
|
def _split_generators(self, dl_manager): |
|
"""Returns SplitGenerators.""" |
|
data_dir = dl_manager.download_and_extract(_URLs) |
|
return [ |
|
datasets.SplitGenerator( |
|
name=datasets.Split.VALIDATION, |
|
gen_kwargs={"filepaths": [data_dir["validation"]], "split": "validation"}, |
|
), |
|
datasets.SplitGenerator( |
|
name=datasets.Split.TEST, |
|
gen_kwargs={"filepaths": [data_dir["test-banking"], data_dir["test-finance"]], "split": "test"}, |
|
), |
|
datasets.SplitGenerator( |
|
name="test.banking", |
|
gen_kwargs={"filepaths": [data_dir["test-banking"]], "split": "test.banking"}, |
|
), |
|
datasets.SplitGenerator( |
|
name="test.finance", |
|
gen_kwargs={"filepaths": [data_dir["test-finance"]], "split": "test.finance"}, |
|
), |
|
] |
|
|
|
def _generate_examples(self, filepaths, split): |
|
key = 0 |
|
for filepath in filepaths: |
|
for line in open(filepath, encoding="utf-8"): |
|
line = json.loads(line) |
|
yield key, line |
|
key += 1 |
|
|