From 04a8c54f7af8be499f2776eac7486a98a1d03f36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maik=20Fr=C3=B6be?= Date: Wed, 7 Jun 2023 10:02:51 +0200 Subject: [PATCH] Prepare addition of the TREC Tip-of-the-Tongue dataset #235 --- ir_datasets/datasets/trec_tip_of_the_tongue.py | 6 ++++++ test/integration/trec_tip_of_the_tongue.py | 3 +++ 2 files changed, 9 insertions(+) diff --git a/ir_datasets/datasets/trec_tip_of_the_tongue.py b/ir_datasets/datasets/trec_tip_of_the_tongue.py index 9eea8cfc..230c5dc3 100644 --- a/ir_datasets/datasets/trec_tip_of_the_tongue.py +++ b/ir_datasets/datasets/trec_tip_of_the_tongue.py @@ -30,6 +30,12 @@ class TipOfTheTongueQuery(NamedTuple): def default_text(self): return self.title + ' ' + self.text + + def __getattr__(self, attr): + if attr == 'query_id': + return self.id + + return self.__getattribute__(attr) def _init(): diff --git a/test/integration/trec_tip_of_the_tongue.py b/test/integration/trec_tip_of_the_tongue.py index cd40f752..d0cb07fe 100644 --- a/test/integration/trec_tip_of_the_tongue.py +++ b/test/integration/trec_tip_of_the_tongue.py @@ -18,6 +18,7 @@ def test_test_tip_of_the_tongue_queries_train(self): self._test_queries('trec-tip-of-the-tongue/train', count=150) query = list(ir_datasets.load('trec-tip-of-the-tongue/train').queries_iter())[0] self.assertEqual('763', query.id) + self.assertEqual('763', query.query_id) self.assertTrue(query.text.startswith("Very rare movie that is scifi/dystopian/experimental/surreal. It’s like Stalker meets el Topo meets")) @@ -26,6 +27,7 @@ def test_test_tip_of_the_tongue_queries_dev(self): self._test_queries('trec-tip-of-the-tongue/dev', count=150) query = list(ir_datasets.load('trec-tip-of-the-tongue/dev').queries_iter())[0] self.assertEqual('152', query.id) + self.assertEqual('152', query.query_id) self.assertTrue(query.text.startswith("Movie from the early 2000s I believe about three people living in an apartment")) @@ -47,3 +49,4 @@ def test_test_tip_of_the_tongue_qrels_dev(self): if __name__ == '__main__': unittest.main() +