The LSTMSentimentModel API is a sentiment analysis service that uses a Long Short-Term Memory (LSTM) model to predict the sentiment of a given text. The API is built with Python and Flask and uses the TensorFlow library for the LSTM model.
This endpoint accepts a JSON object with a single key-value pair. The key should be 'text' and the value should be the text for which you want to predict the sentiment.
{
"text": "your text here"
}The response is a JSON object that includes the predicted sentiment and the probabilities for each sentiment category (positive, neutral, negative).
{
"sentiment": "predicted sentiment",
"probabilities": [probability for positive, probability for neutral, probability for negative]
}This endpoint returns a summary of the LSTM model used for sentiment prediction.
No parameters are required for this request.
The response is a JSON object that includes a summary of the LSTM model.
{
"summary": "model summary"
}If an error occurs while processing the request, the API will return a JSON object with an 'error' key and a description of the error as the value.
{
"error": "description of the error"
}To use this API, you can send a POST request to the appropriate endpoint with the required parameters. The API will return a JSON response with the predicted sentiment or model summary.
This API is designed to handle negations in the input text. It will prepend 'NOT_' to any word that follows a negation word until the next punctuation mark. This helps the model to better understand the sentiment of the text.