Skip to content

niitsuma/word2vec-keras-in-gensim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

51 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

word2vec-keras-in-gensim

Just rewrite train function in gensim.models.word2vec.Word2Vec and gensim.models.doc2vec.Doc2Vec using Keras+Theano

like

class Word2VecKeras(gensim.models.word2vec.Word2Vec):
     def train(...

And can use GPU via Theano.

Install

pip install word2veckeras

Usage

same to gensim.models.word2vec.Word2Vec

Example

vsk = Word2VecKeras(gensim.models.word2vec.LineSentence('test.txt'),iter=100)
print( vsk.most_similar('the', topn=5))

from nltk.corpus import brown
brk = Word2VecKeras(brown.sents(),iter=10)
print( brk.most_similar('the', topn=5))

Requirements

pip install -U keras

About

word2vec uisng keras inside gensim

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published