diff --git a/python/paddle/dataset/sentiment.py b/python/paddle/dataset/sentiment.py index 22d867beea25c97efcbcb6f61ca2b7a7777f9c5c..8051acb8812e201baba605cfa1cb3f74741e0d5a 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))