-
-
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 save/load_word2vec_format
methods for FastText
model. Fix #1743
#1755
Changes from 2 commits
4d727dd
1412f57
191110a
91e04ec
430918d
c0ac05f
2c7fc81
922326f
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 |
---|---|---|
|
@@ -137,6 +137,12 @@ def __contains__(self, word): | |
char_ngrams = compute_ngrams(word, self.min_n, self.max_n) | ||
return any(ng in self.ngrams for ng in char_ngrams) | ||
|
||
@classmethod | ||
def load_word2vec_format(cls, fname, fvocab=None, binary=False, encoding='utf8', unicode_errors='strict', | ||
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. One tiny change I might suggest here would be to use *args and **kwargs instead. I like following this practice in situations where the subclass doesn't make use of the function params itself. It is useful because if any params in the parent class change in the future, the subclass function signature doesn't have to be modified. |
||
limit=None, datatype=REAL): | ||
"""Not suppported. Use gensim.models.KeyedVectors.load_word2vec_format instead.""" | ||
raise NotImplementedError("Not supported. Use gensim.models.KeyedVectors.load_word2vec_format instead.") | ||
|
||
|
||
class FastText(Word2Vec): | ||
""" | ||
|
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.
Necessary? Personally, I would leave this out. I don't see any problem with getting a "deprecation error" instead of "not implemented error". Plus, it's weird to call a method that you know will fail. This is likely to cause more confusion than good. @menshikh-iv, what do you think?
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.
Makes sense. Removing this function from here.
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.
@janpom agree with you