Problem reconstructing Keras's IMDB reviews Keras's sample IMDB reviews are represented as a sequence of word indexes. However,  a dictionary is provided that matches the index to the word I'm trying to use this to reconstruct the text of a review, but I'm getting gibberish. Here's my code:

from keras.datasets import imdb

(x_train, y_train), (x_test, y_test) = imdb.load_data()
ind = imdb.get_word_index()

def find_word(val):
    for key, value in ind.items():
        if value == val:
            return key

rev = x_train[0] #which review to look at
rev_recon = [] #hold the reconstructed review

for i in range(len(rev)):
    word = find_word(rev[i])
    rev_recon.append(word)

print(' '.join(rev_recon))
&gt;&gt;&gt;the as you with out themselves powerful lets loves their 
becomes reaching had journalist of lot from anyone to have 
after out atmosphere never more room titillate it so heart 
shows to years of every never going villaronga help moments


I thought the sequence of word indexes was supposed to represent the sequence in which the words originally appeared in the review. Am I missing something? Here's my code:
Nevermind, it wasn't very clear to me that the defaults for load_data() actually shift the sequence indices by 3, and so to obtain the proper indices for the dictionary you either need to offset those indices during lookup or shift the dictionary values, e.g.:

ind = imdb.get_word_index()
ind = {k:(v+3) for k,v in ind.items()}


And also every review is padded with a 1 at word [0], and so reconstructing the review means starting at [1] or passing start_char=None in load_data()