Preface¶
Welcome to Natural Language Processing: A Notebook-Based Introduction — an open educational resource (OER) for learning modern NLP by reading, running, and modifying real code.
About this book¶
This book is built entirely from interactive Jupyter notebooks. Every chapter is a notebook you can read inline on this site, launch in Google Colab with one click, or download and run locally. The goal is not just to read about NLP, but to do it: inspect a tokenizer's vocabulary, train a classifier, watch attention weights, and fine-tune a language model — all from your browser.
The book accompanies CS-5293 Natural Language Processing at the University of Oklahoma, but it is written to stand on its own for independent self-study. You do not need to be enrolled in the course to work through it.
Who this book is for¶
- Students taking an introductory NLP course.
- Self-learners with basic Python and some exposure to machine learning who want a practical, code-first path into modern NLP and large language models.
- Instructors looking for adoptable, openly licensed notebook materials.
How to use this book¶
Each chapter is a self-contained notebook. At the top of every chapter page you'll find a launch bar:
- Open in Colab — run the notebook in your browser on a free Google Colab runtime.
- View on GitHub — read the source.
- Download .ipynb — run it locally in Jupyter or VS Code.
Read the chapter, run every cell, then change things — that is where the learning happens. Many chapters end with open questions and exercises; treat them as invitations to experiment.
Prerequisites¶
- Comfortable reading and writing Python.
- Familiarity with arrays/tensors and basic NumPy/PyTorch is helpful but is introduced as needed.
- A Google account (for Colab) or a local Python environment.
The first chapter includes a setup tutorial to get your environment ready.
A note on the grant¶
This resource was developed with support from the OU Alternative Textbook Grant 2025–2026. The Alternative Textbook Grant program supports faculty in replacing commercial textbooks with free, openly licensed materials to reduce costs for students. Adopting this book in place of a commercial NLP textbook is exactly the kind of reuse the grant is meant to enable.
License¶
This book is released under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License (CC BY-NC-SA 4.0). You are free to share and adapt the material for non-commercial purposes, with attribution, under the same license. See the License page for details.
Acknowledgements¶
Author: Jie Cao, University of Oklahoma.
Several chapters build on outstanding open resources, including Jurafsky & Martin's Speech and Language Processing, the Hugging Face course and documentation, and Jay Alammar's illustrated guides. Specific attributions appear within the relevant chapters.