word2vec uisng keras inside gensim
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
example test-scoreword Mar 28, 2016
word2veckeras fix ver keras 0.3.1 Apr 15, 2016
README.org test-scoreword Mar 28, 2016
setup.cfg setup.py Jan 16, 2016
setup.py fix ver keras 0.3.1 Apr 15, 2016

README.org

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