Skip to content

Instantly share code, notes, and snippets.

@sai-teja-ponugoti
Created June 2, 2020 01:10
Show Gist options
  • Save sai-teja-ponugoti/5ff5d17f7a53295e8ea3fba2f6166948 to your computer and use it in GitHub Desktop.
Save sai-teja-ponugoti/5ff5d17f7a53295e8ea3fba2f6166948 to your computer and use it in GitHub Desktop.
# forming new sentences for testing, feel free to experiment
# sentence 1 is bit sarcastic, whereas sentence two is a general statment.
new_sentence = [
"granny starting to fear spider in the garden might be real",
"game of thrones season finale showing this sunday night"]
# Converting the sentences to sequences using tokenizer
new_sequences = tokenizer.texts_to_sequences(new_sentence)
# padding the new sequences to make them have same dimensions
new_padded = pad_sequences(new_sequences, maxlen = max_length,
padding = padding_type,
truncating = trunc_type)
new_padded = np.array(new_padded )
print(model.predict(new_padded))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment