Skip to main content

glove Python bindings

Project description

glove-py is an implementation of the GloVe algorithm for learning word vectors from a corpus.

##Installation

using pip: pip install glove-py.

install with github code :

git clone git@github.com:f20500909/glove_py.git

python3 setup.py install

from glove import *

model = Glove(epoch=2)
model.train("small_text")
model.to_txt()
words = model.most_similary("one", 10)
print(words)

using in shell

Skipgram model

Train & load skipgram model

from glove import *

model = Glove(params)
model.train(input_file)
model.to_txt()
words = model.most_similary("one", 10)
print(words)

List of available params and their default value:

help info......
  -input_file               input_file [small_text]
  -log_dir                  a dirctory to save temp file [log/]
  -cofile                   max length of word ngram [cooccur.bin]
  -vocab_file               output vocabulary [vocab.txt]
  -temp_file                temporary file of common occurrence chunk [temp.bin_]
  -embd_file                embedded file[wordvec.txt]
  -vocab_size               vocabulary size to train  [0]
  -max_size                 maximum size to keep in courpus [10000000]
  -min_count                minimum times  [1]
  -window                   the window size to get common occurrence [10]
  -embed_size               embedded size  [80]
  -epoch                    train epoch [1]
  -threads                  max length of char ngram [40]
  -memory_limit             max length of char ngram [1]
  -lr                       max length of char ngram [0.05]
  -keep_case                max length of char ngram [0]
  -symmetric                max length of char ngram [1]

Reference

  • GloVe
  • Jeffrey Pennington, Richard Socher, and Christopher D. Manning. 2014. GloVe: Global Vectors for Word Representation.
  • GloVe-cpp

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

glove_py-0.1.8.tar.gz (20.6 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page