Skip to content

Commit

Permalink
fix doc2vec compatibility for word2vec batching
Browse files Browse the repository at this point in the history
  • Loading branch information
piskvorky committed Nov 21, 2015
1 parent da0b269 commit d8b4134
Show file tree
Hide file tree
Showing 4 changed files with 2,132 additions and 843 deletions.
5 changes: 3 additions & 2 deletions gensim/models/doc2vec.py
Original file line number Diff line number Diff line change
Expand Up @@ -673,8 +673,9 @@ def _do_train_job(self, job, alpha, inits):
self.docvecs.trained_item(indexed_doctags)
return tally, self._raw_word_count(job)

def _raw_word_count(self, items):
return sum(len(item.words) for item in items)
def _raw_word_count(self, job):
"""Return the number of words in a given job."""
return sum(len(sentence.words) for sentence in job)

def infer_vector(self, doc_words, alpha=0.1, min_alpha=0.0001, steps=5):
"""
Expand Down
Loading

0 comments on commit d8b4134

Please sign in to comment.