Skip to content

Commit

Permalink
Merge pull request #93 from LeapBeyond/feature/spacy_version
Browse files Browse the repository at this point in the history
Update to spacy v3rc3
  • Loading branch information
thomasbird committed Jan 25, 2021
2 parents 58c57d7 + 78fca35 commit e72edb0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
9 changes: 7 additions & 2 deletions requirements/python-extras-spacy
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@
# Extra dependancies for spacy detector
# wheel is needed for spacy to do its funky model management, not sure why its not a dep of spacy directly
wheel
thinc==8.0.0rc2; python_version>='3.6' or python_version<'3.9'
spacy-nightly[transformers]==3.0.0rc2; python_version>='3.6' or python_version<'3.9'

thinc>=8.0.0rc3,<8.1.0; python_version>='3.6' or python_version<'3.9'
spacy-nightly[transformers]==3.0.0rc3; python_version>='3.6' or python_version<'3.9'

# thinc==8.0.0rc2; python_version>='3.6' or python_version<'3.9'
# spacy-nightly[transformers]==3.0.0rc2; python_version>='3.6' or python_version<'3.9'

# spacy-nightly[transformers]>=3.0.0rc1; python_version >= '3.6'
# spacy-transformers>=1.0.0rc0
7 changes: 6 additions & 1 deletion scrubadub/detectors/spacy.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,12 @@ def check_spacy_version() -> bool:
@staticmethod
def check_spacy_model(model) -> bool:
"""Ensure that the spaCy model is installed."""
spacy_info = spacy.info()
try:
spacy_info = spacy.info()
except TypeError:
# There is a forgotten default argument in spacy.info in version 3rc3, this try except should be removed
# in the future.
spacy_info = spacy.info(exclude=[])
models = list(spacy_info.get('pipelines', spacy_info.get('models', None)).keys())
if models is None:
raise ValueError('Unable to detect spacy models.')
Expand Down

0 comments on commit e72edb0

Please sign in to comment.