https://github.com/rosette-api-community/text-embeddings-sample
A little python code to show how to get similarity between word embeddings returned from the Rosette API's new /text-embedding endpoint.
https://github.com/rosette-api-community/text-embeddings-sample
machine-learning natural-language-processing nlp python text-embedding text-extraction text-similarity word-similarity
Last synced: 11 days ago
JSON representation
A little python code to show how to get similarity between word embeddings returned from the Rosette API's new /text-embedding endpoint.
- Host: GitHub
- URL: https://github.com/rosette-api-community/text-embeddings-sample
- Owner: rosette-api-community
- Created: 2016-09-14T21:25:35.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-03-16T20:14:26.000Z (about 9 years ago)
- Last Synced: 2025-11-28T04:35:02.441Z (6 months ago)
- Topics: machine-learning, natural-language-processing, nlp, python, text-embedding, text-extraction, text-similarity, word-similarity
- Language: Python
- Size: 2.93 KB
- Stars: 4
- Watchers: 7
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Rosette API Text Embeddings Sample Code
This is a little python code to show how to calculate the similarity between words by computing the cosine similarity (using numpy) between the words' embeddings, returned from the [Rosette API](https://developer.rosette.com/)'s new `/text-embedding` endpoint. The call to the API uses the 1.3 version of the python binding, so be sure to install that package via `$ pip install rosette-api` or `--upgrade` via pip to get the latest.
# To try it out
1. Clone the repo and open the files in your favorite text editor/python IDE.
2. In `cosine_similarity.py`, replace the `user_key` parameter's value `[your key here]` with your [Rosette API key](https://developer.rosette.com/admin/applications) and save.
3. Run `test_embeddings.py` via your python IDE or command line:
`$ python test_embeddings.py`
# Customize for your data
Try editing `test_embeddings.py` to compare words OR longer text you might be interested in to see how their embeddings compare. And if you find anything interesting, let us know! Find us at [support.rosette.com](https://support.rosette.com/hc/en-us) or support@rosette.com.