|
|
|
""" |
|
""" |
|
try: |
|
import ir_datasets |
|
except ImportError as e: |
|
raise ImportError('ir-datasets package missing; `pip install ir-datasets`') |
|
import datasets |
|
|
|
IRDS_ID = 'disks45/nocr/trec-robust-2004' |
|
IRDS_ENTITY_TYPES = {'queries': {'query_id': 'string', 'title': 'string', 'description': 'string', 'narrative': 'string'}, 'qrels': {'query_id': 'string', 'doc_id': 'string', 'relevance': 'int64', 'iteration': 'string'}} |
|
|
|
_CITATION = '@misc{Voorhees1996Disks45,\n title = {NIST TREC Disks 4 and 5: Retrieval Test Collections Document Set},\n author = {Ellen M. Voorhees},\n doi = {10.18434/t47g6m},\n year = {1996},\n publisher = {National Institute of Standards and Technology}\n}\n@inproceedings{Voorhees2004Robust,\n title={Overview of the TREC 2004 Robust Retrieval Track},\n author={Ellen Voorhees},\n booktitle={TREC},\n year={2004}\n}\n@inproceedings{Huston2014ACO,\n title={A Comparison of Retrieval Models using Term Dependencies},\n author={Samuel Huston and W. Bruce Croft},\n booktitle={CIKM},\n year={2014}\n}' |
|
|
|
_DESCRIPTION = "" |
|
|
|
class disks45_nocr_trec_robust_2004(datasets.GeneratorBasedBuilder): |
|
BUILDER_CONFIGS = [datasets.BuilderConfig(name=e) for e in IRDS_ENTITY_TYPES] |
|
|
|
def _info(self): |
|
return datasets.DatasetInfo( |
|
description=_DESCRIPTION, |
|
features=datasets.Features({k: datasets.Value(v) for k, v in IRDS_ENTITY_TYPES[self.config.name].items()}), |
|
homepage=f"https://ir-datasets.com/disks45#disks45/nocr/trec-robust-2004", |
|
citation=_CITATION, |
|
) |
|
|
|
def _split_generators(self, dl_manager): |
|
return [datasets.SplitGenerator(name=self.config.name)] |
|
|
|
def _generate_examples(self): |
|
dataset = ir_datasets.load(IRDS_ID) |
|
for i, item in enumerate(getattr(dataset, self.config.name)): |
|
key = i |
|
if self.config.name == 'docs': |
|
key = item.doc_id |
|
elif self.config.name == 'queries': |
|
key = item.query_id |
|
yield key, item._asdict() |
|
|
|
def as_dataset(self, split=None, *args, **kwargs): |
|
split = self.config.name |
|
return super().as_dataset(split, *args, **kwargs) |
|
|