Parul B.

asked • 06/21/21

Use the IBM Watson Natural Language Understanding API, and need to write function extractEntities(url, source) 

Use the IBM Watson Natural Language Understanding API, and need to write function extractEntities(url, source) that takes as input a URL, and returns a list of dictionaries, with every dictionary containing the entity name, the URL where the entity appeared, the relevance of the entity to the article, and the sentiment about the entity. For example, after calling the function

url = 'http://www.politico.com/story/2017/05/23/infrastructure-transportation-trump-budget-238741'

extractEntities(url, 'politico')

we may get back a list of dictionaries, with each dictionary representing an entity, and looking like this: 

{

'entity': 'Donald Trump',

'url': 'http://www.politico.com/story/2017/05/23/infrastructure-transportation-trump-budget-238741',

'source': 'politico',

'relevance': 0.882851,

'sentiment': -0.25

}

The function extractEntities should return a list of dictionaries, with each dictionary in the list corresponding to one entity.


1 Expert Answer

By:

David H. answered • 07/23/21

Tutor
4.7 (19)

Columbia Data Science Grad specializing in python and data analysis

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.