ScalaConsultants / Aspect-Based-Sentiment-Analysis

💭 Aspect-Based-Sentiment-Analysis: Transformer & Explainable ML (TensorFlow)
Apache License 2.0
539 stars 91 forks source link

About neural sentiment #58

Open littlefive5 opened 2 years ago

littlefive5 commented 2 years ago

nlp = absa.load() text = ("We are great fans of Slack, but we wish the subscriptions " "were more accessible to small startups.") slack, price = nlp(text, aspects=['slack', 'price'])

It seems that the model only classify the sentiment by positive and negative. Can the model detect neural sentiment?

rspiewak47 commented 2 years ago

Yes. Just use a term which has neutral references: import aspect_based_sentiment_analysis as absa

nlp = absa.load() text = ("We are great fans of Slack, but we wish the subscriptions " "were more accessible to small startups. Do you have a cow?")

slack, price, startups, cow = nlp(text, aspects=['slack', 'price', 'startups', 'cow']) assert price.sentiment == absa.Sentiment.negative assert slack.sentiment == absa.Sentiment.positive assert startups.sentiment == absa.Sentiment.negative assert cow.sentiment == absa.Sentiment.neutral

If you make that "Don't have a cow" you get negative.