allenai / scispacy

A full spaCy pipeline and models for scientific/biomedical documents.
https://allenai.github.io/scispacy/
Apache License 2.0
1.71k stars 229 forks source link

AttributeError: type object 'Language' has no attribute 'factory' #414

Closed davidshumway closed 2 years ago

davidshumway commented 2 years ago

Using Google Colab.

Using the latest version of scispacy due to some other issues with the default version installed via pip (0.2.x).

Attempting to use en_core_sci_sm-0.4.0

!pip install scispacy==0.4.0
!pip install /content/gdrive/MyDrive/scispacy/en_core_sci_sm-0.4.0/

Attempting to run the entity linker example code:

import spacy
import scispacy
from scispacy.linking import EntityLinker

I thought this was working previously. I was using lg instead of sm and then I switched to sm partly to explore memory in regard to UMLS. Now this is appearing:

AttributeError                            Traceback (most recent call last)

<ipython-input-20-200d08a76362> in <module>()
      9 
---> 10 from scispacy.linking import EntityLinker
     11 
     12 nlp = spacy.load("en_core_sci_sm")

/usr/local/lib/python3.7/dist-packages/scispacy/linking.py in <module>()
      6 
      7 
----> 8 @Language.factory("scispacy_linker")
      9 class EntityLinker:
     10     """

AttributeError: type object 'Language' has no attribute 'factory'

Any ideas?

davidshumway commented 2 years ago

Factory reset runtime appears to have done the trick!