Skip to content

Commit

Permalink
ciff optional
Browse files Browse the repository at this point in the history
  • Loading branch information
seanmacavaney committed Feb 17, 2025
1 parent a8cb89d commit a647b0c
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ pytest-subtests
pytest-cov
pytest-json-report
ruff
pyciff==0.1.1
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
python_terrier>=0.9.1
pyterrier-alpha>=0.2.0
numpy>=1.21.0, <2.0.0
pyciff==0.1.1
tqdm
tbb<=2020.3.254
3 changes: 3 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ def run(self):
include_package_data=True,
install_requires=list(open('requirements.txt')),
python_requires=">=3.8",
extras_require={
'ciff': ['pyciff==0.1.1'],
},
entry_points={
'console_scripts': ['pyterrier_pisa=pyterrier_pisa.cli:main'],
'pyterrier.artifact': [
Expand Down
7 changes: 5 additions & 2 deletions src/pyterrier_pisa/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from .indexers import PisaIndexer, PisaToksIndexer, PisaIndexingMode
from .stopwords import _STOPWORDS

__version__ = '0.2.1'
__version__ = '0.2.2'

_logger = ir_datasets.log.easy()

Expand Down Expand Up @@ -321,7 +321,10 @@ def to_ciff(self, ciff_file: str, description: str = 'from pyterrier_pisa'):
description: The description to write to the CIFF file.
"""
assert self.built()
import pyciff
try:
import pyciff
except ImportError as ex:
raise ImportError('pyciff==0.1.1 required') from ex
pyciff.pisa_to_ciff(str(self.path/'inv'), str(self.path/'fwd.terms'), str(self.path/'fwd.documents'), ciff_file, description)

def get_corpus_iter(self, field='toks', verbose=True):
Expand Down

0 comments on commit a647b0c

Please sign in to comment.