- Équipes
- Productions scientifiques
-
- Séminaires
This is an old revision of the document!
# Un dictionnaire mappant des mots sur un index entier
word_index = imdb.get_word_index()
# Les premiers index sont réservés word_index = {k:(v+3) for k,v in word_index.items()} word_index[“<PAD>”] = 0 word_index[“<START>”] = 1 word_index[“<UNK>”] = 2 # inconnu word_index[“<UNUSED>”] = 3
reverse_word_index = dict([(value, key) for (key, value) in word_index.items()])
def decode_review(text):
return ' '.join([reverse_word_index.get(i, '?') for i in text])