Closed ajcross1234 closed 3 years ago
Thanks for the tweak.
I added this to the notebook to keep our code stable:
import textacy
if textacy.__version__ < '0.11': # as in printed book
from textacy.text_utils import KWIC
else: # for textacy 0.11.x
from textacy.extract.kwic import keyword_in_context
def KWIC(*args, **kwargs):
# call keyword_in_context with all params except 'print_only'
return keyword_in_context(*args,
**{kw: arg for kw, arg in kwargs.items()
if kw != 'print_only'})
In Chapter 1, in Blueprint: Finding a Keyword in Context (KWIC) textacy 0.11.0 worked with:
from textacy.extract.kwic import keyword_in_context
def kwic(doc_series, keyword, window=35, print_samples=5):