corpus.fit(sentences, window=10)
from glove import Corpus, Glove #Creating a corpus object corpus = Corpus() #Training the corpus to generate the co-occurrence matrix which is used in GloVe corpus.fit(lines, window=10) glove = Glove(no_components=5, learning_rate=0.05) glove.fit(corpus.matrix, epochs=30, no_threads=4, verbose=True) glove.add_dictionary(corpus.dictionary) glove.save('glove.model')
Source: stackoverflow.com