|
|
|
|
|
|
|
|
|
|
|
|
|
"""Merged and simplified dialog act datasets from the silicone collection.""" |
|
|
|
|
|
import pandas as pd |
|
import os |
|
|
|
import datasets |
|
|
|
_DESCRIPTION = """\ |
|
Merged and simplified dialog act datasets from the silicone collection. |
|
""" |
|
|
|
_HOMEPAGE = "https://huggingface.co/datasets/diwank/silicone-merged" |
|
_LICENSE = "MIT" |
|
|
|
_URLS = { |
|
"default": dict( |
|
train="https://huggingface.co/datasets/diwank/silicone-merged/resolve/main/train.h5", |
|
validation="https://huggingface.co/datasets/diwank/silicone-merged/resolve/main/validation.h5", |
|
test="https://huggingface.co/datasets/diwank/silicone-merged/resolve/main/test.h5", |
|
) |
|
} |
|
|
|
class SiliconeMergedDataset(datasets.GeneratorBasedBuilder): |
|
"""Merged and simplified dialog act datasets from the silicone collection.""" |
|
|
|
VERSION = datasets.Version("1.0.0") |
|
BUILDER_CONFIGS = [ |
|
datasets.BuilderConfig(name="default", version=VERSION, description="Default config"), |
|
] |
|
|
|
DEFAULT_CONFIG_NAME = "default" |
|
|
|
|
|
def _info(self): |
|
|
|
features = datasets.Features( |
|
{ |
|
"text_a": datasets.Value("string"), |
|
"text_b": datasets.Value("string"), |
|
"labels": datasets.Value("int64") |
|
} |
|
) |
|
|
|
return datasets.DatasetInfo( |
|
description=_DESCRIPTION, |
|
features=features, |
|
supervised_keys=("text_b", "labels"), |
|
homepage=_HOMEPAGE, |
|
license=_LICENSE, |
|
) |
|
|
|
def _split_generators(self, dl_manager): |
|
|
|
|
|
|
|
urls = _URLS[self.config.name] |
|
filepaths = dl_manager.download_and_extract(urls) |
|
return [ |
|
datasets.SplitGenerator( |
|
name=getattr(datasets.Split, split.upper()), |
|
|
|
gen_kwargs=dict( |
|
filepath=filepaths[split], |
|
split=split, |
|
), |
|
) |
|
for split in ["train", "test", "validation"] |
|
] |
|
|
|
def _generate_examples(self, filepath, split): |
|
df = pd.read_hdf(filepath, "data") |
|
|
|
for key, tuple in enumerate(df.itertuples(index=False)): |
|
yield key, tuple._asdict() |