test / test.py
lhoestq's picture
lhoestq HF staff
initial commit
08aa29f
raw
history blame
1.14 kB
import datasets
_CITATION = """\
"""
_DESCRIPTION = """\
This is a test dataset.
"""
_URL = "https://pastebin.com/raw/HvpE1CnA" # a dummy data file
class Test(datasets.GeneratorBasedBuilder):
"""SQUAD: The Stanford Question Answering Dataset. Version 1.1."""
def _info(self):
return datasets.DatasetInfo(
description=_DESCRIPTION,
features=datasets.Features(
{
"text": datasets.Value("string"),
}
),
supervised_keys=None,
homepage="https://huggingface.co/datasets/lhoestq/test",
citation=_CITATION,
)
def _split_generators(self, dl_manager):
downloaded_file = dl_manager.download_and_extract(_URL)
return [
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": downloaded_file}),
]
def _generate_examples(self, filepath):
"""This function returns the examples in the raw (text) form."""
for _id, line in enumerate(open(filepath, encoding="utf-8")):
yield _id, {"text": line.rstrip()}