I am using keras(tensorflow) to convert text into encodings using tensorflow.keras.preprocessing.text.one_hot
tensorflow.keras.preprocessing.text.one_hot
I have used it for training dataset as below