| | --- |
| | |
| | tags: |
| | - pyterrier |
| | - pyterrier-artifact |
| | - pyterrier-artifact.sparse_index |
| | - pyterrier-artifact.sparse_index.terrier |
| | task_categories: |
| | - text-retrieval |
| | viewer: false |
| | --- |
| | |
| | # nfcorpus.terrier |
| |
|
| | ## Description |
| |
|
| | Terrier index for NFCorpus |
| |
|
| | ## Usage |
| |
|
| | ```python |
| | # Load the artifact |
| | import pyterrier as pt |
| | index = pt.Artifact.from_hf('pyterrier/nfcorpus.terrier') |
| | index.bm25() |
| | ``` |
| |
|
| | ## Benchmarks |
| |
|
| | `nfcorpus/dev` |
| |
|
| | | name | nDCG@10 | R@1000 | |
| | |:-------|----------:|---------:| |
| | | bm25 | 0.2944 | 0.3291 | |
| | | dph | 0.2914 | 0.3293 | |
| |
|
| | `nfcorpus/test` |
| |
|
| | | name | nDCG@10 | R@1000 | |
| | |:-------|----------:|---------:| |
| | | bm25 | 0.3282 | 0.365 | |
| | | dph | 0.3221 | 0.3671 | |
| |
|
| | ## Reproduction |
| |
|
| | ```python |
| | import pyterrier as pt |
| | from tqdm import tqdm |
| | import ir_datasets |
| | dataset = ir_datasets.load('beir/nfcorpus') |
| | meta_docno_len = dataset.metadata()['docs']['fields']['doc_id']['max_len'] |
| | indexer = pt.IterDictIndexer("./nfcorpus.terrier", meta={'docno': meta_docno_len, 'text': 4096}) |
| | docs = ({'docno': d.doc_id, 'text': d.default_text()} for d in tqdm(dataset.docs)) |
| | indexer.index(docs) |
| | ``` |
| |
|
| | ## Metadata |
| |
|
| | ``` |
| | { |
| | "type": "sparse_index", |
| | "format": "terrier", |
| | "package_hint": "python-terrier" |
| | } |
| | ``` |
| |
|