Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
The Natural Language Processing Workshop
The Natural Language Processing Workshop

The Natural Language Processing Workshop: Confidently design and build your own NLP projects with this easy-to-understand practical guide

Arrow left icon
Profile Icon Rohan Chopra Profile Icon Muzaffar Bashir Shah Profile Icon Nipun Sadvilkar Profile Icon Aniruddha M. Godbole Profile Icon Dwight Gunning Profile Icon Sohom Ghosh +2 more Show less
Arrow right icon
AU$14.99 AU$48.99
Full star icon Full star icon Full star icon Full star icon Half star icon 4.6 (5 Ratings)
eBook Aug 2020 452 pages 1st Edition
eBook
AU$14.99 AU$48.99
Paperback
AU$60.99
Subscription
Free Trial
Renews at AU$24.99p/m
Arrow left icon
Profile Icon Rohan Chopra Profile Icon Muzaffar Bashir Shah Profile Icon Nipun Sadvilkar Profile Icon Aniruddha M. Godbole Profile Icon Dwight Gunning Profile Icon Sohom Ghosh +2 more Show less
Arrow right icon
AU$14.99 AU$48.99
Full star icon Full star icon Full star icon Full star icon Half star icon 4.6 (5 Ratings)
eBook Aug 2020 452 pages 1st Edition
eBook
AU$14.99 AU$48.99
Paperback
AU$60.99
Subscription
Free Trial
Renews at AU$24.99p/m
eBook
AU$14.99 AU$48.99
Paperback
AU$60.99
Subscription
Free Trial
Renews at AU$24.99p/m

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Product feature icon AI Assistant (beta) to help accelerate your learning
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Table of content icon View table of contents Preview book icon Preview Book

The Natural Language Processing Workshop

2. Feature Extraction Methods

Overview

In this chapter, you will be able to categorize data based on its content and structure. You will be able to describe preprocessing steps in detail and implement them to clean up text data. You will learn about feature engineering and calculate the similarity between texts. Once you understand these concepts, you will be able to use word clouds and some other techniques to visualize text.

Introduction

In the previous chapter, we learned about the concepts of Natural Language Processing (NLP) and text analytics. We also took a quick look at various preprocessing steps. In this chapter, we will learn how to make text understandable to machine learning algorithms.

As we know, to use a machine learning algorithm on textual data, we need a numerical or vector representation of text data since most of these algorithms are unable to work directly with plain text or strings. But before converting the text data into numerical form, we will need to pass it through some preprocessing steps such as tokenization, stemming, lemmatization, and stop-word removal.

So, in this chapter, we will learn a little bit more about these preprocessing steps and how to extract features from the preprocessed text and convert them into vectors. We will also explore two popular methods for feature extraction (Bag of Words and Term Frequency-Inverse Document Frequency), as well as various methods...

Types of Data

To deal with data effectively, we need to understand the various forms in which it exists. First, let's explore the types of data that exist. There are two main ways to categorize data (by structure and by content), as explained in the upcoming sections.

Categorizing Data Based on Structure

Data can be divided on the basis of structure into three categories, namely, structured, semi-structured, and unstructured data, as shown in the following diagram:

Figure 2.1: Categorization based on content

These three categories are as follows:

  • Structured data: This is the most organized form of data. It is represented in tabular formats such as Excel files and Comma-Separated Value (CSV) files. The following image shows what structured data usually looks like:

Figure 2.2: Structured data

The preceding table contains information about five people, with each row representing a person and each column representing one of their attributes...

Cleaning Text Data

The text data that we are going to discuss here is unstructured text data, which consists of written sentences. Most of the time, this text data cannot be used as it is for analysis because it contains some noisy elements, that is, elements that do not really contribute much to the meaning of the sentence at all. These noisy elements need to be removed because they do not contribute to the meaning and semantics of the text. If they're not removed, they can not only waste system memory and processing time, but also negatively impact the accuracy of the results. Data cleaning is the art of extracting meaningful portions from data by eliminating unnecessary details. Consider the sentence, "He tweeted, 'Live coverage of General Elections available at this.tv/show/ge2019. _/\_ Please tune in :) '. "

In this example, to perform NLP tasks on the sentence, we will need to remove the emojis, punctuation, and stop words, and then change the words...

Feature Extraction from Texts

As we already know, machine learning algorithms do not understand textual data directly. We need to represent the text data in numerical form or vectors. To convert each textual sentence into a vector, we need to represent it as a set of features. This set of features should uniquely represent the text, though, individually, some of the features may be common across many textual sentences. Features can be classified into two different categories:

  • General features: These features are statistical calculations and do not depend on the content of the text. Some examples of general features could be the number of tokens in the text, the number of characters in the text, and so on.
  • Specific features: These features are dependent on the inherent meaning of the text and represent the semantics of the text. For example, the frequency of unique words in the text is a specific feature.

Let's explore these in detail.

Extracting General Features...

Finding Text Similarity – Application of Feature Extraction

So far in this chapter, we have learned how to generate vectors from text. These vectors are then fed to machine learning algorithms to perform various tasks. Other than using them in machine learning applications, we can also perform simple NLP tasks using these vectors. Finding the string similarity is one of them. This is a technique in which we find the similarity between two strings by converting them into vectors. The technique is mainly used in full-text searching.

There are different techniques for finding the similarity between two strings or texts. They are explained one by one here:

  • Cosine similarity: The cosine similarity is a technique to find the similarity between the two vectors by calculating the cosine of the angle between them. As we know, the cosine of a zero-degree angle is 1 (meaning the cosine similarity of two identical vectors is 1), while the cosine of 180 degrees is -1 (meaning...

Summary

In this chapter, you have learned about various types of data and ways to deal with unstructured text data. Text data is usually extremely noisy and needs to be cleaned and preprocessed, which mainly consists of tokenization, stemming, lemmatization, and stop-word removal. After preprocessing, features are extracted from texts using various methods, such as BoW and TFIDF. These methods convert unstructured text data into structured numeric data. New features are created from existing features using a technique called feature engineering. In the last part of this chapter, we explored various ways of visualizing text data, such as word clouds.

In the next chapter, you will learn how to develop machine learning models to classify texts using the feature extraction methods you have learned about in this chapter. Moreover, different sampling techniques and model evaluation parameters will be introduced.

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • Get familiar with key natural language processing (NLP) concepts and terminology
  • Explore the functionalities and features of popular NLP tools
  • Learn how to use Python programming and third-party libraries to perform NLP tasks

Description

Do you want to learn how to communicate with computer systems using Natural Language Processing (NLP) techniques, or make a machine understand human sentiments? Do you want to build applications like Siri, Alexa, or chatbots, even if you’ve never done it before? With The Natural Language Processing Workshop, you can expect to make consistent progress as a beginner, and get up to speed in an interactive way, with the help of hands-on activities and fun exercises. The book starts with an introduction to NLP. You’ll study different approaches to NLP tasks, and perform exercises in Python to understand the process of preparing datasets for NLP models. Next, you’ll use advanced NLP algorithms and visualization techniques to collect datasets from open websites, and to summarize and generate random text from a document. In the final chapters, you’ll use NLP to create a chatbot that detects positive or negative sentiment in text documents such as movie reviews. By the end of this book, you’ll be equipped with the essential NLP tools and techniques you need to solve common business problems that involve processing text.

Who is this book for?

This book is for beginner to mid-level data scientists, machine learning developers, and NLP enthusiasts. A basic understanding of machine learning and NLP is required to help you grasp the topics in this workshop more quickly.

What you will learn

  • Obtain, verify, clean and transform text data into a correct format for use
  • Use methods such as tokenization and stemming for text extraction
  • Develop a classifier to classify comments in Wikipedia articles
  • Collect data from open websites with the help of web scraping
  • Train a model to detect topics in a set of documents using topic modeling
  • Discover techniques to represent text as word and document vectors

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Aug 17, 2020
Length: 452 pages
Edition : 1st
Language : English
ISBN-13 : 9781800200807
Category :
Languages :
Tools :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Product feature icon AI Assistant (beta) to help accelerate your learning
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Product Details

Publication date : Aug 17, 2020
Length: 452 pages
Edition : 1st
Language : English
ISBN-13 : 9781800200807
Category :
Languages :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
AU$24.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
AU$249.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just AU$5 each
Feature tick icon Exclusive print discounts
AU$349.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just AU$5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total AU$ 175.97
The Data Science Workshop
AU$60.99
The Statistics and Calculus with Python Workshop
AU$53.99
The Natural Language Processing Workshop
AU$60.99
Total AU$ 175.97 Stars icon
Banner background image

Table of Contents

8 Chapters
1. Introduction to Natural Language Processing Chevron down icon Chevron up icon
2. Feature Extraction Methods Chevron down icon Chevron up icon
3. Developing a Text Classifier Chevron down icon Chevron up icon
4. Collecting Text Data with Web Scraping and APIs Chevron down icon Chevron up icon
5. Topic Modeling Chevron down icon Chevron up icon
6. Vector Representation Chevron down icon Chevron up icon
7. Text Generation and Summarization Chevron down icon Chevron up icon
8. Sentiment Analysis Chevron down icon Chevron up icon

Customer reviews

Rating distribution
Full star icon Full star icon Full star icon Full star icon Half star icon 4.6
(5 Ratings)
5 star 60%
4 star 40%
3 star 0%
2 star 0%
1 star 0%
N/A Dec 20, 2023
Full star icon Full star icon Full star icon Full star icon Full star icon 5
This is a good book for beginners. The examples are clear. Overall, it is a very good book.
Feefo Verified review Feefo
Darpan Feb 27, 2021
Full star icon Full star icon Full star icon Full star icon Full star icon 5
All NLP practitioners are having trouble finding natural language processing books to start with. Particularly the lack and insufficient understanding of each topic required base to learn. BERT, NLTK, Semantic Efficacy, Segment Embedding, Contextual Embedding all of these are very important and important topics to learn in productive Environment.This book is very good to start with basics. All topics are covered in a particular manner. All functionality is covered with detailed understanding and and hands on method. With this book users can read and learn very quickly because of the easy language Good thing about this book is that its practical implementation of each topic will help us to understand details of implementation has been done in algorithm.Overall it is a very awesome book for nlp.
Amazon Verified review Amazon
William Kpabitey Kwabla Oct 01, 2020
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Explanation Of ConceptThe authors took their time to really explain the concepts for everyone to really understand them. I have a preference of understanding concepts than memorizing them and the authors did an amazing job explaining conceptsClarity of CodeWith the amazing explanations of concepts, they did a great job with the implementation of the concepts in python.ProjectsI like project based learning which is what the authors used to teach and implement the concepts. Aside from that, they added many exercises for each chapter to help solidify what you learn in every chapter.
Amazon Verified review Amazon
Nitin Kishore Jan 25, 2021
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
I've been looking for a good book to refresh my basic concepts since finishing grad school. This books is an extensive package and doesn't just address NLP in terms of recent popular sub fields like chat bots or Bert but rather goes into multiple levels of linguistic analysis like morphology, discourse, syntax, semantics etc. and provides a more well rounded introduction to all sub fields. It's perfect as an intro. This book is easy to consume and filled with python snippets that help you understand what's happening through code.NLTK to spell check your data before lemmatizing was a good tip that is usually missed by many people even in the industry. They do go into using textblob as well. I wish they could have included some spacy related content and went into some use cases or SOTA for each topic. That would help people currently working in the industry as well. Perhaps they would cover that in another book.Exercises, examples and pipelines are very practical and go over standard text processing practices and how to do them. Some of these are generalized and useful in other non NLP related projects as well. The theory is brief, to the point, easy to follow even without any examples and it is not math heavy which is usually what intimidates beginners or non STEM students and professionals from engaging in reading. This is the perfect book for them to start their learning and explore further.Towards the end they do introduce Bert in context of text summarization and explain word vectors and embedding which is crucial if you want to delve into deep learning models. Would love to see more advanced content as well that covers Deep NLP
Amazon Verified review Amazon
Hakuna Matata Feb 08, 2021
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
Very few beginner books in NLP I have seen with details on word sense disambiguation, sentence boundary detection, and detailed chapter in feature extraction and data preparation. I also loved the chapters on web scrapping and dealing with semi structured data - very important skill for a data scientist in general.Love the code snippets and the ability to test those snippets in mybinder. I didn't have to worry about setting up my own Jupyter setup to get going. This is a huge barrier for many developers who want to just focus on learning the concepts instead of getting bogged down with environment setup.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.