Facebook Pixel Code

This is the fifteenth article in a series dedicated to the various aspects of machine learning (ML). Today’s article will continue the discussion of natural language processing (NLP) by considering how it can be assisted by deep learning, another major field of machine learning. We will consider how deep learning impacts NLP in light of one of machine translation, where a machine learning language translates one natural language to another. 

If you’ve been following us through the forest of natural language processing along the journey that is our machine learning series, you’ve probably at least retained one thing: Language is a complex thing. For AI agents, tasks involving a natural language like English will inherently be complex because, well, language is complex and a computer isn’t raised and socialized around a natural language like humans typically are. And complex tasks require complex measures to be accomplished. Now, we’ll stop using the word “complex” and get into how NLP requires the help of the quite complex  elaborate machine learning process, deep learning. 

Deep Learning Review

Recall that deep learning is a much more involved version of the basic machine learning process, which features a foreign/previously unseen input, like a picture of a dog, being analyzed by an ML algorithm before returning an output, such as that same picture being (hopefully correctly) labeled “german shepherd.” What makes deep learning different from more simple ML methods is that it involves more “layers” where the data is analyzed. These layers are composed of neural networks, similar to neuron structure in the human brain, with a great deal of nodes that work to process and make sense of the input data. The multiple layers ensures that each bit of input data is given a more comprehensive analysis, which results in more accurate and reliable outputs. 

Now that we’ve got you caught up, let’s consider how this method of machine learning is employed in the field of natural language processing. 

DL in NLP

Our primary example of DL in NLP will be the task of machine translation (MT), which mainly deals with the translation of one natural language to another. 

Deep learning is necessary in language translation because not every language precisely matches the other in terms of grammar rules and word construction. For instance, the counterpart of one English word may be a two word phrase in Spanish. So, it’s not as simple as an input-output process like image tagging, where the picture of a German shepherd is tagged “german shepherd.” A more intricate understanding of the relationship between two languages is needed. 

The relationship between two languages is defined by which one is considered the “source,” and which is the “target,” which could basically be called “input” and “output,” where the input/source language is translated into the output/target language. The task of turning a source language into a target language sounds simple, but many things must be considered when translating. It takes more than simply plugging in the analogues of each vocabulary word in the sentence. For instance, the meaning of sentences and the words that comprise them often depends on context, so it is necessary to understand what the source sentence is saying so that the same meaning will get across in translation. 

A good DL model will have at least two neural networks, one each for the source and target languages. The source NN will “read” the source sentence, and its understanding of its meaning will be the basis for the target NN’s construction of the target sentence. The official term for this kind of DL model, involving source and target NN’s, is sequence-to-sequence model. 

Still, it is not like the target NN will just spit out a fully formed sentence upon seeing the source NN’s “reading.” Typically, a translation goes one word at a time, from the start of the sentence to the end, considerate of the meaning and context of each word within the sentence. And, as is the hope of every DL model, the output/target sentence hopefully translates not only the words but the meaning as well. 

Summary

Natural language processing involving one language is hard enough as it is, but when two are involved things tend to get tricky. This is why deep learning, a form of machine learning, is used for intricate NLP tasks such as machine translation, where an AI agent translates a source language, like English, into a target language, like Swahili. This tends to involve multiple neural networks, which are complicated layers of nodes that process information, with at least one NN dedicated to understanding the source language and another for translating the interpreted source language into the target language.