Named Entity Recognition

Have you ever imagined how computer knows different names of people, places, brands, dates, and so on? Imagine you have a friend who loves talking about different things like people's names, places, dates, and more. When your friend reads a story or an article, they automatically highlight these important things in different colors. Named Entity Recognition (NER) is like your friend's skill, but for computers and text.

ner.png

There are generally 2 operations we need to perform to achieve NER in a given document:

  • Identification: This is where all the entities in a given text or document is identified.
  • Classification: All identified entities are classified as belonging to a particular predefined entity group.

For example, if we are to perform NER on a text such as

        Ope Bukola is the CEO of Kibo Inc

First, we need to identify all the entities in the text, which are Ope Bukola and Kibo Inc. Next, we classify each entity into a predefined group. Here, we can classify Ope Bukola as a PERSON, and Kibo Inc as a type of ORGANISATION.

Try out NER tool

Check out this NER demo

NER is still a growing a technology which already has manny use cases and wide applications. Some of its applications include:

  • Sentiment analysis: NER can be used to improve the accuracy of sentiment analysis by identifying named entities in the text and understanding their context.
  • Information extraction: NER can be used to extract information from text, such as the names of people and organizations mentioned in a news article.
  • Machine translation: NER can be used to improve the accuracy of machine translation by identifying named entities in the source language and translating them correctly in the target language.
  • Question answering: NER can be used to answer questions about text by identifying the entities mentioned in the question and finding the relevant information in the text.

Next, let's look at how we can perform NER with Spacy using some random text. Feel free to edit the text and try it out by opening the code snippet in Google Colab.

In the code above, we first extracted the entities in the text and their corresponding labels. Next we used the .render() function in displacy, the visualizer for spacy, to visualize the entities in the text.


➡️ Next, we'll try some practice exercises based on what we've learned so far this week... 🎯.