Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Hands-On Natural Language Processing with PyTorch 1.x

You're reading from  Hands-On Natural Language Processing with PyTorch 1.x

Product type Book
Published in Jul 2020
Publisher Packt
ISBN-13 9781789802740
Pages 276 pages
Edition 1st Edition
Languages
Author (1):
Thomas Dop Thomas Dop
Profile icon Thomas Dop

Table of Contents (14) Chapters

Preface Section 1: Essentials of PyTorch 1.x for NLP
Chapter 1: Fundamentals of Machine Learning and Deep Learning Chapter 2: Getting Started with PyTorch 1.x for NLP Section 2: Fundamentals of Natural Language Processing
Chapter 3: NLP and Text Embeddings Chapter 4: Text Preprocessing, Stemming, and Lemmatization Section 3: Real-World NLP Applications Using PyTorch 1.x
Chapter 5: Recurrent Neural Networks and Sentiment Analysis Chapter 6: Convolutional Neural Networks for Text Classification Chapter 7: Text Translation Using Sequence-to-Sequence Neural Networks Chapter 8: Building a Chatbot Using Attention-Based Neural Networks Chapter 9: The Road Ahead Other Books You May Enjoy

Theory of sequence-to-sequence models

Sequence-to-sequence models are very similar to the conventional neural network structures we have seen so far. The main difference is that for a model's output, we expect another sequence, rather than a binary or multi-class prediction. This is particularly useful in tasks such as translation, where we may wish to convert a whole sentence into another language.

In the following example, we can see that our English-to-Spanish translation maps word to word:

Figure 7.1 – English to Spanish translation

Figure 7.1 – English to Spanish translation

The first word in our input sentence maps nicely to the first word in our output sentence. If this were the case for all languages, we could simply pass each word in our sentence one by one through our trained model to get an output sentence, and there would be no need for any sequence-to-sequence modeling, as shown here:

Figure 7.2 – English-to-Spanish translation of words

...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}