From 94e8aec0d68f946a1d523e0aa702210b65ef80e9 Mon Sep 17 00:00:00 2001 From: guenthermi Date: Wed, 24 Jan 2024 10:31:04 +0100 Subject: [PATCH] refactor: remove WikiCLIR --- mteb/tasks/Retrieval/WikiCLIRRetrieval.py | 51 ----------------------- mteb/tasks/Retrieval/__init__.py | 1 - 2 files changed, 52 deletions(-) delete mode 100644 mteb/tasks/Retrieval/WikiCLIRRetrieval.py diff --git a/mteb/tasks/Retrieval/WikiCLIRRetrieval.py b/mteb/tasks/Retrieval/WikiCLIRRetrieval.py deleted file mode 100644 index 575be3009e..0000000000 --- a/mteb/tasks/Retrieval/WikiCLIRRetrieval.py +++ /dev/null @@ -1,51 +0,0 @@ -from collections import defaultdict - -import ir_datasets - -from ...abstasks.AbsTaskRetrieval import AbsTaskRetrieval - - -class WikiCLIRRetrieval(AbsTaskRetrieval): - - _EVAL_SPLIT = 'test' - - @property - def description(self): - return { - 'name': 'WikiCLIR', - 'ir_datasets_name': 'wikiclir/de', - 'reference': 'https://ir-datasets.com/wikiclir#wikiclir/de', - 'description': ( - 'A Cross-Language IR (CLIR) collection between English queries and German documents ' - 'built from Wikipedia. Queries are limited to the first 10k queries to reduce the ' - 'evaluation time.' - ), - 'type': 'Retrieval', - 'category': 's2p', - 'eval_splits': [self._EVAL_SPLIT], - 'eval_langs': ['en-de'], - 'main_score': 'ndcg_at_10', - } - - def load_data(self, **kwargs): - if self.data_loaded: - return - - dataset = ir_datasets.load(self.description['ir_datasets_name']) - # load first 10k queries - queries = defaultdict(dict) - for item in dataset.queries_iter(): - if len(queries) < 10_000: - queries[item.query_id] = item.first_sent - # load corpus and qrels - qrel_dict = defaultdict(dict) - corpus = {item.doc_id: {'title': item.title, 'text': item.text} for item in dataset.docs_iter()} - for item in dataset.qrels_iter(): - if item.query_id in queries.keys(): - qrel_dict[item.query_id][item.doc_id] = item.relevance - - self.queries = {self._EVAL_SPLIT: queries} - self.corpus = {self._EVAL_SPLIT: corpus} - self.relevant_docs = {self._EVAL_SPLIT: qrel_dict} - - self.data_loaded = True \ No newline at end of file diff --git a/mteb/tasks/Retrieval/__init__.py b/mteb/tasks/Retrieval/__init__.py index 406d12e484..99793ab849 100644 --- a/mteb/tasks/Retrieval/__init__.py +++ b/mteb/tasks/Retrieval/__init__.py @@ -37,7 +37,6 @@ from .SCIDOCSPLRetrieval import * from .SciFactPLRetrieval import * from .TRECCOVIDPLRetrieval import * -from .WikiCLIRRetrieval import * from .GerDaLIRRetrieval import * from .GermanDPRRetrieval import * from .XMarketRetrieval import *