Microsoft Cognitive Services is a set of cloud-based machine-intelligence APIs that you can use to extract structured data from complex sources (unstructured text, images, video and audio), and add “AI” type features to applications. A good example is the “Seeing AI” glasses in the video below: the image descriptions, emotion inference, and text recognition are all driven by Cognitive Services APIs.
You can call these APIs from any application, including R. Here are a few examples:
- In a blog post a few months back, I called the Face API from R to determine the apparent gender of programmers according to their GitHub avatar.
- The Economist used the Emotion API to track the emotions of the US presidential candidates during the debates.
- Shohbit at the Big Data Enthusiast blog used the Text Analytics API to chart the sentiment of tweets from the candidates.
There's no official R package (yet!) for calling Cognitive Services APIs. But since every Cognitive Service API is just a standard REST API, we can use the httr package to call the API. Input and output is standard JSON, which we can create and extract using the jsonlite package.
Shohbit has also published a step-by-step guide to calling Cognitive Services APIs from R, with several examples of using the Text Analytics API. The details are at the link below. To get started, all you'll need is to register for a Cognitive Services API key. Rate-limited keys (more than enough to test out the service) are free, and you can register using your GitHub account.
Big Data Enthusiast: Microsoft Cognitive Services (Text Analytics API) in R