![Hands-On Natural Language Processing with PyTorch 1.x](https://img.perlego.com/book-covers/1636286/9781789805536_300_450.webp)
Hands-On Natural Language Processing with PyTorch 1.x
Build smart, AI-driven linguistic applications using deep learning and NLP techniques
Thomas Dop
- 276 Seiten
- English
- ePUB (handyfreundlich)
- Über iOS und Android verfügbar
Hands-On Natural Language Processing with PyTorch 1.x
Build smart, AI-driven linguistic applications using deep learning and NLP techniques
Thomas Dop
Über dieses Buch
Become a proficient NLP data scientist by developing deep learning models for NLP and extract valuable insights from structured and unstructured data
Key Features
- Get to grips with word embeddings, semantics, labeling, and high-level word representations using practical examples
- Learn modern approaches to NLP and explore state-of-the-art NLP models using PyTorch
- Improve your NLP applications with innovative neural networks such as RNNs, LSTMs, and CNNs
Book Description
In the internet age, where an increasing volume of text data is generated daily from social media and other platforms, being able to make sense of that data is a crucial skill. With this book, you'll learn how to extract valuable insights from text by building deep learning models for natural language processing (NLP) tasks.
Starting by understanding how to install PyTorch and using CUDA to accelerate the processing speed, you'll explore how the NLP architecture works with the help of practical examples. This PyTorch NLP book will guide you through core concepts such as word embeddings, CBOW, and tokenization in PyTorch. You'll then learn techniques for processing textual data and see how deep learning can be used for NLP tasks. The book demonstrates how to implement deep learning and neural network architectures to build models that will allow you to classify and translate text and perform sentiment analysis. Finally, you'll learn how to build advanced NLP models, such as conversational chatbots.
By the end of this book, you'll not only have understood the different NLP problems that can be solved using deep learning with PyTorch, but also be able to build models to solve them.
What you will learn
- Use NLP techniques for understanding, processing, and generating text
- Understand PyTorch, its applications and how it can be used to build deep linguistic models
- Explore the wide variety of deep learning architectures for NLP
- Develop the skills you need to process and represent both structured and unstructured NLP data
- Become well-versed with state-of-the-art technologies and exciting new developments in the NLP domain
- Create chatbots using attention-based neural networks
Who this book is for
This PyTorch book is for NLP developers, machine learning and deep learning developers, and anyone interested in building intelligent language applications using both traditional NLP approaches and deep learning architectures. If you're looking to adopt modern NLP techniques and models for your development projects, this book is for you. Working knowledge of Python programming, along with basic working knowledge of NLP tasks, is required.
Häufig gestellte Fragen
Information
Hands-On Natural Language Processing with PyTorch 1.x
![](https://book-extracts.perlego.com/1636286/images/Image85493-plgo-compressed.webp)
Hands-On Natural Language Processing with PyTorch 1.x
![](https://book-extracts.perlego.com/1636286/images/Image85502-plgo-compressed.webp)
Contributors
About the author
About the reviewers
Packt is searching for authors like you
Table of Contents
Preface
Section 1: Essentials of PyTorch 1.x for NLP
Chapter 1: Fundamentals of Machine Learning and Deep Learning
Overview of machine learning14
Supervised learning14
Unsupervised learning17
How do models learn?18
Neural networks22
Structure of neural networks22
Activation functions23
How do neural networks learn?24
Overfitting in neural networks25
NLP for machine learning26
Bag-of-words26
Sequential representation27
Summary27
Chapter 2: Getting Started with PyTorch 1.x for NLP
Technical requirements30
Installing and using PyTorch 1.x30
Tensors32
Enabling PyTorch acceleration using CUDA32
Comparing PyTorch to other deep learning frameworks35
Building a simple neural network in PyTorch36
Loading the data 37
Building the classifier37
Implementing dropout38
Defining the forward pass39
Setting the model parameters39
Training our network41
Making predictions42
Evaluating our model44
NLP for PyTorch44
Setting up the classifier45
Training the classifier47
Summary51
Section 2: Fundamentals of Natural Language Processing
In this section, you will learn about the fundamentals of building a Natural Language Processing (NLP) application. You will also learn how to use various NLP techniques, such as word embeddings, CBOW, and tokenization in PyTorch in this section.53
Chapter 3: NLP and Text Embeddings
Technical requirements56
Embeddings for NLP56
GLoVe57
Embedding operations 59
Exploring CBOW61
CBOW architecture62
Building CBOW63
Exploring n-grams69
N-gram language modeling 70
Tokenization72
Tagging and chunking for parts of speech74
Tagging75
Chunking76
TF-IDF77
Calculating TF-IDF78
Implementing TF-IDF79
Calculating TF-IDF weighted embeddings81
Summary83
Chapter 4: Text Preprocessing, Stemming, and Lemmatization
Technical requirements86
Text preprocessing86
Removing HTML87
Converting text into lowercase87
Removing punctuation88
Replacing numbers90
Stemming and lemmatization91
Stemming92
Lemmatization94
Uses of stemming and lemmatization97
Differences in lemmatization and stemming98
Summary98
Section 3: Real-World NLP Applications Using PyTorch 1.x
Chapter 5: Recurrent Neural Networks and Sentiment Analysis
Technical requirements102
Building RNNs102
Using RNNs for sentiment analysis104
Exploding and shrinking gradients105
Introducing LSTMs106
Working with LSTMs107
LSTM cells108
Bidirectional LSTMs111
Building a sentiment analyzer using LSTMs112
Preprocessing the data113
Model architecture116
Training the model120
Using our model to make predictions125
Deploying the application on Heroku127
Introducing Heroku127
Creating an API using Flask – file structure127
Creating an API using Flask – API file129
Creating an API using Flask – hosting on Heroku131
Summary132
Chapter 6: Convolutional Neural Networks for Text Classification
Technical requirements134
Exploring CNNs134
Convolutions135
Convolutions for NLP137
Building a CNN for text classification140
Defining a multi-class classification dataset140
Creating iterators to load the data141
Constructing the CNN model145
Training the CNN150
Making predictions using the trained CNN154
Summary156
Chapter 7: Text Translation Using Sequence-to-Sequence Neural Networks
Technical requirements158
Theory of sequence-to-sequence models158
Encoders161
Decoders162
Using teacher forcing163
Building a sequence-to-sequence model for text translation164
Preparing the data165
Building the encoder169
Building the decoder171
Constructing the full sequence-to-sequence model172
Training the model175
Evaluating the model180
Next steps181
Summary182
Chapter 8: Building a Chatbot Using Attention-Based Neural Networks
Technical requirements184
The theory of attention within neural networks184
Comparing local and global attention185
Building a chatbot using sequence-to-sequence neural networks with attention188
Acquiring our dataset188
Processing our dataset189
Creating the vocabulary190
Loading the data193
Removing rare words195
Transforming sentence pairs to tensors197
Constructing the model201
Defining the training process206
Defining the evaluating process212
Training the model216
Summary222
Chapter 9: The Road Ahead
Exploring state-of-the-art NLP machine learning224
BERT224
BERT–Architecture227
Applications of BERT235
GPT-2236
Comparing self-attention and masked self-attention238
GPT-2 – Ethics238
Future NLP tasks240
Constituency parsing240
Semantic role labeling244
Textual entailment248
Machine comprehension251
Summary257
Other Books You May Enjoy
Leave a review - let other readers know what you think261
Preface
Who this book is for
What this book covers
Inhaltsverzeichnis
- Hands-On Natural Language Processing with PyTorch 1.x
- Contributors
- 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