From c90d89f037809a98786891ebfd8f60606d1c9961 Mon Sep 17 00:00:00 2001 From: Luke Slater Date: Wed, 25 Apr 2018 15:09:41 +0100 Subject: [PATCH] Update runWord2Vec.py File "runWord2Vec.py", line 9 for line in open('AllAxioms.lst'): ^ TabError: inconsistent use of tabs and spaces in indentation --- runWord2Vec.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/runWord2Vec.py b/runWord2Vec.py index ef8a8ee..af00768 100644 --- a/runWord2Vec.py +++ b/runWord2Vec.py @@ -6,8 +6,8 @@ def __init__(self, dirname): self.dirname = dirname def __iter__(self): - for line in open('AllAxioms.lst'): - yield line.split() + for line in open('AllAxioms.lst'): + yield line.split() sentences =gensim.models.word2vec.LineSentence('AllAxioms.lst') # a memory-friendly iterator ssmodel =gensim.models.Word2Vec(sentences,min_count=0, size=200, window=10, sg=1, negative=4, iter=5) @@ -16,9 +16,9 @@ def __iter__(self): word_vectors=ssmodel.wv file= open ('VecResults.lst', 'w') with open('AllClasses.lst') as f: - for line in f: - GO_class=line.rstrip() - if GO_class in word_vectors.vocab: - GOvectors[GO_class]=ssmodel[GO_class]; - file.write (str(GO_class) + ' '+ str(GOvectors[GO_class]) +'\n') + for line in f: + GO_class=line.rstrip() + if GO_class in word_vectors.vocab: + GOvectors[GO_class]=ssmodel[GO_class]; + file.write (str(GO_class) + ' '+ str(GOvectors[GO_class]) +'\n') file.close()