-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Issue #743, Updated word2vec.n_similarities and test_word2vec.testSimilarities methods #883
Changes from all commits
809f2ba
3084f6b
14ce73f
552cd59
a826db2
b77ac47
ec51a48
1288dcf
8bc778c
3398e5a
eea3590
5235bb6
8f3e51c
306b2ec
ec49724
dc4df1c
9285ef9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1539,9 +1539,13 @@ def n_similarity(self, ws1, ws2): | |
True | ||
|
||
""" | ||
if not(len(ws1) and len(ws2)): | ||
raise ZeroDivisionError('Atleast one of the passed list is empty.') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If input is a list, idiomatic Python is: |
||
v1 = [self[word] for word in ws1] | ||
v2 = [self[word] for word in ws2] | ||
return dot(matutils.unitvec(array(v1).mean(axis=0)), matutils.unitvec(array(v2).mean(axis=0))) | ||
return dot(matutils.unitvec(array(v1).mean(axis=0)), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We don't use vertical indent in gensim -- change to normal hanging indent (see PEP8: all statements on new lines, one level of indent). |
||
matutils.unitvec(array(v2).mean(axis=0))) | ||
|
||
|
||
def init_sims(self, replace=False): | ||
""" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't delete from changelog of phrases fix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't delete it, I had a previous build in which that entry was not in the changelog, anyway I added it. Thank You for marking out the changes.