{"action":"created","issue":{"url":"https://api.github.com/repos/nltk/nltk/issues/238","labels_url":"https://api.github.com/repos/nltk/nltk/issues/238/labels{/name}","comments_url":"https://api.github.com/repos/nltk/nltk/issues/238/comments","events_url":"https://api.github.com/repos/nltk/nltk/issues/238/events","html_url":"https://github.com/nltk/nltk/issues/238","id":3481858,"number":238,"title":"\"from nltk import util\" imports nltk.cluster.util instead of nltk.util","user":{"login":"dan-blanchard","id":976345,"avatar_url":"https://avatars.githubusercontent.com/u/976345?v=3","gravatar_id":"","url":"https://api.github.com/users/dan-blanchard","html_url":"https://github.com/dan-blanchard","followers_url":"https://api.github.com/users/dan-blanchard/followers","following_url":"https://api.github.com/users/dan-blanchard/following{/other_user}","gists_url":"https://api.github.com/users/dan-blanchard/gists{/gist_id}","starred_url":"https://api.github.com/users/dan-blanchard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dan-blanchard/subscriptions","organizations_url":"https://api.github.com/users/dan-blanchard/orgs","repos_url":"https://api.github.com/users/dan-blanchard/repos","events_url":"https://api.github.com/users/dan-blanchard/events{/privacy}","received_events_url":"https://api.github.com/users/dan-blanchard/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2012-03-02T19:15:24Z","updated_at":"2015-06-07T14:53:01Z","closed_at":"2012-05-11T22:31:37Z","body":"I have a lot of code that uses the `util.ngrams` iterator, and I noticed that after the latest release I kept getting `AttributeError: 'module' object has no attribute 'ngrams'` errors all over the place. It turns out that in the latest release when you try to import the `nltk.util` module, it actually imports the `nltk.cluster.util` now. You can actually get around this by directly importing the functions you want like `from nltk.util import ngrams`, but it'd be really nice if it went back to the way it was before."},"comment":{"url":"https://api.github.com/repos/nltk/nltk/issues/comments/109762890","html_url":"https://github.com/nltk/nltk/issues/238#issuecomment-109762890","issue_url":"https://api.github.com/repos/nltk/nltk/issues/238","id":109762890,"user":{"login":"maxlemieux","id":8403155,"avatar_url":"https://avatars.githubusercontent.com/u/8403155?v=3","gravatar_id":"","url":"https://api.github.com/users/maxlemieux","html_url":"https://github.com/maxlemieux","followers_url":"https://api.github.com/users/maxlemieux/followers","following_url":"https://api.github.com/users/maxlemieux/following{/other_user}","gists_url":"https://api.github.com/users/maxlemieux/gists{/gist_id}","starred_url":"https://api.github.com/users/maxlemieux/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maxlemieux/subscriptions","organizations_url":"https://api.github.com/users/maxlemieux/orgs","repos_url":"https://api.github.com/users/maxlemieux/repos","events_url":"https://api.github.com/users/maxlemieux/events{/privacy}","received_events_url":"https://api.github.com/users/maxlemieux/received_events","type":"User","site_admin":false},"created_at":"2015-06-07T14:53:01Z","updated_at":"2015-06-07T14:53:01Z","body":"Confirmed this is still a problem in current release. I reproduced on Python 2.7, NLTK 3.0.2.\r\n\r\nDirect import works as mentioned. Accessing by nltk.util.ngrams does not work."}}