Natural Language Processing (NLP) is a field in computer science concerned with computational techniques to analyze and synthesize natural language and speech. In simple words, it is the science behind daily assistants who understand our words such as iPhone Siri and Google Assistant.
The NLP field is among the most challenging areas in computer science. The reason is that computers are very good at performing mathematical operations and their aggregates, however, NLP field requires computers to understand meanings, languages, grammatical forms, and text variations which are not the comfort zone of computers. In the last couple of years, there has been significant progress in the NLP field, and tangible results were attained under many languages.
Language Understanding Services (LUIS) are one of the innovation results of NLP field. They are packaged services which aim to perform a particular intelligent speech related task, such as translation, punctuation, extracting meaning, etc. Moreover, LUIS services have also enjoyed AIaaS, which we spoke about at ( Democratized AI – AI as a Service for all! ). AIaaS made handy to have a LUIS service up and running quickly without much upfront investment.
Many major vendors implemented LUIS services; Microsoft with LUIS, Amazon with Amazon Lex, Google with their acquired company DialogFlow and IBM with IBM Watson.
From a business point of view, LUIS services provide several benefits such as:
Improved user experience: Humans are more used to unstructured natural text than a menu of rigid structures or options since providing a user experience with natural text flow is less intimidating and allows the user to engage better with the application.
Lower costs: Since NLP services are slowly progressing towards human-level performance, it is possible to utilize them in boring front-office and customer support services.
Applications of LUIS are mostly around customer facing systems such as ticket booking, food ordering, and events ticket booking.
In this blog, we are going to discuss some core LUIS concepts and development approaches. The tutorial will be based on Microsoft LUIS offering. However, the concepts are almost the same among other vendors.
Before building a LUIS app for conversational purposes, it is essential to understand some core concepts and terminologies used in the field. Please note that our discussion is kept short for the sake of simplicity; there are many essential details which are purposefully omitted. You need to consult the documentation for a more in-depth look.
- Domain: A narrow application area the LUIS is specialized on, for example [News].
- Utterances: Are the inputs from the user which the app needs to understand. For example: [Show me yesterday’s financial news]. The developer
needsto provide as much as utterances he thinks the users will use. It means that the same sentence must be inserted multiple times with varying length, words, grammar, pluralization, stemming, noun/verb choice and punctuation. Therefore, customer support personnel would be the most suitable people to provide such information to the developer to configure in the system.
- Intents: Represent the tasks or the actions the user wants to perform. In the previous example, the intent would be [Show news].
- Entities: Are words which are critical in your application domain. They represent data which will be extracted from the utterance which can be name, date, or product name. In the previous example [yesterday’s], [financial] would be our entities.
LUIS Service assigns a confidence score to detected entities and intents since it is possible that more than one entity/intent matches the utterance content. Below is a sample response from Azure LUIS with confidence scores.
"query": "turn on the bedroom light",
Planning your application:
The overall development approach of language understanding services follows the following structure:
- Identify your domain: Find out the narrow domain your app is targeting so that the meaning of the word has a context. For example, when I say (key) it could mean a regular door key for an ordinary person, while it means a cryptographic key for a security specialist. In the previous example, we had [Travel] as our domain. Interestingly, some cloud vendors provide prebuilt domains such as Microsoft Azure that you can easily reuse.
- Identify your intents: Find out what actions do you expect the user to perform with a domain? For example, within [Travel] users can book a ticket, reschedule a ticket, inquiry about flight status.
- Identify your entities: Find out what entities identified within an intent such as a ticket, airline.
Microsoft has proposed a simple yet effective model on how to develop your LUIS service iteratively to generate quick PoC and ensure continuous improvement of your LUIS model.
Build LUIS app schema: This step involves building the LUIS model, starting from a particular app domain, utterances, intents, and entities.
Add training examples: This step involves adding more utterance examples with various words and sentence structure to LUIS model, Microsoft recommends around 10 to 15 utterance per intent.
Train and publish LUIS app: This step involves training the LUIS model (will be done for you!) and publishing the model as HTTPS endpoints for consumption.
Https Endpoints: This step involves testing the generated HTTPS endpoints. As a result, it allows LUIS to choose any utterance with a low confidence score for review.
After finishing the cycle, you can restart again. Begin with revising endpoints utterances where LUIS marked it as low confidence, continue the process until the review list is empty.
Azure LUIS offering uses “Active Learning” to continuously improve the model accuracy; not all vendors have this feature. Feel free to read more about it at Microsoft documentation.
Science is advancing astonishingly! As we have seen now, computers do understand natural language as LUIS does and it opens the door for a wide range of useful applications and scenarios. Moreover, since LUIS is RESTful endpoint, it makes it easy to integrate with other services such as Bot service, QnA maker and others.
That is it for today, comment and let me know what do you think 😉