Пример #1
0
class TestSearchIntegration(unittest.TestCase):
    def setUp(self):
        # The current directory depends on if you're running inside an IDE or from command line.
        curdir = os.getcwd()
        if curdir.endswith('integrations'):
            anserini_root = '../../anserini'
            pyserini_root = '..'
        else:
            anserini_root = '../anserini'
            pyserini_root = '.'

        self.checker = SimpleSearcherChecker(
            anserini_root=anserini_root,
            index=os.path.join(anserini_root, 'indexes/lucene-index.core17.pos+docvectors+raw'),
            topics=os.path.join(pyserini_root, 'tools/topics-and-qrels/topics.core17.txt'),
            pyserini_topics='core17',
            qrels=os.path.join(pyserini_root, 'tools/topics-and-qrels/qrels.core17.txt'))

    def test_bm25(self):
        self.assertTrue(self.checker.run('core17_bm25', '-bm25', '--bm25'))

    def test_bm25_rm3(self):
        self.assertTrue(self.checker.run('core17_bm25_rm3', '-bm25 -rm3', '--bm25 --rm3'))

    def test_qld(self):
        self.assertTrue(self.checker.run('core17_qld', '-qld', '--qld'))

    def test_qld_rm3(self):
        self.assertTrue(self.checker.run('core17_qld_rm3', '-qld -rm3', '--qld --rm3'))

    def tearDown(self):
        pass
Пример #2
0
    def setUp(self):
        # The current directory depends on if you're running inside an IDE or from command line.
        curdir = os.getcwd()
        if curdir.endswith('integrations'):
            anserini_root = '../../anserini'
            pyserini_root = '..'
        else:
            anserini_root = '../anserini'
            pyserini_root = '.'

        self.checker = SimpleSearcherChecker(
            anserini_root=anserini_root,
            index=os.path.join(anserini_root, 'indexes/lucene-index.core17.pos+docvectors+raw'),
            topics=os.path.join(pyserini_root, 'tools/topics-and-qrels/topics.core17.txt'),
            pyserini_topics='core17',
            qrels=os.path.join(pyserini_root, 'tools/topics-and-qrels/qrels.core17.txt'))