This API analyzes the sentiment of customer reviews and generates PDF reports with the results. It supports analyzing single reviews, batches of reviews, and reviews for specific products.
express
: Web framework for building the server.body-parser
: Middleware for parsing JSON request bodies.Sentiment
: Library for sentiment analysis.PDFKit
: Library for creating PDF files.path
andfs
: Node.js modules for handling file paths and filesystem operations.
- Clone the repository:
git clone https://github.com/alilo113/Emotional-Sentiment-Analysis-API-.git ## Endpoints
Endpoint: POST /analyze-review
Request Body:
{
"review": "Your review text here"
}
Response:
{
"message": "PDF created successfully.",
"filePath": "/path/to/the/generated/pdf"
}
Description: Analyzes a single review and generates a PDF report with the sentiment analysis results.
Endpoint: POST /batch-analyze-reviews
Request Body:
{
"reviews": [
"First review text",
"Second review text",
"Third review text"
]
}
Response
{
"message": "PDF created successfully.",
"filePath": "/path/to/the/generated/pdf"
}
Description: Analyzes multiple reviews and generates a single PDF report containing sentiment analysis results for all reviews.
Endpoint: POST /analyze-product-reviews
Request Body:
{
"productId": "product-id",
"reviews": [
"Review text 1",
"Review text 2"
]
}
Response:
{
"productId": "product-id",
"results": [
{
"score": 1,
"comparative": 0.5,
"words": ["good", "excellent"],
"positive": ["good", "excellent"],
"negative": []
},
...
]
}
Description: Analyzes reviews related to a specific product and returns the sentiment analysis results. This endpoint can be extended to include additional product-specific processing.