You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems like changes going back to 42ffffd (2/23/2019) are causing me issues.
On attempting to run example from Chapter 2 of the nltk book (below) I get an ImportError. Seems to be related to the change made on Feb 23 specifically related to the imports: cfd = nltk.ConditionalFreqDist( ( genre, word ) for genre in brown.categories( ) for word in brown.words( categories=genre ) ) cfd.plot()
Traceback (most recent call last):
File "C:\XXX\PycharmProjects\ciExp\venv\lib\site-packages\nltk\probability.py", line 1907, in plot
from matplotlib import plt
ImportError: cannot import name 'plt' from 'matplotlib' (C:\XXX\PycharmProjects\ciExp\venv\lib\site-packages\matplotlib_init_.py)
Correcting the import statement to import matplotlib.pyplot as plt as it was before Feb 23 results in an UnboundedLocalError in the same plot() function. There was a change on May 7 to that line where it removed a comment from if v in self:
File "C:\XXX\PycharmProjects\ciExp\venv\lib\site-packages\nltk\probability.py", line 1919, in plot
kwargs, 'samples', sorted(set(v for c in conditions
File "C:\XXX\PycharmProjects\ciExp\venv\lib\site-packages\nltk\probability.py", line 1920, in
if v in self
UnboundLocalError: local variable 'v' referenced before assignment
Code snippet from probability.py: samples = _get_kwarg( kwargs, 'samples', sorted(set(v for c in conditions if v in self for v in self[c])) ) # this computation could be wasted
Commenting out the if v in self line (probably ill advised but I wanted to walk this back) results in a NameError:
File "C:\XXX\PycharmProjects\ciExp\venv\lib\site-packages\nltk\probability.py", line 1940, in plot
ax.plot(freqs, *args, **kwargs)
NameError: name 'ax' is not defined
I can basically continue to walk this back until the code just hangs infinitely (as far as I can tell). By reverting the probability.py file back before Feb 23, the matplotlib window will show up but (once again, as far as I can tell) it hangs infinitely without showing my data. Other matplotlib function calls seem to work just fine (like those in chapter 1). In my py 3.7 virtenv the version of nltk: 3.4.3 and matplotlib: 3.1.0 so I'm pretty sure it's not an installation issue. Any help would be appreciated!
The text was updated successfully, but these errors were encountered:
It seems like changes going back to 42ffffd (2/23/2019) are causing me issues.
cfd = nltk.ConditionalFreqDist( ( genre, word ) for genre in brown.categories( ) for word in brown.words( categories=genre ) ) cfd.plot()
import matplotlib.pyplot as plt
as it was before Feb 23 results in an UnboundedLocalError in the same plot() function. There was a change on May 7 to that line where it removed a comment fromif v in self
:Code snippet from probability.py:
samples = _get_kwarg( kwargs, 'samples', sorted(set(v for c in conditions if v in self for v in self[c])) ) # this computation could be wasted
if v in self
line (probably ill advised but I wanted to walk this back) results in a NameError:I can basically continue to walk this back until the code just hangs infinitely (as far as I can tell). By reverting the probability.py file back before Feb 23, the matplotlib window will show up but (once again, as far as I can tell) it hangs infinitely without showing my data. Other matplotlib function calls seem to work just fine (like those in chapter 1). In my py 3.7 virtenv the version of nltk: 3.4.3 and matplotlib: 3.1.0 so I'm pretty sure it's not an installation issue. Any help would be appreciated!
The text was updated successfully, but these errors were encountered: