ImportError Traceback (most recent call last)
<ipython-input-13-74c9bc9e3e4a> in <module>
8 from nltk.tokenize.toktok import ToktokTokenizer
9 #import contractions
---> 10 from contractions import CONTRACTION_MAP
11 import unicodedata
12
ImportError: cannot import name 'CONTRACTION_MAP' from 'contractions' (c:\users\nikita\appdata\local\programs\python\python37-32\lib\site-packages\contractions\__init__.py)
One question is: is the CONTRACTION_MAP variable deprecated from the contractions package?
I believe you have mistaken the
contractionspackage available on PyPI with thecontractionsmodule from a textbook called "Text Analytics with Python" (source code).The
CONTRACTIONS_MAPvariable is defined in the latter and is not part of thecontractionspackage API (documented in the GitHub Readme.md).From the documentation, the package can be used to fix contractions like:
If you want access to the map of contraction to expanded version, this can be imported using:
This
contractions_dictcontains entries like: