text_plain_output_1.png
from keras.datasets import imdb

(x_train, y_train), (x_test, y_test) = imdb.load_data(path='imdb.npz', num_words=None, skip_top=0, maxlen=None, seed=113, start_char=1, oov_char=2, index_from=3)

word_index = imdb.get_word_index()

def whatItSay(index=9):
    reverse_index = dict([(value, key) for key, value in word_index.items()])
    decode_review = ' '.join([reverse_index.get(i - 3, '!') for i in x_train[index]])
    print(decode_review)
    print(y_train[index])
    return decode_review
decoded_review = whatItSay()