doc2query / wrapup.md
juliatessler's picture
fixes minor typo
96243b4
|
raw
history blame
1.72 kB

Putting it all together

You can use Doc2Query or Doc2Query-- in an indexing pipeline to build an index of the expanded documents:

D
Doc2Query[−−]
D
Indexer
IDX
import pyterrier as pt
pt.init()
import pyterrier_doc2query
doc2query = pyterrier_doc2query.Doc2Query(append=True)

dataset = pt.get_dataset('irds:msmarco-passage')

indexer = pt.IterDictIndexer('./msmarco_psg')

indxer_pipe = doc2query >> indexer
indxer_pipe.index(dataset.get_corpus_iter())

Once you built an index, you can retrieve from it using any retrieval function (often BM25):

Q
BM25 Retriever
IDX
R
bm25 = pt.BatchRetrieve('./msmarco_psg', wmodel="BM25")

References & Credits