Semantic Sentiment Analysis of Twitter

  • Published on

  • View

  • Download


  • Semantic Sentiment Analysis of Twitter

    Hassan Saif, Yulan He and Harith Alani

    Knowledge Media Institute, The Open University, United Kingdom{h.saif,y.he,h.alani}

    Abstract. Sentiment analysis over Twitter offer organisations a fast and effec-tive way to monitor the publics feelings towards their brand, business, directors,etc. A wide range of features and methods for training sentiment classifiers forTwitter datasets have been researched in recent years with varying results. Inthis paper, we introduce a novel approach of adding semantics as additional fea-tures into the training set for sentiment analysis. For each extracted entity (e.g.iPhone) from tweets, we add its semantic concept (e.g. Apple product) as anadditional feature, and measure the correlation of the representative concept withnegative/positive sentiment. We apply this approach to predict sentiment for threedifferent Twitter datasets. Our results show an average increase of F harmonic ac-curacy score for identifying both negative and positive sentiment of around 6.5%and 4.8% over the baselines of unigrams and part-of-speech features respectively.We also compare against an approach based on sentiment-bearing topic analysis,and find that semantic features produce better Recall and F score when classi-fying negative sentiment, and better Precision with lower Recall and F score inpositive sentiment classification.

    Keywords: Sentiment analysis, semantic concepts, feature interpolation.

    1 IntroductionThe emergence of social media has given web users a venue for expressing and sharingtheir thoughts and opinions on all kinds of topics and events. Twitter, with nearly 600million users1 and over 250 million messages per day,2 has quickly become a gold minefor organisations to monitor their reputation and brands by extracting and analysing thesentiment of the Tweets posted by the public about them, their markets, and competitors.

    Sentiment analysis over Twitter data and other similar microblogs faces several newchallenges due to the typical short length and irregular structure of such content. Twomain research directions can be identified in the literature of sentiment analysis onmicroblogs. First direction is concerned with finding new methods to run such analy-sis, such as performing sentiment label propagation on Twitter follower graphs [14],and employing social relations for user-level sentiment analysis [15, 5]. The second di-rection is focused on identifying new sets of features to add to the trained model forsentiment identification, such as microblogging features including hashtags, emoticons[2], the presence of intensifiers such as all-caps and character repetitions [6] etc., andsentiment-topic features [12].

  • The work in this paper falls into the second direction, by investigating a novel set offeatures derived from the semantic conceptual representation of the entities that appearin tweets. The semantic features consist of the semantic concepts (e.g. person, com-pany, city) that represent the entities (e.g. Steve Jobs, Vodafone, London)extracted from tweets. The rational behind introducing these features is that certain en-tities and concepts tend to have a more consistent correlation with positive or negativesentiment. Knowing these correlations can help determining the sentiment of semanti-cally relevant or similar entities, and thus increasing accuracy of sentiment analysis. Tothe best of our knowledge, using these semantic features in the model training for senti-ment analysis has not been explored before. We evaluated three popular tools for entityextraction and concept identification; AlchemyAPI,3 Zemanta,4 and OpenCalais,5 andused the one that performed best in terms of quantity and accuracy of the identifiedconcepts.

    While previous work on feature engineering for sentiment classification on tweets [1,6] simply incorporate features through augmentation, our experimental results showthat it is more effective to incorporate semantic features through interpolation. Hencewe incorporate the semantic features into Nave Bayes (NB) model training using aninterpolation approach.

    We experiment and evaluate our proposed approach with three datasets collectedfrom Twitter; a general Stanford Twitter Sentiment (STS) dataset, a dataset on theObama-McCain Debate (OMD), and one on Health Care Reform (HCR). Our resultsshow that combining our semantic features with word unigrams outperforms the base-line model trained from unigrams only across all three datasets by an average accuracyof 6.47%. It also outperforms the accuracy of sentiment analysis using the commonpart-of-speech (POS) features often used in the literature [9, 1] by an average of 4.78%.Although these improvements may appear modest, they are very notable in comparisonto the scale of improvements reported in similar literatures. Our results show that theadvantage of using semantic features in microblog sentiment analysis over other tech-niques is mostly restricted to negative sentiment identification, in large topically-diversedatasets.

    The main contributions of this paper can be summarised as follows:

    Introduce and implement a new set of semantic features for training a model forsentiment analysis of tweets

    Investigate three approaches for adding such features into the training model; byreplacement, by argumentation, and by interpolation, and show the superiority ofthe latter approach.

    Test accuracy of sentiment identification when using semantic features with uni-grams on three Twitter datasets, and produce an average harmonic mean (F score)accuracy of 75.95%, with 77.18% Precision and 75.33% Recall

    Demonstrate the value of not removing stowords in increasing sentiment identifi-cation accuracy

    3 www.alchemyapi.com4 www.zemanta.com5

  • Show an average of 6.47% increase in the F score against a baseline approach basedon unigrams only

    Show an average of 4.78% increase in F score in comparison to using the commonPOS features alongside unigrams

    Compare results with sentiment-bearing topic features [12] and show that semanticfeatures improve F by 1.22% when identifying negative sentiment, but worsens Fby 2.21% when identifying positive sentiment.

    The rest of the paper is organised as follows. Section 2 outlines existing work onsentiment analysis with focus on twitter sentiment analysis. Section 3 describes thethree Twitter datasets used in our experiments. Section 4 presents our proposed ap-proach of using semantic features for sentiment analysis, and describes three methodsfor incorporating these features into the sentiment classifier. In Section 5 we describethe baselines we use for evaluating and comparing our results. Experimental results arefully detailed and discussed in Section 6. Discussion and future work are covered inSection 7. Finally, we conclude our work in Section 8.

    2 Related WorkSentiment analysis of tweets data is considered as a much harder problem than thatof conventional text such as review documents. This is partly due to the short lengthof tweets, the frequent use of informal and irregular words, and the rapid evolution oflanguage in Twitter. A large amount of work has been conducted in Twitter sentimentanalysis following the feature-based approaches. Go et al. [4] explored augmentingdifferent n-gram features in conjunction with POS tags into the training of supervisedclassifiers including Naive Bayes (NB), Maximum Entropy (MaxEnt) and Support Vec-tor Machines (SVMs). They found that MaxEnt trained from a combination of unigramsand bigrams outperforms other models trained from a combination of POS tags and un-igrams by almost 3%. However, a contrary finding was reported in [9] that adding POStag features into n-grams improves the sentiment classification accuracy on tweets.

    Barbosa and Feng [2] argued that using n-grams on tweet data may hinder the clas-sification performance because of the large number of infrequent words in Twitter. In-stead, they proposed using microblogging features such as re-tweets, hashtags, replies,punctuations, and emoticons. They found that using these features to train the SVMs en-hances the sentiment classification accuracy by 2.2% compared to SVMs trained fromunigrams only. A similar finding was reported by Kouloumpis et al. [6]. They exploredthe microblogging features including emoticons, abbreviations and the presence of in-tensifiers such as all-caps and character repetitions for Twitter sentiment classification.Their results show that the best performance comes from using the n-grams togetherwith the microblogging features and the lexicon features where words tagged with theirprior polarity. However, including the POS features produced a drop in performance.

    Agarwal et al. [1] also explored the POS features, the lexicon features and the mi-croblogging features. Apart from simply combining various features, they also designeda tree representation of tweets to combine many categories of features in one succinctrepresentation. A partial tree kernel [8] was used to calculate the similarity between twotrees. They found that the most important features are those that combine prior polarityof words with their POS tags. All other features only play a marginal role. Furthermore,

  • they also showed that combining unigrams with the best set of features outperforms thetree kernel-based model and gives about 4% absolute gain over a unigram baseline.

    Rather than directly incorporating the microblogging features into sentiment classi-fier training, Speriosu et al. [14] constructed a graph that has some of the microbloggingfeatures such as hashtags and emoticons together with users, tweets, word unigrams andbigrams as its nodes which are connected based on the link existence among them (e.g.,users are connected to tweets they created; tweets are connected to word unigrams thatthey contain etc.). They then applied a label propagation method where sentiment labelswere propagated from a small set of nodes seeded with some initial label informationthroughout the graph. They claimed that their label propagation method outperformsMaxEnt trained from noisy labels and obtained an accuracy of 84.7% on the subset ofthe Twitter sentiment test set from [4].

    Existing work mainly concentrates on the use of three types of features; lexicon fea-tures, POS features, and microblogging features for sentiment analysis. Mixed findingshave been reported. Some [9, 1] argued the importance of POS tags with or withoutword prior polarity involved, while others emphasised the use of microblogging fea-tures [2, 6]. In this paper, we propose a new type of features for sentiment analysis,called semantic features, where for each entity in a tweet (e.g. iPhone, iPad, MacBook),the abstract concept that represents it will be added as a new feature (e.g. Apple prod-uct). We compare the accuracy of sentiment analysis against other types of features;unigrams, POS features, and the sentiment-topic features. To the best of our knowl-edge, using such semantic features is novel in the context of sentiment analysis.

    3 DatasetsFor the work and experiments described in this paper, we used three different Twitterdatasets as detailed below. The statistics of the datasets are shown in Table 1.

    Dataset Type No. of Tweets Positive Negative

    Stanford Twitter Sentiment Corpus (STS) Train 60K 30K 30KTest 1,000 470 530

    Health Care Reform (HCR) Train 839 234 421Test 839 163 536Obama-McCain Debate (OMD) n-fold cross validation 1,081 393 688

    Table 1. Statistics of the three Twitter datasets used in this paper.

    Stanford Twitter Sentiment Corpus (STS)

    This dataset consists of 60,000 tweets randomly selected from the Stanford Twitter Sen-timent corpus (STS) [4]. Half of the tweets in this dataset contains positive emoticons,such as :), :-), : ), :D, and =), and the other half contains negative emoticons such as :(,:-(, or : (. The original dataset from [4] contained 1.6 million general tweets, and its testset of manually annotated tweets consisted of 177 negative and 182 positive tweets. Incontrast to the training set which was collected based on specific emoticons, the test setwas collected by searching Twitter API with specific queries including product names,companies and people. To extend the testing set, we added 641 tweets randomly se-lected from the original dataset, and annotated manually by 12 users (researchers in ourlab), where each tweet was annotated by one user. Our final STS dataset consists of

  • 60K general tweets, with a test set of 1,000 tweets of 527 negatively, and 473 positivelyannotated ones.

    Health Care Reform (HCR)

    The Health Care Reform (HCR) dataset was built by crawling tweets containing thehashtag #hcr (health care reform) in March 2010 [14]. A subset of this corpus wasmanually annotated with three polarity labels (positive, negative, neutral) and split intotraining and test sets. In this paper, we focus on identifying positive and negative tweets,and therefore we exclude neutral tweets from this dataset. Identifying neutral tweets ispart of our future work plan. The final HCR dataset for training contains 839 tweets,and another 839 tweets were used for testing.

    Obama-McCain Debate (OMD)

    The Obama-McCain Debate (OMD) dataset was constructed from 3,238 tweets crawledduring the first U.S. presidential TV debate in September 2008 [13]. Sentiment ratingsof these tweets were acquired using Amazon Mechanical Turk, where each tweet wasrated by one or more voter as either positive, negative, mixed, or other. Other tweetsare those that couldnt be rated. We only keep those tweet rated by at least three voterswith half of the votes being either positive or negative to ensure their sentiment polarity.This resulted in a set of 1,081 tweets with 393 positive and 688 negative ones. Due tothe relative small size of this dataset, and the lack of a test set, we opted for a 5-foldcross validation approach instead.

    4 Semantic Features for Sentiment AnalysisThis section describes our semantic features and their incorporation into our sentimentanalysis method. As mentioned earlier, the semantic concepts of entities extracted fromtweets can be used to measure the overall correlation of a group of entities (e.g. allApple products) with a given sentiment polarity. Hence adding such features to theanalysis could help identifying the sentiment of tweets that contain any of the entitiesthat such concepts represent, even if those entities never appeared in the training set(e.g. a new gadget from Apple).6

    Semantic features refer to those semantically hidden concepts extracted from tweets [11,12]. An example for using semantic features for sentiment classifier training is shownin Figure 1 where the left box lists entities appeared in the training set together withtheir occurrence probabilities in positive and negative tweets. For example, the entitiesiPad, iPod and Mac Book Pro appeared more often in tweets of positive polarityand they are all mapped to the semantic concept PRODUCT/APPLE. As a result, thetweet from the test set Finally, I got my iPhone. What a product! is more likely tohave a positive polarity because it contains the entity iPhone which is also mapped tothe concept PRODUCT/APPLE.

    4.1 Extracting Semantic Entities and Concepts

    There are several open APIs that provide entity extraction services for online textualdata. Rizzo and Troncy [10] evaluated the use of five popular entity extraction tools

    6 Assuming of course that the entity extractor successfully identify the new entities as sub-typesof concepts already correlated with negative or positive sentiment

  • Fig. 1. Measuring correlation of semantic concepts with negative/positive sentiment. These se-mantic concepts are then incorporated in sentiment classification.

    on a dataset of news articles, including AlchemyAPI, DBPedia Spotlight,7 Extractiv,8

    OpenCalais and Zemanta. Their experimental results showed that AlchemyAPI per-forms best for entity extraction and semantic concept mapping. Our datasets consist ofinformal tweets, and hence are intrinsically different from those used in [10]. There-fore we conducted our own evaluation, and randomly selected 500 tweets from the STScorpus and asked 3 evaluators to evaluate the semantic concept extraction outputs gen-erated from AlchemyAPI, OpenCalais and Zemanta.

    No. of Concepts Entity-Concept Mapping Accuracy (%)Extraction Tool Extracted Evaluator 1 Evaluator 2 Evaluator 3AlchemyAPI 108 73.97 73.8 72.8Zemanta 70 71 71.8 70.4OpenCalais 65 68 69.1 68.7Table 2. Evaluation results of AlchemyAPI, Zemanta and OpenCalais.

    The assessment of the outputs was based on (1) the correctness of the extractedentities; and (2) the correctness of the entity-concept mappings. The evaluation resultspresented in Table 2 show that AlchemyAPI extracted the most number of conceptsand it also has the highest entity-concept mapping accuracy compared to OpenCalaisand Zematna. As such, we chose AlchemyAPI to extract the semantic concepts fromour three datasets. Table 3 lists the total number of entities extracted and the number ofsemantic concepts mapped against them for each dataset.

    STS HCR OMDNo. of Entities 15139 723 1194No. of Concepts 29 17 14

    Table 3. Entity/concept extraction statistics of STS, OMD and HCR using AlchemyAPI.7

  • (a) STS.

    (b) HCR.

    (c) OMD.Fig. 2. Top 10 frequent concepts extracted with the number of entities associated with them.

  • Figure 2 shows the top ten high-level extracted concepts from the three datasets withthe number of entities associated with each of concept. It can be observed that the mostfrequent semantic concept is PERSON across all the three corpora. The next two mostfrequent concepts are COMPANY and CITY for STS, ORGANISATION and COUNTRYfor HCR, and COUNTRY and COMPANY for OMD. The level of specificity of theseconcepts is determined by AlchemyAPI.

    4.2 Semantic Feature Incorporation

    In this section, we propose three different methods to incorporate semantic features intoNaive Bayes (NB) classifier training. We start by an overview of the NB followed byour proposed incorporation methods.

    NB is a probabilistic classifier, where the assignment of a sentiment class c to agiven tweet w can be computed as:

    c = argmaxcC

    P (c|w)

    = argmaxcC

    P (c)


    P (wi|c), (1)

    where Nw is the total number of words in tweet w, P (c) is the prior probability of atweet appearing in class c, P (wi|c) is the conditional probability of word wi occurringin a tweet of class c.

    In multinomial NB, P (c) can be estimated by P (c) = Nc/N WhereNc is the num-ber of tweets in class c and N is the total number of tweets. P (wi|c) can be estimatedusing maximum likelihood with Laplace smoothing:

    P (w|c) = N(w, c) + 1wV N(w

    |c) + |V |, (2)

    where N(w, c) is the occurrence frequency of word w in all training tweets of class cand |V | is the number of words in the vocabulary.

    To incorporate semantic concepts into NB learning, we propose three differentmethods as described below.

    Semantic Replacement: In this method, we replace all entities in tweets with theircorresponding semantic concepts. This leads to the reduction of the vocabulary size,where the new size is determined by:

    |V | = |V | |Wentity|+ |S|, (3)

    where |V | is the new vocabulary size, |V | is the original vocabulary size, |Wentity|is the total number of unique entity words that have been replaced by the semanticconcepts, and |S| is the the total number of semantic concepts.Semantic Augmentation: This method augments the original feature space with thesemantic concepts as additional features for the classifier training. The size of the vo-cabulary in this case is enlarged by the semantic concepts introduced:

    |V | = |V |+ |S|. (4)

  • Semantic Interpolation: A more principal way to incorporate semantic concepts isthrough interpolation where we interpolate the unigram language model in NB with thegenerative model of words given semantic concepts. We propose a general interpolationmethod below which is able to interpolate arbitrary type of features such as semanticconcepts, POS sequences, sentiment-topics etc.

    Thus, the new language model with interpolation has the following formula:

    Pf (W |C) = Pu(W |C) +i

    iP (W,Fi, C) (5)

    Where Pf (W |C) is the new language model with interpolation, Pu(W |C) is the orig-inal unigram class model and can be calculated using the maximum likelihood estima-tion, P (W,Fi, C) is the interpolation component, and Fi is a feature vector of type i.The coefficients and i are used to control the influence of the interpolated featuresin the new language model where:


    i = 1

    By setting to 1 the class model becomes a unigram language model without any fea-ture interpolation. On the other hand, setting to 0 reduces the class model to a featuremapping model. In this work, values of these coefficients have been set by conductinga sensitivity test on the three corpora as will be discuss in Section 6.2.

    The interpolation component in the equation 5 can be decomposed as follows:

    P (W,Fi, C) =j

    P (W |fij)P (fij |C) (6)

    Where fij is the j-th feature of type i, P (fij |C) is the distribution of features fijin the training data given the class C and P (W |fij) is the distribution of words in thetraining data given the feature fij . Both distributions can be computed via the maximumlikelihood estimation.

    5 BaselinesWe compare the performance of our semantic sentiment analysis approach against thebaselines described below.

    5.1 Unigrams Features

    Word unigrams are the simplest features are being used for sentiment analysis of tweetsdata. Models trained from word unigrams were shown to outperform random classifiersby a decent margin of 20% [1]. In this work, we use NB classifiers trained from wordunigrams as our first baseline model. Table 4 lists, for each dataset, the total number ofthe extracted unigram features that are used for the classification training.

    5.2 Part-of-Speech Features

    POS features are common features that have been widely used in the literature for thetask of Twitter sentiment analysis. In this work, we build various NB classifiers trained

  • Dataset No. of UnigramsSTS 37054HCR 2060OMD 2364

    Table 4. Total number of unigram features extracted from each dataset.

    using a combination of word unigrams and POS features and use them as baseline mod-els. We extract the POS features using the TweetNLP POS tagger,9 which is trainedspecifically from tweets. This differs from the previous work, which relies on POS tag-gers trained from treebanks in the newswire domain for POS tagging. It was shown thatTweetNLP tagger outperforms the Stanford tagger10 with a relative error reduction of25% when evaluated on 500 manually annotated tweets [3]. Moreover, the tagger offersadditional recognition capabilities for abbreviated phrases, emoticons and interjections(e.g. lol, omg).

    5.3 Sentiment-Topic Features

    The sentiment-topic features are extracted from tweets using the weakly-supervisedjoint sentiment-topic (JST) mode that we developed earlier [7]. We trained this modelon the training set with tweet sentiment labels discarded. The resulting model assignseach word in tweets with a sentiment label and a topic label. Hence JST essentiallygroups different words that share similar sentiment and topic.

    We list some of the topic words extracted by this model from the STS and OMDcorpora in Table 5. Words in each cell are grouped under one topic and the upper half ofthe table shows topic words bearing positive sentiment while the lower half shows topicwords bearing negative sentiment. For example, Topic 2 under positive sentiment isabout the movie Twilight, while Topic 5 under negative sentiment is about a complaintof feeling sick possibly due to cold and headache. The rational behind this model is thatgrouping words under the same topic and bearing similar sentiment could reduce datasparseness in Twitter sentiment classification and improves accuracy.

    6 Evaluation ResultsIn this section, we evaluate the use of the sentiment features discussed in 4 and presentthe sentiment identification results on the STS, HCR and OMD datasets. We then com-pare these results with those obtained from using the baseline features described inSection 5.

    We use NB trained from word unigrams as the starting-point baseline model. Thefeatures are incorporated into NB by either the interpolation approach described in Sec-tion 4.2 or by simply augmenting into the original bag-of-words feature space. Forevaluation on STS and HCR, we use the training and testing sets shown in Table 1. ForOMD, we perform 5-fold cross validation and report the results averaged over 10 suchruns.

    The raw tweets data can be very noisy, and hence some pre-processing was neces-sary, such as replacing all hyperlinks with URL, converting some words with apostro-


  • Topic 1 Topic 2 Topic 3 Topic 4 Topic 5



    win twilight make tomorrow todayfinal movie mccain weekend nice

    watch award debate school Sundaygame moon good start enjoyluck tonight point plan weather

    today watch interest fun loveweek mtv right yai walkhope excited answer wait sunny



    eiphone dog obama miss feelinternet sad question far sick

    download death understand travel badapple accident doesnt mum hurtstore today answer away painslow car comment dad fluissue awful back love sorecrash cry debate country horrible

    Table 5. Extracted sentiment-topic words by the sentiment-topic model.

    phe, such as haten, to their complete form hating, removing repeated letters (e.g.loovee becomes love), etc.

    6.1 Stopwords

    It is a common practice to perform stopwords removal as a standard pre-processing stepby removing those common words which tend to have little meaning. Nevertheless, Bei[16] argued that stopwords can be used as discriminative features for specific classifica-tion tasks. We have conducted a set of experiments to evaluate the impact of stopwordsremoval on sentiment classification on tweets. We compare the performance of a NBclassifier trained from word unigrams before and after removing the stopwords. It canbe observed from Table 6 that the classifiers learned with stopwords outperform thoselearned with stopwords removed. Similar outcome was observed when using all outsentiment analysis features. Hence, we chose to keep the stopwords in our subsequentexperiments.

    Dataset With Stopwords Without StopwordsStanford Twitter Sentiment (STS) 80.7% 77.5%Health Care Reform (HCR) 71.1% 68.5%Obama-McCain Debate (OMD) 75.4% 73.7%

    Table 6. Sentiment classification accuracy ((True Positives + True Negatives) / Total) with andwithout stopwords using unigram features.

    6.2 Incorporating Semantic Features

    Semantic features can be incorporated into NB training in three different ways, replace-ment, augmentation, and interpolation (Section 4.2). Table 7 shows the F measuresproduced when using each of these feature incorporation methods. With semantic re-

  • placement, where all entities in tweets are replaced with their corresponding semanticconcepts, the feature space shrunk substantially by nearly 15-20%, and produced anaverage F measure of 68.9%. However, this accuracy is 3.5% and 10.2% less than whenusing semantic augmentation and interpolation respectively. The performance degrada-tion is due to the information loss caused by this term replacement which subsequentlyhurts NB performance.

    Augmenting the original feature space with semantic concepts (semantic augmenta-tion) performs slightly better than sentiment replacement, though it still performs 6.5%worse than interpolation. With Semantic interpolation, semantic concepts are incorpo-rated into NB training taking into account the generative probability of words givenconcepts. This method produces the highest accuracy amongst all three incorporationmethods, with an average F of 75.95%.

    Method STS HCR OMD AverageSemantic replacement 74.10 61.35 71.25 68.90Semantic augmentation 77.65 63.65 72.70 71.33Semantic interpolation 83.90 66.10 77.85 75.95

    Table 7. Average sentiment classification accuracy (%) using different methods for incorporatingthe semantic features. Accuracy here is the average harmonic mean (F measure) obtained fromidentifying positive and negative sentiment.

    The contribution of semantic features in the interpolation model is controlled by theinterpolation coefficients in Equation 5. We conducted a sensitivity test to evaluate theimpact of the interpolation coefficients on sentiment classification accuracy by varying between 0 and 1. Figure 3 shows that accuracy reaches its peak with set between0.3 and 0.5. In our evaluation, we used 0.4 for STS dataset, and 0.3 for the other two.

    Fig. 3. Sensitivity test of the interpolation coefficient for semantic interpolation.

    6.3 Comparison of Results

    In this section we will compare the Precision, Recall, and F measure of our semanticsentiment analysis against the baselines described in Section 5. We report the semantic

  • classification results for identifying positive and negative sentiment separately to allowfor deeper analysis of results. This is especially important given how some analysismethods perform better in one sentiment polarity than in the other.

    Table 8 shows the results of our sentiment classification using Unigrams, POS,Sentiment-Topic, and Semantic features, applied over the STS, HCR, and OMD datasetswhich are detailed in Section 3. The table reports three sets of P, R, and F1, one for pos-itive sentiment identification, one for negative sentiment identification, and the thirdshows the averages of the two.

    Dataset Feature Positive Sentiment Negative Sentiment AverageP R F1 P R F1 P R F1


    Unigrams 82.20 75.20 78.50 79.30 85.30 82.20 80.75 80.25 80.35POS 83.70 75.00 79.10 79.50 86.90 83.00 81.60 80.95 81.05Sentiment-Topic 80.70 82.20 81.40 83.70 82.30 83.00 82.20 82.25 82.20Semantics 85.80 79.40 82.50 82.70 88.20 85.30 84.25 83.80 83.90


    Unigrams 39.00 36.10 37.50 81.00 82.80 81.90 60.00 59.45 59.70POS 56.20 22.00 31.70 80.00 94.70 86.70 68.10 58.35 59.20Sentiment-Topic 53.80 47.20 50.30 84.50 87.60 86.00 69.15 67.40 68.15Semantics 53.60 40.40 46.10 83.10 89.30 86.10 68.35 64.85 66.10


    Unigrams 64.20 70.90 67.10 83.30 78.60 80.80 73.75 74.75 73.95POS 69.50 68.30 68.70 83.10 83.90 83.40 76.30 76.10 76.05Sentiment-Topic 68.20 75.60 71.70 87.10 82.40 84.70 77.65 79.00 78.20Semantics 75.00 66.60 70.30 82.90 88.10 85.40 78.95 77.35 77.85

    Table 8. Cross comparison results of all the four features.

    According to these results in Table 8, the Semantic approach outperforms the Un-igrams and POS baselines in all categories and for all three datasets. However, for theHCR and OMD datasets, the sentiment-topic analysis approach seem to outperform thesemantic approach by a small margin. For example, the semantic approach producedhigher P, R, and F1 for the STS dataset, with F1 4.4% higher than Unigrams, 3.5%higher than POS, and 2.1% higher than the sentiment-topic features. In HCR, F1 fromthe semantic features were 8.9% and 11.7% higher than Unigrams and POS, but 3%lower than F1 from sentiment-topic features. For OMD, semantic features also outper-formed the Unigrams and POS baselines, with 5.2% and 2.4% higher F1 respectively.However, in the OMD dataset, F1 from semantic features was 0.4% lower than fromthe topic model, although Precision was actually higher by 1.7%.

    As detailed in Section 3 and Table 1, the STS dataset consists of a large collectionof general tweets with no particular topic focus. Unlike STS, the other two datasets aremuch smaller in size and their tweets discuss very specific topics; the US Health CareReform bill in the HCR dataset, and the Obama McCain debate in the OMD dataset.Using semantic features seem to perform best in the large and general dataset, whereasthe sentiment-topic features seem to take the lead in small, topic-focused datasets. Thereason is likely to be that classifying with sentiment-topic features group words into anumber of topics. In our experiments, we found that for the STS dataset, increasing thenumber of topics leads to the increase of classification accuracy with the peak valueof 82.2% reached at topic number 50. Further increasing topic numbers degrades the

  • classifier performance. However, for HCR and OMD, the best accuracy was obtainedwith only one topic (68.15% for HCR and 78.20% for OMD). The classification per-formance drops significantly by any further increment. This can be explained by thenature of these three datasets. HCR was collected using the hashtag #hcr (health carereform) while OMD consists of tweets about the Obama-McCain debate. Hence thesetwo datasets are topic-specific. On the contrary, STS was collected using more generalqueries and thus it contains a potentially large number of topics.

    Hence the benefits of using the sentiment-topic features seem to be reduced in com-parison to semantic features when the training set is of general content as in the STStweets dataset.

    The average results across all three datasets are shown in Table 9. Here we can seethat semantic features do better than sentiment-topic features and the other baselineswhen identifying negative sentiment. However, sentiment-topic features seem to per-form better for positive sentiment. For positive sentiment, using the semantic approachproduces Precision that is better than Unigrams, POS, and sentiment-topic by 15.6%,2.4%, and 5.8% respectively. However, the Recall produced by the semantic approachwhen identifying positive sentiment is 2.3% and 12.8% higher than in Unigrams andPOS, but 9% lower than Recall from the sentiment-topic approach. Overall, F for pos-itive sentiment from semantic features is 2.2% lower than when using sentiment-topicfeatures. It is worth emphasising that the average Precision from identifying both pos-itive and negative sentiment is the highest at 77.18% when using semantic features.When analysing large amounts of continuously flowing data as with social media re-sources, Precision could well be regarded as much more important than Recall.

    Features Positive Sentiment Negative Sentiment AverageP R F1 P R F1 P R F1

    Unigrams 61.80 60.73 61.03 81.20 82.23 81.63 71.50 71.48 71.33POS 69.80 55.10 59.83 80.87 88.50 84.37 75.53 72.23 72.48Sentiment-Topic 67.57 68.33 67.80 85.10 84.10 84.57 77.02 76.73 76.75Semantics 71.47 62.13 66.30 82.90 88.53 85.60 77.18 75.33 75.95Table 9. Averages of Precision, Recall, and F measures across all three datasets.

    7 Discussion and Future WorkIn this paper we demonstrated the value of using semantic features for the classificationof positive and negative sentiment in Tweets. We tested several off-the-shelf semanticentity extractors and decided on using AlchemyAPI due to its better performance interms of coverage and accuracy. One thing that impacts our results is the abstractionlevel of the concepts retrieved from the entity extractor. In many cases, these conceptswere too abstract (e.g. Person) which were equally used for mentions of ordinary peo-ple, as well as for famous musicians or politicians. For the tweet i wish i could goto france and meet president Obama haha, AlchemyAPI provided the concept Per-son to represent president Obama, whereas Zemanta identified him with the concept/government/politician which is more specific. In future work we plan to devise an ap-proach to increase the specificity of such concepts, perhaps with the aid of DBpedia or

  • using multiple entity extractors and comparing the specificity level of their proposedconcepts.

    In our evaluation of AlchemyAPI, Zemanta, and OpenCalais, we observed thatsome of them perform better than others for specific type of entities. For example,Zemanta produced more accurate and specific concepts to describe entities related tomusic tracks and bands. It might be possible to implement a more selective approach,where certain semantic extractors and concept identifiers are used, or trusted more, forcertain type of entities.

    When using semantic features, all identified concepts in a tweet are added to theanalysis. However, it might be the case that semantic features improve sentiment analy-sis accuracy for some type of concepts (e.g. cities, music) but reduce accuracy in someother concept types (e.g. people, companies). We will investigate the impact of eachgroup of concepts on our analysis accuracy, to determine their individual contributionand impact on our sentiment analysis. We can also assign weights to each concept typeto represent its correlation with positive or negative sentiment.

    We experimented with multiple datasets of varying sizes and topical-focus. Ourresults showed that the accuracy of classifying with some feature selections can besensitive to the size of the datasets and their topical-focus. For example, our evaluationshowed that the semantic approach excels when the dataset is large and of diverse topiccoverage. In future work we will apply these approaches on larger datasets to examinethe consistency of their performance patterns. Furthermore, we also intend to explorevarious feature selection strategies to improve the sentiment classification performance.

    Our sentiment analysis focused on positive and negative tweets. Neutral sentimenttend to be much harder to identify as it requires the determination of the context ofthe tweet message. For example, some words of a tweet may have both subjective andobjective senses. Handling such tweets will therefore require the introduction of anotherclassifier, to identify subjective/objective tweets.

    8 ConclusionsWe proposed the use of semantic features in Twitter sentiment classification and ex-plored three different approaches for incorporating them into the analysis; with replace-ment, augmentation, and interpolation. We found that best results are achieved when in-terpolating the generative model of words given semantic concepts into the unigram lan-guage model of the NB classifier. We conducted extensive experiments on three Twitterdatasets and compared the semantic features with the the Unigrams and POS sequencefeatures as well as with the sentiment-topic features. Our results show that the semanticfeature model outperforms the Unigram and POS baseline for identifying both negativeand positive sentiment. We demonstrated that adding semantic features produces higherRecall and F1 score, but lower Precision, than sentiment-topic features when classify-ing negative sentiment. We also showed that using semantic features outperforms thesentiment-topic features for positive sentiment classification in terms of Precision, butnot in terms of Recall and F1. One average, the semantic features appeared to be themost precise amongst the four other feature selections we experimented with.

    Our results indicates that the semantic approach is more appropriate when the datasetsbeing analysed are large and cover a wide range of topics, whereas the sentiment-topicapproach was most suitable for relatively small datasets with specific topical foci.

  • We believe that our findings demonstrated the high potential of the novel approachof interpolating semantic features into the sentiment classifier. In our current implemen-tation, we rely on Alchemy API which is only able to produce rather coarse semanticconcept mappings. However, our results indicate that further gains could be achievedwhen entities are mapped into a more fine-grained semantic concept space.

    AcknowledgmentThe work of the authors was supported by the EU-FP7 project ROBUST (grant no.257859).

    References1. Agarwal, A., Xie, B., Vovsha, I., Rambow, O., Passonneau, R.: Sentiment analysis of twitter

    data. In: Proc. ACL 2011 Workshop on Languages in Social Media. pp. 3038 (2011)2. Barbosa, L., Feng, J.: Robust sentiment detection on twitter from biased and noisy data. In:

    Proceedings of COLING. pp. 3644 (2010)3. Gimpel, K., Schneider, N., OConnor, B., Das, D., Mills, D., Eisenstein, J., Heilman, M., Yo-

    gatama, D., Flanigan, J., Smith, N.: Part-of-speech tagging for twitter: Annotation, features,and experiments. Tech. rep., DTIC Document (2010)

    4. Go, A., Bhayani, R., Huang, L.: Twitter sentiment classification using distant supervision.CS224N Project Report, Stanford (2009)

    5. Guerra, P., Veloso, A., Meira Jr, W., Almeida, V.: From bias to opinion: A transfer-learningapproach to real-time sentiment analysis. In: Proceedings of the 17th ACM SIGKDD Con-ference on Knowledge Discovery and Data Mining (KDD) (2011)

    6. Kouloumpis, E., Wilson, T., Moore, J.: Twitter sentiment analysis: The good the bad and theomg! In: Proceedings of the ICWSM (2011)

    7. Lin, C., He, Y.: Joint sentiment/topic model for sentiment analysis. In: Proceeding of the 18thACM conference on Information and knowledge management. pp. 375384. ACM (2009)

    8. Moschitti, A.: Efficient convolution kernels for dependency and constituent syntactic trees.In: Proceedings of the European Conference on Machine Learning. pp. 318329 (2006)

    9. Pak, A., Paroubek, P.: Twitter as a corpus for sentiment analysis and opinion mining. Pro-ceedings of LREC 2010 (2010)

    10. Rizzo, G., Troncy, R.: Nerd: Evaluating named entity recognition tools in the web of data.In: Workshop on Web Scale Knowledge Extraction (WEKEX11). vol. 21 (2011)

    11. Saif, H., He, Y., Alani, H.: Semantic Smoothing for Twitter Sentiment Analysis. In: Proceed-ing of the 10th International Semantic Web Conference (ISWC) (2011)

    12. Saif, H., He, Y., Alani, H.: Alleviating Data Sparsity for Twitter Sentiment Analysis. In:Proceedings, 2nd Workshop on Making Sense of Microposts (#MSM2012): Big things comein small packages: in conjunction with WWW 2012 (2012)

    13. Shamma, D., Kennedy, L., Churchill, E.: Tweet the debates: understanding community an-notation of uncollected sources. In: Proceedings of the first SIGMM workshop on Socialmedia. pp. 310. ACM (2009)

    14. Speriosu, M., Sudan, N., Upadhyay, S., Baldridge, J.: Twitter polarity classification withlabel propagation over lexical links and the follower graph. Proceedings of the EMNLP Firstworkshop on Unsupervised Learning in NLP pp. 5363 (2011)

    15. Tan, C., Lee, L., Tang, J., Jiang, L., Zhou, M., Li, P.: User-level sentiment analysis incorporat-ing social networks. In: Proceedings of the 17th ACM SIGKDD Conference on KnowledgeDiscovery and Data Mining (KDD) (2011)

    16. Yu, B.: An evaluation of text classification methods for literary study. Literary and LinguisticComputing 23(3), 327343 (2008)


View more >