Chapter 6. Language

Much of what we do online involves text, and Cognitive Services offers tools to work with text across all your applications: from providing analytics on text content to understanding what a user really wants to do. Instead of forcing users to check boxes, click radio buttons, or choose from a drop-down list, you can use these services to make your app understand the meaning of unstructured text or recognize the intent of what your users are saying no matter how they express it. The Language services also integrate well with the Speech Services we covered in the previous chapter.

Text Analytics

The Text Analytics service takes raw text and extracts four kinds of structured information: the sentiment, the key phrases, the language, and the entities the text refers to. You can use all four endpoints independently, but combining them can enable a higher level of analysis. The four APIs are all very straightforward, and there is no option to tune or customize the service with your own data. All the Text Analytics endpoints are available as containers, meaning you can take advantage of these capabilities in your own data center or edge devices.

The following code snippet creates a Text Analytics client with version 3 of their SDK, ready for use with your content. It can be used with the standard endpoints to extract, for example, sentiment:

class ApiKeyServiceClientCredentials : ServiceClientCredentials
{
   public override Task ProcessHttpRequestAsync(
     HttpRequestMessage ...

Get Building Intelligent Apps with Cognitive APIs now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.