cherry picking https://github.com/longdt219/nltk/commit/4fa2478cc24458147c0f92ac5c88874d0c7aafca; resolves #722