Recognition of Sarcasm in Tweets Based on Sentiment Analysis and
3.2 Proposed features
In addition to the ordinary N-gram features, we propose the other three features to characterize the properties of sarcasm. Although the basic ideas of our proposed features are shared with the previous work on the analysis of sarcasm, the ways to extract the features are different. Especially, our sentiment contradiction feature is unique as will be discussed in Subsection 3.2.2. Note that in this study the feature vector is binary: the value of the feature is defined as 1 if it exists in the tweet, 0 otherwise.
3.2.1 Sentiment score features
It is said that sarcasm contains violation of expectations and violation of felicity condi-tions in the statements [23]. Thus, we attempt to recognize the level of violation and aggressiveness of the words in the tweet. The sentiment score feature represents inten-sity of positive or negative sentiment in the tweet. It is basically measured by sentiment scores of the words derived from a public sentiment lexicon. Furthermore, our method
1http://nlp.stanford.edu/software/corenlp.shtml
also considers concepts of the words to obtain the sentiment score feature. Since many potential sentiment words are not compiled in a sentiment lexicon, our system extract the concepts of the unknown sentiment words to alleviate shortage of a public sentiment lexicon. This procedure is called “concept expansion” in our research. Let us consider an example of sarcastic tweet T1.
T1: I love going to work on holidays.
Suppose that the system can identify only one positive word “love” using a sentiment lexicon, while other words have no polarity. By concept expansion, however, we can recognize that the word “work” refers to “tiring” or “stressful situation” and “holiday”
refers to “day where person stay home and relax”. Now the system is able to identify two additional sentiment words “holiday” and “work”, which illustrate positive and negative sentiment respectively. In this way, concept expansion can compensate for insufficiency of the sentiment lexicon.
In this research, two lexicons are used to obtain the sentiment scores of the words:
SentiStrength [49, 84] and SenticNet [85]. SentiStrength is a sentiment analysis tool that estimates the strength of positive and negative sentiment in short texts in English. It has a sentiment lexicon and rules to perform sentiment analysis. The lexicon in SentiStrength provides positive and negative sentiment scores for various types of polarity words such as booster words, question words, emotion words, negation words, slang, idioms and emoti-cons. The score is represented as an integer from −5 to 5 where the large absolute value stands for the strong sentiment. SenticNet is another sentiment lexicon consisting of the sentiment scores for common sense concepts. The sentiment score is scaled from −1.0 to 1.0 to signify the polarity and intensity of the sentiment. The score in SenticNet is multiplied by 5 and rounded so that the sentiment scores of both SentiStrength and Sen-ticNet are represented by an integer from−5 to 5. Finally, the polarity score of the word w, po score(w), is defined as Equation (3.1), where scoreSS and scoreSN are the scores given by SentiStrength (SS) and SenticNet (SN). If the word is found in SentiStrength or SenticNet, the sentiment score in the lexicon is used as the po score(w). If the word is found in both SentiStrength and SenticNet, the average of the sentiment score of both
lexicons is used as thepo score(w). Otherwise, thepo score(w) will be set to 0.
po score(w) =
1
2 (scoreSS(w) +scoreSN(w)) if w∈SS and w∈SN scoreSS(w) or scoreSN(w) if w∈SS orw∈SN
0 otherwise
(3.1)
The extended polarity score of w,ex po score(w), is defined as Equation (3.2)
ex po score(w) =
po score(w) if w∈SS or w∈SN
|C(w)1 |
∑
c∈C(w)
po score c(c) if C(w) is derived by concept expansion
0 otherwise
(3.2) where C(w) is a set of concepts expanded from the word w. The expanded concepts of the word are obtained by choosing the number of appropriate concepts from ConceptNet lexicon. Then, the average sentiment scores of the concepts are used as ex po score(w).
The detailed procedures of concept expansion will be explained in Section 3.3.
Finally, the sum of the sentiment scores of all positive or negative words in the tweet, sum pos scoreor sum neg score, is calculated as Equation (3.3) or (3.4)
sum pos score= ∑
pos w
ex po score(pos w) (3.3)
sum neg score= ∑
neg w
ex po score(neg w) (3.4) wherepos worneg wis the word whose extended polarity score is positive or negative. We define six sentiment score features “po-degree”, wherepois either “positive” or “negative”
and degree is one of “low”, “medium” or “high”. The feature low”, “positive-medium” and “positive-high” is activated if sum pos score= 0, 0 < sum pos score≤ 2 and sum pos score > 2, respectively. The range of the sentiment scores for each class is determined based on our intuition. The sentiment score features for negative polarity are defined similarly.
3.2.2 Sentiment contradiction feature
As previously explained, sarcasm normally occurs in a sentence that expresses the mean-ing opposite to the intended meanmean-ing. Therefore, we attempt to apply the sentiment
analysis to find contradiction in sentiment polarity among the words in the tweet. Al-though conflict of the polarity has been sometimes used in the analysis of sarcasm, an important characteristic of the proposed feature is coherence in the tweet. We assume that coherence identification plays a significant role because the sentiment contradiction found in incoherent sentences may not indicate sarcasm. Let us consider the following two example tweets.
T2: I am coughing and choking. I am feeling great.
T3: I am coughing and choking. Mary is still fine.
Since there are negative words (“coughing” and “choking”) and positive words (“great”
or “fine”), the sentiment contradiction is found in both T2 and T3. However, T2 is sarcasm, while T3 is not. In T2, two sentences are coherent or related to each other.
The coherence is captured by the fact that pronoun “I” is repeated as the subjects of these sentences. T2 clearly shows contradiction in logical meaning by saying the opposite word of the intended word (coughing and choking ̸= great). Thus, T2 can be classified as sarcastic. On the other hand, in T3, there is no sign of logical connection between the words within two sentences. It is obvious that negative and positive words refer to different subjects “I” and “Mary”, respectively. In such cases, the tweet can be regarded as non-sarcastic even when the sentiment contradiction is found.
The sentiment contradiction feature is represented either contra or contra+coher.
The feature contra is activated if the following two conditions are satisfied: 1) the tweet consists of only one sentence and 2) contradiction in sentiment score is found as bothsum pos score (defined in Equation (3.3)) andsum neg score (Equation (3.4)) are greater than 0. The feature contra+coher is activated if the following three conditions are fulfilled: 1) the tweet consists of two or more sentences, 2) contradiction in the senti-ment score is found and 3) the tweet is classified as coherent. The procedures to identify coherence in the tweet will be explained in Section 3.4.
3.2.3 Punctuation and special symbol feature
Many studies have shown that punctuation plays an important role in the text commu-nication as a sign of pausing, changing in the tone of voice or even to indicate the strong
feeling or exaggerate something. Punctuation has a lot of influence in text classification tasks, especially in the area of the sentiment analysis. Special symbols frequently used in Twitter may also be effective for the sarcasm recognition. Thus, punctuation and spe-cial symbols are considered as one of the main features in our research. The following 7 symbols or words are considered as punctuation and special symbol features:
1. Emoticons
2. Repetitive sequence of punctuation 3. Repetitive sequence of characters 4. Capitalized words
5. Slang or booster words2 6. Exclamation marks 7. Idioms3
The frequency of these elements in the tweet, denoted as f re, is classified into three classes: “low” (f re = 0), “medium” (1 ≤ f re ≤ 3) and “high” (f re > 3). The range of the frequency for each class is determined through our preliminary experiment. Our punctuation and special symbol features are represented as the pair of one of 7 elements and 3 frequency classes. That is, 21 features are introduced.