Sentiment Analysis Using ML

Ohhh!!! Hmmm… Today in a world full of moody people on social media make it a place hub of expressions and emotions. Many people day starts with posting their thoughts or pictures on any social platform and then all their followers and friends comment on their post. Some seem to be happy and some seem too sad or some have no opinions at all.

All people share or express or share their thoughts on various social media platforms in the form of posts, comments, views, etc… So, what if we have a model that would help us to analyze the mood/sentiments of peoples in a real-time zone. If you think it is next to impossible then my dear friend let me tell you we are living in the 20th century and now everything is possible.

Now you must be thinking about how we can do this? so the answer is with the help of AI. By building an ML model we can easily analyze the sentiments of the people on any social media in a real-time zone.

Machine learning is nothing however a method of processing the machine like the human mind.

Sentiment Analysis Using ML

Sentiment analysis is discourse mining of text that identifies and extracts subjective data in supply material and serving to a business to grasp the social sentiment of their complete, product or service whereas observation online conversations

The approach for sentiment analysis with machine learning involves classification algorithms like Navies Bayes, Support Vector Machine, Linear Regression, and Deep Learning ideas like RNN, CNN, etc.

Naïve Bayes :

Naïve Bayes Algorithms are the unit most well-liked for tiny size dataset. This algorithmic rule offers the chance by analyzing sentiments of words in phrases to be positive or negative.

Mathematically Bayes theorem works as the chance of if B is true, is up to the chance of B, if A is true, times the chance of A being true, divide by the chance of B being true: 

P(A|B)=P(B|A) X P(A) / P(B)

Apart from algorithms, there are  Libraries such as Bert also use for the analysis purpose. This gives a flexible edge to do this process on large size dataset using neural networks or deep learning methods along with it.

We can take an example for a sentiment analysis using speech recognition; Below is the code which shows using text blob and sentiment analysis library we can find out the polarity of the sentiment of a person.

Code using NLTK Library

In the above code nltk library is used in which the packages such as Punkt and averaged_perceptron_tagger are downloaded which is used to word tagging in the sentences. Textblob library is used to find the sentiment polarity of the person which ranges from +1 to -1 where +1 is positive,0 indicates neutral and -1 indicates negative.

Speech recognition library is in use to record the audio of the person and text blob will convert the speech into text and also finds the polarity of the sentiment of that text.

This kind of model can be use in customer service which helps to enhance the production of the organization. it can slowly be use in n company to see if the employees are happy with their work and schedules for works and in many various fields it would be helpful for the people to know about other people’s feelings and thoughts

Conclusion:

it is not very easy to express your emotions towards anything to someone face to face so social media is a kind of platform which helps to express yourself through your word or voice or videos. But as good as it seems it is not at all great in reality because some use this to discourage others by saying bad or toxic words that mentally harm that person.

So, I think this kind of model in a huge platform will not only help to get to know the situation of the peoples but also in a way to catch or block toxic peoples.

written by: Kanchan Yadav

reviewed by: Rushikesh Lavate

If you are Interested In Machine Learning You Can Check Machine Learning Internship Program
Also Check Other Technical And Non Technical Internship Programs

Leave a Comment

Your email address will not be published. Required fields are marked *