Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update for current versions of spaCy, gensim, etc.? #86

Open
wendlingd opened this issue Dec 11, 2021 · 1 comment
Open

Update for current versions of spaCy, gensim, etc.? #86

wendlingd opened this issue Dec 11, 2021 · 1 comment

Comments

@wendlingd
Copy link

wendlingd commented Dec 11, 2021

Great book! I read it cover to cover AND tried to run nearly all of the code, which I almost never do.

Could the code in this repo for spaCy and gensim be updated to the current versions? As one example, Ch5/01_KPE.ipynb does not run with the current version of spaCy. I am just learning but I assume changes might include, for Ch5/01_KPE.ipynb,

Book version:

!pip install textacy==0.9.1
!pip install spacy==2.2.4

import spacy
import textacy.ke
from textacy import *

print(f'Using textacy {textacy.__version__} and spaCy {spacy.__version__}')

# Worked with 2.2.4:
textacy.ke.textrank(doc, topn=10)

# Worked with 2.2.4:
print("Textrank output: ", [kps for kps, weights in textacy.ke.textrank(doc, normalize="lemma", topn=5)])

What appears to run okay as of this writing, December 2021, using spaCy 3.2.0...

# Lines of Ch5/01_KPE.ipynb revised for spaCy 3.2.0:
!pip install textacy==0.11.0   # or 0.12.0 but I haven't tried that
!pip install spacy==3.2.0

import spacy
import textacy
from textacy import extract
from textacy.extract import keyterms as kt

print(f'Using textacy {textacy.__version__}')
print(f'Using spaCy {spacy.__version__}')

# Works with 3.2.0:
import spacy
import textacy
from textacy import extract
from textacy.extract import keyterms as kt

print(f'Using textacy {textacy.__version__} and spaCy {spacy.__version__}')

# Works with 3.2.0:
kt.textrank(doc, normalize="lemma", topn=10) # I'm not sure the role of normalize

# Works with 3.2.0:
print("Textrank output: ", [kps for kps, weights in extract.keyterms.textrank(doc, normalize="lemma", topn=5)])

Would be great if someone smarter than me could update the book's spaCy- and gensim-related code to run current versions for 2022...

@wendlingd wendlingd changed the title Update to current library versions for spaCy, gensim, etc.? Update for current versions of spaCy, gensim, etc.? Dec 11, 2021
@kartikay-bagla
Copy link
Collaborator

Hi @wendlingd. Currently we've provided a requirements.txt file with the versions of the libraries we support. As long as you use those versions, our code should work.

As for updating the libraries and the code, that is in the works. We'll hopefully have a clear timeline on it in the near future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants