What is the quickest way to integrate NLP in an application?

November 2, 2017 | Comments(0) |

Cognition simply refers to the act of thinking. It is a product of evolution that only a few organisms are currently capable of. It can also be defined as the process of assimilating knowledge and developing a world view based on understanding via one’s senses and experiences. For cognition to occur, multiple complex processes need to work in-sync. Some of these processes are attention, memory, judgement, evaluation, decision making, language and comprehension.

These processes are one of the most difficult processes to simulate / emulate with.

Cognitive Services
Figure 1: Microsoft’s Cognitive Services allow for the emulation of cognition

 

Microsoft offers a range of services that simulate the faculties of the mind such as recognition, language, knowledge and comprehension. All the services that aid in cognition or the simulation of cognition are labelled under the umbrella title of Cognitive Services. Some of the services in Cognitive Services are:

  1. Bing Speech API
  2. Computer Vision API
  3. Bing Search API
  4. Emotion API
  5. Speaker Recognition API
  6. Face API
  7. Recommendations API
  8. Language Understanding Intelligence Service

Each service tackles a specific machine learning problem related to cognition. We are here to talk about LUIS, Microsoft’s NLP platform.

LUIS

The Language Understanding Intelligence Service (LUIS) falls under the language sub-category of Cognitive Services. LUIS endows applications with the ability to understand natural language. Natural language is defined as a language that has evolved over time with repeated usage and repetition.

Natural languages tend not be pre-meditated and are evolved based on a generation’s requirements or environment. The beauty of natural language is that it is diverse beyond comprehension. A multitude of dialects exist within a single language and each dialect presents itself with a unique flair associated with its environment and usage. However, it is this beauty that has created a roadblock in our ability to process natural language via programming. The diversity inherent to language can cause the same sentence to mean a variety of things in different contexts. Some languages have even evolved without scripts and some with scripts so ancient that most of it is lost. These gaps in our knowledge base has also presented numerous hurdles in our quest for computer based natural language processing.

Another issue with natural language and its processing is that it is not based off a rigid structure or foundation. As such, programming NLP into silicon based systems proves to be a major hurdle due to the systems’ inherent orderliness. The complexity that natural language brings to the table (such as satire, sarcasm and innuendos) makes the act of building processing engines a mammoth task.

Developing natural language processing engines and natural language generation systems is a task left to those who have devoted countless years to this subject. For a novice programmer to pick up natural language processing, it may prove too high a wall to climb.

Figure 2: LUIS is the NLP service offered by Microsoft

 

Fortunately, natural language processing has been a major field in computer science for a few years now. This has enabled major tech giants such as Microsoft, AWS and IBM to launch natural language processing as a service via each of their Cloud Platforms. Now, the general public have access to advanced NLP engines allowing for the widespread adoption and creation of new and interesting UI / UX patterns.

 

NLP Service Azure
Figure 3: Microsoft offers its NLP service via Azure

 

Regions

Microsoft’ offering in this domain (LUIS), is accessible through the Azure Cloud. All that is required is an Azure subscription. The LUIS service is available in the following regions:

  • East US
  • West US
  • West Central US
  • West Europe
  • Southeast Asia

 

Pricing

Due to its recent launch out of beta, Microsoft is yet to make the service available across all their datacentres. The pricing is more or less the same across all regions:

Tier Features Unit Price
Free Transactions 10k/month
Basic 50 transactions/s Transactions INR 49.58/transaction

 

Structure

LUIS operates on the intent-entity model. This means that the LUIS service takes a sentence as an input and deciphers the intent or objective behind the sentence. The service also breaks the sentence down into its constituent elements or entities.

For example, consider a taxi hailing app that has implemented NLP using LUIS. If the user issues the following command: “Book a cab to the airport for me”, the intent could be BookCab and the entities would be Destination with the value of Destination being the airport. With the right downstream processing, the app can then proceed to pull the user’s current location and book a cab with the destination set as airport.

Microsoft offers a web-based GUI to create, train and deploy models for the LUIS service. The GUI can be accessed via www.luis.ai. The first step of using Microsoft’s NLP service is designing the model.

Luis Gui
Figure 4: The LUIS web-based GUI

 

During model development, a clear understanding of the model’s purpose is a must. Once the goals have been set, the intents and its corresponding entities must be created. However, if the model is being designed to incorporate conventional domains such as time, weather, calendar or fitness, then one can incorporate pre-built collections of intents and entities. These collections are freely available from the LUIS homepage and spans a wide variety of domains.

 

Pre Build Domain
Figure 5: Pre-built domain specific intents and entities are available

 

Once the intents and entities have been created, developers must then proceed to train the model by feeding it instances of its usage. Training must consist of both valid and invalid utterances to ensure that the model can correctly identify both, appropriate and inappropriate examples.

 

Natural Languare
Figure 6: The intents are the main objectives that the model needs to identify in natural language

 

However, one must keep in mind that training the model does not make the model accessible. For this, the app must be “published”. On model publication, LUIS generates an endpoint URL that can be accessed using the subscription key associated with the LUIS account. Microsoft also offers slots for staging and production that decouples the development and production aspects of the model. Should any changes be made to the model, it is required that the model be re-published.

Entities
Figure 7: Entities are the dependent variables of an intent

 

Although LUIS offers an extensive set of REST APIs to access and modify the model, the SDKs offer a more abstract interface for the service. Some of the languages and technologies that the LUIS service is available in are:

  • Windows
  • js
  • Python
  • Android

 

Applications

NLP offers a new way of interfacing with users. Currently, the most popular implementation for NLP is in virtual assistants on smartphones.

While some may call such technologies “gimmicky”, it is the precursor to greater, more vivid possibilities. For example, with the help of NLP, the differently abled can interact with the computer in a more dynamic manner.

NLP can also aid in the real-time conversion of spoken audio of one language into another language. All these implementations are now undemanding than they have ever been, partly due to the IoT revolution. The rapidly dropping prices of components enables DIY enthusiasts to imbue cognitive abilities into their projects quickly.

We at CloudThat, cover NLP as well as its implementation in IoT in our Level 4 training i.e. Designing and Implementing IoT Solutions. If you are interested in knowing more, please check out our course outline page.

What do you think of the IoT revolution and NLP? Let us know in the comments!


Leave a Reply