Skip to content

Commit

Permalink
Support loading gensim word2vec with new format.
Browse files Browse the repository at this point in the history
  • Loading branch information
zake7749 authored Sep 26, 2017
1 parent ee15cd9 commit 03132ff
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Chatbot/RuleMatcher/rulebase.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,10 @@ def load_model(self,path):
Args:
path: the path of the model.
"""

self.model = models.KeyedVectors.load_word2vec_format(path,binary=True)
try:
self.model = models.Word2Vec.load(path) # cur
except:
self.model = models.KeyedVectors.load_word2vec_format(path, binary=True) # old

def match(self, sentence, topk=1, threshold=0, root=None):

Expand Down

0 comments on commit 03132ff

Please sign in to comment.