Page 32 - MSDN Magazine, November 2017
P. 32
• This phone has a great battery
• The display is sharp and bright
• The store does not have the apps I need
Let’s run these three parts individually using the Text Analytics API and see what comes back and how this lets you make better sense of the review. I’ll now use the key phrase and the sentiment operations of the Text Analytics API and show the output of this API transformed into a powerful targeted analysis of the sentiment reflected in the text input.
I also need to remove the punctuation marks and any conjunc- tions in order to get the best analysis. I changed my Curl script to
Figure 6 Using the Text Analytics API on the Output of the Linguistic Analysis API
pass the tokens one by one first to key phrase endpoint and then to the sentiment endpoint. Figure 6 shows my result.
If I compile these results to a human-friendly format, here’s what it looks like:
• This phone has a great battery Key phrase: great battery Sentiment: 81 percent
• The display is sharp and bright Key phrase: display Sentiment: 94 percent
• The store does not have the apps I need Key phrase: store, apps
Sentiment: 25 percent
When discussing the Text Analytics API earlier in this article, I ran the complete review through the API and saw that the review had a 77 percent positive sentiment. However, running the review with the Linguistic API, breaking it down to its individual tokens and then processing them with the Text Analytics API gives a truer assessment of the individual aspects of the phone in question and the targeted sentiment analysis for each of them.
It also made clear that a better apps selection for this phone would have brought the overall positivity of this review much higher than the initial 77 percent.
Just as electricity became the lifeblood of the second industrial revolution, data is the lifeblood of the AI revolution that’s just ahead.
Wrapping Up
I recently came across the tagline, “Data is the new electricity.” Just as electricity became the lifeblood of the second industrial revolution, data is the lifeblood of the AI revolution that’s just ahead. As a devel- oper, you gather data all the time, in various forms. One increasingly significant form of data is customer input—as reviews on shopping and traveling portals, in survey responses, feedback and suggestions both off- and online, and more. It’s also becoming increasingly com- mon for customers to openly provide such feedback, making it even more important to take this information seriously. Organizations will want to make sure to listen to their customers and take appropriate action to remediate any issues they encounter with products and services. The Text Analytics and the Linguistic Analysis Cognitive Services are just the tools you need to do justice to your customers.n
Ashish sAhu is a senior technical evangelist working with Developer Experience at Microsoft India, helping ISVs and startups overcome technical challenges, adopt the latest technologies, and evolve their solutions to the next level. He can be contacted at ashish.sahu@microsoft.com.
ThAnks to the following Microsoft technical expert for reviewing this article: Sandeep Alur
{
"documents": [
{
"keyPhrases": [
"great battery" ],
"id": "1" }
],
"errors": [] }
{
"documents": [
{
"score": 0.814330127882407, "id": "1"
} ],
"errors": [] }
{
"documents": [
{
"keyPhrases": [
"display" ],
"id": "1" }
],
"errors": [] }
{
"documents": [
{
"score": 0.94089591967051, "id": "1"
} ],
"errors": [] }
{
"documents": [
{
"keyPhrases": [
"store",
"apps" ],
"id": "1" }
],
"errors": [] }
{
"documents": [
{
"score": 0.255424793209646, "id": "1"
} ],
"errors": [] }
28 msdn magazine
Cognitive Services