| --- |
| tags: |
| - pyterrier |
| - pyterrier-artifact |
| - pyterrier-pisa |
| task_categories: |
| - text-retrieval |
| viewer: false |
| pretty_name: PISA index of the BRIGHT Sustainable Living collection for PyTerrier |
| language: |
| - en |
| --- |
| |
| # PISA index of the BRIGHT Sustainable Living collection for PyTerrier |
|
|
| ## Description |
|
|
| An PISA index of the sustainable-living subset of the BRIGHT dataset build with PyTerrier's PISA plugin. |
|
|
| ## Usage |
|
|
| You will need to install PyTerrier, and its PISA engine: |
|
|
| ```python |
| %pip install pyterrier |
| %pip install pyterrier-pisa |
| ``` |
|
|
|
|
| ```python |
| import pyterrier as pt |
| |
| pisa_index = pt.Artifact.from_hf('pyterrier-tutorial/bright.sustainable.pisa.text') |
| pisa_bm25 = pisa_index.bm25(k1=0.9, b=0.4) |
| pisa_bm25.search("renewable energy and sustainable development").head(10) |
| ``` |
|
|
| ## Reproduction |
|
|
| ```python |
| from pyterrier_pisa import PisaIndex |
| |
| pisa_path = "./bright-pisa-index" |
| |
| if os.path.exists(pisa_path): |
| shutil.rmtree(pisa_path) |
| |
| pisa_index = PisaIndex( |
| pisa_path, |
| text_field="text", |
| threads=2, |
| overwrite=True |
| ) |
| |
| dataset = pt.get_dataset('irds:bright/sustainable-living') |
| pisa_index.index(dataset.get_corpus_iter()) |
| ``` |
|
|
| ## Metadata |
|
|
| ``` |
| { |
| "type": "sparse_index", |
| "format": "pisa", |
| "package_hint": "pyterrier-pisa", |
| "stemmer": "porter2" |
| } |
| ``` |