Concept

Using Named Entity Recognition (NER)

Named entities are noun phrases that refer to specific locations, people, organizations, and so on. NER automatically finds the named entities in texts and determines what kind of named entity they are. nltk.ne_chunk() can recognize named entities.

def extract_ne(quote): words = word_tokenize(quote, language=language) tags = nltk.pos_tag(words) tree = nltk.ne_chunk(tags, binary=True) return set(" ".join(i[0] for i in t) for t in tree if hasattr(t, "label") and t.label() == "NE")

0

1

Updated 2021-08-13

References


Tags

Python Programming Language

Data Science