## 2 Materials and Methods
### Feature Selection
The information entropy \(E\)[37] in information theory is used to describe the distribution of keywords in a category. In any category, keywords that appear in many documents can better represent this category, and such terms should be selected to participate in the classification as far as possible. That is, the more evenly distributed keywords among the documents within the class should be given greater weight. \[E(t,C_{i})=-\sum_{j=1}^{n}e_{j} \tag{4}\]  
where \(n\) represents the number of documents in \(C_{i}\); \(e_{j}\) calculates the \(j\)th document in \(C_{i}\), and its definition is as follows. \[e_{j}= \begin{cases}\frac{Nd_{j}}{NC_{i}}\log_{2}\frac{Nd_{j}}{NC_{i}},&NC_{i} \
eq 0\text{ and }Nd_{j}\
eq 0\\ 0,&NC_{i}=0\text{ or }Nd_{j}=0\end{cases}  \tag{5}\]  
where \(Nd_{i}\) represents the number of occurrence times in the \(j\)th document of the category \(C_{i}\) of keyword \(t\), and \(NC_{i}\) represents the number of occurrence times in all the documents of the category \(C_{i}\) of keyword \(t\). The product of Inter-Category Dispersion and Intra-Category Information Entropy is used to replace the _idf_ item in _tf-idf_, thus introducing the statistics of the distribution of feature words between and within categories, so that they can affect the final weight value; that is, the feature selection algorithm _tf-DE_ is shown in the following. \[w_{ij}=tf_{ij}\cdot D(t)\cdot E(t,C_{i}) \tag{6}\]  
In this paper, parameters \(D\) and \(E\) are calculated respectively according to the keyword occurrence times in the dictionary. Similar keywords are selected to be clustered into a class, and this class is then used as the dimension of the vector space to represent the text. In this way, the problems of synonyms in the dictionary can be dealt with, so as to further reduce the dimension of the feature vector and reduce the complexity of the feature weight calculation and distance calculation. The algorithm for feature vector extraction is shown in Algorithm 1, which is explained in detail below. ```
Input: trainText, keywordList Output: keywordList
1. Function Load_trainText(trainText, keywordList)
2. fileID, label = trainText.id, trainText.label
3. keywordResult = KeywordsCheck(trainText, keywordList)
4. for i = 1 to keywordResult.length
5. id = GetKeyword(keywordResult[i])
6. keywordList[id].type[label].file[fileID].count = keywordResult[i].count
7. keywordList[id].type[label].count += keywordResult[i].count Input: keywordList Output: keywordList
8. Function Calc_weight(keywordList)
9. for i = 1 to keywordList.length
10. for j = 1 to M
11. tfij = NC = keywordList[i].type[j]. count
12. for k = 1 to keywordList[i].type[j].fileNum
13. if (keywordList[i].type[j].file[k].count > 0) d[j] = tfij
14. Nd = keywordList[i].type[j].file[k].count
15. E[j] += Nd/NC * log(Nd/NC)
16. D=Standard_deviation(d)
17. for j = 1 to M
18. wij = tfij * D * E[j] Input: testText, keywordList Output: featureVector
19. Function Get. featureVector (testText, keywordList)
20. featureVector = InitFeatureVector(keywordList)
21. keywordResult = KeywordsCheck(text, keywordList)
22. for i = 1 to keywordResult.length
23. id, weightVector = GetKeyword(keywordResult[i])
24. featureVector[id] = weightVector
```  
**Algorithm 1** feature vector extraction algorithm for text  
```
1. Reading training text set. 2. Obtain the training text ID and the category label. 3. Find keywords in the training text. 4. Iterate through the keywords in the training text. 5. Obtain keyword ID. 6. Count the occurrence number of keyword in this text. 7. Count the occurrence number of keyword in the category. 8. Feature vector weight calculation function. 9. Go through the keyword \(i\) in each dictionary. 10. Iterate through each category \(j\). 11. Obtain the occurrence number of keyword \(i\) in category \(j\), that means \(tf_{ij}\) and \(NC\). 12. Go through each document \(k\) in the category
13. Count the number \(d_{j}\) of text containing keyword \(i\) in category \(j\). 14.