Hello and welcome to this art tutorial.
So now let's proceed to the next step of the cleaning process,
which is about removing all the numbers from the reviews.
So we will just copy this line and paste it below,
because you'll see that now during the next steps of the cleaning process
is going to be very easy
because we will always use the same line here to update the corpus.
And at each new step, we are going to apply the right
transformation that we want to do for the particular step of the cleaning process
to the whole corpus, thanks to the tmp function.
So basically what we just need to do is replace this content transformer
with two layers input by remove numbers.
And that's how we apply this
remove numbers function to the reviews in the corpus through the tmp function.
And that will remove all the numbers of all the 1000 reviews in the corpus.
So let's check it out.
To check that out.
We cannot do it with this first review because this first review doesn't
contain any number, so nothing will be removed here.
But I had a look at the data set,
and there is the review 841 that contains a number.
Let's have a look at this review.
To do this we will use the same line as we used to look at the first review.
So I'm pressing the up arrow here to take this line of code
that gives us access to the reviews.
And inputting the index one here will input the 841 index.
And now let's press enter to have a look at the review.
And the review is for 40 bucks ahead.
I really expect better food.
So that's a negative review.
And what should be highlighted in this review is this 40 number here
which we want to see if it's going to be removed.
Once we apply this remove numbers function to the reviews of the corpus,
so that all the numbers in the reviews can be removed thanks to the tmp function.
So let's check it out.
We will select this line and execute.
Done.
And now let's have a look at this 841 review.
So I'm pressing the up arrow twice
to get back to this line of code giving us the written review.
So now the corpus is updated.
Let's see if the number 40 disappeared
and it did four bucks ahead.
I really expect better food.
40 disappeared.
And that's exactly what we wanted. So great.
Basically all the numbers are now removed from the reviews in the corpus.
Next step done, and we are ready to move on to the next step,
which will be about removing any kind of punctuation in the reviews,
because of course, in our sparse matrix, in the end, we don't want to get a column
for a comma or another column for a colon, or another column
for a dot, or for a semicolon, or any kind of punctuation.
Of course, we only want to create some columns for relevant words.
That will help the machine learning classification algorithm
to see the correlations
between the presence of the words and the outcome,
whether the review is positive or negative.
All right.
So let's do that in the next tutorial.
And until then enjoy machine learning.