Esempio n. 1
0
 def __init__(self, ranker, prels, anserini, index, topn=5, topw=3):
     RelevanceFeedback.__init__(self,
                                ranker,
                                prels,
                                anserini,
                                index,
                                topn=topn)
     self.topw = topw
Esempio n. 2
0
 def __init__(self, ranker, prels, anserini, index):
     RelevanceFeedback.__init__(self,
                                ranker,
                                prels,
                                anserini,
                                index,
                                topn=10)
     self.index_reader = pyserini.index.IndexReader(self.index)
Esempio n. 3
0
 def __init__(self, ranker, index, topn=10, topw=10, original_q_w=0.5):
     RelevanceFeedback.__init__(self,
                                ranker=ranker,
                                prels=None,
                                anserini=None,
                                index=index,
                                topn=topn)
     self.topw = topw
     self.searcher = SimpleSearcher(index)
     self.ranker = ranker
     self.original_q_w = original_q_w
Esempio n. 4
0
def get_rf_expanders(rankers, index, anserini, output):
    expanders = []
    for ranker in rankers:
        ranker_name = get_ranker_name(ranker)
        expanders.append(
            RelevanceFeedback(ranker=ranker_name,
                              prels='{}.abstractqueryexpansion.{}.txt'.format(
                                  output, ranker_name),
                              anserini=anserini,
                              index=index))
        expanders.append(
            Docluster(ranker=ranker_name,
                      prels='{}.abstractqueryexpansion.{}.txt'.format(
                          output, ranker_name),
                      anserini=anserini,
                      index=index)),
        expanders.append(
            Termluster(ranker=ranker_name,
                       prels='{}.abstractqueryexpansion.{}.txt'.format(
                           output, ranker_name),
                       anserini=anserini,
                       index=index))
        expanders.append(
            Conceptluster(ranker=ranker_name,
                          prels='{}.abstractqueryexpansion.{}.txt'.format(
                              output, ranker_name),
                          anserini=anserini,
                          index=index))
    return expanders
Esempio n. 5
0
 def __init__(self,
              ranker,
              prels,
              anserini,
              index,
              w_t,
              w_a,
              corpus_size,
              replace=False,
              topn=3,
              topw=10,
              adap=False):
     RelevanceFeedback.__init__(self,
                                ranker,
                                prels,
                                anserini,
                                index,
                                topn=topn)
     self.index_reader = pyserini.index.IndexReader(self.index)
     self.topw = 10
     self.adap = adap
     self.w_t = w_t  # weight for title field
     self.w_a = w_a  # weight for anchor field
     self.corpus_size = corpus_size  #total number of documents in the collection
Esempio n. 6
0
def get_rf_expanders(rankers, corpus, output, ext_corpus=None):
    expanders_list = []
    for ranker in rankers:
        ranker_name = utils.get_ranker_name(ranker)
        if param.ReQue['expanders']['RM3']:
            from expanders.rm3 import RM3
            expanders_list.append(
                RM3(ranker=ranker_name, index=param.corpora[corpus]['index']))
        if param.ReQue['expanders']['RelevanceFeedback']:
            from expanders.relevancefeedback import RelevanceFeedback
            expanders_list.append(
                RelevanceFeedback(
                    ranker=ranker_name,
                    prels='{}.abstractqueryexpansion.{}.txt'.format(
                        output, ranker_name),
                    anserini=param.anserini['path'],
                    index=param.corpora[corpus]['index']))
        if param.ReQue['expanders']['Docluster']:
            from expanders.docluster import Docluster
            expanders_list.append(
                Docluster(ranker=ranker_name,
                          prels='{}.abstractqueryexpansion.{}.txt'.format(
                              output, ranker_name),
                          anserini=param.anserini['path'],
                          index=param.corpora[corpus]['index'])),
        if param.ReQue['expanders']['Termluster']:
            from expanders.termluster import Termluster
            expanders_list.append(
                Termluster(ranker=ranker_name,
                           prels='{}.abstractqueryexpansion.{}.txt'.format(
                               output, ranker_name),
                           anserini=param.anserini['path'],
                           index=param.corpora[corpus]['index']))
        if param.ReQue['expanders']['Conceptluster']:
            from expanders.conceptluster import Conceptluster
            expanders_list.append(
                Conceptluster(ranker=ranker_name,
                              prels='{}.abstractqueryexpansion.{}.txt'.format(
                                  output, ranker_name),
                              anserini=param.anserini['path'],
                              index=param.corpora[corpus]['index']))
        if param.ReQue['expanders']['BertQE']:
            from expanders.bertqe import BertQE
            expanders_list.append(
                BertQE(ranker=ranker_name,
                       prels='{}.abstractqueryexpansion.{}.txt'.format(
                           output, ranker_name),
                       index=param.corpora[corpus]['index'],
                       anserini=param.anserini['path']))
        if param.ReQue['expanders']['OnFields']:
            from expanders.onfields import OnFields
            expanders_list.append(
                OnFields(ranker=ranker_name,
                         prels='{}.abstractqueryexpansion.{}.txt'.format(
                             output, ranker_name),
                         anserini=param.anserini['path'],
                         index=param.corpora[corpus]['index'],
                         w_t=param.corpora[corpus]['w_t'],
                         w_a=param.corpora[corpus]['w_a'],
                         corpus_size=param.corpora[corpus]['size']))
        if param.ReQue['expanders']['AdapOnFields']:
            from expanders.adaponfields import AdapOnFields
            expanders_list.append(
                AdapOnFields(
                    ranker=ranker_name,
                    prels='{}.abstractqueryexpansion.{}.txt'.format(
                        output, ranker_name),
                    anserini=param.anserini['path'],
                    index=param.corpora[corpus]['index'],
                    w_t=param.corpora[corpus]['w_t'],
                    w_a=param.corpora[corpus]['w_a'],
                    corpus_size=param.corpora[corpus]['size'],
                    collection_tokens=param.corpora[corpus]['tokens'],
                    ext_corpus=ext_corpus,
                    ext_index=param.corpora[ext_corpus]['index'],
                    ext_collection_tokens=param.corpora[ext_corpus]['tokens'],
                    ext_w_t=param.corpora[ext_corpus]['w_t'],
                    ext_w_a=param.corpora[ext_corpus]['w_a'],
                    ext_corpus_size=param.corpora[ext_corpus]['size'],
                    adap=True))

    return expanders_list