Banner_Language

In BlueGranite’s penultimate showcase of our Microsoft Cognitive Services APIs series, we’re surveying various Language services. Working with these APIs will provide your solution with the ability to extract and understand natural language.

All About Language

The Language capabilities increase your application’s ability to “read”, comprehend, and enrich written text. The following Language services handle common tasks for intelligent applications.

language-textanalytics Text Analytics Extract key phrases, measure sentiment, and recognize linked entities
language-bingspellcheck Bing Spell Check Contextual spell check available for multiple languages
language-texttranslator Translator Text Detect language and translate text to another language
language-languageunderstanding Language Understanding Build custom natural language understanding models
language-contentmoderator Content Moderator Moderate language and detect profanity, detect words from custom lists, check for personally identifiable information, flag content for human review

To try any of these Language Cognitive Services, get free trial API keys here. 

Language APIs for Data Professionals

For data professionals, Text Analytics likely represents the most approachable API in this category. At BlueGranite, we regularly take advantage of the text analytics capabilities in Cognitive Services to gauge sentiment and extract key phrases. We even have a webinar recording that showcases these capabilities alongside some other Microsoft technologies. In our last post in this series, we also discussed how to combine the Speech to Text API with the Text Analytics API in the same solution.

The Language APIs represent much more than sentiment analysis though, even for data-centric and non-application development situations. You might employ APIs such as Bing Spell Check or Translator Text in storage, transformation, or reporting scenarios. For example, your business might regularly receive customer feedback via email. Bing Spell Check could help enhance the quality of your email text.  While most mispellings misspelings misspellings likely would not impact the writer’s intent, it can be useful in some cases to run raw text through Spell Check if you intend to automatically parse and classify it as part of a data pipeline. There could be enough difference in the raw versus corrected text to impact sentiment or influence the extraction of key phrases. Similarly, if customer emails regularly arrive in different languages, the Translator Text API is useful to both identify the source language and obtain a translated copy of the customer email.

With the various Language APIs, developers have the power of natural language understanding and enrichment at their fingertips. By providing the convenience of pre-built AI, the Language APIs from Cognitive Services let you focus on your results rather than worry about training your own models. In many situations, that may be all you need, or it could serve as a pilot to determine if you truly require a data scientist to develop custom models.

Text Analytics API

The Text Analytics API is a very popular and easy-to-use service. Its endpoints can be built into a simple demo, as shown below, or can be integrated into larger applications or big data solutions using a wide variety of programming languages such as C#, Java, Node.js, PHP, Python and Ruby.

Cognitive Services Text Analytics API Demo

Click on the image to try the Text Analytics API demo

In order to get started using the Text Analytics API, the first step is to acquire an API Key. A free trial, offering a 7-day tryout and up to 5,000 transactions (calls), is available. To use it, you will need to agree to the Microsoft Cognitive Service Terms and sign up using your Microsoft, LinkedIn, Facebook or GitHub account. Otherwise, a Text Analytics API Key is also available via a Microsoft Azure subscription. Once you have signed up for your Text Analytics API Key, you can begin making calls to the service.

Cognitive Services Text Analytics KPI Free Trial

To demonstrate how easy it is to get started with the Text Analytics API, I built a demo using Power BI Desktop. In my demo, I am using the Power BI Ideas Title and Text to determine key phrases within the data. I performed key phrase extraction on the top 500 suggestions in the Power BI Ideas forum.  If you are not familiar with Power BI Ideas, it is an open forum where users can make suggestions for improving and adding new features to the Power BI product. Users can also add votes to others’ ideas to express their interest in the suggested Power BI enhancements. Microsoft uses forum votes as a guide when adding features to Power BI.

To access the Power BI Ideas data for my demo, I used Power Query to import data from the ideas.PowerBI.com web page. Here is the link I used returned the top 500 ideas in JSON format, sorted descending by vote count.

Power BI Import Web Data Using JSON Format

After doing some transformations in Power Query (Converted to Table, Changed Types, Renamed Columns, etc.), my data was ready for the Text Analytics API. Next, I created a custom function that was used to submit the Power BI Ideas text to the Text Analytics API and return the key phrases. I combined the Power BI Ideas title and text columns into a custom column called “title_text” for this purpose. Using this new custom column, I used the Invoke Custom Function feature in Power Query to call out to the Text Analytics API using my function ‘fnKeyPhrases’ and created a new column containing the key phrases that were returned from the API.

Power BI Desktop Advanced Editor Function

The resulting key phrases were returned to my dataset.

Cognitive Services Text Analytics KPI - Key Phrase Extraction

Using this key phrase data, I was able to do analysis in Power BI and quickly see a breakdown of Power BI Ideas by Created Date, Vote Count, Comment Count and Key Phrase.

Top 500 Power BI Ideas Sorted by Vote Count

The Word Cloud custom visual came in handy to show the Key Phrase frequency.Power BI Desktop Word Cloud Containing Top 500 Power BI Ideas

This brief Text Analytics API demo highlights how quickly these easy-to-use APIs can be integrated into your existing applications or processes.

Stay Tuned for Knowledge APIs

In addition to this Language services overview, 3Cloud has also surveyed Microsoft’s Cognitive Services Search, Vision, and (as mentioned earlier) Speech APIs. That only leaves Knowledge APIs, which we’ll cover in the near future.

Finally, contact us if you would like to learn more about incorporating Cognitive Services into your own solutions.