Skip to content

Commit

Permalink
Fix get_word_index (keras-team#2981)
Browse files Browse the repository at this point in the history
  • Loading branch information
nzw0301 authored and fchollet committed Jun 15, 2016
1 parent 6b122ba commit c53c64d
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion keras/datasets/reuters.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from six.moves import cPickle
from six.moves import zip
import numpy as np
import sys


def load_data(path="reuters.pkl", nb_words=None, skip_top=0,
Expand Down Expand Up @@ -64,4 +65,11 @@ def load_data(path="reuters.pkl", nb_words=None, skip_top=0,
def get_word_index(path="reuters_word_index.pkl"):
path = get_file(path, origin="https://s3.amazonaws.com/text-datasets/reuters_word_index.pkl")
f = open(path, 'rb')
return cPickle.load(f)

if sys.version_info < (3,):
data = cPickle.load(f)
else:
data = cPickle.load(f, encoding="latin1")

f.close()
return data

0 comments on commit c53c64d

Please sign in to comment.