浏览代码

Fixing a bug of 'for loop' (#280)

At line#62, 'for loop' should be "range(n, -1, -1)", otherwise it would not be able to enter the loop.
zdc19 6 年之前
父节点
当前提交
9e1bb504f5
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      examples/2_BasicModels/word2vec.py

+ 1 - 1
examples/2_BasicModels/word2vec.py

@@ -59,7 +59,7 @@ count = [('UNK', -1)]
 # Retrieve the most common words
 count.extend(collections.Counter(text_words).most_common(max_vocabulary_size - 1))
 # Remove samples with less than 'min_occurrence' occurrences
-for i in range(len(count) - 1, -1):
+for i in range(len(count) - 1, -1, -1):
     if count[i][1] < min_occurrence:
         count.pop(i)
     else: