-
-
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
[MRG] FastText out-of-vocab fix #1409
Conversation
gensim/models/wrappers/fasttext.py
Outdated
@@ -344,7 +344,7 @@ def init_ngrams(self): | |||
ngram_indices = [] | |||
for i, ngram in enumerate(all_ngrams): | |||
ngram_hash = self.ft_hash(ngram) | |||
ngram_indices.append((len(self.wv.vocab) + ngram_hash) % self.bucket) | |||
ngram_indices.append((len(self.wv.vocab)) + ngram_hash % self.bucket) |
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.
No needed brackets (len(...))
Also, you change operation order, it's correct behavior?
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.
Removed the extra brackets.
Yes, the new operation order is correct behaviour, it was a bug earlier.
Nice work @jayantj 👍 |
@menshikh-iv @prakhar2b Please review.