Frontiers in Computing and Intelligent Systems ISSN: 2832-6024 | Vol. 10, No. 3, 2024 95 Analysis and Optimization Scheme of the Effectiveness of Word2vec in Intelligent Recommendation of Traditional Chinese Medicine Folk Prescriptions Xue Bai 1, Gao Wei 1, Tao Ye 2 1 Harbin Institute of Finance, Harbin, Heilongjiang, China 2 University of Science and Technology Liaoning, Anshan, Liaoning, China Abstract: With the rapid development of science and technology and medical intelligence, personalized intelligent recommendation has been applied more and more widely in the medical field. For a patient, it is a very important link to find a suitable prescription, but in the face of many treatment programs and prescriptions, it is difficult for users to quickly obtain effective information and make a choice suitable for their condition. By analyzing the individual needs of users, valuable information is mined from a large number of traditional Chinese medicine treatments and remedies, and it is recommended to users to provide help for users to get treatment in time. However, most of the existing TCM prescription recommendation systems are based on traditional collaborative filtering or content-based recommendation algorithms, which lack in-depth mining of the semantic information of TCM prescription. Therefore, this paper proposes an intelligent recommendation method for traditional Chinese medicine prescriptions based on Word2vec model, aiming to improve the accuracy and personalization of the recommendation system by learning the semantic representation of traditional Chinese medicine prescriptions. Since Word2vec model does not distinguish the semantic relationship between context words and central words, the semantic is relatively missing, and the effect on subsequent tasks is limited. Therefore, it is of great significance to propose an optimization plan to effectively promote the modernization and intelligent development of traditional Chinese medicine. Keywords: Intelligent Recommendation; Word2vec Model; Collaborative Filtering; Content-based Recommendation. 1. Introduction Text classification is a fundamental task in the field of natural language processing (NLP) [1], which classifies text data into predefined categories. Traditional text classification methods mainly rely on artificially designed features, such as word frequency, TF-IDF, etc. However, these methods often fail to fully capture the semantic information of words. In recent years, the emergence of word embedding technologies such as Word2vec [2] has provided a new solution for text classification. This paper will discuss the application of Word2vec in Chinese text classification and its advantages. After thinking that the folk formula entered by the user is random and relatively oral, this paper uses the cosine similarity calculation method, so that the text similarity calculation method is further updated and improved, so that the user can find the most suitable folk formula more obvious. There is also the keyword comparison, the user input of the disease is compared one by one, the similarity comparison calculation, and then the recommendation system is further improved. 2. Word2vec Model Word2vec is an efficient technique for creating word embeddings where each word is represented by a fixed-length vector using a two-layer neural network. Word2vec technology mainly includes: continuous word bag (CBOW) [3] model and skit-gram [4] model, which can provide high- quality word embedding vector. Where CBOW predicts the word for a given context, Skip-gram predicts the context for a given word, and its essential feature is to identify a word as a vector. Therefore, Word2Vec word vector can better express the similarity and analogy relationship between different words. Word2Vec pre-trained word vector will also consider the relationship between the order and context of words. Considering the distribution representation of emotion words themselves, it can map words with similar semantics into similar vector Spaces. Thus, the semantic relation between words can be realized. Compared with the current popular BERT model [5], Word2Vec word embedding is simpler and more efficient. The language model is trained by the neural network language model to train the generated word vector, which first realizes the prediction according to the obtained probability and then according to the words appearing in the context, and optimizes the objective function of the model by constructing the neural network. Word2vec is a combination of models that do the work of generating word vectors, which can be understood as simplified neural networks that can represent words as low-dimensional dense vectors, which was proposed in 2013, and open-source computing tools for the same term vectors. These models are generally three-layer network structure, training and reconstruction to get the desired word text, and the relevant input words are guessed to a certain degree, after the model is trained, Word2vec will carry out one-to-one relationship mapping between words and vectors, and the relationship between vectors maps the relationship between words and words. As shown in Figure 1 below. CBOW makes predictions based on some context of the present word, while the other model makes predictions based on some context of the present word. CBOW predicts tw based on some contexts 211 ,,,  ttt2t wwww of the present word tw , while the other model predicts 211 ,,,  ttt2t wwww of the present 96 word tw . Among them, both of them adopt the hierarchical structure of input, projection and output. Taking CBOW model to implement Word2vec as an example, it first uses )tion(representahot -one jtx  to convert the context mt1t1tmtt wwwwc  ,...,,,...,: of word tw into the input word vector ( jtv  ): Figure 1. CBow and skip gram model diagram }0{\},...,{, mmjVv jtxjt   Then, the relative context input word vector mtttmt vvvv  ,...,,,... 11 of the current word tw is averaged, and this value is used as the input of the model:    j mmjv m v jtt }0/{},...,{, 2 1 ˆ This step is called projection. The softmax() function is then used to output the probability that the word is a word, thereby reducing the computation time: tvUz ˆ VwvusoftmaxzsoftmaxwwwwwPy tiimtttmtii   i ),ˆ()(),...,,,...,|(ˆ 11 Therefore, the VU, word vector matrix is the parameter of the model, and for the central word tw , the CBOW model calculates its loss as:            || 1 || 1 || 1 11 ˆˆ ˆ ˆ ,...,,,...,| ˆ v k kt v k tktt v k tk tt t mtttmtt t zexplogz )vexp(ulogvu )vexp(u )vexp(u log ) softmax(zlog )wwwwlogP(w y logL Therefore, the empirical risk of the model is:    mt mtw ty log ˆ In general, since CBOW trains the model in a linear context, it is better able to express the semantic similarity between words to a certain extent. For example: The word segmentation operation of the "intelligent Chinese medicine prescription system" will get the word segmentation effect of intelligent, Chinese medicine, folk prescription and system. After word segmentation, it will enter the output layer for input, and for each word, it has its own corresponding input layer. The meaning expressed by SUM in Figure 1 is to sum "intelligence", "traditional Chinese medicine", "recommendation" and "system" in the input layer for feature words vector. Under the study of neural network language model. Word2vec is used to improve the neural network language model in the following aspects. Improving the frequency of words in the corpus is the first prerequisite for data training. Because adding words with low frequency to the dictionary not only takes up a lot of memory space, but also has a great impact on the frequency of training. At the same time, if the words with fewer occurrences do not meet its training times, the accuracy of the training word vector will also decline, so the use of word2vec these noises will be eliminated, that is to say, the words with small occurrences of words in the vocabulary will be ignored. The input layer is entered according to the sum of the word vectors, which is different from the original order of the word vectors of the input words, and the training speed is significantly improved by reducing the calculation amount. To remove the hidden layer, you sum the vectors in the input layer first, and then connect them directly to the output layer. This will not affect the effect of training, but the amount of calculation training will be reduced. The requirement of training speed is to improve it and reduce complexity at the same time, so the negative sample algorithm is referenced. In fact, the negative sample algorithm is a method of replacing the word order central words in the corpus with other words, and then constructing 97 words that are not in the corpus. For the word2vec calculation method, it is based on the distribution of words, and for words, they are the same, indicating that the context has similar semantics. Using the word2vec model to represent the feature word vector that the user wants to remedy in the text input, the word vector of these words can be combined into a large vector to represent the user's intention. The similarity of each recipe is shown in the data, so the user can be recommended a recipe that is semantically similar to the user's intention. 3. Optimization Scheme of Intelligent Recommendation of Traditional Chinese Medicine Prescription based on Word2vec Model In this paper, through thinking and comprehensive analysis of the intelligent traditional Chinese medicine prescription recommendation, practical application and main features, Word2vec model is used to build a model for the intelligent traditional Chinese medicine prescription recommendation system. Then I thought that the folk formula input by the user is random and relatively oral, so this paper uses the cosine similarity calculation method, so that the text similarity calculation method is further updated and improved, so that the effect of users can find the most suitable folk formula is more obvious. There is also keyword comparison, one by one comparison of the user's input conditions, similarity comparison calculation, and then further improve the recommendation system, through the following ways to optimize the intelligent recommendation of traditional Chinese medicine prescriptions based on Word2vec model. 3.1. Personalized Recommendation Technology Personalized recommendation refers to the creation of characteristic models for users or administrators through user's or administrator's registration information, user's usage of prescription, record of selecting prescription, query of prescription, and evaluation information of prescription, combined with the application analysis of artificial intelligence in the medical field, and then selecting a well- matched model by using relevant technologies. Finally, the most suitable prescription is recommended to users or administrators. Behavioral data refers to the user's behavioral information data, such as user queries, clicks, browsing history, browsing time, product reviews and ratings. In personalized recommendation technology, users' feedback to the system also has its own characteristics. Display feedback refers to user information, reviews, etc. Implicit feedback represents whether the user has adopted the recipe, and how it has been used. By comparing them, it can be seen that the amount of implicit feedback data is wider, so that the implicit feedback data can be used to deeply understand the direction of users' needs, which requires the application of data mining knowledge, and then obtain the degree of users' folk prescription intention, and conduct modeling operations on it, so that users can be satisfied with the folk prescription needs based on personal information. The essence of personalized recommendation is to implement the recommendation algorithm. In the previous description, it can be understood that the main implementation process of the collaborative filtering algorithm is to recommend the folk recipe information used by the user, which is recommended many times because of the use of more, which is relatively limited and has many drawbacks, mainly including: 1) User cold start: it is mainly said to new users, for new users, there is no historical search information, there is no use of folk prescriptions, so it is not intelligent recommendation for users. 2) Data sparse problem: The so-called sparse problem is that when the prescription is not evaluated much and the information is incomplete, most of the prescriptions recommended by the system do not meet the needs of users. Content-based recommendation algorithm is to find the similarity between keywords in the input text of users, or between the text features between them and the needs of users for folk prescriptions without relying on historical data, and then present the recommended content to users. It is in this way that the above cold start problem is improved. Content-based recommendation algorithm has many benefits, as follows: 1) For the newly collected and crawled folk recipe data, although the data information is not perfect, although the user evaluation does not have any tips, it can also recommend the user, so as not to ignore the existence value and significance of the new folk recipe. Then it improves the occurrence of cold start problem. 2) The recommendation results are also clear and can be recognized by users, and the recommendation process is also very simple. Since users do not record the use of individual recipes in intelligent recommendation, and the collection of recipes is continuous, users and administrators will continue to increase the number of recipes, we need to consider these problems of sparse data. To solve this problem, this paper adopts the idea of recommending traditional Chinese medicine prescriptions based on content recommendation method to build the recommendation model of intelligent traditional Chinese medicine prescription system. 3.2. Content-based Recommendation Algorithm Model Analysis Content-based recommendation algorithm mainly consists of three main parts. The first is to extract the attributes of folk feature words: it is to obtain the characteristics of folk information in the text and get the data set of folk attributes. It is mainly composed of structural attributes and non- structural attributes, and the specific components are described above. The second is the training of user demand characteristics: on the information such as the evaluation after the use of the screened prescription by the user, it can be seen whether the user has the intention of the prescription, and the background information of these prescriptions can train the user's needs. The third is to recommend its folk remedies. By calculating the characteristics of user intention and the collected folk prescriptions characteristic words, keyword comparison and similarity calculation are carried out, and then the recommendation result is output, and the first s folk prescriptions are also recommended to the user. In the traditional method, the method to deal with the unstructured attributes of product feature extraction is to describe each product with feature items (also called keywords), and calculate the weight of the feature items by using TF-IDF [6~7] calculation method. Next, each feature item is assigned a different weight value w to distinguish the 98 importance of each feature item. The text can be represented as T = (t1, w1; t2, w2; ... tn, wn), abbreviated T = (w1, w2... wn). The TF-IDF method is used to assign weights to each function item to calculate how important these function items are to the current text in the corpus. At the same time, this method also has many shortcomings, it only takes into account the frequency and weight of feature items in the text, but ignores the relationship between the order of feature items in the text and the context semantics, and there is a problem of dimensional disaster. This will lead to the query of information and the user needs the treatment method does not meet. 3.3. Optimization Scheme of Similarity Technology The important research point of using content-based recommendation computing method in the project is to calculate the similarity of folk recipe attribute feature screening and user feature selection obtained through training. If we know the needs of the user, and learn the characteristics of the user's prescription, we can take this prescription as the benchmark, calculate its similarity with the historical data of various traditional Chinese medicine prescriptions. For the information text input by users, open the intelligent traditional Chinese medicine prescription recommendation system in the web page, and the first step is to query the text that conforms to their own symptoms. Then, the next operation is to extract the feature words from the information text input by users, and then carry out the folk prescription similar to the language meaning in the data according to these attributes. This process enables the personalization of recommendations. This is the main task of the design of this intelligent Chinese medicine prescription system. Choosing a suitable similarity calculation method is the essential requirement of intelligent recommendation. In this design, according to the analysis of the characteristics of users in voice input or keyboard input, there are relatively colloquial phenomena. Therefore, the cosine similarity calculation method is applied, so that the recommended result will be more accurate. 3.3.1. Cosine Calculation Method The cosine value is used to calculate the relationship between vectors, and we infer this by calculating the Angle between them. The cosine value can be obtained through the calculation formula. If the result is a value that is infinitely close to 0, it means that the correlation between the two vectors is very large [8]. Cosine is calculated in the interval [- 1,1], that's its range, but if the value is 1, it means that they have the same direction, if the value is -1, it means that the vector is opposite. Compute the vectors A(x1, y1), B(x2, y2) with the following formula:   1 2 1 2 2 2 2 2 1 1 2 2 cos x x y y x y x y      For the n-dimensional vector A(x1, x2......) xn, B(y1, y2...... yn), the formula is as follows:         1 2 2 1 1 cos n i i i n n i i i i x y x y         When this formula is applied to system calculations, then the value of x represents the value of the first vector and y is the value of the second vector. When calculating the text similarity, the second formula above will be used. In the process of realizing the intelligent recommendation of Chinese medicine, they will respectively use the vector representation of each folk recipe in the obtained data and the vector representation of the folk recipe intention in the problem text input by the user. 3.3.2. User Label Collaborative Filtering Algorithm The main content of the so-called label is the name that summarizes the user's personal characteristic information, including the user’s name, mobile phone number, avatar and other characteristics, and also includes the characteristics screened from the user's input disease text and the evaluation of the folk prescription. The folk prescription label is the characteristic label of the input text. The basic needs of users are filtered according to labels. For users' demands for folk prescriptions, the weight reorganization of labels is adopted, so the user label group is filtered. The core of the design of this algorithm is [9~11]: The calculation method is used to convey the needs of users' folk prescriptions, and the similarity of the label group is calculated to recommend the folk prescriptions required by users. Calculate user A's demand rights Reorganize UTWa into {UTWa1, UTWa2,... , UTWan} and other folk prescriptions X standard weight recombination UTWx to {UTWx1, UTWx2,... UTWxn} direct similarity, this paper is mainly used to calculate the similarity degree of user demand prescriptions, we use cosine similarity to calculate, and for collaborative filtering similarity algorithm is composed of cosine value calculation method, Euclidean distance calculation method and Pearson coefficient [49,50]. According to the following formula, the information of traditional Chinese remedies that are very similar to user A is selected through calculation, and then the treatment methods, including usage, proportion of traditional Chinese medicines and precautions are recommended.    , cos , a x a x a x x x UTM UTM sim UTM UTM UTM UTM UTM UTM    We calculate the similarity of the folk recipe information in the text information and data input by users, and select the folk recipe that is similar and meets the needs of users. Therefore, we can select the unused folk recipe that meets the needs of users from the calculated folk recipe. At the same time, according to the degree and constant change of users' demand for folk recipe, Continuously change the user's label weight so that the user's similarity can be calculated for subsequent recommendations. Calculate the similarity between user A and the prescription in the data, select the first M prescriptions with the highest similarity calculation result, select the usage and evaluation of these M prescriptions, and confirm that user A has not used the prescription. When recommending the prescription to the system, the user will selectively open the prescription, and then operate according to the label of the prescription. Furthermore, the weight reorganization of user design is improved and superimposed according to the weight reorganization. If the user does not 99 choose one of the folk remedies in the recommendation result, the UTW of the user's demand label right reorganization will be changed and the weight of the user's demand will be reduced. 3.3.3. An item-based Label Collaborative Filtering Algorithm The overall process of this calculation method is very easy to get, that is, when the user operates the system and chooses one of the prescriptions to read the information, then the system will recommend the information for this prescription, and the main content of the recommendation is similar to this prescription. When the user queries the prescription for treating hypertension, there is also a diabetic prescription in the intelligent TCM prescription recommendation system, which has a strong correlation with the prescription read by users, and it is so that users can recommend a variety of prescriptions according to their own reading content, so that they can query the prescription that is very in line with their needs and their own physical conditions in a limited time. Correlations between recipes are calculated using labels. The correlation calculation method of the folk formula is similar to the collaborative filtering algorithm based on user labels, and the cosine algorithm can also be used to determine the direct similarity of partial squares. 3.4. Speech Recognition Technology based on BP Neural Network Voice recognition technology is also crucial in the implementation of the recommendation system, determining whether accurately finding the symptoms that are appropriate for the user is a critical step and an essential part. DTW, hidden Markov, and other methods of neural networks can be used to achieve non-specific speech recognition, and many computational methods have their own advantages. This paper introduces the basic principle, structure and application of BP neural network in speech recognition technology, as well as its advantages and disadvantages. This paper designs the model formed by the combination of hidden Markov model and BP neural network, mainly in order to effectively solve the defect of slow convergence of BP neural network [12] and easy to confuse similar words in HMM. This algorithm is implemented by MATLAB [13]. Applying hybrid model to non-specific Chinese speech recognition can effectively improve the speech recognition rate. 3.4.1. The Basic Principles of Speech Recognition A complete speech recognition system is mainly composed of five modules, including speech signal preprocessing, feature extraction, reference pattern library establishment, pattern matching and language model [14]. In order to shorten the training time and test time in the process of recognition, the speech feature database is built to store the speech feature parameters in a unified way. The speech database is divided into four categories according to different characteristic parameters, as shown in Table Table 1. Speech feature database file Instructions Phonetic feature MFCC MFCC Characteristic parameter library MFCC features are stored in a similar way to the above, except that they are stored in the MFCC folder. sinMFCC sinMFCC Characteristic parameter library The sinMFCC functions are stored in a similar way to the above except that they are stored outside the sinMFCC folder. chafenMFCC chafenMFCC Characteristic parameter library In addition to storing these functions in the chafenMFCC folder, the chafenMFCC functions are stored in a similar manner as above. The process of establishing a voice database is the process of reading from a voice file, pre-accentuating, endpoint detection, framing, windowing, feature extraction and creating a database [15]. The master subroutine and its functions are shown in Table 2. Table 2. Establishment of voice database and main subprograms Subroutine name or class name Instructions Realization function wavRead() Read program Take a speech waveform, turn it into a digital quantity and save it PreEmphasis Preemphasis program Filtering and pre-accentuating speech Detection() Endpoint detector It is implemented in two ways: Lawrence Rabiner Framing() Framing subroutine The speech signal is divided into short frames of 10ms~30ms. Hamming() Plus hamming window Make each voice frame smooth transition DTW() Feature vector sequence clustering Each speech feature vector is merged into the same frame, which is 20 frames in this article Characters() Feature database program Create a feature parameter library 100 3.4.2. HMM and BP Neural Network Hybrid Model Aiming at the shortcomings of a single BP neural network, this paper combines HMM and BP neural network [16~18] to make good use of their respective advantages in speech recognition technology. For HMM model, it has a high dynamic time series modeling ability, so it can better improve the speech recognition effect. HMM and BP neural network models can be combined in a variety of ways, and the current application is more in the combination of frame level and speech level. From the review of relevant literature, it can be seen that frame-level combination is more consistent with the structural characteristics of the hybrid model in different combinations. Frame-level combination methods are divided into many types, and the following is a brief introduction to these types of combination methods. (1) HMM can preprocess speech signals, but also require accuracy in the input vector dimension. The dimension of speech signal is different after extracting feature parameters. The reason why we need to adjust the time of the input vector is that the number of neurons in the input layer is always unchanged, which ensures that the vector dimension in the neuron model is the same. (2) The observation probability of HMM can be calculated by using BP neural network model. The prerequisite for applying the HMM model is the assumption that the current state is only related to the previous state, but the actual speech signal has some relationship with the preceding and following states, so the model seems to have some flaws. Using BP neural network model to calculate the observation probability of HMM is a good solution at present. In this approach, HMM is a complete recognition model. Only the BP neural network model is used to simulate the corresponding probability of the observed value series in each state. (3) The Viterbi algorithm network is established in HMM by using BP neural network model. This network structure can achieve better recognition efficiency and faster processing speed [19]. (4) The BP neural network model is used as the post- processor of HMM, and the output value of HMM is used as the input value of BP neural network. This method also fully embodies the time series processing capability of HMM and the unmapped classification capability of BP neural network model. 4. Conclusion This paper mainly introduces the calculation method of word2vec, and the operation steps of the model mainly include three parts: the feature acquisition of user input text, the feature learning of user folk formula, and the generation of recommendation result. Text similarity technique is used to generate recommendation results. When users do not know how to express drugs and do not know the specific symptoms, the cosine value calculation method is introduced to calculate the similarity for the situation that users will input unclear semantics and partial colloquial language, and thus the obtained results of recommended prescriptions have been greatly improved. Finally, the combination of HMM and BP neural network improves the defects of traditional BP neural network and strengthens the accuracy of language recognition technology. Improve user satisfaction. References [1] Xu Kangting, Song Wei. Chinese text sentiment analysis method combining Language knowledge and deep learning [J]. Big Data,2022(3) : 115-127. [2] Ren Weijian, Xu Haijie, Kang Chaohai, Huo Fengcai, Ren Lu, Zhang Yongfeng, Research on Emotion Analysis based on Word2vec and Attention Mechanism [J]. Computer and Digital Engineering, 2024,(10):2991-2995+3147. [3] Schwenk H Continuous space language models[J]. Computer Speech Language, 2007, 21(3): 492~518. [4] J. Liu, E.L. Chen and Z.T. He: Journal of Shi Jia Zhuang Railway Institute (Natural Science), Vol. 22 (2009) No. 4, p.40- 42. [5] Fu Zefan, Yao Jingfa, Teng Guifa. Research on sensitive website information recognition and its variant restoration technology based on BERT model [J]. Modern Electronic Technology, 2024,(23):105-112. [6] Liu Jia, Chen Minshi, Xie Yi, SU Zhaoyu, Wu Xingyu. Operator User Portrait Analysis based on TF-IDF Algorithm [J]. Telecommunications Engineering Technology and Standardization, 2023,(10):1-5+30. [7] Li Long, Jin Shuo, Huang Xia. Research on Graduate Employment recommendation Algorithm based on improved TF-IDF Algorithm [J]. Computer and Digital Engineering, 2023, (09):1985-1989+2118. [8] Li Lin, Li Hui. A text similarity calculation Method based on Concept vector Space [J]. Data Analysis and Knowledge Discovery, 2018(05). [9] Cheng Yuan. Research on Personalized distributed recommendation System of mobile news [Master of Engineering Thesis of Beijing Institute of Technology] Beijing: Beijing Institute of Technology,2016. [10] Wang Junxian. Research on Key technologies of News recommendation system based on Hadoop [Tianjin University of Technology Master of Engineering Dissertation] Tianjin: Tianjin University of Technology,2017. [11] Ma Huifang, Jia Mei Huizi, Zhang Di, et al. Microblog recommendation method integrating label association relationship and user social relationship. Journal of Electronics, 2017 (1): 112~118. [12] Zhang Zhiqiang. Research on Chinese Speech Recognition and decoding Technology [D]. Xinjiang Agricultural University, 2017. [13] Wang Huizhen. Research on speech endpoint detection algorithm based on Matlab [J]. Yangtze River Information and Communication, 2024, (11):66-69. [14] Su Yunpeng. Research on Single Sentence Speech Recognition Algorithm Based on Deep Learning [D]. Xidian University, 2019. [15] Mikolov T, Sutskever I, Chen K, et al. Distributed representations of words and phrases and their compositionality [c].2013: 3111~3119. [16] Zhao Taifei, Gu Weihao, Ma Xinyuan, Duan Yanfeng. Water Use behavior recognition based on HMM and BP neural network combination model [J]. Journal of Water Resources and Water Engineering, 2019, (04):14-17. [17] Yang Yang. Research on Chinese speech recognition System based on HMM and BP neural network [D]. Northeastern University, 2017(06). [18] Yang Hongchao. Research on web text Information Extraction based on HMM and BP network hybrid model [D]. University of South China, 2011(11). [19] Yao Zhiqiang, Dai Beiqian. Channel robustness of speech recognition method based on multi-band HMM and neural network fusion. Computer Engineering and Applications.2004.