Chatbot, Data, Helium

It’s Not Just the Semantics

I used to use the idiom "it's just semantics" to mean that the difference is in the details, and word choice is unimportant. On a recent project, I've had the opportunity to work with a linguistics and natural language processing expert. She highlighted my mistake in using that idiom; semantics is the branch of linguistics concerned with the meanings of words and the meanings embedded in the context of the way words are used. When I was using the term "it's just semantics" I was actually saying that the meaning of words is not important. I've come to understand that meaning is the most important part of language and how we communicate.

With the emergence of virtual assistants like Alexa, Siri and Cortana, we have seen explosive growth in the realm of natural language processing (NLP). NLP is the field within artificial intelligence which enables machines to have conversations with humans. The three fields within NLP are speech/text recognition, natural language understanding (NLU) and natural language generation (NLG). While NLP has seen major advances in the last decade, even passing the turing test, we still consider NLP to be very early on in its maturity. In particular natural language understanding has proven to be the most complex and challenging of the three. Why? You guessed it; semantics.

As humans we take for granted our innate ability to interpret the meaning of words. Our language is incredibly nuanced. Examples of these nuances include; words with multiple definitions, introduction of slang, shorthand and culturally relevant usage. Take the following sentences for example. "Tom Brady is a gunslinger.", or "What's up dog?", or "The Chainsmokers' new hit is fire." All sentences are representative of common language used by the general populace, but none of these sentences are literal. They all require varying levels of linguistic comprehension.

Let's break down the last sentence; "The Chainsmokers' new hit is fire." Imagine you are an alien learning language for the first time. What would you need to understand to make sense of this sentence? You'd have to know that The Chainsmokers are not literally a group of people who smoke cigarettes in abundance, but rather a popular music act. Second you'd need to know that a hit is slang for a song which has gained popularity. And finally you would need to understand that fire is slang for hot which in turn, is slang for attractive or desirable. So a more literal interpretation of the same sentence is "The music band named The Chainsmokers have a popular song which is desirable."

To make this task even harder is that language is ever changing. Language evolves not only in the words we use, but in the ways that we use them to create meanings or semantics. To believe we could write or code a set of rules which encompasses all of these nuances is futile. We know this, because the early NLU solutions tried to do exactly that. The early solutions were decision trees which were severely limited. Instead of trying to solve the issue with rules, we instead turn to statistical inference and machine learning on large amounts of conversational data. So instead of creating rules, we look at millions of examples of the word being used in language and then determine meaning based off of the statistical probabilities of how that word is used in context. The real life equivalent of this is learning Japanese by watching Japanese television for thousands of hours. You learn the usage of words through many examples of conversations.

To accomplish this we first look at dictionaries to give us the common or findable definitions. Second we include ontologies or classifications to help us understand what similar properties a word may have with its category. For example, The Chainsmokers is in the classification of music bands, and properties that tend to go with music bands are artists, songs, producers, instruments, etc. By knowing that the Chainsmokers are a music band, we can assume the properties, meanings and usages associated with music bands. (More details on Ontology-Driven NLP).

Third, works on the theory that if we want to find the meaning of a word, we can look at the words most often used along with that word to describe it's meaning. An example of this would be to look at the words most often used near the term Tom Brady. Words you'd find are 'football', 'quarterback', 'New England Patriots', 'Gisele Bundchen', 'Passing', 'Touchdown', 'Bill Belichick', maybe even 'Deflategate'. These words combined in varying weights give us a much clearer view of who or what the term 'Tom Brady' means. This is called Distributional Semantics or Word Embeddings and it gives us a word's relative meaning. There are applications such as Word2Vec which allows you to find the relationships (or vectors) between words and scores them against all other words in your data set. (More details on Word2Vec).

Finally, when you are deciding which language data sets to train your NLP on, it's important to consider the type of language input you are expecting. Wikipedia for example is a strong source for broad topics of knowledge, but tends to be written in a more academic and fact driven style of language. Twitter on the other hand is much more representative of the way the internet speaks. Transcripts from phone calls are very conversational in nature, but very different than the way that people type. Matching your source language data with the input you are expecting is essential.
Fortunately you don't have to build these solutions from scratch. Solutions like TensorFlow, Google's NL API and Microsoft LUIS all provide a foundation to do these types of NLP. You can add your language example data and user inputs to continuously train these solutions to have better language understanding for your specific use case.

We believe that robots and chatbots have incredible potential to build trusted relationships with people. We employ techniques in the design of these bots to build rapport and meaningful interactions with the end user. As natural language understanding becomes more mature, we will see bots become better at showing empathy, responding to requests and engaging with the user. We are excited to be pushing the boundaries of how bots can help people everyday at Helium.

Author


Avatar