You don’t need the exact same class Lang, but could have a look at the underlying operations and how to transform each word to an index.
Also, zou don’t necessarily need normalizeString, but it might help cleaning the tweets.
The passed argument to Lang is just the name of the language, which I called “tweet”.
The most important part is, that using the input_lang.word2index dict, you’ll get valid word indices, which can be used to train a model.