Welcome to the NLP API! This simple API is built with Flask and spaCy, and it helps you analyze the sentiment of a text and identify named entities (NER). It’s perfect for understanding the vibe of a text or extracting key details like names, places, and more.
-
Clone the repository:
git clone https://github.com/asma-sassi/nlp-sentiment-analysis-api.git cd nlp-sentiment-analysis-api -
Create and activate the virtual environment:
For MacOS/Linux:
python3 -m venv venv source venv/bin/activateFor Windows:
python -m venv venv venv\Scripts\activate
-
Install the dependencies:
pip install -r requirements.txt
-
Run the Flask API:
python app.py
Send a JSON object with the text you want to analyze.
{
"text": "I am feeling good today!"
}The API will return the sentiment (positive/negative/neutral) and entities (like people, places, or dates) found in the text.
{
"sentiment": "positive",
"entities": [["good", "ADJ"]],
"text": "I am feeling good today!"
}- Flask: A simple framework for building APIs.
- spaCy: A library for natural language processing (NLP).
- Transformers (Hugging Face): Used for advanced NLP tasks like sentiment analysis and named entity recognition (NER).