Skip to content

skaty5678/PREcily_gensim_API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PREcily_gensim_API

This Flask API calculates the similarity between two text sentences using the Word2Vec model. It preprocesses the text, removes stop words, and computes the cosine similarity between the word embeddings of the sentences.

Prerequisites

  • Python 3.x
  • Flask
  • NLTK
  • Gensim

You can install the required Python packages using the following command:

pip install flask nltk gensim
  1. Run the Flask API using the following command:

    python app.py

    This will start the API locally on http://localhost:8080.

  2. Use a tool like curl or Postman to send POST requests to the API with JSON data containing two text sentences for which you want to calculate similarity. Example:

    curl -X POST -H "Content-Type: application/json" -d '{"text1": "First sentence", "text2": "Second sentence"}' http://localhost:8080
  3. The API will respond with a JSON object containing the similarity score between the two sentences.

Endpoint

  • POST /

    • Request:

      {
        "text1": "First sentence",
        "text2": "Second sentence"
      }
    • Response:

      {
        "similarity score": 0.85
      }

About

calculating the text similarity but using gensim.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages