# Social Network Sentiment Analysis Using Hybrid Deep Learning Models
## 4 Experiments and Results
### Data Preprocessing and Encoding  
Once the corpus has been selected and the problem classified, the tweets should be cleaned and processed so that the network can understand the texts under the same conditions. The following considerations were taken into account in the preprocessing stage to normalise the data and avoid some grammatical errors:  
* To convert to lowercase to avoid the duplication of words due to the inability to distinguish between upper case and lower case letters.
* To remove URLs as they do not provide information on opinion.
* To remove mentions (@) as they refer to other users and do not provide useful information.
* To remove hashtags (#) and retweets (RTs).
* To remove accents and diacritical vowels to eliminate spelling errors and standardise all words.
* To remove punctuation marks to reduce spelling errors in the text.
* To reduce the repetition of characters, e.g., change \"Holaaaaaa\" to \"hola\" (\"hello\" in English).
* To normalise laughter.
* To standardise slang/jargon to reduce spelling mistakes, e.g., change \"tb\" to \"tambien\" (\"too\" in English), \"tq/tk\" to \"te quiero\" (\"I love you\" in English), \"+\" to \"mas\" (\"more\" in English), and \"x\" to \"por\" (\"for\" in English).  
Nonetheless, it is important to highlight that in the data preprocessing phase of this proposal, no automated text correction tool was used to correct grammatical errors.  
The next step is the tokenisation process, which consists of considering each word of each tweet as a token, so a particular tokeniser created for Twitter called TweetTokenizer [45] will be used. The next step is token extraction, which consists of transforming text into numbers, as a neural network cannot be fed by text strings. In fact, the inputs to the neural network must be only numbers, and in our case, we must transform both the tweet (tokenising and normalising the text) and the tag (which corresponds to a letter and represents the polarity of each tweet). To transform the tweet data into numbers, a dictionary was created in which each tweet will be represented by a vector of corresponding indices in the dictionary. To transform the tags, the One Hot Encoding technique, a mechanism that encodes the different classes as a matrix, was used. In the case that we distinguish between three polarities (P, N, and NONE), the matrix will have three columns, in which a \"1\" is placed in the column corresponding to the class to which a tweet belongs and a \"0\" in the other two columns.  
Finally, feature reduction is an optional step and consists of reducing the vocabulary that the neural network can handle. In our case, initially, we have considered using the following two techniques:  
* To delete Stopwords: There is a set of words that, although necessary to construct meaningful sentences, lack information to determine polarity in texts and/or sentences. In Spanish, these words are prepositions, pronouns, conjunctions, and different forms of certain verbs such as \"haber\" (\"to have\") or \"ser\" (\"to be\"), among others.
* To apply stemming: This is a process of morphological normalisation whereby a word is transformed into its root by removing its suffixes and inflexions. For example, the word \"guapas\" (\"beautiful\") would be converted to its root \"guap\". In this case, we use the SnowballStemmer [46] in Spanish as it is the most used for this type of problem.