Interpretation and Classification of Emotions on Computational Social Science

DOI : 10.17577/IJERTV10IS020276

Download Full-Text PDF Cite this Publication

Text Only Version

Interpretation and Classification of Emotions on Computational Social Science

Gayathry S Warrier Department Of CSE,

SCMS School of Engineering and Technology

Arshey M Department Of CSE,

SCMS School of Engineering and Technology

Jency Rena N M Department Of CSE

SCMS School of Engineering and Technology

AbstractInterpretation and Classification of Emotions is per- haps one of the most popular applications of NLP. Categorization and elucidation of emotions is contextual text mining that is related with the analysis and understanding of human emotions from textual data. In the area of tourism, the internet plays a major role in the advertisement of hotels. Travelers convey their experience in the hotel by posting reviews or comments on the internet. The Vendors can be benefited by considering and correcting user reviews on the internet to improvise and assess their hotels. With the reviews available in abundance over social media , excursionists find it difficult to understand all the reviews whether they have positive or negative suggestions. It takes Computational Social Science to rapidly identify if the review is a positive or negative review. Evolution in social platforms such as tourist blogs, Twitter, Facebook and LinkedIn has fueled interest in Interpretation and Classification of Emotion. This paper focuses on extracting different categories of customers reviews about various places of stay and analyzing the category that gives better results. Multilayer Perceptron model is used for classification of data into negative and positive sentiment categories. Classifying the data into positive and negative classes with fewer mis-classifications is the primary focus.

Index TermsNLP, Classification, Interpretations, Emotions, Sentimental analysis.


    Hotel reviews are an important way of evaluating and analyzing a comfortable place of stay during our vacations. It is identified that 93% of hotel management expresses their concern about online excursionist reviews which are unfa- vorable to the property s fortune [1]. Reviews available digitally available are more pertinent, accurate and elaborated than the ones available in hotel catalogues [2]. Even though there exists numerous online reviews, prediction based on positive or negative opinions about the hotel cannot be done. catalogues. Certain reviews on hotel websites only provide ratings that are considered not unbiased and hence it is not used for assessing hotels [2]. To Illustrate, Ibis Hotel review says that: Poor service and inadequate facilities [3]. But it had a 4 star rating. But the review at Aston Hotel there are like I like to stay here a lot. The wall and lobby decoration has a lot of Indonesian reliefs and carving. The hotel guest gives them a three star rating. Based on the reviews it doesnt prove

    that Ibis Hotel is not inevitably worthier than Aston Hotel and contrariwise. It can be inferred from the above example that the structure of rating evaluation is different from the penned reviews and hence it is not used as balanced evaluation for choosing hotels.

    Classification of Emotions is a significant subject in ma- chine learning which aims to fragment subjective information from the textual reviews. The area of sentimental analysis is closely tied to natural language processing and text mining. It can be used to find the perspective of the reviewer in accor- dance to different topics or the complete contrariety of review. Using Interpretation of Emotions, we can find the mentality of the reviewer while giving the review and apprehend if the person was joyous, upset, irate and so on.Classification of Emotions refers to the use of natural language processing, text analysis and computational linguistics to extract and identify subjective information in source materials. [4] The main intention is to understand the perspective of a speaker or a writer according to some topic or the complete contextual polarity of a document. The attitude can be, his or her judgement or assessment, influenced by the emotional state etc.

    In a period of 10 years ,social media has seen a surmount increase in blogs and forums, which has fuelled the curiosity in Interpretation of Emotions. Digital viewpoint has been converted into a type of simulated currency with the enhance- ment of criticisms, gradings, compliments and other methods of online representations, for ventures that are looking to advertise their products, explore new opportunities and manage their recognitions.The field of Interpretation of Emotions is looked upon to automate the process of filtering out the noise, understanding the conversations, identifying the relevant content and following appropriate actions. The downside of most algorithms is that they utilize straightforward terms to communicate assumptions about a product or service.

    [5] Nonetheless, social factors, sentence negation, sarcasm, mockery, language uncertainty and differing contexts make it amazingly hard to transform a line of composed content into a straightforward genius or con assessment..The dataset used for

    this consists of 2000 files with negative and positive reviews and each review is labeled with corresponding polarity.


    Natural Language Processing, or NLP for brief, is broadly defined as the programmed control of natural language, like discourse and content, by program. The research of natural language processing has been around for more than 50 years and developed out of the field of linguistics with the ascent of digital media.

    Deep Learning is concerned with algorithms enlivened by the structure and capacity of the brain called artificial neural networks. [6] The significant deep learning techniques used in natural language processing are Multilayer Perceptron (MLP), Convolution Neural Network (CNN), Long Short-Term Mem- ory Recurrent Neural Network (LSTM) etc.

    With the expansion in the amount of user reviews and opinions in the internet, there is a growing need to examine and assess the sentiment of the review. [7] Machine learning techniques are suitable for analysing the sentiments. In Inter- pretation and Classification of Emotions,it is done by using features such as Bag of Words, POS Tags, WorldNet Effect and Lexical Features. [8] [9]They found out that Bag of Words feature has a better accuracy than other features. The classifier used was Na¨ve Bayes. [10]

    Although Bag of Words feature is easier to use and has a simple structure, [11] it disregards the lexical and semantic structure of a sentence. When a sentence contains polarity shift words such as not, dont, etc. Bag of Words model tend to have reduced accuracy. [12] rectifies this problem by using a technique called Dual Interpretation and Classification of Emotions. It is done by using Dual Training and Dual predic- tion algorithm, the original review is reversed by removing the negation words and replacing the words with its antonyms. The original review and the reversed review is trained separately and in the prediction time we compare the sentiments of the original and reversed reviews. [13] The public sentiment of an event or product tends to vary over the time. Analysis of the evolution of sentiment is an interesting problem.

    In [1], rather than classifying the sentiment as positive, negative or neutral, a sentiment vector is made which consists of the emotions such as angry, disgust, happy etc. Each sen- timent vector is time stamped to facilitate evolution analysis, after analyzing the sentiment at each time stamp, data mining techniques [14] are used for evolution analysis to fid the patterns in the sentiment evolution and to find the reasons for it. [14]Binary classified Interpretation and Classification of Emotions techniques are inadequate for organizations to keep track of the performance and public opinion about their products. Sentiment evolution analysis presented in the paper will be useful for keeping track of public opinion.

    Computational Social Science holds a great practical value for accurate positioning of required user information. It in- cludes a variety of supervised learning methods, text-feature representation methods, feature selection mechanism and clas- sification results. The factors affecting the classification per-

    formance is a problem that requires immediate concern. In [2] verbs, adjectives and adverbs are chosen as text features and the weight of each word is calculated using TF-IDF. Then SVM and ELM with kernels are used for the classification criteria. The result obtained shows that ELM with kernels is much more effective than SVM. Even though the accuracy obtained in calculation of the text emotions are almost the same, ELM with kernels holds a large margin of advantage in case of the time taken for testing and training.

    Recent years witnessed a huge increase in the number of review websites that furnishes us with an extraordinary chance to share our perspectives on different items and services. Anyway the presence of enormous measures of information causes a data over-burdening issue to give a precise suggestion. Tralatitious systems such as the RS considered factors such as users purchase requisition, product type and emplacement. In [4]a more effective sentiment based recommended Rating Prediction System (RPS) is implemented. It thinks about the clients own wistful credits for the item, relational nostalgic impact and item notoriety.At last the three factors ie; client opinion similitude, relational wistful impact and things noto- riety closeness are contemplated for making a precise forecast. This framework shows huge upgrades over other existing methodologies.



    The primary goal of this paper is to figure out the underlying sentiment of a hotel review based on its textual data. In this paper, classification is performed based on reviews a person gives whether they liked the stay or not at the hotel. This is extremely useful in situations when the property owner wants to measure its overall pursuance using reviews that arbiters and viewers are providing for the hotel.Multilayer Perceptron is used as the classification model for the corrective classification sentiments from different features like Bag of Words, Bigram and POS-tag-Bigram. Accuracy is determined using the classification model for each feature and is then compared to determine the feature having the highest accuracy using frequency as feature selection method.

    Initially the dataset is pre-processed by tokenizing the reviews, removing unwanted symbols, removing stop words and by performing lemmatization on the resulting token. The resulting data is said to be pre-processed. Three different sets of vocabulary are created from the pre-processed output. Vocabulary for each feature, that is Bag of Words, Bigram and POS-tag Bigram is created. The data from the data file is then divided as training and testing set and the dataset along with vocabulary is fed into Multilayer Perceptron for creating the classification model. The model is then trained using frequency scoring method using train dataset. Now the model is tested using the test data. The accuracy is then obtained. Accuracy for the Multilayer Perceptron Model is then compared for each feature and the feature with highest accuracy and least error is determined through comparative study. Further, different

    word scoring methods are used for further comparison of the Multilayer Perceptron Model using different features.

    Fig. 1. Architecture of Proposed System

    The proposed Sentiment Classification can be categorized into following steps. Initially, the dataset is to be chosen to consist of positive and negative features and then they are split into tests and trained. Relevant features must be selected from the preprocessing step. Bag of Words, Bigram-Bag of Words and POS-Tag Bigram are considered as features. The next step is feature extraction using frequency word scoring method. Finally, a classification model to classify reviews based on their polarity.


    The dataset is derived from Kaggle Database which com- prises hotel evaluations of more than 5000 assessments in csv. The factors includes name of the city,the country, name of hotel, ranking, and reviews. Feature reduction is performed based on research needs. Then reviews are manually labeled based on the phrase to value 1 (positive) and value 0 (negative). The dataset is divided into a test set and train set. 90 % of data is utilized for training and 10 % for testing i.e. 900 files from both negative and positive dataset is considered as training and the rest 100 as test.


    Data preprocessing is a major step before feature selection. Dataset consists of lots of irrelevant or unwanted symbols which are noises in the dataset. Datasets must be screened before they are fed to the classification model for training and testing. Datasets which are not preprocessed increases the noise and thus results in reduction of accuracy of results. Following steps are used in preprocessing.

    • Tokenization

    • Removal of Unwanted Symbols

    • Stop word Elimination

    • Lemmatization


    There are different varieties of features which can be used for classification. In this proposed system we use three features. They are:

    • Bag of Words

    • Bag of Words- Bigram

    • POS-Tag Bigram

      Bag of Words The words are considered as the features in the dataset. Tokenize the word and consider the word count for the unique list that is to be formed for further processing. Bag of words- Bigram Initially all the data in the dataset is converted into bigram form and then a unique list for bigram

      is created. Then count the bigram for further verification.

      POS-Tag-Bigram Initially all the data is converted into bigram form and then these bigrams are further tagged based on Parts Of Speech(POS). Then count the POS-Tags for further processing.


    UniqueList formation is the creation of a file containing the vocabulary of a dataset. For the Bag of Words feature, UniqueList is created by selecting the unique words in the entire dataset. UniqueList is generated for calculating the frequency of each word in each file. Similarly UniqueList for converted Bigram-Bag of Words and POS-Tag-Bigram are generated and frequency of respective feature is calculated for further processing.


    Feature Selection is one of the key concepts in machine learning which influences the performance of the model.The features that are used to train multilayer perceptron models effects mainly the performance achieved. The feature selection technique used is frequency scoring.Here texts to matrix() function in Keras API to convert texts to matrix form based frequency mode, where the document is based on the rate of occurrence of words .


    Instead of machine learning classifiers,neural networks are proposed which are found to have more accuracy for larger dataset. In the proposed system,the Multilayer Perceptron model is used for classification and prediction.

    1) Multilayer Perceptron Model: MLP model is an arti- ficial neural network. This model consists of more than one perceptron. The input layer receives the signal, an output layer makes the prediction based on the input, and a random number of hidden layers are in between them. These hidden layers are the true inference engine o the MLP. MLPs can be single or multiple hidden layers that can estimate a continuous function.

    In this proposed system, four layers used are an input layer, two hidden layers, and an output layer. The activation function used in hidden layers is ReLU(Rectified Linear Unit).

    f(z) = max(0, z) (1)

    Where and

    Fig. 2. Architecture of Multilayered Perceptron

    R(z) = 0(whenz < 0)

    R(z) = z(whenz >= 0)

    1. Single Hidden Layer: When using a single hidden layer the accuracy of features i.e. bag of words, bigram- bag of words and POS Tag-bigram are 88%,84% and 51% respec- tively. Hence the feature bag of words obtained maximum accuracy of 88% and POS Tag-Bigram is having the lowest accuracy of 51%.

    2. Multiple Hidden Layers: When using multiple hidden layers, the accuracy of features i.e. bag of words, bigram- bag of words and POS Tag-bigram are 91%,87% and 51% respectively. Hence the feature bag of words obtained max- imum accuracy of 91% and POS Tag-bigram is having the lowest accuracy of 51%.

    Sigmoid Activation Function gives a single output by taking in inputs from multiple inputs .This is the function used in the output layer.

    f(z) = 1/(1+e( z)) (2)

    where f(z) is the output function.

    2) Prediction: Initially the preprocessed dataset is split into

    train data and test data. During training three features i.e. bag of words, bigram bag of words and POS Tag bigram are selected and their corresponding UniqueList is created. Each feature is then fed separately into the multilayer perceptron model for model training. The test data is then given into the model and prediction id done by classifier. Accuracy of prediction is compared for each feature. Also, accuracy comparison is done by increasing the number of hidden layers of the multilayer perceptron .

    Fig. 3. Comparing features using Single hidden layer

    Accuracy of the multilayer perceptron model is evaluated for each of the features i.e. bag of words, bigram-bag of words and POS Tag-Bigram .The result is evaluated using both a single hidden layer and multiple hidden layers. The following conclusions were obtained.

    Fig. 4. Comparing features using multiple hidden layer

    5) Comparison: From the obtained results,it is inferred that when using two hidden layers rather than a single hidden layer the accuracy of features bigram-bag of word increased from 84% to 87%, bag of words increased from 88% to 91%. But the accuracy of the feature POS Tag- Bigram remained constant. Even if it is further increased, the number of hidden

    Fig. 5. Comparison

    layers leads to only a slight variation in accuracy. We could also increase the number of epochs in the perceptron model which will show a minute increase in accuracy, but a large increment leads to overfitting of the dataset. So, it is not preferred.


Computational Social Science is a broad field which has scope in Review Analysis, Personal Profiling, Political Cam- paigns, and Comments Classification etc. This tool analyses labelled training datasets and learns the patterns existing in the dataset for classification of future data. There are many features on the basis it is classified and many classification algorithms used for Analysis. Based on the results analysis the accuracy of the Classifier based on different features and then the many features combined it is determined that Deep Neural Networks can produce greater accuracy when there are large amounts of dataset as opposed to Naive Bayes Networks.The datasets were trained and tested individually using Bag of Words, Bag of Words- Bigrams, POS Tag- Bigrams and got the highest accuracy of 88%,the number of hidden layers in MLP is increased and the accuracy further increased to 91%.


[1]H.-X. Shi and X.-J. Li, A sentiment analysis model for hotel reviews based on supervised learning, in 2011 International Conference on Machine Learning and Cybernetics, vol. 3, pp. 950954, IEEE, 2011.

[2]W. Kasper and M. Vela, Sentiment analysis for hotel reviews, in Computational linguistics-applications conference, vol. 231527, pp. 45 52, 2011.

[3] g294265

d1229624 ReviewsIbisS ingaporeonBencoolen

Singapore.html, 2020(accessedOctober162020).

[4]T. Ghorpade and L. Ragha, Featured based sentiment classification for hotel reviews using nlp and bayesian classification, in 2012 In- ternational Conference on Communication, Information & Computing Technology (ICCICT), pp. 15, IEEE, 2012.

[5]A. Goel, J. Gautam, and S. Kumar, Real time sentiment analysis of tweets using naive bayes, in 2016 2nd International Conference on Next Generation Computing Technologies (NGCT), pp. 257261, IEEE, 2016.

[6]A. Valdivia, M. V. Luz o´ n, and F. Herrera, Sentiment analysis in tripadvisor, IEEE Intelligent Systems, vol. 32, no. 4, pp. 7277, 2017.

[7]S. Ceri, A. Bozzon, M. Brambilla, E. Della Valle, P. Fraternali, and

S. Quarteroni, An introduction to information retrieval, in Web infor- mation retrieval, pp. 311, Springer, 2013.

[8]E. Haddi, X. Liu, and Y. Shi, The role of text pre-processing in sentiment analysis, Procedia Computer Science, vol. 17, pp. 2632, 2013.

  1. 10 Fold-Cross Validation

  2. need-it-in-a-Naive-Bayes-classifier.

  3. model/.

[12]A. A. Farisi, Y. Sibaroni, and S. Al Faraby, Sentiment analysis on hotel reviews using multinomial na¨ve bayes classifier, in Journal of Physics: Conference Series, vol. 1192, p. 012024, IOP Publishing, 2019.

[13]D. M. Powers, Evaluation: from precision, recall and f-measure to roc, informedness, markedness and correlation, arXiv preprint arXiv:2010.16061, 2020.

[14]J. Han, M. Kamber, and J. Pei, Data mining concepts and techniques third edition, The Morgan Kaufmann Series in Data Management Systems, vol. 5, no. 4, pp. 83124, 2011.

Leave a Reply