Skip to content

Commit

Permalink
Fixed the new spaCy bug where the entire model name had to be include…
Browse files Browse the repository at this point in the history
…d while loading/downloading the model. Also added spaCy to the install_requires in setup.py. No idea how it worked earlier...
  • Loading branch information
SarthakJShetty committed Dec 19, 2021
1 parent 49f1c7c commit 12efaff
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
7 changes: 6 additions & 1 deletion pyResearchInsights/NLP_Engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,12 @@ def lemmatization(status_logger_name, textual_data, allowed_postags=['NOUN', 'AD
status_logger(status_logger_name, lemmatization_start_status_key)

texts_out = []
nlp = spacy.load('en', disable=['parser', 'ner'])
try:
nlp = spacy.load('en_core_web_sm', disable=['parser', 'ner'])
except OSError:
from spacy.cli import download
download('en_core_web_sm')
nlp = spacy.load('en_core_web_sm', disable=['parser', 'ner'])
for sent in textual_data:
doc = nlp(" ".join(sent))
texts_out.append([token.lemma_ for token in doc if token.pos_ in allowed_postags])
Expand Down
7 changes: 4 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,21 @@
setup(
name = 'pyResearchInsights', # How you named your package folder (MyLib)
packages = ['pyResearchInsights'], # Chose the same as "name"
version = '1.58', # Start with a small number and increase it with every change you make
version = '1.59', # Start with a small number and increase it with every change you make
license='MIT', # Chose a license from here: https://help.github.com/articles/licensing-a-repository
description = 'End-to-end tool for scientific literature analysis', # Give a short description about your library
long_description = 'Check out the detailed README [here](https://github.com/SarthakJShetty/pyResearchInsights)!',
author = 'Sarthak J. Shetty', # Type in your name
author_email = '[email protected]', # Type in your E-Mail
url = 'https://github.com/SarthakJShetty/pyResearchInsights', # Provide either the link to your github or to your website
download_url = 'https://github.com/SarthakJShetty/pyResearchInsights/archive/v_158.tar.gz', # I explain this later on
download_url = 'https://github.com/SarthakJShetty/pyResearchInsights/archive/v_159.tar.gz', # I explain this later on
keywords = ['Educational Tools', 'Analysis', 'Scraper', 'Natural Language Processing'], # Keywords that define your package best
install_requires=[ # I get to this in a second
'numpy',
'pandas',
'matplotlib',
'nltk',
'spacy',
'pyLDAvis',
'gensim',
'beautifulsoup4',
Expand All @@ -28,6 +29,6 @@
'Programming Language :: Python :: 3', #Specify which pyhton versions that you want to support
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
],
)

0 comments on commit 12efaff

Please sign in to comment.