Natural Language Processing for the Layperson

Article adjectives, nouns, and prepositions are just a few of the many parts of speech that we use every day. We use these parts of speech to communicate in various different ways, whether it’s writing, reading and/or speaking.

Natural language refers to the way that we, as humans, speak to each other. The best example is if you think about how you speak in person to your friends and co-workers — full sentences. “Can you grab the paper from the desk for me?” is an example of how someone may naturally ask a question that includes not just parts of speech, but also the context and true meaning (semantics) of the question.

Breaking Down a Sentence

When humans speak to each other naturally, we don’t necessarily always think in terms of nouns (“you”, “paper”, “desk”) and prepositions (“from the desk”, “for me”) nor their grammatical categories of verb phrases (“Can you grab”) and noun phrases (“the paper”, “the desk”) when we are asking or being asked a question. Our brains just don’t need to break it down like that.

When we use sentences like these with other humans, there is context that we understand as humans that computers have a hard time learning. For example, if someone asked me,”Can you grab the paper from the desk for me?,” I would know that they meant right now and not some other time. I would also know that “grab” doesn’t mean pick it up and hold it menacingly, but to pick it up and hand it to the requester (maybe nicely, who knows).

Natural Language Processing (NLP) occurs when us humans begin to interact with with computers via text or voice. When we begin interacting with computers by asking Google a question, for example, the necessity for machines to learn how humans ask questions as well as the context and the meaning of the words becomes vital to the success of getting the right answers — the same kind of answers we would expect from a human.

 

NLP and Semantics

To provide an example of how NLP is used, let’s learn from my favorite search engine guinea pig, Google.

Everything Apples!

Everything Apples!

When I search Google for “apples”, it’s not quite sure if I meant “Apple” the company, pictures of apples or nutrition of apples. What it does know is that in context of a search for “apples”, people generally want to know about the company, want graphics/pictures of apples for some other use, or happen to want to know some additional information about apple nutrition.

Let’s introduce a sentence into Google for a better example of NLP in action. The following examples will also give you a peek into how difficult NLP really is for machines. Here’s what happens if I search,”How much water can I drink” vs “How much water should I drink”:

1_6OKjJGfpzoEjAo5hFzAb9g (1).png

Compare this to:

1_Iflqj7YmEh0mafQyzcLN-Q.png

When Google Search recognizes that you are asking a question using NLP (“how”), the result presented is a results summary or snippet of what Google predicts is the answer to the question. (This ties together NLP and machine learning, but right now we are solely focused on the NLP aspect of this search.)

You’ll notice that the result for “how much water should I drink” is completely different from the previous result of “how much water can I drink,” yet both of the answers in the snippets contain the word “should” and provide recommendations differently. That is because Google’s NLP is still learning which snippet to present when dealing with semantics. Can” and “should” do have different meanings and I might expect to see more scientific answers in response to “can” than “should”. Again, humans can more easily detect changes in meaning like this, but machines need more data to fully learn.

One Word Can Make All the Difference

Let’s take it a step further and make the sentence more specific. When I asked,”how much water can I drink”, its recommendation included a weight of 150 and water consumption range. What if I’m a different weight? If I am asking a fellow American the question,“how much water can drink if I weigh 120,” they would understand that I meant in pounds. Google, similarly, knows that I am currently in Texas and I would expect that it would understand my question without “pounds” added. That is not the case:

1_WDl6Xy3ubmIayluTPOg42g.png

It’s clear here that Google Search is still learning and has yet to learn the context of this sentence. Here is what happens when I add “pounds”:

Again, Google knows that I am asking a question (“how”) and that it should display an answer that it predicts answers that question. It also knows that I mean daily and not annually and returns the best answer showing per day. The end result of this search is a snippet that includes a list with body weights and their associated amounts of water that should be consumed daily. It’s a great answer to a question that took a little work to get the right answer to. Just as it takes a child some time to learn the intricacies of their native language, NLP must learn to provide the right answers by trial and error with our help.

Why NLP is Important?

The usefulness of NLP is largely seen when combined with machine learning capabilities. With regards to being leveraged by businesses, when a machine can learn the semantics and context of the questions it is asked and statements it is given, it will enable businesses to unlock the potential of its large volumes of data to streamline processes and extract information without needing the help of a subject matter expert. Examples of use cases where NLP can be beneficial will be seen in subsequent articles.

Although I am vastly oversimplifying the complexity of NLP, I believe this will help to give the not-so-tech-savvy crowd a high-level understanding of what NLP is.

Syndi Espinoza is a solutions consultant & sales professional who aligns business and technology objectives.