How to extract the named entities using polyglot?

1.0K    Asked by NakanoHase in Data Science , Asked on Dec 5, 2019
Answered by Nitin Solanki

Polyglot recognizes three types of entities

Persons (Tag: I-PER): politicians, scientists, artists, athletes, etc.

Organizations (Tag: I-ORG): sports teams, newspapers, banks, universities, schools, non-profits, companies, etc.

Locations (Tag: I-LOC): cities, countries, regions, continents, neighborhoods, administrative divisions, etc.

 Polyglot supports about 40 languages and to see those we can import languages from polyglot



For extracting entities, we need to import libraries

blob = """The Israeli Prime Minister Benjamin Netanyahu has warned that Iran poses a "threat to the entire world"."""

text = Text(blob)

# We can also specify language of that text by using

# text = Text(blob, hint_language_code='en')

We can extract the entities from ‘blob’ in the following way

text.entities

The following entities found by Polyglot are


A user wants to do sentiment analysis of some sentences with Python and TextBlob lib. He wants to know if there is any way to set n-grams to that. Basically, he does not want to analyze word by word, but he wants to analyze 2 words, 3 words, because phrases can carry much more meaning and sentiment.

From the following code, he wants for example n-grams = 2, n-grams = 3 etc? Is it possible to do that with TextBlob, or VaderSentiment lib?

This can be done by defining the following set of codes







Your Answer

Interviews

Parent Categories