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
contractions
package available on PyPI with thecontractions
module from a textbook called "Text Analytics with Python" (source code).The
CONTRACTIONS_MAP
variable is defined in the latter and is not part of thecontractions
package 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_dict
contains entries like: