Overview


In today’s internet world, there is lots of business information. But 80% of this information is unstructured i.e. unorganized, and it is expected to be 93% by 2020 due to constant use of social media, emails, documents, photos, videos, etc. This unstructured information gives lot of information about your customers, customer feedback about your brand, feedback about your competitors and much more. People write about their experience at different places, whether it was good or bad. They give reviews about different products they have used. This impacts the views of other people about this product. First thing people see before buying a product or service is online reviews.

We will see how Review Inspector analyzes sentiment of this reviews so that business owners can align their strategies with customer demand. Review Inspector does sentiment analysis as well as POS Tagging of reviews.


Sentiment Analysis

  • Sentiment Analysis gives whether the sentiment of the review is positive, negative or neutral.
  • You can input a sentence of your choice and gauge the underlying sentiment.

POS Tagging

  • POS Tagging (Part Of Speech Tagging) is the process of marking up a word in a text (corpus) as corresponding to a particular part of speech, based on both its definition and its context.


Our Approach


To solve the problem, we use IntelliHub . Lets see how IntelliHub works:

  • First user will pass sentence.
  • It goes to Phoenix Language (a Natural Language Processing module in IntelliHub ).
  • It analyzes and gives sentiment i.e. Positive, negative or neutral as well as Part of Speech of all words using POS Tagger.


App Creation

First we need to create an App from console and enable API for language.

In Studio, we can build model in two ways:

  • Using SDK (For Developer)
  • Using Interface (For Non-Developer)


Using SDK


If you want to develop a model using SDK, just copy API key from IntelliHub Console.




To install python SDK use following command:


pip install spotflock-studio
                            



Connect To Studio

Description

You can access the services provided by enabling API for Phoenix Language. IntelliHub provides StudioClient where you have to pass your APP KEY as an argument.

Code


import studio

c = studio.StudioClient("YOUR API KEY")

 

import com.spotflock.StudioClient;

StudioClient c = new StudioClient("YOUR API KEY");

 

Sentiment Analysis

Description

The phoenix language's Sentiment Analysis APIs identifies the sentiments and returns the json with sentiment analysis details.

Code


sentence = client.sentiment_analysis("The rooftop cafeteria of hotel was great.")
 

response


{'text': "The rooftop cafeteria of hotel was great.",
 'polarity': 3,
 'emotion': 'POSITIVE',
 'msg': None}

 

String response = c.sentimentAnalysis("The rooftop cafeteria of hotel was great.");
System.out.println(response);
 

response


{"text": "The rooftop cafeteria of hotel was great.",
 "polarity": 3,
 "emotion": "POSITIVE",
 "msg": null}

 

POS Tagger

Description

You can find Part Of Speech (POS) of each word in a sentence using Phoenix Language.

Code


sentence = client.pos_tagger("The stay was great")
 

response


{'text': 'The stay was great',
 'result': {'The': 'DT', 'was': 'VBD', 'great': 'JJ', 'stay': 'NN'},
 'msg': None}

 

r = c.posTagger("The stay was great.");
System.out.print(r);
 

response


{"text": "The stay was great",
 "result": {"The": "DT", "was": "VBD", "great": "JJ", "stay": "NN"},
 "msg": null}
 

Using Interface


  1. Once we have created an App and Phoenix Language enabled we need to go to the API Explorer.

    Once we are at the API Explorer tab, we can test sentiment analysis and POS tagging.

    Sentiment Analysis

    Description

        This API would enable you to do a sentiment analysis and classify if the text is positive, neutral or negative.

    URI

        POST /api/v1/language-service/phoenix-language/nlp/sentiment

    Headers

        We need to mention our API Key in the headers

    Body

        We need to send the sentence we want to analyse in a json format with 'text' as key.

    Request

    
    {
     "text": "The rooftop cafeteria of hotel was great."
    }
    
                                        

    Response

    
    {
      "text": " The rooftop cafeteria of hotel was great.",
      "polarity": 3,
      "emotion": "POSITIVE"
    }
                                        

    Snapshot



    POS Tagger

    Description

        This API would enable you to do a POS tagging.

    URI

        POST /api/v1/language-service/phoenix-language/nlp/pos

    Headers

        We need to mention our API Key in the headers

    Body

        We need to send the sentence we want to analyse in a json format with 'text' as key.

    Request

    
    {
     "text": "The stay was great."
    }
    
                                        

    Response

    
    {'text': 'The stay was great',
     'result': {'The': 'DT', 'was': 'VBD', 'great': 'JJ', 'stay': 'NN'},
     'msg': None
                                            }
                                        

    Snapshot



Summary


Review Inspector is just a small application of Phoenix Language. We can extend the use case such as:

  • Analysing sentiment of comments for our social media posts.
  • We can also use for faster customer support by filtering negative sentiments in forums by keeping them as high priority.

Helpdesk