Keyword extension method and system based on semantic driving
By calculating the optimality of word vector position and displacement direction, and adaptively adjusting the displacement amplitude, the problem of difficulty in determining the word vector adjustment amplitude in the Word2Vec algorithm is solved, thus improving the accuracy and efficiency of keyword expansion.
Patent Information
- Application Number
- CN202511550516.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-28
- Publication Date
- 2026-02-10
AI Technical Summary
In existing technologies, when expanding keywords using the Word2Vec algorithm, it is difficult to determine the magnitude of word vector adjustment, resulting in low convergence efficiency in the early stages of iteration and excessive adjustment in the later stages of model updates, which affects the relevance of word vectors.
By calculating the optimality of word vector position and the optimality of displacement direction, the adaptive displacement amplitude is determined, and the word vector is updated.
It improves the accuracy and efficiency of word vector adjustment, ensuring that word vectors remain relevant and accurate during the update process.
Smart Images

Figure CN121501972A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data processing, and in particular to a semantically driven keyword expansion method and system. Background Technology
[0002] Currently, semantically driven keyword expansion has become a core tool for enterprises to improve online visibility and accurately reach users, exhibiting profound technological integration and paradigm shifts. The industry still faces challenges such as semantic understanding biases and the need for dynamic optimization to cope with the minute-by-minute iterations of search engine algorithms. In practical applications, a semantically driven keyword expansion method is used to achieve precise semantic positioning and complete keyword expansion.
[0003] In existing technologies, semantic vector mapping is performed using the Word2Vec algorithm to achieve semantically driven keyword expansion. However, during keyword expansion using the conventional Word2Vec algorithm, it is difficult to determine the magnitude of adjustment to the word vectors. Directly adjusting based on a fixed vector distance will reduce the convergence efficiency of word vectors in the early stages of iteration, causing them to lose their correlation with existing word vectors, and will also lead to excessively large adjustments to word vectors in later stages of model updates. Summary of the Invention
[0004] To make word vector adjustments more accurate, this application provides a semantically driven keyword expansion method and system.
[0005] Firstly, this application provides a semantically driven keyword expansion method, employing the following technical solution: Collect keyword information from the files to be processed; Based on the degree of preference of the displacement direction and the degree of preference of the position of the word vector corresponding to the keyword in the keyword information, the necessity of the displacement of the word vector is obtained and the corresponding displacement amplitude is determined. The word vector is updated by performing displacement based on the displacement magnitude.
[0006] Optionally, collect keyword information from the file to be processed, including: The input text is cleaned and preprocessed using natural language processing to obtain a list of corresponding word segmentation results. Obtain the frequency of each word in the segmented results list, denote the number of segmentation types as n, and denote the frequency of the i-th segmentation type as P. i .
[0007] Optionally, based on the degree of preference for the displacement direction and the degree of preference for the position of the word vector corresponding to the keyword in the keyword information, the necessity of the displacement of the word vector and the corresponding displacement magnitude are obtained, including: Initialize word vectors for the keywords; The optimal position is obtained based on the word vector position, and the optimal displacement direction of the word vector is obtained based on the word vector displacement direction. The displacement necessity is obtained based on the directional preference degree and the position preference degree of the word vector to determine the displacement amplitude corresponding to the word vector.
[0008] Optionally, the keywords are initialized with word vectors, including: Initialize word vectors based on the frequency of word segmentation; The domain of the three-dimensional vector is obtained according to the type of word segmentation, and the maximum value of each dimension of the three-dimensional vector is denoted as... And obtain the center point position as ; The word vector with the highest frequency is initialized as the center point, the initial positions of the word segments are all set at integer points, and all word segments are sorted in descending order of frequency and initialized sequentially.
[0009] Optionally, the corresponding position optimization degree can be obtained based on the word vector position, including: For the The word vector, preset the nth word vector The neighborhood range of each word vector is ; Get each of the following values in the input text: Each word has its left and right sides Each segmentation word is recorded as a neighboring segmentation word; In the word vector space, the first The Euclidean distance between the word vectors is less than Other word vectors are denoted as the corresponding spatial neighborhood word segments; The number of spatial neighborhood segmentations is denoted as ,Will The Middle The word vector at the th word in the th ... The frequency of occurrence in the neighborhood word segmentation of each word vector is denoted as . and obtain the first The optimality of the position of each word vector: ; in, Indicates the first The optimality of the position of each word vector Indicates the first The word vector and its first Euclidean distance between spatial neighborhood word segments Indicates the first The first word vector of the nth word vector The frequency of each spatial neighborhood segmentation word in its neighborhood segmentation words. Indicates the first The frequency of each word vector in the input text Indicates the first The spatial neighborhood segmentation word in the input text is the first one The ratio of the frequency of occurrence of each word's neighborhood. This represents the Euclidean distance weight.
[0010] Optionally, the optimization degree of the word vector displacement direction can be obtained based on the word vector displacement direction, including: The preset initial displacement amplitude is , will the The direction of the word vector update shift is denoted as . and the first The word vector is updated by shifting in the direction of the update shift. The position after that is recorded as the target position; The first The Euclidean distance between each spatial neighborhood word segment and the target location is denoted as . To obtain the directional optimization degree of the word vector: ; in, Indicates the first The degree of directional optimization of each word vector Indicates the first The frequency of each word in the input text Indicates the first The first word vector of the nth word vector The Euclidean distance between each spatial neighborhood word segment and the target location Indicates the first The word vector and its first Euclidean distance between spatial neighborhood word segments Indicates the first The first word vector of the nth word vector The frequency of each spatial neighborhood segmentation word in its neighborhood segmentation words. Indicates the first The frequency of each word vector in the input text Indicates the size of the neighborhood. Indicates the first The spatial neighborhood word segmentation and the first The correlation between word vectors It represents the ratio of the distances between two Euclidean logarithms.
[0011] Optionally, the necessity of the corresponding displacement can be obtained based on the directional and positional optimization of the word vectors to determine the corresponding displacement magnitude, including: The ratio of the direction preference degree to the position preference degree of the word vector is denoted as the displacement necessity of the word vector. The higher the displacement necessity, the greater the displacement amplitude of the word vector. The product of the necessity of the word vector's displacement and the initial displacement magnitude is denoted as the displacement magnitude of the word vector.
[0012] Secondly, this application provides a semantically driven keyword expansion system, which adopts the following technical solution: The acquisition module is used to collect keyword information from the files to be processed. The determination module is used to obtain the necessity of the displacement of the word vector and determine the corresponding displacement amplitude based on the degree of preference of the displacement direction and the degree of preference of the position of the word vector corresponding to the keyword in the keyword information. The update module is used to perform displacement based on the displacement amplitude to complete the update of the word vector.
[0013] This application has the following technical effects: To address the problem of difficulty in determining the magnitude of displacement adjustment during keyword expansion using the conventional Word2Vec algorithm, this invention adaptively adjusts the displacement magnitude by calculating the optimality of the position and direction of each word vector to be shifted. This achieves the beneficial effect of making the adjustment of word vectors more accurate based on the adaptive displacement magnitude. Attached Figure Description
[0014] Figure 1 This is a flowchart illustrating steps S1 to S3 of this application. Detailed Implementation
[0015] This application discloses a semantically driven keyword expansion method, referring to... Figure 1 ,include: S1: Collect keyword information from the files to be processed.
[0016] As an example, standard natural language preprocessing operations such as cleaning and word segmentation are performed on the input text to obtain a clean list of word segmentation results. The frequency of each word in the segmentation is obtained, and the number of segmentation categories is recorded as follows: , will the The frequency of occurrence of each word segment is denoted as... .
[0017] In one embodiment, the input text is "I like to eat apples, apples are delicious". Text cleaning includes removing punctuation, special characters, and irrelevant content to standardize the text. For example, removing commas (,) and periods (.) results in the cleaned text: "I like to eat apples, apples are delicious". Standard natural language processing tools (such as the Chinese word segmentation tool jieba) can be used to segment the cleaned text into independent lexical units. The segmentation result list is: ["I", "like", "eat", "apple", "apple", "very", "delicious"]. This segmentation list represents the cleaned word segmentation result and is used for subsequent analysis.
[0018] Furthermore, word frequency statistics are performed: the frequency (number of occurrences) of each word in the segmentation result list is calculated. The word frequency statistics show that "I" appears once, "like" appears once, "eat" appears once, "apple" appears twice, "very" appears once, and "delicious" appears once. Key parameters are recorded: the number of segmentation types n: the number of different words. In this example, there are 6 different words, therefore n=6. The frequency of occurrence of the i-th segmentation type... Each word can be assigned an index i, and its frequency recorded. For example, let i=1 correspond to "I", then... =1.
[0019] S2: Based on the degree of preference of the displacement direction and the degree of preference of the position of the word vector corresponding to the keyword in the keyword information, obtain the necessity of the displacement of the word vector and determine the corresponding displacement amplitude.
[0020] It should be noted that in the Word2Vec algorithm, for any word vector, when it needs to be shifted, if the position of the word vector is already close to that of other related word vectors, it should be shifted slightly to ensure that it is still near the related word vectors and to prevent excessive shifting that would cause it to deviate from the related word vectors.
[0021] In one embodiment of this application, the specific process for obtaining the displacement amplitude based on the word vector of the keyword is as follows: initialize the word vectors of all keywords; obtain the position preference degree based on the position of the word vector, and then obtain the direction preference degree based on the displacement direction of the word vector; obtain the displacement necessity based on the direction preference degree and position preference degree of the word vector, so as to determine the displacement amplitude.
[0022] Specifically, firstly, during the initialization of word vectors for all keywords: word vectors are initialized based on the frequency of word segmentation. It should be noted that word vector initialization can affect the efficiency and accuracy of subsequent updates to some extent; therefore, word vectors with higher frequencies should be initialized closer to the center of all word vectors to ensure they are more easily moved to appropriate positions. Specifically, the domain of the three-dimensional vector is obtained based on the types of word segmentation in the input text, and the maximum value of each dimension of the three-dimensional vector is denoted as... To obtain the center point position is The most frequent word vector is initialized as the center point. All word segmentation initialization positions are set at integer points. All word segments are sorted by frequency from highest to lowest and initialized sequentially, ensuring that the initialization position of the most frequent word segmentation vector is closest to the center point.
[0023] As an example, word vectors are initialized based on word frequency, placing high-frequency words near the center in a three-dimensional space. The domain of the three-dimensional vector is calculated as: n=3, X= =2; Center point location: = (1,1,1); Initialization positions: "Apple" (highest frequency) is initialized at the center point (1,1,1), "Delicious" (second highest frequency) is initialized at a point close to the center (1,1,0), and "Sweet" (lowest frequency) is initialized at another point (1,0,1).
[0024] Secondly, in the process of obtaining the positional preference of a word vector based on its position, and then obtaining the directional preference of the word vector based on its displacement direction, the specific steps include: In the Word2Vec algorithm, word vectors are updated through backpropagation, and the relevance is measured by the distance between word vectors. Therefore, the actual relevance is calculated by recording the number of times a word vector is adjacent to other word vectors in the historical input data, and the positional preference of the word vector is calculated accordingly. Then, the directional preference is calculated based on the change in positional preference after displacement according to the displacement direction of the word vector.
[0025] It should be noted that for any given word vector, if other word vectors around it have a high correlation with it, it means that the word vector is already in a relatively good position and should be shifted by a small amount.
[0026] Specifically for the first Each word vector has a predefined neighborhood range of 1 / 2. Get each of the following values in the input text: Each word on the left and right sides The nth word segment is denoted as the neighborhood segment, which is the word vector space that is related to the nth word segment. The Euclidean distance between the word vectors is less than Other word vectors are denoted as their spatial neighborhood segmentations, and the number of spatial neighborhood segmentations is denoted as... , of which The word vector at the th word in the th ... The frequency of occurrence in the neighborhood word segmentation of each word vector is denoted as . Based on this, obtain the first The optimality of the position of each word vector: ; in, Indicates the first The optimality of the position of each word vector Indicates the first The word vector and its first Euclidean distance between spatial neighborhood word segments Indicates the first The first word vector of the nth word vector The frequency of each spatial neighborhood segmentation word in its neighborhood segmentation words. Indicates the first The frequency of each word vector in the input text.
[0027] Regarding the formula for the degree of location preference, it should be noted that in the formula... Partially representing the first The spatial neighborhood segmentation word in the input text is the first one The ratio of the frequencies of occurrence in the neighborhood of the segmented word; the larger the ratio, the more significant the difference between the frequencies of occurrence in the neighborhood of the segmented word. The spatial neighbor pixel and the first The probability of two word segments appearing together is relatively high, and it is similar to the first word segment. If the correlation between the segmented words is high, then the first segmented word... The higher the optimization degree of the position of each word vector, the better the formula. Partially representing the Euclidean distance weights.
[0028] As an example, for "apple" (i=1): Obtain the optimal position of all word vectors according to the steps above. Spatial neighborhood segmentation: Other word vectors with a Euclidean distance less than r=2. Calculate the distance: d(1,2) (apple and delicious): d(1,3) (Apples and Sweet): Since both examples are less than 2, the spatial domain word segmentation includes "delicious" and "sweet", N1=2.
[0029] Further, text domain analysis: In the input text, for each occurrence of "apple", take r=2 words on both sides (not exceeding the boundary): "apple" at position 1: no word on the left, "delicious" (position 2) and "apple" (position 3) on the right → domain segmentation: "delicious", "apple"; "apple" at position 3: "delicious" (position 2) and "apple" (position 1) on the left, "sweet" (position 4) on the right → domain segmentation: "delicious", "apple", "sweet". Then, statistical Q... 1,j Q 1,2 (Frequency of "delicious" in the "apple" category): Appears twice in both category 1 and category 3; Q 1,3 (Frequency of "sweet" in the "apple" domain): Appears only in domain 3, once in total, Q1=2 ("apple" appears twice in the text). Calculate U1: = ( 1), =1; = ( 1), =0.5, and the final calculation yields U1≈0.75.
[0030] Similarly, the U values of other word vectors can be obtained using the above calculation method. i .
[0031] It should be further explained that, for any word vector, during the update process, if its displacement direction is away from the center of the nearby word vectors, its displacement amplitude should be relatively low, and the displacement amplitude should be calculated accordingly.
[0032] Specifically, the preset initial displacement amplitude is For the first Let the word vectors be and the direction of their update shift be denoted as . Displace it in the direction of the updated displacement. The position after that is recorded as the target position, and the position of the first... The Euclidean distance between each spatial neighborhood word segment and the target location is denoted as . Based on this, the directional optimization degree of the word vector can be obtained: ; in, Indicates the first The degree of directional optimization of each word vector Indicates the first The frequency of each word in the input text Indicates the first The first word vector of the nth word vector The Euclidean distance between each spatial neighborhood word segment and the target location Indicates the first The word vector and its first Euclidean distance between spatial neighborhood word segments Indicates the first The first word vector of the nth word vector The frequency of each spatial neighborhood segmentation word in its neighborhood segmentation words. Indicates the first The frequency of each word vector in the input text Indicates the size of the neighborhood.
[0033] Regarding the formula for the degree of directional preference, it should be noted that in the formula... Partially representing the first The spatial neighborhood word segmentation and the first The correlation between word vectors is expressed as a ratio; the larger the ratio, the stronger the correlation. The formula... The value represents the ratio of two Euclidean distances. The larger the ratio of the Euclidean distances, the less desirable the target location is.
[0034] At this point, the directional optimization degree of all word vectors has been obtained.
[0035] Furthermore, the necessity of displacement is determined based on the directional and positional optimization levels of the word vectors to ascertain their displacement magnitude. Specifically, for any word vector, the higher its positional optimization level, the lower its displacement magnitude should be to maintain a relatively accurate position; conversely, the higher its directional optimization level, the higher its displacement magnitude should be to find a better position. Specifically, the ratio of the directional optimization level to the positional optimization level of the word vector is denoted as the unique necessity of that word vector; the higher the displacement necessity, the larger the displacement magnitude. The product of the unique necessity of the word vector and the initial displacement magnitude is denoted as the displacement magnitude of the word vector.
[0036] As an example, for "apple" (i=1): The initial displacement amplitude T=1, assuming the displacement direction is (0, 0, 1) (upward). Target position: Current position (1, 1, 1) + displacement direction (0, 0, 1) × T = (1, 1, 2). P1=2, n=3. =6, N1=2 (spatial domain segmentation of "delicious" and "sweet"). Calculate the summation term: for j=2 ("delicious") and j=3 ("sweet"), the summation equals 0.42675, V1=6×0.42675≈2.5605. Further, calculate the positional necessity ≈3.414, displacement amplitude =3.414. Therefore, for the word vector "apple", its displacement amplitude is 3.414. This means that during the update, "apple" will move 3.414 units along the displacement direction (0,0,1).
[0037] S3: Perform displacement according to the displacement magnitude to complete the word vector update.
[0038] It should be noted that the word vectors are shifted and updated based on their displacement magnitude to complete the word vector shift update of the Word2Vec algorithm, and the semantic relationships between keywords are established based on the Word2Vec algorithm. This leads to keyword expansion.
[0039] As an example, for the word vector "apple", the current position is (1, 1, 1), the displacement direction is (0, 0, 1), and the displacement magnitude is 3.414. The new position = current position + displacement direction × displacement magnitude = (1, 1, 1) + (0, 0, 1) × 3.414 = (1, 1, 4.414).
[0040] This application adaptively updates word vectors based on the frequency of each word and its distance from other word vectors. It obtains the directional optimization degree of word vectors based on the displacement direction of word vectors, and then obtains the position optimization degree of word vectors based on the Euclidean distance between the current position of word vectors and other words. Based on the directional optimization degree and the position optimization degree of words, it obtains the necessity of word vector displacement and adjusts the displacement amplitude to achieve the beneficial effect of making word vector adjustment more accurate based on adaptive displacement amplitude.
[0041] This application also discloses a semantically driven keyword expansion system, including: a collection module for collecting keyword information of a file to be processed; The determination module is used to obtain the necessity of the displacement of the word vector and determine the corresponding displacement amplitude based on the degree of preference of the displacement direction and the degree of preference of the position of the word vector corresponding to the keyword in the keyword information. The update module is used to perform displacement based on the displacement amplitude to complete the update of the word vector.
[0042] The above are all preferred embodiments of this application, and are not intended to limit the scope of protection of this application. Therefore, all equivalent changes made in accordance with the structure, shape and principle of this application should be covered within the scope of protection of this application.
Claims
1. A semantically driven keyword expansion method, characterized in that, Includes the following steps: Collect keyword information from the files to be processed; Based on the degree of preference of the displacement direction and the degree of preference of the position of the word vector corresponding to the keyword in the keyword information, the necessity of the displacement of the word vector is obtained and the corresponding displacement amplitude is determined. The word vector is updated by performing displacement based on the displacement magnitude.
2. The semantically driven keyword expansion method according to claim 1, characterized in that, Collect keyword information from the files to be processed, including: The input text is cleaned and preprocessed using natural language processing to obtain a list of corresponding word segmentation results. Obtain the frequency of each word in the segmented results list, denote the number of segmentation types as n, and denote the frequency of the i-th segmentation type as P. i .
3. The semantically driven keyword expansion method according to claim 2, characterized in that, Based on the optimization degree of the displacement direction and the optimization degree of the position of the word vector corresponding to the keyword in the keyword information, the necessity of the displacement of the word vector is obtained and the corresponding displacement magnitude is determined, including: Initialize word vectors for the keywords; The optimal position is obtained based on the word vector position, and the optimal displacement direction of the word vector is obtained based on the word vector displacement direction. The displacement necessity is obtained based on the directional preference degree and the position preference degree of the word vector to determine the displacement amplitude corresponding to the word vector.
4. The semantically driven keyword expansion method according to claim 3, characterized in that, Initialize the word vectors for the keywords, including: Initialize word vectors based on the frequency of word segmentation; The domain of the three-dimensional vector is obtained according to the type of word segmentation, and the maximum value of each dimension of the three-dimensional vector is denoted as... And obtain the center point position as ; The word vector with the highest frequency is initialized as the center point, the initial positions of the word segments are all set at integer points, and all word segments are sorted in descending order of frequency and initialized sequentially.
5. The semantically driven keyword expansion method according to claim 3, characterized in that, The optimal position is determined based on the word vector position, including: For the The word vector, preset the nth word vector The neighborhood range of each word vector is ; Get each of the following values in the input text: Each word has its left and right sides Each segmentation word is recorded as a neighborhood segmentation word; In the word vector space, the first The word vectors whose Euclidean distance is less than that of other word vectors are denoted as the corresponding spatial neighborhood word segments; The number of spatial neighborhood segmentations is denoted as , and . The Middle The word vector at the th word in the th ... The frequency of occurrence in the neighborhood word segmentation of each word vector is denoted as . and obtain the first The optimality of the position of each word vector: ; in, Indicates the first The optimality of the position of each word vector Indicates the first The Euclidean distance between a word vector and its i-th spatial neighborhood word segmentation Indicates the first The first word vector of the nth word vector The frequency of each spatial neighborhood segmentation word in its neighborhood segmentation words. Indicates the first The frequency of each word vector in the input text This indicates that the i-th spatial neighborhood word segment is in the input text. The ratio of the frequency of occurrence of each word's neighborhood. This represents the Euclidean distance weight.
6. The semantically driven keyword expansion method according to claim 3, characterized in that, The optimization degree of word vector displacement direction is obtained based on the word vector displacement direction, including: The preset initial displacement amplitude is , will the The direction of the word vector update shift is denoted as . and will the The word vector is updated by shifting in the direction of the update shift. The position after that is recorded as the target position; The first The Euclidean distance between each spatial neighborhood word segment and the target location is denoted as . Obtain the directional optimization degree of the word vector: ; in, Indicates the first The degree of directional optimization of each word vector Indicates the first The frequency of each word in the input text Indicates the first The first word vector of the nth word vector The Euclidean distance between each spatial neighborhood word segment and the target location Indicates the first The word vector and its first Euclidean distance between spatial neighborhood word segments Indicates the first The first word vector of the nth word vector The frequency of each spatial neighborhood segmentation word in its neighborhood segmentation words. Indicates the first The frequency of each word vector in the input text Indicates the size of the neighborhood. Indicates the first The spatial neighborhood word segmentation and the first The correlation between word vectors It represents the ratio of the distances between two Euclidean logarithms.
7. The semantically driven keyword expansion method according to claim 3, characterized in that, The necessity of displacement is obtained based on the directional and positional optimization of the word vectors to determine the corresponding displacement magnitude, including: The ratio of the direction preference degree to the position preference degree of the word vector is denoted as the displacement necessity of the word vector. The higher the displacement necessity, the greater the displacement amplitude of the word vector. The product of the necessity of the word vector's displacement and the initial displacement magnitude is denoted as the displacement magnitude of the word vector.
8. A semantically driven keyword expansion system, characterized in that, include: The acquisition module is used to collect keyword information from the files to be processed. The determination module is used to obtain the necessity of the displacement of the word vector and determine the corresponding displacement amplitude based on the degree of preference of the displacement direction and the degree of preference of the position of the word vector corresponding to the keyword in the keyword information. The update module is used to perform displacement based on the displacement amplitude to complete the update of the word vector.