""" """ # TODO try: import ir_datasets except ImportError as e: raise ImportError('ir-datasets package missing; `pip install ir-datasets`') import datasets IRDS_ID = 'clueweb12/b13/clef-ehealth/fr' IRDS_ENTITY_TYPES = {'queries': {'query_id': 'string', 'text': 'string'}, 'qrels': {'query_id': 'string', 'doc_id': 'string', 'relevance': 'int64', 'trustworthiness': 'int64', 'understandability': 'int64', 'iteration': 'string'}} _CITATION = '@inproceedings{Zuccon2016ClefEhealth,\n title={The IR Task at the CLEF eHealth Evaluation Lab 2016: User-centred Health Information Retrieval},\n author={Guido Zuccon and Joao Palotti and Lorraine Goeuriot and Liadh Kelly and Mihai Lupu and Pavel Pecina and Henning M{\\"u}ller and Julie Budaher and Anthony Deacon},\n booktitle={CLEF},\n year={2016}\n}\n@inproceedings{Palotti2017ClefEhealth,\n title={CLEF 2017 Task Overview: The IR Task at the eHealth Evaluation Lab - Evaluating Retrieval Methods for Consumer Health Search},\n author={Joao Palotti and Guido Zuccon and Jimmy and Pavel Pecina and Mihai Lupu and Lorraine Goeuriot and Liadh Kelly and Allan Hanbury},\n booktitle={CLEF},\n year={2017}\n}' _DESCRIPTION = "" # TODO class clueweb12_b13_clef_ehealth_fr(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/clueweb12#clueweb12/b13/clef-ehealth/fr", 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 # always return split corresponding with this config to avid returning a redundant DatasetDict layer return super().as_dataset(split, *args, **kwargs)