changed some NLTK code to comply with NLTK 3.0