Hello guys.
So we are going to continue the discussion with respect to natural language processing.
And in this video we are going to discuss about name entity recognition.
This is an amazing topic.
So let me open a file over here.
So here you can see that let's say that we have a lot of sentences right.
Like one example of this particular sentence is over here.
The Eiffel Tower was built from 1887 to 1889 by French engineer Gustave Eiffel, uh, whose company
specialized in building metal frameworks and structures.
Right now, this is a sentence.
Now, from this particular sentence we know that what is parts of speech tagging, right.
Which is noun, pronoun and all.
But along with that, with the help of NLTK, we will also be able to get something called as name entity
tags right now.
What are some of the examples of name entity tags.
So here you can see one of the tag is something called as person.
The second tag can be location or place.
Third tag can be date time.
Right?
And here also I have given some examples.
So if I probably say Eiffel Tower, it may be coming as a place.
It can come as a location.
Right over here you can see that okay Gustav Eiffel.
This will basically be getting tagged as a name itself right here.
Suppose if this numbers are actually there, it can be something else, right?
Suppose if you are giving some money value like $1 million.
So let's say this $1 million is present somewhere here, right?
And uh, you know, that will be basically tagged as something called as money.
Right.
So it will be given some kind of name entity tags.
Right.
So let us see some examples and let us see that how this name entity recognition will be given with
the help of NLTK library.
To begin with, what I am actually going to do, I'm going to take this particular sentence.
I'm going to just execute it over here okay.
And again we'll be going like, uh, how we did in the past videos itself.
So let me do one thing over here.
Let me create some more cells okay.
Now the first word, first thing I will just go ahead and import NLTK.
And as you know that uh, with respect to NLTK, also I can use something called as a word tokenize.
Word word tokenize.
Word underscore tokenize.
And here I'm just going to give all my the complete sentence itself.
So here uh let's go ahead and give the sentence over here.
And once I execute it here you'll be able to see that the Eiffel Tower was everything is coming over
here.
So this is my entire words, the list of words.
Right.
So this is my entire list of words now.
Perfect.
Now see this usually, uh, for doing the parts of speech tagging.
What we what do we do?
We basically write nltk dot, pos, underscore tag, and I basically give this entire words to this.
And based on this, every, each and every word will be assigned to some tags.
Okay.
So let me just write this as, uh, as my tagged uh, elements or tag something.
I'm just giving a variable name which is like tagged elements.
And this will get stored over here.
Okay.
Now see this if I really want to provide some an, uh, named entity recognition, all I have to do
is that use this NLTK dot named entity.
So there is something called as mne.
Okay, so let me just show you any, uh, any chunk okay.
So any chunk is a function over here.
And if I probably see the definition of this particular thing, uh, function you'll be seeing use NLTK
currently recommended name entity Chunker to chunk the given list to a given list of tag tokens.
Okay, and inside this I will just pass my all my tag elements.
Okay, so this will be my tag elements.
I'm just going to give this.
Probably we may get an error.
The reason is that because we need to download this one right.
So here you can see that NLTK dot download max net any chunker.
Because here we are specifically using some chunker techniques to basically get the named entity.
And for that we really need to download it.
And that is what is the first requirement.
So here you can see that I'm downloading it.
And once this downloaded gets uh, once this entirely, this uh, Max, Max and any chunker gets downloaded,
we are good to run this specific code.
So this may take some amount of time because this may also be a huge, uh, it can be a huge library
inside it which needs to be downloaded.
So now I will just go ahead and execute it.
Still I'm getting some error.
It also says that okay you need to download NLTK dot download words.
Perfect.
So what I'm actually going to do go and make one more cell.
And please don't worry whenever you get some errors.
I've seen some people who who gets worried.
First of all just go ahead and see the error.
What exactly it is.
It is very much simple and you just need to execute it.
So guys now once this NLTK or download of words gets downloaded, now all I have to do is that over
here you will be seeing that NLTK dot any underscore chunk.
I have to give the tag elements.
And then I just need to write dot draw.
Once I execute this here you'll be able to see this.
What an amazing graph I'm able to get.
Now see this.
Everybody observe this.
I don't know whether you are able to see this properly or not, but just clearly if you will be able
to see it, it has given most of the information very much clearly.
So here it is very much clear that you, uh, this entire sentence.
Right.
The organization is, uh, recognized for FL and tower, right.
Which is a noun right over here you can see this word, uh, was is a verb built.
It is over here.
1887 is something like CD.
And here you can see GPE right.
French JJ right.
It is being able to determine as JJ here you can see person information is being able to get captured
which is like Gustav NP.
So here you can clearly see all this information very nicely.
Right.
So which whichever entity is been able to get recognized here you will be able to find that.
So person is their GP is there and organization is there.
What.
That is what we will be able to find out.
This s is the entire sentence over here.
But with this graph, you will be able to understand that you are able to get the entire information.
So like this.
If you probably go and see that what all uh, other entities you can find person, place, location,
date, time, money and all.
So I hope you were able to understand about named entity recognition and how you will be able to see
this and how you will be able to see the diagrams.
So yes, this was it with respect to this particular video, but understand that NLTK provides this
amazing feature.
You should definitely use it when it where it is required, right?
So this was it from my side for this particular video.
I'll see you all in the next video.
Thank.