## 4 Sentiment Analysis from Text  
In our model, opinion captures sentiments about information. The information regarding opinions in the ARCOMEM system is expressed by means of three basic concepts, as follows:  
1. Opinion Holder: the author/contributor;
2. Sentiment Classification: a classification of the way in which the opinion is expressed. The classification of opinion types is restricted to two classes: * Polarity represents the basic positive/negative/neutral classification; * Scale indicates a gradient classification from e.g., very negative to very positive, represented numerically by a figure between \(-1\) and \(+1\);
3. Opinion Target: the entities, events _etc._ the opinion is about.  
The sentiment analysis application is developed in GATE, and is designed to run on text annotated with entities and events, and the relevant linguistic processing associated with these (sentences, tokens, POS tags, morphological analysis, Noun Phrase (NP) and Verb Phrase (VP) chunks). We shall not describe the entity and event recognition system here as it is fully covered in [30; 31]. However, Figure 2 shows how the two systems fit together.  
The sentiment analysis application depicted on the right hand side of Figure 2 comprises the following components:  
* Flexible Gazetteer Lookup: this matches lists of affect/emotion words against the text. We use a flexible gazetteer, which means that the words in the list are matched according to their root form. This enables different lexicalisations, e.g., plurals, different verb forms _etc._ to match against each other. However, we do restrain the matching (at a later point in the grammar rules) so that a match is only valid if the same POS applies to both, _i.e._, a verb will not be matched with an adjective. This is because many sentiment-bearing words differ in sentiment when used as different parts of speech (compare e.g., \"I like it\" with \"someone like me\");
* Regular Gazetteer Lookup: this uses a regular gazetteer, and matches lists of affect/emotion words against the text only if they occur in exactly the same form as the list, _i.e._, different lexicalisations are not matched, because these tend to be specific terms such as swear words or phrases. For example, \"bloody\" is often used as a swear word, but \"blood\" is not, so we only want a match with a swearing sentiment when it is used as an adjective;
* Comment Detector: this set of JAPE grammars identifies comments found in news texts and blogs and annotates them separately from the main articles, so that sentiments can be aggregated appropriately;
* Sentiment Grammars: sets of hand-crafted JAPE rules which annotate sentiments and link them with the relevant targets and opinion holders. It includes modules for detection of conditional sentences, questions, sarcasm, swearing _etc_;
* Sentiment Aggregation: Groovy scripts which combine the scores for sentiments over sentences, paragraphs and documents and output an aggregated score for each;* RDF Generation: creates the relevant RDF-XML according to the data model from the annotations. This enables the output to be used by other applications, such as the opinion event detection module.  
More detailed description of these components and the method used for sentiment analysis can be found in [32,33], while detailed description of the mechanisms for sarcasm detection can be found in [20]. In short, we use a combination of sentiment dictionary lookup, where every sentiment-containing word has a starting score, and then sets of rules which attach the sentiments to the correct target and opinion holder entities, and which adjust the score of the sentiment overall by considering not just the combination of sentiment words but also negatives, adverbs, sarcasm, conditional sentences, and so on, all of which affect the score. For example, a negative word will flip the polarity of the word or phrase that is negated; an adverb or swear word will generally enhance the value of a sentiment that is in a linguistic relation with it.  
Figure 2: System Architecture.