I am using keras(tensorflow) to convert text into encodings using
I have used it for training dataset as below
from tensorflow.keras.preprocessing.text import one_hot corpus = ['nice app'] onehot_repr = [one_hot(words, 10000) for words in corpus] print(onehot_repr) # [5779, 2969]
It's ok upto this point.
But when I use the
one_hot for my testing set it generates different encoding.
I have created a Flask API to test, So how can use same encoding for both train and test set
Result from API is :
[[5129, 4965]] for same text