Example #1
0
 def test_simple_qrels(self):
     qrels = Qrels('tools/topics-and-qrels/qrels.covid-round1.txt')
     self.assertEqual(
         len(qrels.get_docids(topic=1, relevance_grades=[1, 2])), 101)
     self.assertEqual(len(qrels.get_docids(topic=1, relevance_grades=[2])),
                      56)
     self.assertEqual(len(qrels.get_docids(topic=1, relevance_grades=[1])),
                      45)
Example #2
0
    def test_retain_qrels(self):
        run = TrecRun('tests/resources/simple_trec_run_filter.txt')
        qrels = Qrels('tools/topics-and-qrels/qrels.covid-round1.txt')

        run.retain_qrels(qrels,
                         clone=True).save_to_txt(output_path=self.output_path)
        self.assertTrue(
            filecmp.cmp('tests/resources/simple_trec_run_keep_verify.txt',
                        self.output_path))
Example #3
0
    def test_discard_qrels(self):
        run = TrecRun(
            os.path.join(self.root,
                         'tests/resources/simple_trec_run_filter.txt'))
        qrels = Qrels(
            os.path.join(self.root,
                         'tools/topics-and-qrels/qrels.covid-round1.txt'))

        run.discard_qrels(
            qrels, clone=False).save_to_txt(output_path=self.output_path)
        self.assertTrue(
            filecmp.cmp(
                os.path.join(
                    self.root,
                    'tests/resources/simple_trec_run_remove_verify.txt'),
                self.output_path))