Skip to content

Instantly share code, notes, and snippets.

@MLWhiz
Created January 18, 2019 05:50
Show Gist options
  • Select an option

  • Save MLWhiz/7f867da58aa20b50e724c12b89950fc9 to your computer and use it in GitHub Desktop.

Select an option

Save MLWhiz/7f867da58aa20b50e724c12b89950fc9 to your computer and use it in GitHub Desktop.
from keras.preprocessing.text import Tokenizer
## Tokenize the sentences
tokenizer = Tokenizer(num_words=max_features)
tokenizer.fit_on_texts(list(train_X)+list(test_X))
train_X = tokenizer.texts_to_sequences(train_X)
test_X = tokenizer.texts_to_sequences(test_X)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment