# Topic-Specific Emotion Mining Model for Online Comments
## 3 Proposed Model
### Extraction of Aspect-Opinion Pairs  
In this subsection, we will explain in detail how to extract aspect-opinion pairs from online reviews.  
The traditional topic model does not take into account the relationship between words, resulting in semantic loss, which causes the emotion mining results to have low accuracy and be incomprehensible. To resolve this problem, we match opinions with the aspect words evaluated by them. In this way, each single word in the word bag is replaced by a word pair. In our paper, the method to extract an aspect-opinion pair is pattern matching based on part of speech.  
To a large extent, the aspect word is a noun or a noun phrase, and the part of speech of an opinion is adjective, adverb, or verb. Here, nouns, adjectives, adverbs, and verbs are reserved for extracting aspect-opinion pairs. Adverbs are utilized to embellish adjectives or verbs. As a result, adverbs are merged with the part modified by them into a whole, and then the part of speech of the whole is annotated as the property of modifier, which not only simplifies the matching pattern, but also solves the problem of negation to some extent. When the opinion words are modified by negative words, it will lead to the emotional reversal of the opinion words. Because negatives are usually adverbs in Chinese, this problem can be solved by combining them with modifiers. For example, in the comment \"the appearance is not good\", the phrase (not(adv.) good(adj.)) changes into a compound phrase (not good(adj.)). For the sake of brevity, nouns, adjectives, adverbs, and verbs are respectively abbreviated to n., a., d., and v. in the paper. The matching pattern we have designed is shown in Table 2. And the aspect-opinion pair extraction method based on pattern matching is shown in Algorithm 1.  
```
Input: A collection of user online comments D Output: Aspect-opinion pairs <Wa,Wo> set S of each comment
1. for each comment text d in D:
2. Divide the comment text into comment fragments set based on separator (comma or space) in the text;
3. for each comment fragment in comment text d:
4. segment words and part-of-speech tagging using word segmentation tools;
5. reserve nouns, adjectives, verbs, and adverbs;
6. if adverb of existence in comment fragment:
7. merge adverbs with the part modified by them into a whole, and then annotate the part of speech of the whole as the property of modifier;
8. do pattern matching according to Table 2;
9. put aspect-opinion pairs <Wa,Wo> into set S;
10. end for
11. output the aspect-opinion pairs set S;
12. end for
```  
**Algorithm 1**Aspect-opinion pair extraction based on pattern matching In Chinese, people like to use commas or spaces to divide a comment into fragments. Each comment is divided into comment fragments according to the actual separator (comma or space) used by the comment. In order to reduce redundancy and improve accuracy, we performed pattern matching for each comment fragment instead of for the whole review.  
Because of the differences between Chinese and English expressions, the matching pattern of aspect-opinion pairs is different. The matching pattern is designed for Chinese texts in this paper.