|
"""ReRelEM dataset""" |
|
|
|
import datasets |
|
import pandas as pd |
|
|
|
_CITATION = """ |
|
""" |
|
|
|
_DESCRIPTION = """ |
|
""" |
|
_URLS = { |
|
"train": "https://raw.githubusercontent.com/ruanchaves/rerelem/9de7c418879b010a8ca9940639cac900bd27d9fd/rerelem_train.csv", |
|
"validation": "https://raw.githubusercontent.com/ruanchaves/rerelem/9de7c418879b010a8ca9940639cac900bd27d9fd/rerelem_val.csv", |
|
"test": "https://raw.githubusercontent.com/ruanchaves/rerelem/9de7c418879b010a8ca9940639cac900bd27d9fd/rerelem_test.csv" |
|
} |
|
|
|
class ReRelEm(datasets.GeneratorBasedBuilder): |
|
|
|
VERSION = datasets.Version("1.0.0") |
|
def _info(self): |
|
return datasets.DatasetInfo( |
|
description=_DESCRIPTION, |
|
features=datasets.Features( |
|
{ |
|
"docid": datasets.Value("string"), |
|
"sentence1": datasets.Value("string"), |
|
"sentence2": datasets.Value("string"), |
|
"label": datasets.Value("string"), |
|
"same_text": datasets.Value("bool"), |
|
}), |
|
supervised_keys=None, |
|
homepage="", |
|
citation=_CITATION, |
|
) |
|
|
|
def _split_generators(self, dl_manager): |
|
downloaded_files = dl_manager.download(_URLS) |
|
return [ |
|
datasets.SplitGenerator( |
|
name=datasets.Split.TRAIN, |
|
gen_kwargs={ |
|
"filepath": downloaded_files["train"] |
|
} |
|
), |
|
datasets.SplitGenerator( |
|
name=datasets.Split.VALIDATION, |
|
gen_kwargs={ |
|
"filepath": downloaded_files["validation"] |
|
} |
|
), |
|
datasets.SplitGenerator( |
|
name=datasets.Split.TEST, |
|
gen_kwargs={ |
|
"filepath": downloaded_files["test"] |
|
} |
|
) |
|
] |
|
|
|
def _generate_examples(self, filepath): |
|
records = pd.read_csv(filepath).to_dict("records") |
|
for idx, row in enumerate(records): |
|
yield idx, row |
|
|