appendix B Playful Python and regular expressions
To get the most out of this book, it will help to be comfortable with Python, even playful. You can learn a lot by just trying things and making mistakes—following your fun. Your brain learns best through trial and error on the edge of what you can already do. If you copy–paste someone else’s (or AI’s) code, you don’t learn nearly as much as you do when you exercise your own creative instincts and generate your own code. And it turns out this works well for machine learning too.
This trial-and-error approach to training both machines and yourself is called active learning. In this appendix, you’ll learn how to do it for yourself, and throughout the rest of the book, you’ll do it for your machine learning pipelines. If you develop a growth mindset and start to enjoy learning from your mistakes, it will make you a better software engineer and NLP engineer. When things don’t work, you’ll need to be able to play around and explore to find a way to make Python do what you want. And even when your code works well, playing around may help you uncover powerful new ways of doing things or, perhaps, discover hidden “monsters” lurking in your code. Hidden errors and edge cases are very common in natural language processing (NLP) because there are so many different ways to say the same thing in a language like English.