Reputation: 1
I have a case study to work on, in which there are several customer reviews available and I have to do the following
predict their sentiment (positive, negative, neutral) based on their reviews
display a wordcloud of not the frequently occurring words, but the words which are the pain-points of the customer and of what is the customer happy about.
e.g. If many customers are happy about leather-strap of the watch, then the wordcloud should display 'leather-strap' in the wordcloud of positive sentiments.
& If many customers are complaining/unhappy about the dial-size, then the wordcloud should display 'dial-size' in the wordcloud of negative sentiments.
Point 1 can be achieved more or less using VADER.
But I am not sure how to achieve point 2, as it is not the usual wordcloud of frequently occurring words.
Can you please help me on how can I achieve the second task?
Upvotes: 0
Views: 584
Reputation: 345
I wanted to add it as a comment but it was not clear enough there.
Well, I used the below code:
Anaconda command prompt:
pip install rake-nltk
Jupyter:
from rake_nltk import Rake
r = Rake()
myText = ''' The watch has a good dial. The good thing about the product is the
leather strap '''
r.extract_keywords_from_text(myText)
r.get_ranked_phrases()
Output:
['leather strap', 'good thing', 'good dial', 'watch', 'product']
I think you can try this algorithm in your actual text and get ranked phrases. Hope this will help. Check this link for more details: https://pypi.org/project/rake-nltk/#:~:text=RAKE%20short%20for%20Rapid%20Automatic,other%20words%20in%20the%20text.
Upvotes: 0
Reputation: 345
Since no code was shared, I would break this problem into the following steps:
You already found the sentiments
for the group of sentences with positive sentiment, find the most important word from each sentence
calculate the number of times this word is present in the positive sentiments
create the word cloud based on the number of times each word is available
Repeat step 2-4 for the sentences with negative sentiments
Check the following link: https://amueller.github.io/word_cloud/generated/wordcloud.WordCloud.html.
Let me know if I missed understanding your exact issue.
Upvotes: 0