Share E-Book
Scan to open this page

Scan with your phone to open this page

AuthorHobson Lane, Maria Dyshel

Develop your NLP skills from scratch, with an open source toolbox of Python packages, Transformers, Hugging Face, vector databases, and your own Large Language Models. Natural Language Processing in Action, Second Edition has helped thousands of data scientists build machines that understand human language. In this new and revised edition, you’ll discover state-of-the art Natural Language Processing (NLP) models like BERT and HuggingFace transformers, popular open-source frameworks for chatbots, and more. You’ll create NLP tools that can detect fake news, filter spam, deliver exceptional search results and even build truthfulness and reasoning into Large Language Models (LLMs).

AI Reading Assistant

Whole-book reading guide from stratified index samples; jump to passages in the text

AI guide
【One-Line Pitch】 A hands-on guide that takes you from raw text to working NLP systems, using Python, open-source tools, and modern transformers. Best for data scientists and developers who want to build machines that read, write, and reason with language rather than just study the theory. 【Book Arc】 - **Opening (~0%–10%)**: Frames what NLP is, how it differs from programming languages, and surveys dozens of real-world applications—from spam filtering to chatbots—while clearing up common "AI hype" misconceptions. - **Early (~10%–32%)**: Builds the foundation of turning text into numbers: tokenization (characters, subwords, words, sentence pieces), stemming, and the trade-offs between vocabulary size and data needs. - **Middle (~32%–48%)**: Moves into vector representations—bag-of-words, term frequency–inverse document frequency (TF-IDF), sparse matrices, and cosine similarity—showing how to do math on text for search and document comparison. - **Late (~48%–70%)**: Introduces deep learning architectures in sequence: convolutional neural networks (CNNs) for text, then recurrent networks (RNNs, GRUs, LSTMs) for sequence handling and memory. - **Ending (~70%–100%)**: Transitions to transformers (BERT, Hugging Face), attention mechanisms, and practical applications like chatbots, fake-news detection, and building truthfulness into large language models. 【Key Takeaways】 - **NLP is fundamentally about turning language into numbers** (Early): Tokens, vectors, and distance metrics are the scaffolding for every downstream task—without this, no model can process text. - **Tokenization choice shapes your entire pipeline** (Early): Characters need tiny vocabularies but generalize broadly; words are interpretable but balloon to 20–50k tokens; subwords (WordPiece) are the sweet spot for deep learning. - **Bag-of-words still powers real search engines** (Middle): Despite ignoring word order, BOW vectors compress documents efficiently and remain useful as a first filter or keyword index. - **TF-IDF and cosine similarity make document retrieval practical** (Middle): Sparse matrices handle millions of documents; term frequency–inverse document frequency weights rare, meaningful words over common ones. - **RNNs and LSTMs solve sequence memory, but transformers changed the game** (Late): Recurrence handles order but struggles with long dependencies; attention-based transformers stack logical units into a "LEGO set for language." - **Transfer learning and dropout make CNNs robust for real text** (Late): Pre-trained embeddings plus regularization let you apply convolutional models to messy, real-world data like disaster reports. - **The book builds toward LLM truthfulness and reasoning** (Ending): Beyond classification, it addresses making large language models more reliable—detecting fake news, filtering spam, and grounding outputs. 【Reading Tips】 - **Deep-read Part 1 (chapters 1–4)**: The tokenization and vector chapters are the conceptual backbone; skimming them will make later deep learning chapters feel like magic instead of mechanics. - **Skim the application survey in chapter 1 if you already know NLP use cases**: It's broad but shallow—useful for orientation, not for implementation details. - **Work the code examples actively**: The book is "in Action" style; the stemming, BOW, and TF-IDF snippets are short enough to run and modify as you read. - **Treat the CNN/RNN chapters as a bridge, not a destination**: Understand why recurrence was replaced by attention before diving into transformer details. - **Use the "Test yourself" sections as checkpoints**: They signal what the authors consider essential before moving on. 【Coverage Limits】 The excerpts cover the book's structure, early foundations, and chapter topics through transformers, but do not include detailed content from the later application chapters (chatbots, fake-news detection, LLM truthfulness) or the full transformer implementation. Specific code outputs and advanced architecture details beyond chapter 9 are not represented.
Page 13
ough time 337 Initializing the hidden layer in an RNN 340 8.4 Remembering with recurrent networks 341 Word-level language models 342 ■ Gated recurrent units...
View in text
Excerpt 2
ing nudges trolls health Assist Analyze Correct Check Check teaching Assist Converse music grammar grammar spelling proving Summarize Entertain Debate Musico...
View in text
Excerpt 3
s as large as a typical dictionary—20 to 50 thousand words. Subwords (word pieces) are the optimal token to use for most deep learning NLP pipelines. Subword...
View in text
Excerpt 4
word search. But if you want to do something more advanced, like classifying text or finding its topic, you will want to know which words are most important...
View in text
Excerpt 5
ip('cat dog apple lion NYC love'.split(), ... np.random.rand(6)))) >>> topic['petness'] = (.3 * tfidf['cat'] +\ ... .3 * tfidf['dog'] +\ Handcrafted weights...
View in text
Excerpt 6
t semantic search. We’ll talk more about them in chapter 10. Technically, these indexing or hashing solutions cannot guaran- tee you will find all the best m...
View in text
Excerpt 7
ppens to contain the abbreviation Dr., for the word doctor. You can use this to practice your Mommy is a doctor intuition pump. You’ll soon find out whether...
View in text
Excerpt 8
x[0], ... iterator.multi_index[1], weight=edge) As shown in the following listing, you can now use matplotlib.pyplot to visualize the shiny new graph (networ...
View in text
Tags
AI categories
PythonArtificial Intelligence
ISBN: 1617299448
Publish Year: 2025
Language: English
Pages: 720
File Format: PDF
File Size: 11.1 MB
Text Preview (First 20 pages)
Registered users can read the full content for free

Register as a Gaohf Library member to read the complete e-book online for free and enjoy a better reading experience.

Generating text preview…