From 480c7c4ee300803ea9097266a654e72a47267143 Mon Sep 17 00:00:00 2001 From: yuyang Date: Mon, 17 Sep 2018 05:42:30 +0000 Subject: [PATCH] Fix sentiment dataset --- python/paddle/dataset/sentiment.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/paddle/dataset/sentiment.py b/python/paddle/dataset/sentiment.py index 22d867beea2..8051acb8812 100644 --- a/python/paddle/dataset/sentiment.py +++ b/python/paddle/dataset/sentiment.py @@ -67,7 +67,7 @@ def get_word_dict(): for field in movie_reviews.fileids(category): for words in movie_reviews.words(field): word_freq_dict[words] += 1 - words_sort_list = six.iteritems(word_freq_dict) + words_sort_list = list(six.iteritems(word_freq_dict)) words_sort_list.sort(cmp=lambda a, b: b[1] - a[1]) for index, word in enumerate(words_sort_list): words_freq_sorted.append((word[0], index)) -- GitLab