Closed ksaadDE closed 2 months ago
Luckily enough, nobody needs to install the entire scispacy library to just obtain the Abbreviation Extraction utility :) https://github.com/allenai/scispacy/blob/main/scispacy/abbreviation.py
Just in case someone needs it as well. To include and use it:
from filename import AbbreviationDetector
loaded_nlp_model.add_pipe('abbreviation_detector')
Example code, partially stolen borrowed from StackOverflow
import spacy
from filename import AbbreviationDetector
def filter_abbrv (loaded_nlp_model, txtData):
loaded_nlp_model.add_pipe('abbreviation_detector')
doc=loaded_nlp_model (txtData)
altered_tok=[tok.text for tok in doc]
print("abbrv:", doc._.abbreviations)
for abrv in doc._.abbreviations:
altered_tok[abrv.start]=str(abrv._.long_form)
return (" ".join(altered_tok))
loaded_nlp_model = spacy.load("en_core_web_lg") # or whatever
filter_abbrv (loaded_nlp_model, "StackOverflow (SO) and Github are pretty cool")
Has anyone figured out a work-around for this for the functionalities which require scispacy or even nmslib?
Hi, you may have some luck with this workaround here: https://github.com/allenai/scispacy/issues/473#issuecomment-1590443024
My workaround was to install everything in Python/anaconda 3.9. Annoying, but it works
@dakinggg Do you have a workaround for Databricks ML? I've run out of tricks, I cannot get nmslib to install on 3.11 or 3.10
Based on https://github.com/allenai/scispacy/issues/520#issue-2438749767, I was able to get it working on both windows and wsl with python 3.11, by installing with mamba
. Could others on this thread try that and let me know if it works? If so, I will update the installation instructions.
I've added a known support matrix to the readme for nmslib, so going to go ahead and close this issue.
python3 -m pip install scispacy
bin/python (venv) --> Python 3.11.6
bin/pip --version (venv) --> 3.11.6