# An Algorithm for the Detection of Hidden Propaganda in Mixed-Code Text over the Internet +
## 4 Propaganda Detection in Mixed-Code Text
### A Mixed Code Text Normalisation Algorithm  
This section presents the proposed algorithm to normalise mixed-code text related to \"Special Characters for Alphabets\", whose pseudocode is reported in Algorithm 1. It consists of four main steps so labelled: (i) _Text Segregation_, which splits words by generating different subset of symbols, (ii) _Character Transformation_, that aims to derive, from each subset of symbols, letters of the alphabet, (iii) _Word Selection_, which deals with the generation and selection of existing words according to a dictionary on the basis of the derived letters, (iv) _Sentence Reconstruction_, which aims to replace the initially mixed-code text with the selected words in order to obtain a meaningful standard textual sentence. A more detailed description of each step is exemplified through a simple reference example. In particular, given the sentence \(S\) in input, as it is represented through the equation (1), which contains a mixed-code text called from now on _Art Form Word--AFW_ (e.g., \"F\(|\{|T\"\}\)\"), each step of the proposed normalisation algorithm is elaborated in the following. \[S=My\;\text{F}|\{|T\;is\;cold\} \tag{1}\]  
_Text Segregation step_: this step has a syntactic function, and it works on the single words. It aims to create groups of symbols starting form the _AFW_ in consideration. In particular, after splitting the sentence into subwords and identify those containing nonalphabetic characters, for each _AFW_ the algorithm reworks its sequence of characters by grouping them differently, and generating several combinations, as it is shown in Table 3. In this approach a recursive operation is used to make combinations. It iterates through all the characters to make all the possible combinations. The process keeps one character constant and makes combinations with the rest of the remaining characters. Then it takes the first and second characters together and then makes combinations with the rest of the remaining characters. This operation is carried out exhaustively. In is assumed that, the order of the symbols through which the mixed-code text is built, and as a consequence the order of the combinations, reflects the order of the letters in the standard word. It means that the word has been written in the order it is meant to be read and it is not an anagram. Figure 2: Research approach: data management, phases and work-products. ```
Data: String S={W\({}_{1}\), W\({}_{2}\),..., W\({}_{k-1}\), W\({}_{k}\) };  Placeholder={P\({}_{1}\), P\({}_{2}\),..., P\({}_{k-1}\), P\({}_{k}\) };  CandidateWords cw[];  Integer i=1; j=1; z=1;  Word w; CharactersGroup cg; String S\({}_{Norm}\);  SegregationMatrix SM [K][N][M];  TransformedCharacter TC [M]; Text Segregation step: while i<= S.size()do // - as long as there are words  w=S.getWord(i); // take the i-th word ifw.isNotMixedCode()then // if the i-th word is a regular word \(S_{Norm}\).append\({}_{i}\)(w); // it does not have to be normalised else  S\({}_{Norm}\).append\({}_{i}\)(P\({}_{i}\)); // create a place holder in the i-th position  SM\({}_{k=i}\).segregate(w); // segregate the i-th word  end if i++;  end while Character Transformation step: while j<= SM.GroupSize()do // for each segregated word  cg=SM.getGroup(j); // select the j-th group of characters ifcg.isAnAlphabeticCharacter()then // if it is one of the standard alphabetic letters  TC[j]=cg; //apply the rule-1 by considering it as it is else  TC[j]=convertIntoSingleCharacter(cg); //apply the rule-2 by using OCR to transform the j-th cg group of symbols into one alphabetic character.