Skip to content

Commit cd4bc24

Browse files
committed
Merge branch 'practical-nlp:master' into master
2 parents e41dc3d + 8f80241 commit cd4bc24

File tree

7 files changed

+823
-635
lines changed

7 files changed

+823
-635
lines changed

Ch3/02_Bag_of_Words.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@
131131
"source": [
132132
"#BoW with binary vectors\n",
133133
"count_vect = CountVectorizer(binary=True)\n",
134-
"bow_rep_bin = count_vect.fit_transform(processed_docs)\n",
134+
"count_vect.fit(processed_docs)\n",
135135
"temp = count_vect.transform([\"dog and dog are friends\"])\n",
136136
"print(\"Bow representation for 'dog and dog are friends':\", temp.toarray())"
137137
]

Ch4/03_Word2Vec_Example.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@
269269
" feats = []\n",
270270
" for tokens in list_of_lists:\n",
271271
" feat_for_this = np.zeros(DIMENSION)\n",
272-
" count_for_this = 0\n",
272+
" count_for_this = 0 + 1e-5 # to avoid divide-by-zero \n",
273273
" for token in tokens:\n",
274274
" if token in w2v_model:\n",
275275
" feat_for_this += w2v_model[token]\n",

0 commit comments

Comments
 (0)