Natural Language Processing with Python Cookbook

Learn the tricks and tips that will help you design Text Analytics solutions
Preview in Mapt

Natural Language Processing with Python Cookbook

Krishna Bhavsar, Naresh Kumar, Pratap Dangeti

Learn the tricks and tips that will help you design Text Analytics solutions

Quick links: > What will you learn?> Table of content

Mapt Subscription
FREE
$29.99/m after trial
eBook
$22.40
RRP $31.99
Save 29%
Print + eBook
$39.99
RRP $39.99
What do I get with a Mapt Pro subscription?
  • Unlimited access to all Packt’s 5,000+ eBooks and Videos
  • Early Access content, Progress Tracking, and Assessments
  • 1 Free eBook or Video to download and keep every month after trial
What do I get with an eBook?
  • Download this book in EPUB, PDF, MOBI formats
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
What do I get with Print & eBook?
  • Get a paperback copy of the book delivered to you
  • Download this book in EPUB, PDF, MOBI formats
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
What do I get with a Video?
  • Download this Video course in MP4 format
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
$0.00
$22.40
$39.99
$0 p/m after trial
RRP $31.99
RRP $39.99
Subscription
eBook
Print + eBook
Start 14 Day Trial

Frequently bought together


Natural Language Processing with Python Cookbook Book Cover
Natural Language Processing with Python Cookbook
$ 31.99
$ 22.40
Artificial Intelligence with Python – Sequence Learning [Video] Book Cover
Artificial Intelligence with Python – Sequence Learning [Video]
$ 124.99
$ 106.25
Buy 2 for $35.00
Save $121.98
Add to Cart

Book Details

ISBN 139781787289321
Paperback294 pages

Book Description

Natural Language Processing (NLP) is a field of computer science, artificial intelligence, and computational linguistics concerned with the interactions between computers and human (natural) languages; in particular, it's about programming computers to fruitfully process large natural language corpora.

This book includes unique recipes that will teach you various aspects of performing Natural Language Processing with NLTK—the leading Python platform for the task. You will come across various recipes during the course, covering (among other topics) natural language understanding, Natural Language Processing, and syntactic analysis. You will learn how to understand language, plan sentences, and work around various ambiguities. You will learn how to efficiently use NLTK and implement text classification, identify parts of speech, tag words, and more. You will also learn how to analyze sentence structures and master lexical analysis, syntactic and semantic analysis, pragmatic analysis, and the application of deep learning techniques.

By the end of this book, you will have all the knowledge you need to implement Natural Language Processing with Python.

Table of Contents

Chapter 1: Corpus and WordNet
Introduction
Accessing in-built corpora
Download an external corpus, load it, and access it
Counting all the wh words in three different genres in the Brown corpus
Explore frequency distribution operations on one of the web and chat text corpus files
Take an ambiguous word and explore all its senses using WordNet
Pick two distinct synsets and explore the concepts of hyponyms and hypernyms using WordNet
Compute the average polysemy of nouns, verbs, adjectives, and adverbs according to WordNet
Chapter 2: Raw Text, Sourcing, and Normalization
Introduction
The importance of string operations
Getting deeper with string operations
Reading a PDF file in Python
Reading Word documents in Python
Taking PDF, DOCX, and plain text files and creating a user-defined corpus from them
Read contents from an RSS feed
HTML parsing using BeautifulSoup
Chapter 3: Pre-Processing
Introduction
Tokenization – learning to use the inbuilt tokenizers of NLTK
Stemming – learning to use the inbuilt stemmers of NLTK
Lemmatization – learning to use the WordnetLemmatizer of NLTK
Stopwords – learning to use the stopwords corpus and seeing the difference it can make
Edit distance – writing your own algorithm to find edit distance between two strings
Processing two short stories and extracting the common vocabulary between two of them
Chapter 4: Regular Expressions
Introduction
Regular expression – learning to use *, +, and ?
Regular expression – learning to use $ and ^, and the non-start and non-end of a word
Searching multiple literal strings and substring occurrences
Learning to create date regex and a set of characters or ranges of character
Find all five-character words and make abbreviations in some sentences
Learning to write your own regex tokenizer
Learning to write your own regex stemmer
Chapter 5: POS Tagging and Grammars
Introduction
Exploring the in-built tagger
Writing your own tagger
Training your own tagger
Learning to write your own grammar
Writing a probabilistic CFG
Writing a recursive CFG
Chapter 6: Chunking, Sentence Parse, and Dependencies
Introduction
Using the built-in chunker
Writing your own simple chunker
Training a chunker
Parsing recursive descent
Parsing shift-reduce
Parsing dependency grammar and projective dependency
Parsing a chart
Chapter 7: Information Extraction and Text Classification
Introduction
Using inbuilt NERs
Creating, inversing, and using dictionaries
Choosing the feature set
Segmenting sentences using classification
Classifying documents
Writing a POS tagger with context
Chapter 8: Advanced NLP Recipes
Introduction
 Creating an NLP pipeline
 Solving the text similarity problem
Identifying topics
Summarizing text
 Resolving anaphora
Disambiguating word sense
 Performing sentiment analysis
 Exploring advanced sentiment analysis
Creating a conversational assistant or chatbot
Chapter 9: Applications of Deep Learning in NLP
Introduction
Classification of emails using deep neural networks after generating TF-IDF
IMDB sentiment classification using convolutional networks CNN 1D
IMDB sentiment classification using bidirectional LSTM
Visualization of high-dimensional words in 2D with neural word vector visualization
Chapter 10: Advanced Applications of Deep Learning in NLP
Introduction
Automated text generation from Shakespeare's writings using LSTM
Questions and answers on episodic data using memory networks
Language modeling to predict the next best word using recurrent neural networks LSTM
Generative chatbot using recurrent neural networks (LSTM)

What You Will Learn

  • Explore corpus management using internal and external corpora
  • Learn WordNet usage and a couple of simple application assignments using WordNet
  • Operate on raw text
  • Learn to perform tokenization, stemming, lemmatization, and spelling corrections, stop words removals, and more
  • Understand regular expressions for pattern matching
  • Learn to use and write your own POS taggers and grammars
  • Learn to evaluate your own trained models
  • Explore Deep Learning techniques in NLP
  • Generate Text from Nietzsche's writing using LSTM
  • Utilize the BABI dataset and LSTM to model episodes

Authors

Table of Contents

Chapter 1: Corpus and WordNet
Introduction
Accessing in-built corpora
Download an external corpus, load it, and access it
Counting all the wh words in three different genres in the Brown corpus
Explore frequency distribution operations on one of the web and chat text corpus files
Take an ambiguous word and explore all its senses using WordNet
Pick two distinct synsets and explore the concepts of hyponyms and hypernyms using WordNet
Compute the average polysemy of nouns, verbs, adjectives, and adverbs according to WordNet
Chapter 2: Raw Text, Sourcing, and Normalization
Introduction
The importance of string operations
Getting deeper with string operations
Reading a PDF file in Python
Reading Word documents in Python
Taking PDF, DOCX, and plain text files and creating a user-defined corpus from them
Read contents from an RSS feed
HTML parsing using BeautifulSoup
Chapter 3: Pre-Processing
Introduction
Tokenization – learning to use the inbuilt tokenizers of NLTK
Stemming – learning to use the inbuilt stemmers of NLTK
Lemmatization – learning to use the WordnetLemmatizer of NLTK
Stopwords – learning to use the stopwords corpus and seeing the difference it can make
Edit distance – writing your own algorithm to find edit distance between two strings
Processing two short stories and extracting the common vocabulary between two of them
Chapter 4: Regular Expressions
Introduction
Regular expression – learning to use *, +, and ?
Regular expression – learning to use $ and ^, and the non-start and non-end of a word
Searching multiple literal strings and substring occurrences
Learning to create date regex and a set of characters or ranges of character
Find all five-character words and make abbreviations in some sentences
Learning to write your own regex tokenizer
Learning to write your own regex stemmer
Chapter 5: POS Tagging and Grammars
Introduction
Exploring the in-built tagger
Writing your own tagger
Training your own tagger
Learning to write your own grammar
Writing a probabilistic CFG
Writing a recursive CFG
Chapter 6: Chunking, Sentence Parse, and Dependencies
Introduction
Using the built-in chunker
Writing your own simple chunker
Training a chunker
Parsing recursive descent
Parsing shift-reduce
Parsing dependency grammar and projective dependency
Parsing a chart
Chapter 7: Information Extraction and Text Classification
Introduction
Using inbuilt NERs
Creating, inversing, and using dictionaries
Choosing the feature set
Segmenting sentences using classification
Classifying documents
Writing a POS tagger with context
Chapter 8: Advanced NLP Recipes
Introduction
 Creating an NLP pipeline
 Solving the text similarity problem
Identifying topics
Summarizing text
 Resolving anaphora
Disambiguating word sense
 Performing sentiment analysis
 Exploring advanced sentiment analysis
Creating a conversational assistant or chatbot
Chapter 9: Applications of Deep Learning in NLP
Introduction
Classification of emails using deep neural networks after generating TF-IDF
IMDB sentiment classification using convolutional networks CNN 1D
IMDB sentiment classification using bidirectional LSTM
Visualization of high-dimensional words in 2D with neural word vector visualization
Chapter 10: Advanced Applications of Deep Learning in NLP
Introduction
Automated text generation from Shakespeare's writings using LSTM
Questions and answers on episodic data using memory networks
Language modeling to predict the next best word using recurrent neural networks LSTM
Generative chatbot using recurrent neural networks (LSTM)

Book Details

ISBN 139781787289321
Paperback294 pages
Read More

Read More Reviews

Recommended for You

Artificial Intelligence with Python – Sequence Learning [Video] Book Cover
Artificial Intelligence with Python – Sequence Learning [Video]
$ 124.99
$ 106.25
Supervised and Unsupervised Learning with Python [Video] Book Cover
Supervised and Unsupervised Learning with Python [Video]
$ 124.99
$ 106.25
Python Natural Language Processing Book Cover
Python Natural Language Processing
$ 39.99
$ 28.00
Scalable programming with Scala and Spark [Video] Book Cover
Scalable programming with Scala and Spark [Video]
$ 49.99
$ 42.50
Create Apps in MATLAB with App Designer (Codes Included) [Video] Book Cover
Create Apps in MATLAB with App Designer (Codes Included) [Video]
$ 24.99
$ 21.25
Mastering Machine Learning with MATLAB [Video] Book Cover
Mastering Machine Learning with MATLAB [Video]
$ 124.99
$ 106.25