How to predict the sentiment of the entities form the tweet?

I have a JSON file (tweets.json) that contains tweets (sentences) along with the name of the author.

Objective 1: Get the most frequent entities from the tweets. Objective 2: Find out the sentiment/polarity of each author towards each of the entities.

Sample Input:
Assume we have only 3 tweets:
Tweet1 by Author1: Pink Pearl Apples are tasty but Empire Apples are not.
Tweet2 by Author2: Empire Apples are very tasty.
Tweet3 by Author3: Pink Pearl Apples are not tasty.

Sample output: Entities in the topics extracted: Share a dictionary with extracted entities as keys and the number of tweets an entity has mentioned as values.

Example dictionary for the above example: {“Pink Pearl Apples” : 2,
“Empire Apples” : 2}

Now, objective 2 -

Now using Count Vectorizer I have completed objective 1, now how to get the sentiment based on the entities(Objective 2)

Thanks in Advance!!!

Topic spacy stanford-nlp sentiment-analysis language-model nlp

Category Data Science


If you have a fixed number of entities and a labelled dataset, then you can build a CNN multilabel classification model. The final layer of model has Nx3 binary outputs, where N is the number of entities. Each entity has 3 outputs, representing positive, negative and a NA sentiment. The NA is important, an entity may not be represented in a tweet.

The CNN is recommended over a standard dense network so that the model can take advantage of signal words in the neighborhood of entities to estimate the sentiment.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.