# Detecting Suspicious Texts Using Machine Learning Techniques
## 4 Proposed System
### Feature Extraction  
Machine learning models could not possibly learn from the texts that we have prepared. Feature extraction performs numeric mapping on these texts to find some meaning. This work explored the bag of words (BoW) and term frequency-inverse document frequency (tf-idf) feature extraction techniques to extract features from the texts.  
The BoW technique uses the word frequencies as features. Here, each cell gives the count \((c)\) of a feature word \((f_{wi})\) in a text document \((t_{i})\). Unwanted words may get higher weights than the context-related words on this technique. The Tf-idf technique [38] tries to mitigate this weighting problem by calculating the tf-idf value according to Equation (1):  
\[tf-idf(f_{wi},t_{i})=tf(f_{wi},t_{i})\log\frac{m}{|tem:f_{w}et|} \tag{1}\]  
Here, \(tf-idf(f_{wi},t_{i})\) indicates the tf-idf value of word \(f_{wi}\) in text document \((t_{i})\), \(tf(f_{wi},t_{i})\) indicates the frequency of word \(f_{wi}\) in text document \((t_{i})\), \(m\) means total number of text documents, and \(|tem:f_{w}et|\) represents the number of text document \(t\) containing word \(f_{w}\).  
Tf-idf value of the feature words \(((f_{w}))\) puts more emphasis on the words related to the context than other words. To find the final weighted representation of the sentences, compute the Euclidean  
Figure 3: Schematic process of the proposed suspicious text detection system.  
norm after calculating \(tf-idf\) value of the feature words of a sentence. This normalization set high weight on the feature words with smaller variance. Equation (2) computes the norm:  
\[X_{norm}(i)=X_{i}/\sqrt{(X_{1})^{2}+(X_{2})^{2}+...+(X_{n})^{2}} \tag{2}\]  
Here, \(X_{norm}(i)\) is the normalized value for the feature word \(f_{w1}\) and \(X_{1},X_{2}\),..., \(X_{n}\) are the \(tf-idf\) value of the feature word \(f_{w1},f_{w2}\),..., \(f_{wn}\), respectively. Features picked out by both techniques have been applied on the classifier.  
BoW and tf-idf feature extraction techniques are used to extract the features. Table 4 presents the sample feature values for first five feature words \((f_{w1},f_{w2},f_{w3},f_{w4},f_{w5})\) of the first four text samples \((t_{1},t_{2},t_{3},t_{4})\) in our dataset. Features exhibited by an array of size \((m*n)\) having m rows and n columns. A total of 7000 text documents \(t_{1},t_{2}\),..., \(t_{7000}\) are represented in rows while all the feature words \(f_{w1},f_{w2},...,f_{3000}\) are represented in columns. In order to reduce the complexity and computational cost, 3000 most frequent words considered as the feature words among thousands of unique words.  
The model extracted linguistic n-gram features of the texts. The N-gram approach is used to take into account the sequence order in a sentence in order to make more sense from the sentences [39]. Here, 'n' indicates the number of consecutive words that can be treated as one gram. N-gram, as well as a combination of n-gram features, will be applied in the proposed model.  
Table 5 shows the illustration of various n-gram features. The combination of two feature extraction techniques and n-gram features will be applied to find the best-suited model for the accomplishment of suspicious Bengali text detection.