File size: 1,442 Bytes
8125a1c
 
 
f55201c
8125a1c
 
 
 
f55201c
 
 
8125a1c
 
f55201c
8125a1c
 
 
f55201c
8125a1c
 
 
f55201c
 
8125a1c
f55201c
 
8125a1c
 
 
f55201c
 
 
 
 
 
 
8125a1c
 
 
 
f55201c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8125a1c
 
 
 
 
 
 
 
 
 
f55201c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
---
tags:
- pyterrier
- pyterrier-anserini
- pyterrier-artifact
task_categories:
- text-retrieval
viewer: false
language:
- en
pretty_name: Anserini index of the BRIGHT Sustainable Living collection for PyTerrier
---

# Anserini index of the BRIGHT Sustainable Living collection for PyTerrier

## Description

An Anserini index of the sustainable-living subset of the BRIGHT dataset build with PyTerrier's Anserini plugin.

## Usage

You will need to install PyTerrier, and its Anserini engine:

```python
%pip install pyjnius git+https://github.com/terrier-org/pyterrier.git
%pip install pyterrier-anserini
```


```python
import pyterrier as pt

anserini_index = pt.Artifact.from_hf("pyterrier-tutorial/bright.sustainable.anserini.text")
anserini_bm25 = anserini_index.bm25(k1=0.9, b=0.4)
anserinni_bm25.search("renewable energy and sustainable development").head(10)
```

## Reproduction

```python
from pyterrier_anserini import AnseriniIndex

anserini_path = "./bright-anserini-index"

if os.path.exists(anserini_path):
    shutil.rmtree(anserini_path)

anserini_index = AnseriniIndex(anserini_path)
anserini_indexer = anserini_index.indexer(
    fields=["text"],
    store_positions=True,
    verbose=True
)

dataset = pt.get_dataset('irds:bright/sustainable-living')
anserini_indexer.index(dataset.get_corpus_iter())
```

## Metadata

```
{
  "type": "sparse_index",
  "format": "anserini",
  "package_hint": "pyterrier-anserini"
}
```