Python - Sentiment Analysis using Affin Last Updated : 17 Feb, 2023 Comments Improve Suggest changes Like Article Like Report Afinn is the simplest yet popular lexicons used for sentiment analysis developed by Finn Årup Nielsen. It contains 3300+ words with a polarity score associated with each word. In python, there is an in-built function for this lexicon. Let's see its syntax- Installing the library: python3 # code print("GFG") pip install afinn / #installing in windows pip3 install afinn / #installing in linux !pip install afinn #installing in jupyter Code: Python code for sentiment analysis using Affin python3 #importing necessary libraries from afinn import Afinn import pandas as pd #instantiate afinn afn = Afinn() #creating list sentences news_df = ['les gens pensent aux chiens','i hate flowers', 'he is kind and smart','we are kind to good people'] # compute scores (polarity) and labels scores = [afn.score(article) for article in news_df] sentiment = ['positive' if score > 0 else 'negative' if score < 0 else 'neutral' for score in scores] # dataframe creation df = pd.DataFrame() df['topic'] = news_df df['scores'] = scores df['sentiments'] = sentiment print(df) Output: topic scores sentiments 0 les gens pensent aux chiens 0.0 neutral 1 i hate flowers -3.0 negative 2 he is kind and smart 3.0 positive 3 we are kind to good people 5.0 positive The best part of this library package is that one can find score sentiment of different languages as well. python3 afn = Afinn(language = 'da') #assigning 'da' danish to the object variable. afn.score('du er den mest modbydelige tæve') Output: -5.0 Thus, Afinn can we used easily to get scores immediately. Comment More infoAdvertise with us Next Article Python - Sentiment Analysis using Affin R rakshita_iyer Follow Improve Article Tags : Misc Python Practice Tags : Miscpython Similar Reads Twitter Sentiment Analysis using Python This article covers the sentiment analysis of any topic by parsing the tweets fetched from Twitter using Python. What is sentiment analysis? Sentiment Analysis is the process of 'computationally' determining whether a piece of writing is positive, negative or neutral. Itâs also known as opinion mini 10 min read Sentiment Analysis using VADER - Using Python Sentiment analysis helps in finding the emotional tone of a sentence. It helps businesses, researchers and developers to understand opinions and sentiments expressed in text data which is important for applications like social media monitoring, customer feedback analysis and more. One widely used to 3 min read Tweet Sentiment Analysis Using Python Streamlit This article covers the sentiment analysis of by parsing the tweets fetched from Twitter using the streamlit Python framework. What is Sentiment Analysis? Sentiment Analysis is the process of âcomputationallyâ determining whether a piece of writing is positive, negative or neutral. Itâs also known a 4 min read Sentiment Detector GUI using Tkinter - Python Prerequisites : Introduction to tkinter | Sentiment Analysis using Vader Python offers multiple options for developing a GUI (Graphical User Interface). Out of all the GUI methods, Tkinter is the most commonly used method. Python with Tkinter outputs the fastest and easiest way to create GUI applica 4 min read Twitter Sentiment Analysis WebApp using Flask This is a web app made using Python and Flask Framework. It has a registration system and a dashboard. Users can enter keywords to fetch live tweets from Twitter and analyze them for sentiment. The results are then visualized in a graph. The project uses the popular Tweepy API to connect to X (forme 15+ min read Like