code reorganisation, cf https://github.com/nltk/nltk/pull/564