Skip to content

Python interface for building, loading, and using GloVe vectors.

Notifications You must be signed in to change notification settings

Lguyogiro/pyglove

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 

Repository files navigation

A small Python module that allows you to train and use GloVe vectors in your Python appplications. For more about GloVe, see https://nlp.stanford.edu/pubs/glove.pdf

eg

>>> from pyglove import GloVe
>>> from sklearn.datasets import fetch_20newsgroups

>>> sentences = [sentence.split() for sentence in fetch_20newsgroups()['data']]
>>> glove_pth = "/path/to/glove/install"
>>> vector_file_name = "20newsgroup_words.txt"  # file where vectors will be stored

>>> model = GloVe(sentences, vector_file_name, glove_installation_dir=glove_pth, 
                  vocab_min_count=5, vector_size=50, window_size=15)
              
>>> model.most_similar("Camry", n=1)
[('Toyota', 0.69786818922200133)]

About

Python interface for building, loading, and using GloVe vectors.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages