Organizations can understand their customers’ views of their product or service using text analysis of their reviews, feedback, or transcribed call to customer service. Voice of Customer (VoC) allows businesses to look at the product from the user’s perspective. This makes it an indispensable tool for early defect detection, brand management, market analysis, etc. This article describes an architecture to deploy Voice of Customer Solution using Google’s Cloud Natural Language API. We discuss the strengths of these powerful APIs. We also mention some of the limitations of Google APIs and how they can be addressed using smart text processing by applying domain-specific taxonomy. We will also share the results obtained using Google APIs and NLP processing on two types of customer review data, Apparel and Technology product shopping.

Google’s Cloud Natural Language API

The Cloud Natural Language API allows developers to classify a document, analyze the sentiments, identify entities and associated sentiments. It also provides the capability to analyze the syntax. All these abilities are provided to a user using APIs based on Google’s pre-trained models. A notable feature of Google APIs is that it returns sentiments at three levels: document level, sentence level, and entity level. The Google Natural Language APIs are a suitable and state-of-the-art option for building VoC solutions. The developer does not need to be an NLP expert, and understanding of the underlying machine learning models is not required. On the other hand, access to the model details is not provided; hence it cannot be tuned to a specific task or dataset.

Table showing content classification, sentiment analysis, entity detection, entity sentiment analysis, and syntax analysis
Google Cloud provides another capability called AutoML Natural Language which enables Data Scientists to build and deploy custom machine learning models that analyze and categorize documents, identify entities within them and assesses attitudes within them. This gives the flexibility to develop a tailored NLP model in contrast to the standardized out-of-the-box capabilities Cloud Natural Language API functions can provide.

Building Voice of Customer solution using Google Cloud NLP APIs

We built Voice of Customer as a natural language processing solution that aims to help a business to understand the opinion of the customers about the products and services they offer. Customers express their views and emotions by posting their reviews on various online platforms. VoC provides the ability to the decision-makers to understand customer views and emotions and reasoning behind it.

Earlier, we built VoC solutions using open source and another well-known analytics platform. We found that adapting Google Cloud to scale VoC solution for thousands of reviews or documents from various sources like e-commerce platforms, emails, social media is cost-effective and efficient. Resilient architecture represented below in Figure 1 ensures scaling up or down of the VoC solution as and when required.

Diagram showing the Google Cloud Platform Natural Language API

Figure 1: Architecture diagram of VoC using Cloud Natural Language API on Google Cloud

For our VoC solution, we created the programs described below to collect the responses from Google API, which scales for thousands of reviews.

  1. Driver function: It estimates the volume of data to be processed and,based on decides the number of worker functions to be initiated so that requests to APIs and NLP processing for complete data takes only a few minutes. Every worker function processes only a small segment of data.
  2. Worker functions:
    1. The job of the worker functions is to invoke analyseSentiment and analyseEntitySentiment APIs. It also maps entities to the sentences of the document.
    2. Using the analyseSyntax method to collect tokens and retain only adjectives/adverbs/nouns in the document. It associates the filtered tokens with entities using customized rules.
    3. Lemmatization of both entities and tokens to eliminate redundancy and filtering out irrelevant entities.
    4. Use classifyText method to obtain the document category of the reviews and retain category having highest confidence value.
  3. All the processed results are collected, and a dashboard is used to communicate all the actionable insights.

Voice of Customer: Use Cases

We produced results for ~1,200 reviews for apparel and ~2,200 reviews for technology products using the architecture outlined above and custom natural processing. A quick summary of the results is provided below.

MetricsApparelTechnology product
Number of documents processed1,1902,266
Number of sentences processed4,2548,530
Document categories detected12 out of which 90% are Shopping category of taxonomy generated by Google classifyText method17 out of which 85% in Computers & Electronics category of taxonomy generated by Google classifyText method
Unique entities detected8,4354,722
Types of entities detected7 types of entities out of 67% is “Other” category7 types of entities out of 67% is the “Other” category, followed by Consumer Goods (17%)

Dashboard snapshot for Technology product reviews

This section of the dashboard provides a summary of document categories and top positive and negative sentiment entities. The bar chart displays the monthly review count, and the line shows the average sentiment score.

Dashboard snapshot for reviews of apparels

This section of the dashboard provides a summary of entity sentiments for technology products. It displays entities with their total positive, negative, and neutral mentions and key themes used by the reviewer to express their sentiments

Deriving value out of responses collected from Google NLP API

Cloud natural language APIs are powerful in detecting a variety of entities and document categories. It determines the sentiments at three different levels: document level, sentence level and entity level with high accuracy. Numeric values generated by the APIs like sentiment score and magnitude are used to define the polarity of the sentiment. Salience is a score generated for entities to indicate the centrality of the entity and is used to drop the entities which does not have reasonable score. The classifyText method does excellent job of document classification and creates document category at three levels with hierarchical structure. It has the ability to classify documents into 27 content categories with three levels of hierarchy. Review example 1, below is correctly classified as /Computers & Electronics/Computer Hardware/Laptops & Notebooks with 99% confidence. All the important entities like laptop, game, keyboard and keys are detected. Sentiment scores generated for these entities are accurate.

Example 1: “This ⟨laptop1 is amazing. It runs ⟨everything3 I need it to run, including intensive ⟨games4 . I can now play my favorite ⟨game6 in my ⟨laptop1 . The ⟨one8downside2 is that the ⟨keyboard7 is terribly hard as half the time when I push the ⟨keys5 , it does not type. “

Customer has expressed his happiness about the laptop with concerns related to keyboard. APIs detected it correctly. Sentiment score for the laptop is positive while sentiment score for the keyboard or keys is negative. Entity level sentiment is provided in the table below for the example 1

Table showing entity values
Entity DetectedSalienceTypeSentiment ScoreMagnitude
laptop0.61Consumer Good0.90.9
game0.03Work of Art0.90.9
keyboard0.02Consumer Good-0.90.9

While Google APIs provide multiple capabilities and scales for thousands of documents, it requires processing to translate the results into actionable insights to take business decisions. There are some limitations which have been addressed by introducing customized natural language processing using domain knowledge. Figure 2 represents a high-level functional step to enhance the API results used in our VoC solution.

Figure 2: Functional Steps in VoC Solution

APIs scale for thousands of documents and one does not need expertise in natural language processing. Responses from API calls are collected and processed using domain-specific taxonomy and custom rules to polish the information present. Responses for each review from all the five APIs are processed to create actionable insights. This includes data cleaning and augmenting the results with domain-specific taxonomy and linguistic rules.

As stated, earlier, analyzeEntitySentiment has generated an accurate sentiment score for keyboard in the example 1 but is not sufficient to take a specific action. Sentiment for keyboard is negative, and reviewer has used the adjective “terribly hard” to describe the issue. The product team would be interested in knowing the reasons for negative sentiments. To enrich the insight and make it actionable, themes of expression are captured using the analyzeSyntax method and associated with entities detected using distance in the sentence vector. So, if the negative sentiment of the keyboard is combined with terribly hard, the business understands the issue with the keyboard.

AnalyzeEntity API also returns large number of entities irrelevant to the business-like downside and everything in the example 1. In the same example, games and game are detected as two different entities and classified as Event and Work of Art, similarly, keyboard as Consumer Good but keys as Other. These limitations in the APIs are addressed in VoC by creating dictionary of entities not relevant to a domain and is used to eliminated impertinent entities. A rule-based approach specific to the domain is developed to refine entity classification and lemmatize identified entities (game and games) to ensure that the same entities are not identified as different entities. In example 1, since the document category is /Computers & Electronics/Computer Hardware/Laptops & Notebooks with 99% confidence, entities like keys, the game gets reclassified as consumer goods.

Google entity sentiment API does not always deal with negations for entity sentiments appropriately. For the below review (Example 2) for a dress overall document and sentence level sentiment score computed by API is negative but quality as an entity is assigned a positive score. This is addressed using custom rules by associating negation keywords with entities and changing the polarity of the scores.

Example 2: “This ⟨dress1 was beautiful, and I loved wearing it but the ⟨quality3 couldn’t be more awful! The ⟨lace2 stretched and balled up and after ⟨hand washing4 it literally was falling apart after ⟨one5 time wearing it.”

We summarize below the text processing used in our VoC solution to refine the results collected using Google APIs to create actionable insights.

  1. Analysis of sentiment scores and their magnitude across the document-by-document category for a sample of reviews is used to understand the effectiveness of Google’s pre-trained model for a given domain.
  2. Analysis of entities: Entities detected are processed to eliminate redundancy and irrelevancy (e.g., game vs games, everything, etc. in the example 1) and entities (downside) not relevant to the business domain. This is implemented by creating a dictionary of entities irrelevant to a domain. Negations are handled using custom rules after analyzing the entities and its sentiment scores.
  3. Reclassification of entities using document category and domain knowledge.
  4. Sentiments collected at the sentence level and entity level are associated with themes (adjective/adverb) using the tokens collected using anayzeSyntax. This helps in understanding the kind of words customers have used to express their sentiments and if needed sentence to understand the context. These are used to understand the degree of negative or positive sentiments.

Comparison of Google’s Cloud Natural Language with open-source NLP packages

Polyglot, NLTK, TextBlob, fastText are some of the alternate open-source packages available for sentiment analysis. However, these packages have many limitations. These open-source packages do not support Entity Sentiment Analysis, they provide document-level sentiments. A rule-based approach is required to compute Entity sentiments which require significant effort and knowledge natural language processing is non-negotiable. Polyglot supports named-Entity Sentiment Analysis but is limited to Country, Organization, Places, etc.

Most of the open-source packages support only English whereas Google APIs support multiple languages ( Scaling VoC using Google APIs is very easy and can be done in no time whereas scaling with an open-source platform requires dedicated effort on architectural design. It can be easily integrated with Speech-to-Text API to generate insights from audio conversations like customer care recordings etc. Google Cloud Natural Language APIs are cost-effective. For detailed pricing refer to the price guide:


Google Cloud Natural Language APIs are useful in computing sentiment score at entity level besides document and sentence level. Voice of Customer solution built using these APIs scales to process thousands of the review document. Results obtained using five APIs are enriched by bringing all the information together to create actionable insights in the form of a dashboard. We have addressed limitations found with these APIs by developing domain specific entity or taxonomy dictionaries and custom rules. Google APIs auto scale without any administration overhead and capabilities are much better than open-source packages.


  • Natural Language Understanding by James Allen. Published by Pearson Education.
  • The Handbook of Computational Linguistics and Natural Language Processing by Alexander Clark, Chris Fox, and Shalom Lappin. Published by Wiley-Blackwell.
  • Natural Language Processing with Python: Analyzing Text with the Natural Language Toolkit. Steven Bird, Ewan Klein, and Edward Loper. Published by O’Reilly Media, Inc.
  • Reducing Warranty Costs Through Proactive Customer Sentiment Monitoring


Lokendra Devangan, Senior Manager

Vishal Sharma, Associate Analyst

Want to learn more about Sentiment Analysis for your business? Talk to our experts about what you’d like to do.
Core Compete is a Google Cloud Partner.