|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"""TODO: Add a description here.""" |
|
|
|
import json |
|
import datasets |
|
|
|
|
|
|
|
_CITATION = """\ |
|
""" |
|
|
|
|
|
|
|
_DESCRIPTION = """\ |
|
""" |
|
_HOMEPAGE = 'https://github.com/nala-cub/prost' |
|
_LICENSE = 'Apache 2.0' |
|
|
|
_URL = 'https://huggingface.co./datasets/corypaik/prost/resolve/main/data' |
|
|
|
_URLs = {'default': f'{_URL}/default.jsonl'} |
|
|
|
MC_LABELS = list('ABCD') |
|
|
|
|
|
class Prost(datasets.GeneratorBasedBuilder): |
|
"""TODO: Short description of my dataset.""" |
|
|
|
VERSION = datasets.Version('1.0.0') |
|
|
|
def _info(self): |
|
features = datasets.Features({ |
|
'A': datasets.Value('string'), |
|
'B': datasets.Value('string'), |
|
'C': datasets.Value('string'), |
|
'D': datasets.Value('string'), |
|
'context': datasets.Value('string'), |
|
'question': datasets.Value('string'), |
|
'ex_question': datasets.Value('string'), |
|
'group': datasets.Value('string'), |
|
'label': datasets.ClassLabel(names=MC_LABELS), |
|
'name': datasets.Value('string'),}) |
|
return datasets.DatasetInfo(description=_DESCRIPTION, features=features, |
|
supervised_keys=None, homepage=_HOMEPAGE, |
|
license=_LICENSE, citation=_CITATION) |
|
|
|
def _split_generators(self, dl_manager): |
|
""" Returns SplitGenerators.""" |
|
path = dl_manager.download_and_extract(_URLs[self.config.name]) |
|
kwargs = {'path': path} |
|
return [datasets.SplitGenerator(datasets.Split.TEST, gen_kwargs=kwargs)] |
|
|
|
def _generate_examples(self, path): |
|
with open(path, 'r') as f: |
|
for _id, line in enumerate(f.readlines()): |
|
yield _id, json.loads(line) |
|
|