无法导入名称“组合规则句子分段器”

2024-06-13 03:49:57 发布

您现在位置:Python中文网/ 问答频道 /正文

我已经安装了所有的软件包。在导入它们时,我收到一个错误,如“无法导入名称‘组合规则’、‘句子’、‘分段器’”。如何正确导入软件包

!pip install https://s3-us-west-2.amazonaws.com/ai2-s2-scispacy/releases/v0.2.0/en_core_sci_sm-0.2.0.tar.gz
pip install https://s3-us-west-2.amazonaws.com/ai2-s2-scispacy/releases/v0.2.0/en_core_sci_md-0.2.0.tar.gz
pip install https://s3-us-west-2.amazonaws.com/ai2-s2-scispacy/releases/v0.2.0/en_ner_bc5cdr_md-0.2.0.tar.gz
pip install https://s3-us-west-2.amazonaws.com/ai2-s2-scispacy/releases/v0.2.0/en_ner_bionlp13cg_md-0.2.0.tar.gz

import scispacy
import spacy
from spacy import displacy
from collections import Counter
import en_core_web_sm
import en_ner_bc5cdr_md
import en_core_sci_sm
import en_core_sci_md
import en_ner_bionlp13cg_md
from scispacy.abbreviation import AbbreviationDetector
from scispacy.umls_linking import UmlsEntityLinker
from collections import OrderedDict
from pprint import pprint


/usr/local/lib/python3.6/dist-packages/spacy/util.py:275: UserWarning: [W031] Model 'en_core_web_sm' (2.2.5) requires spaCy v2.2 and is incompatible with the current spaCy version (2.3.2). This may lead to unexpected results or runtime errors. To resolve this, download a newer compatible model or retrain your custom model with the current spaCy version. For more details and available updates, run: python -m spacy validate
  warnings.warn(warn_msg)
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-14-66f9ffa9fc68> in <module>()
      4 from collections import Counter
      5 import en_core_web_sm
----> 6 import en_ner_bc5cdr_md
      7 import en_core_sci_sm
      8 import en_core_sci_md

/usr/local/lib/python3.6/dist-packages/en_ner_bc5cdr_md/__init__.py in <module>()
      5 from spacy.util import load_model_from_init_py, get_model_meta
      6 
----> 7 from scispacy.custom_sentence_segmenter import combined_rule_sentence_segmenter
      8 
      9 __version__ = get_model_meta(Path(__file__).parent)['version']

ImportError: cannot import name 'combined_rule_sentence_segmenter'

Tags: installpipfromhttpscoreimportmodels3