## 3 General Framework and Methodology
### Keyword Expansion Technique
#### 3.2.2 Word2 Vec  
Word2 Vec is a shallow neural network model for converting words into vectors. It captures the semantic and syntactic relationships between words by analyzing the context of the words. Word2 Vec has two main architectures: CBOW (Continuous Bag of Words) and skip-gram. CBOW predicts the target words based on the contextual vocabulary, while skip-gram predicts the contextual vocabulary based on the target words. During training, the model adjusts the weights to minimize the prediction error. Eventually, words are represented as vectors which are semantically similar in terms of proximity in the vector space. Word2 Vec performs well in handling large-scale corpora and capturing lexical-semantic relations, and it is widely used in natural language processing tasks.  
The Continuous Bag of Words (CBOW) model is a word bag model that predicts the word vector of the current word using the word vectors of the surrounding context. The model diagram is shown in Figure 2, which includes an input layer, a projection layer, and an output layer. The training process of the CBOW model is as follows:  
Assume that there are N words in the document. Select n words before and after the target word for training.  
1. The input layer takes the one-hot vectors X1 to Xn of the n words surrounding the current predicted word as input, each of which is 1 \(\times\) N-dimensional.
2. Initialize the weight matrix W N \(\times\) d. Multiplying the input layer vectors by W N \(\times\) d yields n one-dimensional vectors of length d, where d is the predefined word vector dimension. Summing these vectors and taking their average yields the projection layer vector h.
3. Initialize the weight matrix W\({}^{\prime}\). Multiply the vector h by W\({}^{\prime}\) to obtain the vector u. Apply the Softmax function to calculate the probabilities of each predicted word. Setthe position of the word with the highest probability to 1 and all others to 0, resulting in the final output being a one-hot vector for a single word.
4. Compare the calculated vector with the one-hot vector of the currently predicted word, continuously optimize the weight matrix to maximize the predicted probability of the predicted word, and converge. At this point, the weight matrix W is the desired word vector matrix, where each column represents the word vector of each word. Multiplying it by the one-hot vector of a specific word yields the corresponding word vector.  
The skip-gram model predicts the word vectors of its context based on the word vector of the current word. Its model diagram is shown in Figure 3. The training process is similar to that of CBOW. The input is the one-hot vector of the current predicted word, and the output is the one-hot vector of the n words above and below it. After training is complete, the final weight matrix W is obtained, which is the word vector matrix.  
Figure 3: Skip-gram model.  
Figure 2: CBOW model.  
By using the trained Word2 Vec model, the vector similarity between the keyword and other words is calculated. Based on the similarity, we filter out the words that are semantically similar to the keywords and use them as extended keywords. For example, given the keyword \"cold\", we find words with high similarity to the vector of \"cold\", such as \"influenza\", \"fever\", \"cough\", \"fever\", \"cough\", etc., to realize the semantic expansion of the keywords, which helps to cover the related concepts more comprehensively and improve the effect of text analysis and information retrieval.