From the course: NLP with Python for Machine Learning Essential Training
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Regular expression replacements - Python Tutorial
From the course: NLP with Python for Machine Learning Essential Training
Regular expression replacements
- [Instructor] Picking up right where we left off, understanding how regx can be used for tokenization is helpful, but let's explore another usage of regx's. So I've defined a sentence here, I want to follow pep8 guidelines. If you're not aware, pep8 is a style guide for Python. Now let's just say this sentence lies in some very large document that you've put together. And you realize that a lot of people don't know what pep8 means. So you want to expand it to pep8 Python style guide. However, let's assume that it's also likely that you made some spelling errors, so instead of pep8, maybe you had pep7, or peep8, which are represented by these other two test strings. So you don't really feel comfortable explicitly searching for pep8 and then replacing that with pep8 Python style guide, because you'll miss these mistakes. So you need to come up with a pattern that will not only capture pep8, but also your mistakes. So we want to build a process that will identify every place where pep8…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
(Locked)
What are NLP and NLTK?4m 7s
-
(Locked)
NLTK setup and overview6m 15s
-
(Locked)
Reading in text data11m 41s
-
(Locked)
Exploring the dataset6m 56s
-
(Locked)
What are regular expressions?4m 8s
-
(Locked)
Learning how to use regular expressions8m 44s
-
(Locked)
Regular expression replacements6m 3s
-
(Locked)
Machine learning pipeline4m 45s
-
(Locked)
Implementation: Removing punctuation9m 10s
-
(Locked)
Implementation: Tokenization3m 37s
-
(Locked)
Implementation: Removing stop words4m 2s
-
(Locked)
-
-
-
-
-