Skip to content

Commit 8e4e8f0

Browse files
committed
update
1 parent 8672ba2 commit 8e4e8f0

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

nlp_class2/pmi.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,9 @@ def remove_punctuation_3(s):
133133

134134
start = max(0, i - context_size)
135135
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]:
137139
wc_counts[w, c] += 1
138140
print("Finished counting")
139141

@@ -161,8 +163,8 @@ def remove_punctuation_3(s):
161163

162164

163165
# latent dimension
164-
D = 50
165-
reg = 0.
166+
D = 100
167+
reg = 0.1
166168

167169

168170
# initialize weights

nlp_class2/pretrained_glove.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def nearest_neighbors(w, n=5):
9292
word2vec = {}
9393
embedding = []
9494
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:
9696
# is just a space-separated text file in the format:
9797
# word vec[0] vec[1] vec[2] ...
9898
for line in f:

0 commit comments

Comments
 (0)