https://github.com/navin-mohan/wordsim
A simple Python wrapper for the GloVe pretrained word vectors.
https://github.com/navin-mohan/wordsim
glove machine-learning nlp python
Last synced: 7 months ago
JSON representation
A simple Python wrapper for the GloVe pretrained word vectors.
- Host: GitHub
- URL: https://github.com/navin-mohan/wordsim
- Owner: navin-mohan
- License: mit
- Created: 2017-07-31T09:50:15.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2017-07-31T17:20:27.000Z (about 8 years ago)
- Last Synced: 2025-01-21T08:12:42.111Z (9 months ago)
- Topics: glove, machine-learning, nlp, python
- Language: Python
- Homepage:
- Size: 4.88 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# WordSim
A simple Python wrapper for the [**GloVe**](https://nlp.stanford.edu/projects/glove/) pretrained word vectors.
Easy functions for [**Cosine Similarity**](https://en.wikipedia.org/wiki/Cosine_similarity) and [**Euclidian Distance**](https://en.wikipedia.org/wiki/Euclidean_distance).## How to Install (using pip)
```bash
pip install git+git://github.com/nvnmo/WordSim.git
```## Usage
```python
from wordsim import WordSim# path to the pretrained GloVe word vectors
GLOVE_FILE_NAME = './glove.6B.50d.txt'# loading the vectors at creation
w = WordSim(GLOVE_FILE_NAME)# you can also do this
w = WordSim()
w.load_glove_model(GLOVE_FILE_NAME)cosine_similarity = w.similarity("girl","woman")
euclidian_distance = w.distance("girl","woman")# do something with the values..
print("Cosine Similarity: {0} Euclidian Distance: {1}".format(cosine_similarity,euclidian_distance))
```## Where to find GloVe pretrained models?
You can find them [here](https://github.com/stanfordnlp/GloVe).
### Doesn't fit your needs?
Checkout this [repo](https://github.com/maciejkula/glove-python).