{'fraction_non_alphanumeric': 0.030956905535462514, 'fraction_numerical': 0.009869429289523692, 'mean_word_length': 4.910869565217391, 'pattern_counts': {'":': 0, '<': 1, '<?xml version=': 0, '>': 1, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Language Independent Sentiment Analysis

Social media platforms and online forums generate rapid and increasing amount of textual data. Businesses, government agencies, and media organizations seek to perform sentiment analysis on this rich text data. The results of these analytics are used for adapting marketing strategies, customizing products, security and various other decision makings. Sentiment analysis has been extensively studied and various methods have been developed for it with great success. These methods, however apply to texts written in a specific language. This limits applicability to a limited demographic and a specific geographic region. In this paper we propose a general approach for sentiment analysis on data containing texts from multiple languages. This enables all the applications to utilize the results of sentiment analysis in a language oblivious or language-independent fashion.


I. INTRODUCTION
In recent years, there has been a tremendous increase in generating textual data. Publicly available texts are produced in the form of posts on social media platforms, questions and answers on forums, comments, reviews of products, news, and policy proposals to name a few. The information content of this data is very rich and is of great utility to various sectors of society and economy. Inferring the opinion or feelings of the author of the texts (referred to as sentiment of the text) is of great value for the government, manufacturers, retailers, media organizations, academia, and many other entities.
Manufacturers and content producers can modify product designs or customize according to the market feedback inferred from sentiments of the reviews and comments provided by the users. This, in turn, can lead to greater customer satisfaction and hence enhanced revenue. Advertisers and marketing agencies can use this information for adapting effective marketing strategies and optimize their budgets. Governments and policymakers could use it to predict social reactions to a policy proposal. Sports organizations and clubs can benefit from sentiment analysis on fans' comments to measure players' contribution to a game and hence estimate players' worth.
Given the vast volume, velocity, and varying writing styles of the text, performing manual sentiment analysis, even on a small subset of texts is nearly impossible. Various methods using tools from text analytics, natural language processing and computational linguistics have been developed to automatically judge the sentiment of the text and hence the mood of the source of the text. These tools, however are mainly applicable to the text datasets written in a specific language. Moreover, a wide majority of sentiment analysis models work on the English language. Although English is the most common language used over the internet, there is a sizable body of texts that is written in various other languages.
A versatile sentiment analysis tool that is languageindependent will open a broad avenue of applications that are not limited to a specific geographic region or a group of people. It will also essentially use the best of all worlds, particularly the wide array of tools developed by the natural language processing and text analytics community for the English language can be extended to other languages.
In this paper, we address the problem of sentiment analysis on short texts. We evaluate our model on two publicly available datasets comprised of English and German languages. Our model predicts the sentiment of a text while being oblivious to the language of the text. We achieve significant improvement over the current state-of-the-art on these two dataset in terms of language-independent sentiment analysis.
We report the results of experiments on mixed as well as individual languages. Our model is straight-forward and does not incorporate any language-specific tool. Thus it can readily be extended for language-independent sentiment analysis with more than two languages.
The rest of the paper is organized as follows. We provide a brief review of existing methods for sentiment analysis, multilingual sentiment analysis, and language-independent sentiment analysis in Section II. The proposed model is described in Section III. The description of the datasets along with the results of the experiments are presented in Section IV. Finally, we conclude the paper in Section V.

II. RELATED WORK
People tend to share ideas, opinions, and emotions towards a particular movie, product, service, or personality on the internet. Such shares are often posted on social media platforms. These posts are a source of firsthand information, such as tweets from people at a concert, a game, or a conference. Automatic detection of emotions in these posts can give insight to what populous feel about a particular event, personality or product, consequently facilitating managerial decisions. The problem of identification of emotion in a text is known as "sentiment analysis".
Detecting sentiment in a longer text, such as movie reviews [1], is easier as compared to shorter text due to the greater available context. In tweets, for instance, people tend to use self-created abbreviations due to tweet-length restriction of 140 characters. Furthermore, short texts are also influenced by regional languages and create a distinct informal dialect of communication [2]. The informal language, spelling variations of the same word, and self-created abbreviations make the automatic sentiment analysis task very challenging. One way to enhance short text sentiment analysis is to normalize lexical variations of a word to its standard root word [3]. However, such an approach requires external resources, which might not be available for all languages. More sophisticated approaches translate the source language into English and utilize readily available resources of English language to perform sentiment analysis [4]. However, such an approach cannot be generalized across all languages due to non-availability of robust translation tools. In recent years, deep learning has been extensively used to understand and model natural language. No complex feature engineering is required to model the richness of human language [5]. For language-independent sentiment analysis, a deep learning network has been proposed in [6], which utilizes convolutional neural network (CNN) for feature learning and classification. They proved language independence of the model on English, French, and Greek languages. It is established that using pre-trained embeddings can increase the performance of a deep learning model for tasks involving NLP [7]. Such embeddings, trained on large scale corpus, are readily available for English language [8], [9]. However, not every language enjoys the luxury of the availability of such resources. Therefore, more recent approaches avoid using any language-specific features such as dictionaries, morphological structures, syntactic preprocessing, or pre-trained embeddings [10]. They show that their approach achieves state of the art on three datasets comprising of English, German, and Arabic languages.
Another issue with pre-trained embedding is that it does not account for sentiment polarity of words and might map words with opposite polarities to vectors closer to each other in Euclidean space. A novel sentiment-specific word embedding is proposed for language-independent sentiment analysis, which shows an improvement over traditional pre-trained embeddings of word2vec [11].
The most recent approach addresses the problem of language and domain-independent sentiment detection using the surrounding context of the analyzed document in a character n-gram based model [12]. Their all-in-one classifier achieves comparable performance on multiple domains and languages.

III. PROPOSED APPROACH
For given input text, each word is first mapped to a d dimensional vector, known as word embedding. This word embedding is later used to learn features representations. These features are forwarded to a small classifier for final prediction. More formally, given a text T with t words (T = < w 1 , w 2 , w 3 , ..., w t >), where each word is defined by a d dimensional vector initialized randomly from a uniform distribution, our goal is to predict sentiment y ∈ {positive, neutral, negative} for T . We propose a Convolutional Neural Network (CNN) and Long Short-term Memory (LSTM) based architecture to achieve this goal.
The choice of CNN is made to learn n-gram features from the input text as it has been proven that utilizing ngram features are useful for language-independent models [6], [10]. However, these existing architectures ignore the fact that encoding long-term dependencies in text is also crucial for learning robust feature representation [4]. In the proposed model, we utilize two layers of LSTM to capture long-term dependencies, while to learn n-gram features, CNN is used. A global max-pooling is used on the representation learned by CNN, which outputs the maximum value from each feature map learned by a particular filter. The outputs of the second LSTM and global max-pooling layers are then forwarded to a small feed-forward network for final prediction. This feedforward network consists of a fully-connected (dense) layer, followed by dropout and batch-normalization layers . . . . . . . . . to avoid over-fitting [13], [14]. We use "ReLU" activation function for CNN as well as fully-connected layers, which is defined by σ(x) = max(x, 0). Finally, a "softmax" layer is used to get probabilities for each class and a label is assigned based on maximum probability. Figure 1 illustrates the complete model architecture.

A. Dataset Description
In this study, we use two publicly available datasets, having English and German languages respectively. The Sanders Twitter corpus 1 (hereinafter called as Twitter dataset) is in English language and has 5, 513 tweets, manually annotated as positive, neutral, negative or irrelevant classes. Note that there is no standard train/test split for this particular dataset. Hence, we follow the strategy employed in [10] and randomly split the 20% of the data for testing purposes. We employ stratify sampling method to maintain the ratio of classes in the test split.
The second dataset is in German language for the task of aspect-based sentiment detection 2 (hereinafter referred to as GermEval dataset). The standard training, development, testing 1, and testing 2 splits are available. Despite two test splits, only first split is used for testing in the literature, thus we also opt to use first split for testing. This dataset has only three classes i.e. positive, neutral and negative.
We also combine these two datasets to form a Mixed language dataset for the evaluation of language independence of the proposed model. Note that we do not include the tweets marked as irrelevant from the Twitter dataset in this combined dataset to maintain consistency across both languages. Class distribution with respect to each split of all datasets is given in TableI. We perform all the experiments without any preprocessing or over-sampling.

B. Hyperparameters
We empirically decide the number of CNN filters, kernel size (k) of the CNN filters, LSTM units, and units in Dense layers. The value of k in the CNN layer is set to 7 to learn 7-gram features. The rest of the hyperparameters are 1 https://github.com/zfz/twitter corpus 2 https://sites.google.com/view/germeval2017-absa/data  Table II.

C. Evaluation Metrics
As seen from the Table I, for each dataset, the distribution of number of instances in each class is very skewed, where "neutral" class is dominant by a considerable margin. In such cases, Accuracy is not an optimal measure of performance. Therefore, we choose to evaluate the results in terms of macro F1-score. However, for completeness sake, we also report Accuracy, Precision, and Recall for all variations of the experiments.

D. Results and Discussion
We focus the discussion on the results with respect to F1score. However, other metrics are also reported in Table III. We take the language-independent model presented in [10] as baseline. For mixed languages, we re-run the baseline model as this specific setting of mixed language was not reported in the original study. We perform two kinds of experiments with respect to the choice of embedding dimensions. First, we choose d = 300, as suggested in [10]. Then we also perform the experiments by reducing the embedding dimensions d to 100 and report the performance of the proposed model.
With respect to Twitter dataset, traditional Machine Learning algorithms, such as SVM, Decision Trees, Naive Bayes, and Logistic Regression were applied by [15]. They reported that they achieved 70.10% testing accuracy. Another approach presented in [16] used an ensemble of multiple learning algorithms and utilized majority vote to get the final prediction. This approach was able to achieve an accuracy of 76.30%. A similar approach was opted in [17] which achieved comparable accuracy of 76.25%. More recently, the baseline model based on CNN was able to achieve an accuracy of 78.60% with F1-score of 69.13%. They also perform the experiments by oversampling the underrepresented classes and report an accuracy of 79.57% while F1-score with oversampling was increased to 70.23%. It is worthwhile to note that the proposed model outperforms the baseline for both embedding dimensions choices. However, highest F1-score is achieved with 300 dimensions. With respect to F1-score, our model shows a significant improvement of 2.77% over the baseline. Note that the results indicate that the proposed model has an improved ability to differentiate between the classes without any preprocessing and oversampling. This proves that  the model is robust with respect to skewness in class label distribution, as evident from Figure 2 (a). In regards to GermEval dataset, we report results with respect to test split 1. On this test split, the results of multiple algorithms are reported in [18]. SWN2-RNN approach achieved 74.9% accuracy while fasttext based embedding were able to achieve 74.8% accuracy. A hybrid approach based on SVM and biDirectionalLSTM was able to achieve an accuracy of 74.5%. The baseline model without any oversampling reports the best results in literature on this specific split of GermEval dataset, which is 75.45. However, the F1-score without oversampling is 49.00%. The proposed model is able to achieve an F1-score of 54.79%, which is significantly higher than baseline model (without oversampling). When the strategy of oversampling is incorporated in [10], the F1-score attained a significant boost on the expense of accuracy. Our model achieves comparable results with oversampled baseline model.
Turning now to the case of mixed language, no results in literature exist on this specific setting. However, we rerun baseline model on mixed language dataset. The model was able to achieve an accuracy of 74.75% with F1-score of 57.37%. However, the proposed model with 300 dimensional embedding vectors significantly outperformed the base model with F1-score of 61.24%. The results lead us to conclude that the proposed model exhibits language independence. Figure 2 shows confusion matrix for test split of all three datasets using the proposed model (with 300 dimensional embeddings). The figure shows that the proposed model favors "neutral" class, which makes intuitive sense as the number of instances in this class are significantly higher than other classes.

V. CONCLUSIONS
In this study, we presented a novel architecture for the problem of language independent sentiment analysis. We use two datasets of English and German languages, while we also perform experiments by combining both datasets to evaluate the language independence of the model. We compare our results with existing state-of-the-art model on these datasets and show that the proposed model outperforms the baseline by a significant margin with respect to F1-score on English and mixed language datasets. Our model achieves comparable results on German language dataset. The results show that the proposed model can successfully be applied to multiple or mixed languages, without major loss in predictive performance.