0% found this document useful (0 votes)
16 views3 pages

NLP 08

Uploaded by

tahamurade01
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views3 pages

NLP 08

Uploaded by

tahamurade01
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Experiment 8

Name of the Student: - Taha Murade


Roll No. 74
Date of Practical Performed: - 12/09/24 Staff Signature with Date & Marks

Aim: Write a program to perform & implement Named Entity Recognition


Theory:

What is Named Entity Recognition (NER)?


Let’s first discuss what entities mean?

Entities are the most important chunks of a particular sentence such as noun phrases, verb
phrases, or both. Generally, Entity Detection algorithms are ensemble models of :

● Rule-based Parsing, python


● Dictionary lookups,
● POS Tagging,
● Dependency Parsing.

For Example, In the above sentence, the entities are:


Date: Thursday, Time: night, Location: Chateau Marmont, Person: Cate
Blanchett Now, we can start our discussion on Named Entity Recognition
(NER),

1. Named Entity Recognition is one of the key entity detection methods in NLP.
2. Named entity recognition is a natural language processing technique that can automatically
scan entire articles and pull out some fundamental entities in a text and classify them into
predefined categories. Entities may be,

● Organizations,
● Quantities,
● Monetary values,
● Percentages, and more.
● People’s names
● Company names
● Geographic locations (Both physical and political)
● Product names
● Dates and times
● Amounts of money
● Names of events

1
3. In simple words, Named Entity Recognition is the process of detecting the named
entities such as person names, location names, company names, etc from the text.

4. It is also known as entity identification or entity extraction or entity chunking.


5. With the help of named entity recognition, we can extract key information to
understand the text, or merely use it to extract important information to store in a
database.

6. The applicability of entity detection can be seen in many applications such as

● Automated Chatbots,
● Content Analyzers,
● Consumer Insights, etc.

Commonly used types of name

● Pip install numpy


● Import numpy
● Numpy uses much less memory to store data and it provides a mechanism
of specifying the data types
● “punkt” divides a text into a list of sentences
● “Average perceptron tagger” is used for tagging words with their parts of
speech (pos)
● “Maxnet ne chunker” name entity recognition package

Code:

#pip install spacy


#python -m spacy download en_core_web_sm

import spacy

# Load the English model


nlp = spacy.load("en_core_web_sm")

# Sample text for NER


text = """
Apple Inc. is looking at buying U.K. startup for $1 billion.
San Francisco is a great place to live.
Barack Obama was the 44th President of the United States.

2
"""

# Process the text


doc = nlp(text)

# Extract and print named entities


print("Named Entities, Phrases, and Concepts:")
for entity in doc.ents:
print(f"{entity.text} - {entity.label_}")

Output:

Conclusion: - Thus, we have learned and implemented a code of Named Entity Recognition.

You might also like