From 69dfb7b4b10d09c177b470b26290ab6c07241c95 Mon Sep 17 00:00:00 2001 From: lzjqsdd Date: Tue, 3 May 2016 00:40:35 -0500 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E5=85=B3=E9=94=AE=E8=AF=8D?= =?UTF-8?q?=E5=AF=B9=E7=BC=96=E5=8F=B7=E7=9A=84=E6=98=A0=E5=B0=84=E6=A8=A1?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ml/InverseIndex.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ml/InverseIndex.py b/ml/InverseIndex.py index c553117..e98ba3c 100644 --- a/ml/InverseIndex.py +++ b/ml/InverseIndex.py @@ -90,7 +90,7 @@ class InverseIndex: indexdoc = dict() f = open(Global.inverse_dir+'id.txt','wb') for name in vectorizer.get_feature_names(): - indexdoc[i] = name + indexdoc[name] = i i+=1 f.write(json.dumps(indexdoc)) f.close() @@ -99,7 +99,7 @@ class InverseIndex: row = tfidf.shape[0] for i in range(0,colnum): filename = Global.inverse_dir+str(i/Global.filesize)+'.txt' - f = open(filename,'a') + f = open(filename,'a' idx_list = dict() for j in range(0,row): val = tfidf[j,i]