{"id":2134,"date":"2019-11-10T16:08:01","date_gmt":"2019-11-10T16:08:01","guid":{"rendered":"https:\/\/www.codeastar.com\/?p=2134"},"modified":"2020-01-01T17:24:15","modified_gmt":"2020-01-01T17:24:15","slug":"nmt-make-an-easy-neural-machine-translator","status":"publish","type":"post","link":"https:\/\/www.codeastar.com\/nmt-make-an-easy-neural-machine-translator\/","title":{"rendered":"NMT – make an easy Neural Machine Translator"},"content":{"rendered":"\n

I haven’t updated this blog for a few months. As there is something big happened in my hometown<\/a>. But life must go on, so we come back here and learn a new topic — NMT (Neural Machine Translation). You may try the translate service before (if not, let’s Google Translate<\/a>), it is the time we find out how natural language processing work in translation. <\/p>\n\n\n\n

What is NMT?<\/h3>\n\n\n\n

Let we start from the very beginning, what is NMT? It is a machine translation process handling in a neural network<\/a>. We have used neural network to solve different kinds of problems in this blog. For example, hand writing recognition<\/a> and toxic comment classification<\/a>. And this time, we use neural network in machine learning, to solve translation problem. <\/p>\n\n\n\n

When we started our machine learning journey in the early posts<\/a>, we mentioned machine learning was a series of actions on data analysis. In our case of translation, machine learns word relationships from reading bilingual corpora. It is no problem to translate words in this way. But it is not the full side of machine translation. We want a machine can translate not only words but a whole sentence like a human does. Then we apply neural network on machine translation.<\/p>\n\n\n\n

From our previous comment classification exercise, we use neural network to let machine learn several words in a sentence. So the machine can classify rather a sentence is “toxic” or not. This time, instead of classifying a “toxic” sentence, we classify words on the sentence from language A to language B. How do we do that? Here it comes, Encoder-Decoder Model.<\/p>\n\n\n\n

Encoder-Decoder Model<\/h3>\n\n\n\n

Although it sounds like a new term to us, in fact, we have tasted part of it before. Do you remember the word embedding<\/a> in NLP? Yes, it was a encoder actually. Last time, we encoded comments into sequences. Then this time, we encode language phases into sequences. The decoder works like an encoder in reserve. But we decode sequences into another language. So the whole concept should look like:<\/p>\n\n\n\n

\"NMT<\/figure>\n\n\n\n