From the course: NLP with Python for Machine Learning Essential Training

Unlock the full course today

Join today to access over 24,700 courses taught by industry experts.

Learning how to use regular expressions

Learning how to use regular expressions

- [Instructor] There is a lot to unpack with regular expressions. I'm going to outline a few quick examples here, but there's so much that you can do with regexes in terms of searching for character patterns, character placement within a string, splitting up the strings, and so on. So I encourage you to do some of your own exploration to learn the different patterns and the functions that can be used. You can find more details in the link here. To put this to use, the low-hanging fruit here and the primary reason that we're talking about regexes is in order to tokenize sentences or split a sentence into a list of words so that Python can understand what it needs to be looking at. Right now, Python just sees a string of characters, so we need to tell it what to focus on, and how to organize those characters. For our machine learning model, Python will need to split the string into what we call tokens, or words, so that the model can learn how those tokens relate to the r response…

Contents