我已经在Windows中成功安装了spacy,但是在jupyter笔记本中加载spacy时出现错误
import os
import pandas as pd
from nltk.stem import PorterStemmer
from nltk.tokenize import sent_tokenize, word_tokenize
from nltk.corpus import stopwords
path= "B:/NLTK"
os.chdir(path)
## Import Data
stop_words=set(stopwords.words('english'))
data = pd.read_csv("Seperated_data.csv")
text1=data['Problems_describe']
list= text1.astype(list)
#print(list)
for sent in sent_tokenize(list.read()):
words = word_tokenize(sent)
filtered_sentence = [w for w in words if not w in stop_words]
print(filtered_sentence)
我在jupyter终端中检查了软件包的有效性,如下所示:
ValueError: could not broadcast input array from shape (96) into shape (128)
我尝试在Jupyter笔记本中导入
python -m spacy validate
✔ Loaded compatibility table
====================== Installed models (spaCy v2.1.4) ======================
ℹ spaCy installation:
C:\Users\iKhan\AppData\Roaming\Python\Python36\site-packages\spacy
TYPE NAME MODEL VERSION
package en-core-web-sm en_core_web_sm 2.1.0 ✔
package en-core-web-md en_core_web_md 2.1.0 ✔
package en-core-web-lg en_core_web_lg 2.1.0 ✔
以下是对错误的完整追溯
import spacy
nlp = spacy.load('en_core_web_sm', disable=['parser', 'ner'])
Error
ValueError: could not broadcast input array from shape (96) into shape (128)