{'fraction_non_alphanumeric': 0.033287101248266296, 'fraction_numerical': 0.007397133610725843, 'mean_word_length': 5.047840944392669, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Constructing Thai Opinion Mining Resource: A Case Study on Hotel Reviews

Opinion mining and sentiment analysis has recently gained increasing attention among the NLP community. Opinion mining is considered a domaindependent task. Constructing lexicons for different domains is labor intensive. In this paper, we propose a framework for constructing Thai language resource for feature-based opinion mining. The feature-based opinion mining essentially relies on the use of two main lexicons, features and polar words. Our approach for extracting features and polar words from opinionated texts is based on syntactic pattern analysis. The evaluation is performed with a case study on hotel reviews. The proposed method has shown to be very effective in most cases. However, in some cases, the extraction is not quite straightforward. The reasons are due to, firstly, the use of conversational language in written opinionated texts and, secondly, the language semantic. We provide discussion with possible solutions on pattern extraction for some of the challenging cases.


Introduction
With the popularity of Web 2.0 or social networking websites, the amount of user-generated contents has increased exponentially. One interesting type of these user-generated contents is texts which are written with some opinions and/or sentiments. An in-depth analysis of these opinionated texts could reveal potentially useful information regarding the preferences of people towards many different topics including news events, social issues and commercial products. Opinion mining and sentiment analysis is such task for analyzing and summarizing what people think about a certain topic.
Due to its potential and useful applications, opinion mining has gained a lot of interest in text mining and NLP communities (Ding et al., 2008;Jin et al., 2009). Much work in this area focused on evaluating reviews as being positive or negative either at the document level (Turney, 2002;Pang et al., 2002;Dave et al., 2003;Beineke et al., 2004) or sentence level (Kim and Hovy, 2004;Wiebe and Riloff, 2005;Wilson et al., 2009;Yu and Hatzivassiloglou, 2003). For instance, given some reviews of a product, the system classifies them into positive or negative reviews. No specific details or features are identified about what customers like or dislike. To obtain such details, a feature-based opinion mining approach has been proposed (Hu and Liu, 2004;Popescu and Etzioni, 2005). This approach typically consists of two following steps.
1. Identifying and extracting features of an object, topic or event from each sentence upon which the reviewers expressed their opinion.
2. Determining whether the opinions regarding the features are positive or negative.
The feature-based opinion mining could provide users with some insightful information related to opinions on a particular topic. For example, for hotel reviews, the feature-based opinion mining allows users to view positive or negative opinions on hotel-related features such as price, service, breakfast, room, facilities and activities. Breaking down opinions into feature level is very essential for decision making. Different customers could have different preferences when selecting hotels to stay for vacation. For example, some might prefer hotels which provide full facilities, however, some might prefer to have good room service.
The main drawback of the feature-based opinion mining is the preparation of different lexicons including features and polar words. To make things worse, these lexicons, especially the features, are domain-dependent. For a particular domain, a set of features and polar words must be prepared. The process for language resource construction is generally labor intensive and time consuming. Some previous works have proposed different approaches for automatically constructing the lexicons for the featurebased opinion mining (Qiu et al., 2009;Riloff and Wiebe, 2003;Sarmento et al., 2009). Most approaches applied some machine learning algorithms for learning the rules from the corpus. The rules are used for extracting new features and polar words from untagged corpus. Reviews of different approaches are given in the related work section.
In this paper, we propose a framework for constructing Thai language resource for the feature-based opinion mining. Our approach is based on syntactic pattern analysis of two lexicon types: domain-dependent and domainindependent. The domain-dependent lexicons include features, sub-features and polar words. The domain-independent lexicons are particles, negative words, degree words, auxiliary verbs, prepositions and stop words. Using these lexicons, we could construct a set of syntactic rules based on the frequently occurred patterns. The rule set can be used for extracting more unseen sub-features and polar words from untagged corpus.
We evaluated the proposed framework on the domain of hotel reviews. The experimental results showed that our proposed method is very effective in most cases, especially for extracting polar words. However, in some cases, the extraction is not quite straightforward due to the use of conversational language, idioms and hidden semantic. We provide some discussion on the challenging cases and suggest some solutions as the future work.
The remainder of this paper is organized as follows. In next section, we review some related works on different approaches for constructing language resources for opinion mining and sentiment analysis. In Section 3, we present the proposed framework for constructing Thai opinion mining resource by using the dual pattern extraction method. In Section 4, we apply the proposed framework with a case study of hotel reviews. The performance evaluation is given with the experiment results. Some difficult cases are discussed along with some possible solutions. Section 5 concludes the paper with the future work.

Related work
The problem of developing subjectivity lexicons for training and testing sentiment classifiers has recently attracted some attention. The Multiperspective Question Answering (MPQA) opinion corpus is a well-known resource for sentiment analysis in English . It is a collection of news articles from a variety of news sources manually annotated at word and phrase levels for opinions and other private states (i.e., beliefs, emotions, sentiments, speculations, etc.). The annotation in this work also took into account the context, which is essential for resolving possible ambiguities and accurately determining polarity.
Although most of the reference corpora has been focused on English language, work on other languages is growing as well. Kanayama et al. (2006) proposed an unsupervised method to detect sentiment words in Japanese. In this work, they used clause level context coherency to identify candidate sentiment words from sentences that appear successively with sentences containing seed sentiment words. Their assumption is that unless the context is changed with adversative expressions, sentences appearing together in that context tend to have the same polarities. Hence, if one of them contains sentiments words, the other successive sentences are likely to contain sentiment words as well. Ku and Chen (2007) proposed the bag-of-characters approach to determine sentiment words in Chinese. This approach calculates the observation probabilities of characters from a set of seed sentiment words first, then dynamically expands the set and adjusts their probabilities. Later in 2009, Ku et al. (2009), extended their bag-of-characters approach by including morphological structures and syntactic structures between sentence segment. Their experiments showed better performance of word polarity detection and opinion sentence extraction.
Some other methods to automatically generate resources for subjectivity analysis for a foreign language have leveraged the resources and tools available for English. For example, Benea et al. (2008) applied machine translation and standard Naive Bayes and SVM for subjectivity classification for Romanian. Their experiments showed promising results for applying automatic translation to construct resources and tools for opinion mining in a foreign language. Wan (2009) also leveraged an available English corpus for Chinese sentiment classification by using the co-training approach to make full use of both English and Chinese features in a unified framework. Jijkoun and Hofmann (2009) also described a method for creating a Dutch subjectivity lexicon based on an English lexicon. They applied a PageRank-like algorithm that bootstraps a subjectivity lexicon from the translation of the English lexicon and rank the words in the thesaurus by polarity using the network of lexical relations (e.g., synonymy, hyponymy) in Wordnet.

The proposed framework
The performance of the feature-based opinion mining relies on the design and completeness of related lexicons. Our lexicon design distinguishes lexicons into two types, domaindependent and domain-independent. The design of domain-dependent lexicons is based on the feature-based opinion mining framework proposed by Liu et al. (2005). The framework starts by setting the domain scope such as digital camera. The next step is to design a set of features associated with the given domain. For the domain of digital camera, features could be, for instance, "price", "screen size" and "picture quality". Features could contain sub-features. For example, the picture quality could have the subfeatures as "macro mode", "portrait mode" and "night mode". Preparing multiple feature levels could be time-consuming, therefore, we limit the features into two levels: main features and subfeatures.
Another domain-dependent lexicon is polar words. Polar words are sentiment words which represent either positive or negative views on features. Although some polar words are domain-independent and have explicit meanings such as "excellent", "beautiful", "expensive" and "terrible". Some polar words are domaindependent and have implicit meanings depending on the contexts. For example, the word "large" is generally considered positive for the screen size feature of digital camera domain. However, for the dimension feature of mobile phone domain, the word "large" could be considered as negative.
On the other hand, the domain-independent lexicons are regular words which provide different parts of speech (POS) and functions in the sentence. For opinion mining task, we design six different domain-independent lexicons as follows (some examples are shown in Table 1).
• Particles (PAR): In Thai language, these words refer to the sentence endings which are normally used to add politeness of the speakers (Cooke, 1992).
• Negative words (NEG): Like English, these words are used to invert the opinion polarity. Examples are "not", "unlikely" and "never".
• Degree words (DEG): These words are used as an intensifier to the polar words. Examples are "large", "very", "enormous".
• Prepositions (PRE): Like English, Thai prepositions are used to mark the relations between two words.
• Stop words (STO): These words are used for grammaticalization. Thai language is considered an isolating language, to form a noun the words "karn" and "kwam" are normally placed in front of a verb or a noun, respectively. Therefore, these words could be neglected when analyzing opinionated texts. Although some of the above lexicons are similar to English, however, some words are placed in different position in a sentence. For example, in Thai, a degree word is usually placed after a polar word. For example, "very good" would be written as "good very" in Thai. Figure 1 shows all processes and work flow under the proposed framework. The process starts with a corpus which is tagged based on two lexicon types. From the tagged corpus, we construct patterns and lexicons. The pattern construction is performed by collecting text segments which contain both features and polar words. All patterns are sorted by the frequency of occurrence. The lexicon construction is performed by simply collecting words which are already tagged with the lexicon types. The lexicons are used for performing the feature-based opinion mining task such as classifying and summarizing the reviews as positive and negative based on different features. The completeness of lexicons is very important for the feature-based opinion mining. To collect more lexicons, patterns are used in the dual pattern extraction process to extract more features and polar words from the untagged corpus.

A case study of hotel reviews
To evaluate the proposed framework, we perform some experiments with a case study of hotel reviews. In Thailand, tourism is ranked as one of the top industries. From the statistics provided by the Office of Tourism lions. The number of registered hotels in all regions of Thailand is approximately 5,000. Providing an opinion mining system on hotel reviews could be very useful for tourists to make decision on hotel choice when planning a trip.

Corpus preparation
We collected customer reviews from the Agoda website 2 . The total number of reviews in the corpus is 8,436. Each review contains the name of the hotel as the title and comments in free-form text format. We designed a set of 13 main features: service, cleanliness, hotel condition, location, food, breakfast, room, facilities, price, comfort, quality, activities and security. The set of main features is designed based on the features obtained from the Agoda website. Some additional features, such as activities and security, are added to provide users with more dimensions.
In this paper, we focus on two main features: breakfast and service. Table 2 shows the domain-dependent lexicons related to the breakfast feature. For breakfast main feature (FEA), we include all synonyms which could be used to describe breakfast in Thai. These include English terms with their synonyms, transliterated terms and abbreviations.
The breakfast sub-features (FEA*) are specific concepts of breakfast. Examples include "menu", "taste", "service" and "coffee". It can be observed that some of the sub-features could also act as a main feature. For example, the sub-feature "service" of breakfast is also used as the main feature "service". Providing subfeature level could help revealing more insightful dimension for the users. However, designing multiple feature levels could be time-consuming, therefore, we limit the features into two levels, i.e., main feature and sub-feature. The polar words (POL) are also shown in the table. We denote the positive and negative polar words by placing [+] and [-] after each word. It can be observed that some polar words are dependent on sub-features. For example, the polar word "long line" can only be used for the sub-feature "restaurant".
2 Agoda website: http://www.agoda.com Table 2: Domain-dependent lexicons for the breakfast feature. Table 3 shows the domain-dependent lexicons related to the service feature. The main features include synonyms, transliterated and English terms which describe the concept service. The service sub-features are, for example, "reception", "security guard", "maid", "waiter" and "concierge". Unlike the breakfast feature, the polar words for the service feature are quite general and could mostly be applied for all subfeatures. Another observation is that some of the polar words are based on Thai idiom. For example, the phrase "having rigid hands" in Thai means "impolite". In Thai culture, people show politeness by doing the "wai" gesture.

Experiments and results
Using the tagged corpus and the extracted lexicons, we construct the most frequently occurred patterns. For two main features, breakfast and service, the numbers of tagged reviews for each feature are 301 and 831, respectively. We randomly split the corpus into 80% as training set and 20% as test set. We only consider the patterns which contain both features (either main features or sub-features) and polar words. For the breakfast feature, the total number of extracted patterns is 86. For the service feature, the total number of extracted patterns is 192.  occurred patterns extracted from the corpus. The symbols of the tag set are as shown in Table 1 and 2 with the tag <OTH> denoting any other words.
From the tables, two patterns which occur frequently for both features are <FEA><POL> and <FEA*><POL>. These two patterns are very simple and show that the opinionated texts in Thai are mostly very simple. Users just simply write a word describing the feature followed by a polar word (either positive or negative) without using any verb in between. Some examples for the pattern <FEA*><POL> are <coffee cup><dirty> and <employee><friendly>. In English, a verb "to be" (is/am/are) is usually required between <FEA*> and <POL>.
Using the extracted patterns, we perform the dual pattern extraction process to collect the sub-features and polar words from the test data set. Table 6 shows the evaluation results of sub-features and polar words extraction for both breakfast and service features. It can be observed that the set of patterns could extract polar words (POL) with higher accuracy than sub-features (FEA*). This could be due to the patterns used to Table 4: Top-ranked breakfast patterns with examples describe the polar words are straightforward and not complicated. This is especially true for the case of breakfast feature in which the accuracy is approximately 95%.  Table 6: Evaluation results of features and polar words extraction.
not be easily captured. The difficulties are due to many reasons including the language semantic and the need of world knowledge. For example, in case #5 of service feature, the whole phrase can be interpreted as "attentive". It is difficult for the system to generate the pattern based on this phrase. Another example is case #4 of both tables, the customers express their opinions by comparing to other hotels. To analyze the sentiment correctly would require the knowledge of a particular hotel or hotels in specific locations.

Conclusion and future work
We proposed a framework for constructing Thai opinion mining resource with a case study on hotel reviews. Two sets of lexicons, domaindependent and domain-independent, are designed to support the pattern extraction process. The proposed method first constructs a set of patterns from a tagged corpus. The extracted patterns are then used to automatically extract and collect more sub-features and polars words from an untagged corpus. The performance evaluation was done with a collection of hotel reviews obtained from a hotel reservation website. From the experimental results, polar words could be extracted more easily than sub-features. This is due to the polar words often appear in specific positions with repeated contexts in the opinionated texts. In some cases, extraction of subfeatures and polar words are not straightforward due to the difficulties in generalizing patterns. For example, some subjectivity requires complete phrases to describe the polarity. In some cases, the sub-features are not explicitly shown in the sentence. For future work, we plan to complete the construction of the corpus by considering the rest of main features. Another plan is to include the semantic analysis into the pattern extraction process. For example, the phrase "forget something" could imply negative polarity for the service feature.