This book is licensed for the personal use of the buyer. Please do not share or resell the file. Short quotations with attribution are welcome.
The information in this book is provided for education. It is not legal, financial or other professional advice. Product and company names are used only to describe them and belong to their owners.
This is a free sample: the introduction and first chapter.
IntroductionIntroduction
Large language models dominate today's conversation about AI, and for good reason: they write, summarise, translate and answer questions with remarkable fluency. But natural language processing (NLP) is a much older and broader field. Many language problems are solved better, cheaper, faster or more transparently by other methods: a keyword search, a regular expression, a small classifier trained on a few thousand examples, or a well-designed embedding search.
This book gives you the whole toolkit. It tells the story of NLP from text preparation and classic statistical methods, through word embeddings and sequence models, to transformers and large language models. Then it works through the main tasks (classification, extraction, search, summarisation, translation, question answering) with guidance on which approach fits which problem and how to evaluate the results.
The aim is judgement: knowing which tool to pick, why, and how to tell whether it works.
How the book is organised
Chapters 1 to 9: text as data: characters, tokens, normalisation, regular expressions and classic representations.
Chapters 10 to 17: classic models and word embeddings.
Chapters 18 to 25: sequence models, attention, transformers and large language models.
Chapters 26 to 37: tasks: classification, sentiment, extraction, search, summarisation, translation, question answering, generation and conversation.
Chapters 38 to 44: practice: a worked classifier, labelled datasets, long documents, structured output, cost and latency, domain adaptation and monitoring.
Chapters 45 to 52: evaluation, multilingual NLP, bias, privacy, choosing approaches, case studies and a checklist.
Chapter 1Why Language Is Hard for Computers
Language looks easy because we use it effortlessly. For computers it is full of difficulty:
Ambiguity: "bank" may be a river bank or a financial institution; "I saw her duck" has two readings.
Context: "It's cold" may be a weather report or a request to close the window.
Variation: spelling errors, slang, abbreviations, dialects and code-switching between languages.
Implicit knowledge: understanding often depends on facts about the world never stated in the text.
Structure: meaning depends on word order and grammar, not just on which words appear.
NLP methods differ mainly in how much of this they capture, and at what cost.
You have reached the end of the free sample. The full book continues with 51 more chapters, plus the appendices.