Hello, everyone.
Welcome back.
In the previous lesson, we have seen how to draw the bounding box, but here one thing you need to
notice is that this is not the proper way to draw the bounding box for each and every entity.
For example, if we considered the name we have, the two boxes has been drawn.
One is for this and second one is for this.
Ideally, we should draw one bounding box and that bounding box should be the consist of these two.
But.
Similarly, for the organization, if we take this, we have five warning box information so that ideally
we should have one bounding box means we should draw only one warning box of this and this and all belongs
to one entity.
Now, so let's see that how exactly we can do that.
Let me close this.
And now in order to do that, the first and foremost thing, let me print our baby box.
So this is a baby diaper flipping printers.
And here one thing you need to notice is that there are several groups of information is there.
We need to divide the tokens into several groups.
For example, these two belongs to one group and this is belongs to one group and organization, basically
one two three four.
So the one two three four five so this five roses belongs to one group and four.
Similarly for email, this three roses belongs to one group and so on.
So basically, what we have to do here is that we need to split the data into several groups.
That is what exactly we need to do here.
So let's see how the group the labels are, the group, the labels, there are several ways to group
the labels.
The first and foremost thing.
What I will do here is that for the sake of simplicity, there are still ways of lots of ways to do
the programming.
But I will take the easiest method since there are the B I and so many targets out there.
For the sake of simplicity, let me don't consider the B I tagging because anyway, the always out,
we don't have this.
Let me first remove this tagging in order to remove the tagging.
What you have to do is that let me take this labels and.
Here, take this labels and apply the lambda function.
OK.
Apply lambda function.
We have the input tax, and for this, we need to remove the first two values.
If you remove the first $2 leaves and rest, all will be our basic level.
OK, let me consider the first two honorable standing by to two column.
And which will basically remove the first two values.
Now let's print maybe the f dot hat.
OK, so we have all the labels are there here.
Now it is easy to group the labels.
Let's see how to grow the labels.
Let me create a class.
All right, the idea our idea is to group the labels.
OK, my idea is that whenever I found the sequences of phone and phone and this belongs to one group,
and if this email one group and wherever the organization's comes in a sequence and that is going to
be in one group for that, let's create a class class.
And it is a group jump.
And let me create the function and the underscore underscore in it.
I'm just on a school.
Of self.
Now, let's create the self-taught I.D. equal to zero.
Now create led me to create the initialize the text with empty.
Now, the Get Group, No, basically dysfunctional gender, the group, no self-taught text.
And here the logic is this if the group name is saying this belongs to same idea, I means I need to
provide the same I.D. to it.
Suppose if the group name has changed, then I need to provide the different I.D. So that's what I have
to do here.
So let me write down here.
So self-taught text equal to equal to text.
It means the input text a saying.
Then what are the I.D. I have?
There is does I need to provide the same I.D. so I'll return self-taught if it means returning the same
I.D. else, I need to provide a different idea to it.
Self-taught I.D..
Heidi, I need to first, I'll increment this next self-taught text, a call to text.
I mean, I'm just uploading the cell text to text and then I'll return.
Self-taught Heidi not executed.
And also, let me initialize group Jen.
Basically, this will generate the group, and that's going to be equal to the group, Jen.
OK, let me write T R P, D E and.
OK.
OK, now executed, but that's my group, Jen.
Now let me take this Bebe dear.
And here, let me create one more column named group that's going to be equal to.
VVF.
The input for this is going to be my label.
And apply.
The function I just want to apply here is Group Jen.
Dont get group.
Now execute it, done now, let's execute this, and we have the DVD off, and here we go.
We can see that this is the label and belong to the same group.
And this is the label group two.
And this is the Group three.
This is Group four Group PHI.
And this is a Group six.
And this is the Group seven and eight.
And so cool, right?