File tree Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -133,7 +133,9 @@ def remove_punctuation_3(s):
133
133
134
134
start = max (0 , i - context_size )
135
135
end = min (len (line_as_idx ), i + context_size )
136
- for c in line_as_idx [start :end ]:
136
+ for c in line_as_idx [start :i ]:
137
+ wc_counts [w , c ] += 1
138
+ for c in line_as_idx [i + 1 :end ]:
137
139
wc_counts [w , c ] += 1
138
140
print ("Finished counting" )
139
141
@@ -161,8 +163,8 @@ def remove_punctuation_3(s):
161
163
162
164
163
165
# latent dimension
164
- D = 50
165
- reg = 0.
166
+ D = 100
167
+ reg = 0.1
166
168
167
169
168
170
# initialize weights
Original file line number Diff line number Diff line change @@ -92,7 +92,7 @@ def nearest_neighbors(w, n=5):
92
92
word2vec = {}
93
93
embedding = []
94
94
idx2word = []
95
- with open ('../large_files/glove.6B/glove.6B.50d.txt' ) as f :
95
+ with open ('../large_files/glove.6B/glove.6B.50d.txt' , encoding = 'utf-8' ) as f :
96
96
# is just a space-separated text file in the format:
97
97
# word vec[0] vec[1] vec[2] ...
98
98
for line in f :
You can’t perform that action at this time.
0 commit comments