KeyError: 'Location', when using Spacy >= 3.1.0
vanyingenzi opened this issue · 1 comments
vanyingenzi commented
When trying to extract keywords, use MultipartiteRank. Using the following code :
extractor = pke.unsupervised.MultipartiteRank()
--> extractor.load_document(input=text, language='fr')
I get the following TraceBack error :
/usr/local/lib/python3.7/dist-packages/pke/readers.py in str2spacy(model)
109 def str2spacy(model):
110 downloaded_models = [os.path.basename(m) for m in list_downloaded_spacy_models()]
--> 111 links = list_linked_spacy_models()
112 filtered_downloaded = [m for m in downloaded_models if m[:2] == model]
113 if model in downloaded_models + links:
/usr/local/lib/python3.7/dist-packages/pke/readers.py in list_linked_spacy_models()
80 def list_linked_spacy_models():
81 """ Read SPACY/data and return a list of link_name """
---> 82 spacy_data = os.path.join(spacy.info(silent=True)['Location'], 'data')
83 linked = [d for d in os.listdir(spacy_data) if os.path.islink(os.path.join(spacy_data, d))]
84 # linked = [os.path.join(spacy_data, d) for d in os.listdir(spacy_data)]
Now I checked and saw that within the recent spacy library update they change the keyword Location
to location
.
Anyhow, can anybody update it please.
Thank you
ygorg commented
Hi, thanks for reporting this error, it is linked to #165.
Edit: Please try reinstalling pke (pip install git+https://github.com/boudinfl/pke
) you seem to not have the last version.
Could you please report what is the output of the following code:
import spacy, sys
print(sys.version)
print(repr(spacy.__version__))
print(int(spacy.__version__.split('.')[0]) < 3)
Thank you