Product Sentiments

This page explains how to use the Product Sentiments module to retrieve various product sentiments from consumer reviews.

Overview

The Product Sentiments (PS) API lets you extract various product sentiments from consumer reviews. It uses Natural Language Processing (NLP) to identify and extract the following key sentiments:

  • Positive sentiment: Overall favorable opinions and feedback.
  • Negative sentiment: Unfavorable opinions and critiques.
  • Common keywords: Frequently used terms and phrases by consumers.
  • High-quality marketing quotes: Powerful statements suitable for promotional materials and campaigns.

Tip:

To learn more about PS API, refer to Product Sentiments API.

Functionality

The PS API provides the following five independent API functionalities:

  1. Retrieve Summarized Features: Provides a list of the product's best and worst features, along with quotes, that the consumers used in their reviews to describe the product.
  2. Retrieve Quotes for Summarized Features: Provides quotes for a specific feature based on the language provided which are English, French, German, and Spanish.
  3. Retrieve Features: Provides a comprehensive list of Keywords that consumers commonly use to describe the product in their reviews.
  4. Retrieve Quotes: Provides a high-quality marketing quotes about the product. By default, five quotes are provided.
  5. Retrieve Expressions: Provides all expressions related to a product based on the provided productId, clientId, and feature. Currently, this functionality only supports English (en).

Configuration

All the above listed PS APIs require configuration. Ensure the API call contains both client id and API key.

The code below demonstrates how to configure PS API for Android mobile environment:

BVConfig config = new BVConfig.Builder()
                .apiKeyProductSentiments(apiProductSentimentKey)
                .clientId(clientId)
                .build();

BVSDK bvsdk = BVSDK.builderWithConfig(this, BazaarEnvironment.STAGING, config)
                .logLevel(BVLogLevel.VERBOSE)
                .okHttpClient(getOkHttpClient(getLoggingInterceptor()))
                .build();

BVProductSentimentsClient bvProductSentimentsClient = new BVProductSentimentsClient.Builder(BVSDK.getInstance())
                .build();

Retrieve summarized features

The code below demonstrates how to configure Retrieve Summarized Features API:

 final SummarisedFeaturesRequest request = new SummarisedFeaturesRequest.Builder("product_id")
                .addLanguage("en")
                .addEmbed("quotes")
                .build();
        bvProductSentimentsClient.prepareCall(request).loadAsync(new ProductSentimentsCallback<SummarisedFeaturesResponse>() {

            @Override
            public void onSuccess(@NonNull SummarisedFeaturesResponse summarisedFeaturesResponse) {

            }

            @Override
            public void onFailure(@NonNull ProductSentimentsException e) {

            }
        });

Retrieve quotes for summarized features

The code below demonstrates how to configure Retrieve Quotes for Summarized Features API:

final SummarisedFeaturesQuotesRequest request = new SummarisedFeaturesQuotesRequest.Builder("product_id","feature_id")
                .addLanguage("en")
                .addLimit("10")
                .build();
        bvProductSentimentsClient.prepareCall(request).loadAsync(new ProductSentimentsCallback<SummarisedFeaturesQuotesResponse>() {

            @Override
            public void onSuccess(@NonNull SummarisedFeaturesQuotesResponse summarisedFeaturesQuotesResponse) {

            }

            @Override
            public void onFailure(@NonNull ProductSentimentsException e) {

            }
        });

Retrieve features

The code below demonstrates how to configure Retrieve Features API:

 final FeaturesSentimentRequest request = new FeaturesSentimentRequest.Builder("product_id")
                .addLanguage("en")
                .addLimit("10")
                .build();
bvProductSentimentsClient.prepareCall(request).loadAsync(new ProductSentimentsCallback<FeaturesSentimentResponse>() {


   @Override
    public void onSuccess(@NonNull FeaturesSentimentResponse featuresSentimentResponse) {
                
            }

   @Override
     public void onFailure(@NonNull ProductSentimentsException e) {

            }
        });

Retrieve quotes

The code below demonstrates how to configure Retrieve Quotes API:

   final QuotesSentimentRequest request = new QuotesSentimentRequest.Builder("product_id")
                .addLanguage("en")
                .addLimit("10")
                .build();
bvProductSentimentsClient.prepareCall(request).loadAsync(new ProductSentimentsCallback<QuotesSentimentResponse>() {
            
       @Override
        public void onSuccess(@NonNull QuotesSentimentResponse quotesSentimentResponse) {
                
            }

        @Override
         public void onFailure(@NonNull ProductSentimentsException e) {

            }
        });

Retrieve expressions

The code below demonstrates how to configure Retrieve Expressions API:

 final ExpressionsSentimentRequest request = new ExpressionsSentimentRequest.Builder("product_id","removal")
                .addAdditionalField("language","en")
                .addLimit("10")
                .build();
        bvProductSentimentsClient.prepareCall(request).loadAsync(new ProductSentimentsCallback<ExpressionsSentimentResponse>() {

            @Override
            public void onSuccess(@NonNull ExpressionsSentimentResponse expressionsSentimentResponse) {

            }

            @Override
            public void onFailure(@NonNull ProductSentimentsException e) {

            }
        });

What’s Next

How to setup