Created
January 1, 2019 19:27
-
-
Save bluedistro/54757cd75fb3e01f92fa93e0ad091bc6 to your computer and use it in GitHub Desktop.
decode review
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def decode_review(text_list): | |
word_index = tokenizer.word_index | |
sequences = tokenizer.texts_to_sequences(text_list) | |
data = pad_sequences(sequences, maxlen=500) | |
# decode the words | |
reverse_word_index = dict([(value, key) for (key, value) in word_index.items()]) | |
decoded_review = ' '.join([reverse_word_index.get(i, '?') for i in sequences[0]]) | |
return decoded_review, data |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment