Documnet encodings in fastai version 2

How to get the encodings from documents in fastai version2 as there is an article written on it how to get the encodings from version1. As there are lot more changes in version2 can anyone help me with it …?
https://medium.com/@alden_6876/getting-document-encodings-from-fastais-ulmfit-language-model-a3f9271f9ecd