Skip to content

rosette-api-community/text-embeddings-sample

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

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'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 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 or support@rosette.com.

About

A little python code to show how to get similarity between word embeddings returned from the Rosette API's new /text-embedding endpoint.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages