E-Commerce Review Sentiment Analysis API

Overview

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.

1. Analyze a Single Review

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.

2. Batch Analyze Reviews

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.

3. Analyze Reviews for a Specific Product

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.