Semantic clustering method and device
By combining word segmentation and semantic similarity calculation with predefined high-frequency keywords and word distribution locations, the system can quickly identify user intent, solving the problem of high computational resource consumption in existing technologies and achieving efficient automation and flexible adaptability of the intelligent customer service system.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-20
- Publication Date
- 2026-03-10
AI Technical Summary
Existing semantic clustering methods have shortcomings in recognition accuracy and response speed, especially in terms of high computational resource consumption and inability to quickly respond to a large number of customer inquiries.
By acquiring the sentence to be identified and performing word segmentation, the semantic similarity between multiple clusters and multiple words to be identified is calculated. Using a predefined set of high-frequency keywords and a set of sample words, combined with the distribution position and weight of words, the user's intent is quickly determined and the corresponding business process is invoked.
It improves the accuracy and response speed of semantic matching, reduces computational complexity, and realizes the automation and efficiency of intelligent customer service systems, enabling them to quickly adapt to changes in business needs.
Smart Images

Figure CN121636706A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the technical field of data recognition, and particularly relates to a method and apparatus for semantic clustering. Background Technology
[0002] With the rapid development of e-commerce and the commerce industry, consumers have increasingly higher demands for service quality and efficiency. Traditional customer service systems, relying on human agents, are unable to respond quickly to a large volume of customer inquiries during peak periods, resulting in a poor customer experience. Intelligent customer service systems, as an emerging technology, can solve this problem to some extent by improving response speed and service quality through automation. Semantic understanding and processing are among the core technologies of intelligent customer service systems.
[0003] Semantic clustering is an important method for achieving automated customer service in intelligent customer service systems. It analyzes customer language input to identify their intent, thereby matching appropriate business processes and providing precise service. However, existing semantic clustering methods still have room for improvement in terms of accuracy and response speed.
[0004] Currently, common semantic clustering methods include machine learning-based methods. Machine learning-based methods identify semantics by training models, but they require a large amount of training data, and the model training process is complex and computationally expensive. Summary of the Invention
[0005] In view of this, embodiments of the present invention provide a method and apparatus for semantic clustering to solve the technical problem of high computational resource consumption based on machine learning methods.
[0006] A first aspect of this invention provides a semantic clustering method, the semantic clustering method comprising: The sentence to be identified is obtained, and the sentence to be identified is segmented into words to obtain multiple words to be identified; Calculate the semantic similarity between multiple clusters and multiple words to be identified; wherein each cluster corresponds to a different semantic intent; the semantic intent includes price inquiry, function inquiry, specification inquiry, after-sales inquiry, or order inquiry; When the semantic similarity is greater than the similarity threshold, the business process is invoked according to the semantic intent corresponding to the semantic similarity.
[0007] Furthermore, the step of calculating the semantic similarity between multiple clusters and multiple words to be identified includes: Obtain the high-frequency keyword set corresponding to each of the multiple clusters; wherein, the high-frequency keyword set refers to the word set pre-defined based on semantic intent; The set of high-frequency keywords containing one or more words to be identified is used as the pre-selected set of high-frequency keywords; Extract multiple sample word sets from the clusters corresponding to the pre-selected high-frequency keyword set; The set of sample words containing one or more words to be identified is used as the target sample word set; Extract the training sentences corresponding to the target sample word set; When the target sample word set has one and only one word to be identified, the first preset word weight corresponding to the word to be identified is used as the first similarity of the target sample word set. When there are multiple words to be identified in the target sample word set, extract the second preset word weights corresponding to each of the multiple words to be identified; The second similarity of the target sample word set is calculated based on the distribution positions of the multiple words to be identified and the second preset word weights.
[0008] Further, the step of calculating the second similarity of the target sample word set based on the distribution positions corresponding to the plurality of words to be identified and the second preset word weights includes: The word distribution error is calculated based on the distribution positions of the words to be identified in the training sentences and the sentences to be identified. Calculate the first average value among the weights of multiple second-preset words; Obtain the first adjustment parameter corresponding to the preset word weights and the second adjustment parameter corresponding to the word distribution error; Multiply the first average value by the first adjustment parameter to obtain the first value; Multiply the word distribution error by the second adjustment parameter to obtain the second value; The first value is added to the second value to obtain the second similarity.
[0009] Furthermore, the step of calculating the word distribution error based on the distribution positions of the words to be identified in the training sentences and the sentences to be identified includes: Extract the first distribution position of the words corresponding to the multiple words to be identified in the training statement, and set a first order for the multiple words to be identified based on the first distribution position; Extract the second distribution position of the words corresponding to the plurality of words to be identified in the sentence to be identified, and set a second sorting for the plurality of words to be identified based on the second distribution position; Calculate the difference between the first and second sortings corresponding to the same word to be identified; Divide the difference by the number of the plurality of words to be identified to obtain the position error; Calculate the second average value among the positional errors corresponding to each of the plurality of words to be identified; The difference between 1 and the second average value is taken as the word distribution error.
[0010] Furthermore, prior to the step of calculating the semantic similarity between multiple clusters and multiple words to be identified, the method further includes: Obtain a set of high-frequency keywords corresponding to each of the multiple target semantic intents; wherein, the set of high-frequency keywords is based on multiple high-frequency keywords determined manually; Multiple training statements are obtained, and the training statements are segmented to obtain multiple training words; For each training statement, count the number of words in the high-frequency keyword set that contain the training words; For each training statement, the target semantic intent corresponding to the maximum number of words is used as a mapping relationship; The multiple training statements mapped to the target semantic intent are treated as clusters; Based on the clusters, calculate the explicit feature weights and implicit semantic weights for each training word; The explicit feature weights and implicit semantic weights are added together to obtain the preset weights of the training words.
[0011] Further, the step of calculating the explicit feature weights and implicit semantic weights of each training word based on the cluster includes: Calculate word frequency, inter-cluster distribution frequency, and intra-cluster specificity factor; The explicit feature weights are obtained by multiplying the word frequency, inter-cluster distribution frequency, and intra-cluster specificity factor; wherein, the explicit feature weights are used to quantify the discriminativeness of words in the current cluster. Implicit semantic weights are calculated based on the semantic relevance between training words; wherein, the implicit semantic weights are used to evaluate the semantic importance of words to the current cluster in the training set.
[0012] Furthermore, the steps of calculating word frequency, inter-cluster distribution frequency, and intra-cluster specificity factor include: Obtain the current cluster to which the training words belong, and count the first number of training sentences in the current cluster; Count the second number of training sentences containing the training words in the current cluster; Divide the second quantity by the first quantity to obtain the word frequency; Count the first total number of clusters, and count the third number of clusters containing the training words; Add the third quantity to 1 to get the third value; Divide the first total number by the third value and take the logarithm to obtain the inter-cluster distribution frequency; Count the fourth number of training sentences containing the training words in all clusters; Divide the second quantity by the fourth quantity to obtain the cluster specificity factor.
[0013] Furthermore, the step of calculating implicit semantic weights based on the semantic relevance between training words includes: Step A1: Count the fifth number of training sentences containing the current training word in all clusters; Step A2: Count the sixth number of training sentences containing other training words in each cluster; wherein, the other training words refer to words other than the current training word among all training words; Step A3: Count the seventh number of training sentences that share the training words and other words in all clusters; Step A4: Multiply the fifth quantity by the sixth quantity to obtain the fourth value; Step A5: Divide the seventh quantity by the fourth value and take the log to obtain the semantic relevance. Step A6: If the semantic correlation between two training words is greater than a preset value, then the two training words are regarded as two adjacent training words; Step A7: Set the initial influence of each training word to 1; Step A8: For each training word, obtain all adjacent training words corresponding to that training word; Step A9: The sum of the products of the influence and semantic relevance of all adjacent training words corresponding to the training word is taken as the new influence of the training word; Step A10: Iterate through steps A8 to A9 to obtain the final influence, and use the final influence as the implicit semantic weight corresponding to the training word.
[0014] A second aspect of the present invention provides a semantic clustering apparatus, comprising: The first acquisition unit is used to acquire basic information and activity information of the individual trying to lose weight, and calculate non-exercise calorie consumption value based on the basic information and activity information; wherein, the basic information includes age, height, weight and gender, and the activity information includes occupation type, commuting mode and home activities; The second acquisition unit is used to acquire the calorie intake value corresponding to the preset customized recipe; The matching unit is used to match exercise strategies based on non-exercise calorie expenditure and calorie intake values.
[0015] A third aspect of the present invention provides a terminal device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the semantic clustering method described in the first aspect above.
[0016] A fourth aspect of the present invention provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the semantic clustering method described in the first aspect.
[0017] The beneficial effects of this invention compared to existing technologies are as follows: By segmenting the statements to be identified, the granularity of semantic analysis is refined, enabling the system to more accurately capture key information in user inquiries. Calculating the semantic similarity between multiple clusters and multiple words to be identified ensures the accuracy of semantic matching. Each cluster corresponds to a different semantic intent (such as price inquiries, function inquiries, etc.), allowing the system to accurately determine user intent. Employing a mechanism where semantic similarity exceeds a similarity threshold enables rapid filtering and matching of user intent. This process eliminates the need for complex model calculations, significantly improving response speed. Based on the semantic intent corresponding to semantic similarity, business processes are directly invoked, reducing manual intervention steps and achieving automation and efficiency in inquiry processing. The semantic clustering method can flexibly adapt to different business scenarios; by simply adjusting the clusters and corresponding semantic intents, it can be extended to applications in other fields. The system can quickly respond to changes in business needs by adding or adjusting clusters, maintaining high flexibility and adaptability. This provides a more scientific and comprehensive weight reduction solution. This invention obtains and comprehensively analyzes an individual's basic and activity information to accurately calculate non-exercise calorie consumption values, and combines these with calorie intake values from a customized diet plan to match corresponding exercise strategies, thereby improving the accuracy and effectiveness of weight loss strategies. Attached Figure Description
[0018] To more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings used in the description of the embodiments or related technologies will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0019] Figure 1 A schematic flowchart of a semantic clustering method provided by the present invention is shown; Figure 2 A schematic diagram of a semantic clustering apparatus according to an embodiment of the present invention is shown; Figure 3A schematic diagram of a terminal device provided in an embodiment of the present invention is shown. Detailed Implementation
[0020] In the following description, specific details such as particular system architectures and techniques are set forth for illustrative purposes and not for limitation, in order to provide a thorough understanding of the embodiments of the invention. However, those skilled in the art will understand that the invention can be implemented in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, apparatuses, circuits, and methods are omitted so as not to obscure the description of the invention with unnecessary detail.
[0021] This invention provides a method and apparatus for semantic clustering to address the technical problem of high computational resource consumption based on machine learning methods.
[0022] First, this invention provides a method for semantic clustering. Please refer to... Figure 1 , Figure 1 A schematic flowchart of a semantic clustering method provided by the present invention is shown. Figure 1 As shown, this semantic clustering method may include the following steps: Step 101: Obtain the sentence to be recognized and perform word segmentation on the sentence to be recognized to obtain multiple words to be recognized; It receives user input text (such as a sentence from a customer service conversation) and then performs word segmentation on the sentence. The original, continuous sentence is broken down into discrete, meaningful word units.
[0023] Step 102: Calculate the semantic similarity between multiple clusters and multiple words to be identified; wherein, each cluster corresponds to a different semantic intent; the semantic intent includes price inquiry, function inquiry, specification inquiry, after-sales inquiry, or order inquiry; The words obtained from word segmentation are compared semantically with multiple predefined clusters. Each cluster represents a specific business intent category. The similarity between the word to be identified and each predefined intent cluster is calculated.
[0024] Traditional clustering algorithms (even lightweight ones) require calculating distances for each new sentence and iteratively finding cluster centers or nearest neighbors at runtime, with computational costs increasing with the amount of data. This embodiment completely eliminates the runtime dynamic clustering process. Intent clusters and their representative information (sets of high-frequency keywords) can be pre-calculated and stored offline. In the customer service domain, core intent categories are typically finite and enumerable (as listed in the claims). Predefining these fixed numbers of clusters means that similarity calculations only need to be performed a fixed number of times (comparable to the number of clusters), rather than processing relationships between all data points as in unsupervised clustering. Similarity calculation is performed at the word level, which is much lighter than directly calculating sentence-level similarity (which usually requires complex models). Aggregating word similarity is also simpler than generating sentence vectors.
[0025] Specifically, step 102 includes steps 1021 to 1028: Step 1021: Obtain the high-frequency keyword set corresponding to each of the multiple clusters; wherein, the high-frequency keyword set refers to the word set pre-defined based on semantic intent; For each predefined semantic intent cluster (such as "price inquiry" or "feature inquiry"), a pre-defined offline word set is loaded. The high-frequency keyword set is the core representation of each intent cluster. It contains words or phrases that best represent the intent, appear frequently in historical corpora or expert experience, and have strong discriminative power. This set is manually compiled offline or obtained through simple frequency statistics, without the need for complex model training. For example, the high-frequency keyword set for the "price inquiry" cluster might contain ["price", "how much", "quote", "expensive", "discount", "offer"].
[0026] By directly matching the word to be identified with this relatively small set of keywords, it is possible to quickly determine whether the word is likely to belong to a certain intent cluster. Compared to calculating the similarity of the entire intent cluster (which may contain a large number of samples), the computational cost is greatly reduced.
[0027] Step 1022: Select the set of high-frequency keywords containing one or more words to be identified as the pre-selected set of high-frequency keywords; The system examines the high-frequency keyword set for each predefined intent cluster. If at least one word from the segmented text of the current statement appears in the high-frequency keyword set of a certain intent cluster, then that intent cluster is marked as "pre-selected." If no word in the statement matches a high-frequency word of a certain intent cluster, the statement is considered highly unlikely to belong to that intent, and no further calculations are needed for that cluster. This significantly reduces the number of intent clusters that require in-depth processing.
[0028] Step 1023: Extract multiple sample word sets from the clusters corresponding to the pre-selected high-frequency keyword set; For the "pre-selected" intent clusters identified in the previous step (i.e., clusters where at least one word to be identified matches its high-frequency keywords), a more comprehensive set of sample words associated with that cluster is loaded. Each set of sample words is obtained based on word segmentation of a single training sentence.
[0029] It is worth noting that since the high-frequency keyword set only contains high-frequency words, the accuracy of intent judgment is low. Therefore, it is necessary to perform further identification based on the sample word set in the cluster corresponding to the high-frequency keyword set in order to improve the accuracy of intent recognition.
[0030] Step 1024: Use the set of sample words containing one or more words to be identified as the target sample word set; Step 1025: Extract the training sentences corresponding to the target sample word set; It is associated with the original training corpus or example sentences (i.e. training sentences) that generated the "target sample word set".
[0031] Step 1026: When there is one and only one word to be identified in the target sample word set, the first preset word weight corresponding to the word to be identified is used as the first similarity of the target sample word set; The preset weight value of the word (first preset word weight) is directly used as the similarity score (first similarity) between this "target sample word set" and the current sentence.
[0032] Step 1027: When there are multiple words to be identified in the target sample word set, extract the second preset word weights corresponding to each of the multiple words to be identified; Step 1028: Calculate the second similarity of the target sample word set based on the distribution positions of the multiple words to be identified and the second preset word weights.
[0033] In the embodiments corresponding to steps 1021 to 1028, an efficient and easy-to-implement specific scheme is provided to perform the key step of "calculating semantic similarity". Essentially, it transforms the complex semantic similarity calculation into a lightweight aggregation operation based on multi-level matching and pre-stored weights using a predefined lexicon, making it very suitable for resource-constrained intelligent customer service scenarios.
[0034] Specifically, step 1028 includes steps B1 to B6: Step B1: Calculate the word distribution error based on the distribution positions of the words to be identified in the training sentences and the sentences to be identified; The position of the word to be identified in the current user input statement (the statement to be identified) is compared with its typical position in the historical training corpus (the training statement) that generated the target sample word set.
[0035] Word distribution position refers to the sequential position of words in a sentence (e.g., the first word, the second word). Word distribution error is used to quantify the numerical value of this positional difference.
[0036] Specifically, step B1 includes steps B11 to B16: Step B11: Extract the first distribution position of the words corresponding to the multiple words to be identified in the training statement, and set a first order for the multiple words to be identified based on the first distribution position; For all matching words to be identified in the current "target sample word set" (e.g., word A, word B, word C), find the position information of these words in the historical training corpus that generated this target sample set (first distribution position). Based on the order in which these words appear in the training sentences (e.g., word A is always the 2nd word in the training sentence, and word B is always the 5th word), assign them a sequence number representing their typical order (first sorting). For example, sorted from earliest to latest position, word A's sequence number = 1, and word B's sequence number = 2.
[0037] Step B12: Extract the second distribution position of the words corresponding to the multiple words to be identified in the sentence to be identified, and set a second sorting for the multiple words to be identified based on the second distribution position; Obtain the actual positions (second distribution positions) of these matching words in the current user input statement (the statement to be recognized). Based on the actual order in which these words appear in the current statement (e.g., word B is the first word, word A is the fourth word), assign them a sequence number representing their actual order (second sorting). For example, sorted from earliest to latest position, word B's sequence number = 1, word A's sequence number = 2. This step obtains the actual order of the matching words in the user's current expression.
[0038] Step B13: Calculate the difference between the first and second sortings corresponding to the same word to be identified; This difference (|expected sequence number - actual sequence number|) quantifies the degree to which the position of the word deviates from the expected order relative to other matching words.
[0039] For example: The training pattern expects word A to precede word B (order 1, order 2). The user sentence actually has word B preceding word A (order 1, order 2). Then the difference for word A, _A = |1 - 2| = 1, and the difference for word B, _B = |2 - 1| = 1.
[0040] Step B14: Divide the difference by the number of the plurality of words to be identified to obtain the position error; Dividing the absolute position difference of each word by the total number of matched words N makes the range of the result relatively stable (in the range of [0, (N-1) / N]), and will not produce huge differences in magnitude due to different numbers of matched words, which facilitates subsequent comparison and calculation.
[0041] Step B15: Calculate the second average value among the positional errors corresponding to each of the plurality of words to be identified; The smaller this average value, the closer the overall word order is to the training pattern. The larger this average value, the greater the deviation in the overall word order.
[0042] Step B16: Take the difference between 1 and the second average value as the word distribution error.
[0043] Because the second average value is greater than or equal to 0 (absolute value of position difference and non-negative), and the maximum value will not exceed (N-1) / N < 1, the word distribution error ranges from (1 / N, 1). The larger the value (closer to 1), the smaller the overall positional deviation of the matched word group, i.e., the higher the positional matching degree; the smaller the value, the larger the overall positional deviation, i.e., the lower the positional matching degree.
[0044] In the embodiments corresponding to steps B11 to B16, the relative order deviation between words is quantified and converted into an index representing the degree of position matching within the range of [0,1], which perfectly meets the requirements for quantification processing of position information.
[0045] Step B2: Calculate the first average value among the weights of multiple second preset words; For all words to be identified that fall within the same "target sample word set", extract their respective second preset word weights, and then calculate the arithmetic mean of these weights.
[0046] Step B3: Obtain the first adjustment parameter corresponding to the preset word weight and the second adjustment parameter corresponding to the word distribution error; The first adjustment parameter is applied to the average word weight. It controls the contribution of the base weight component (the first value) to the final similarity. The first adjustment parameter > 0.
[0047] The second adjustment parameter is applied to the word distribution error. It controls the degree to which the positional error component (the second value) penalizes the final similarity score.
[0048] For example, the first adjustment parameter is 1.2 and the second adjustment parameter is 0.5.
[0049] Step B4: Multiply the first average value by the first adjustment parameter to obtain the first value; The average of the base weights is scaled. This is the core positive term for the final similarity score.
[0050] Step B5: Multiply the word distribution error by the second adjustment parameter to obtain the second value; Step B6: Add the first value to the second value to obtain the second similarity.
[0051] The final similarity score considers both the average weight strength of the matched words and their degree of matching in the sentence. Good positional matching results in a small penalty, or even zero, while poor positional matching significantly lowers the score.
[0052] In the embodiments corresponding to steps B1 to B6, a specific, efficient, adjustable implementation scheme that takes into account contextual location information is provided, which improves the accuracy of intent recognition while maintaining low computational complexity.
[0053] Step 103: When the semantic similarity is greater than the similarity threshold, invoke the business process according to the semantic intent corresponding to the semantic similarity.
[0054] When the similarity between one or more words to be identified and a predefined intent cluster exceeds a certain threshold, the intent of the statement is determined to belong to the semantic intent corresponding to that cluster. Then, based on the determined specific intent (such as "price inquiry"), the corresponding business processing flow (such as querying product price and replying) is triggered. Focusing on a few common and limited intents in the customer service field (price, function, specification, after-sales, order inquiry) makes the number of predefined clusters controllable and the number of similarity calculations fixed and few.
[0055] The construction of intent clusters is completed before system deployment or offline. At runtime, only simple word segmentation, lookup, and threshold comparison are performed. Essentially, this embodiment transforms the "semantic clustering" problem into a "lightweight word matching problem based on a predefined intent library." It sacrifices the flexibility of traditional clustering methods in automatically discovering new clusters on unlabeled data (which is often not a primary requirement in customer service), but in return, it achieves a significant improvement in runtime computational efficiency, making it highly suitable for resource-sensitive intelligent customer service scenarios with relatively fixed intents.
[0056] In the embodiments corresponding to steps 101 to 103, word segmentation of the statements to be identified refines the granularity of semantic analysis, enabling the system to more accurately capture key information in user inquiries. Calculating the semantic similarity between multiple clusters and multiple words to be identified ensures the accuracy of semantic matching. Each cluster corresponds to a different semantic intent (such as price inquiries, function inquiries, etc.), allowing the system to accurately determine user intent. Employing a mechanism where semantic similarity exceeds a similarity threshold enables rapid filtering and matching of user intent. This process eliminates the need for complex model calculations, significantly improving response speed. Based on the semantic intent corresponding to semantic similarity, business processes are directly invoked, reducing manual intervention steps and achieving automation and efficiency in inquiry processing. The semantic clustering method can flexibly adapt to different business scenarios; by simply adjusting the clusters and corresponding semantic intents, it can be extended to applications in other fields. The system can quickly respond to changes in business needs by adding or adjusting clusters, maintaining high flexibility and adaptability. This represents a more scientific and comprehensive weight reduction solution. This invention obtains and comprehensively analyzes an individual's basic and activity information to accurately calculate non-exercise calorie consumption values, and combines these with calorie intake values from a customized diet plan to match corresponding exercise strategies, thereby improving the accuracy and effectiveness of weight loss strategies.
[0057] As an optional embodiment of the present invention, steps C1 to C7 are further included before step 102: Step C1: Obtain the high-frequency keyword set corresponding to each of the multiple target semantic intents; wherein, the high-frequency keyword set is based on multiple high-frequency keywords determined manually; For each business intent that needs to be identified (target semantic intent, such as "price inquiry", "feature inquiry", etc.), a set of high-frequency words that best represent that intent are manually compiled.
[0058] Target semantic intent refers to a predefined category of intent that the system needs to identify. The high-frequency keyword set is a list of the most typical and frequently occurring words under this intent, manually specified by domain experts based on experience or preliminary data analysis. For example, the high-frequency keyword set for the intent "price inquiry" might be ["price", "how much", "quote", "expensive"]. This is the starting point and key input for the construction process. Manual setting ensures the domain relevance and accuracy of the keywords, avoiding the complex calculations that might be required for automatic keyword mining (such as topic models and keyword extraction models). High-frequency keywords provide a basis for subsequent rapid training sentence selection.
[0059] Step C2: Obtain multiple training statements and perform word segmentation on the training statements to obtain multiple training words; We collect a large amount of historical customer service dialogues or other relevant corpora as training statements. These statements are then segmented into word units.
[0060] Step C3: For each training statement, count the number of words in the high-frequency keyword set that contain the training words; Count the number of words in these training words that appear in the high-frequency keyword set for each target semantic intent.
[0061] Step C4: For each training statement, use the target semantic intent corresponding to the maximum number of words as a mapping relationship; Assign the statement to the intent that matches the most high-frequency words. Label the training statements with intents. This is the basis for building intent clusters.
[0062] Step C5: Cluster the multiple training statements mapped to the target semantic intent as clusters; All training statements mapped (assigned) to the same target semantic intent are grouped together, and this set constitutes the cluster corresponding to that intent. Here, clusters are no longer dynamically generated by traditional clustering algorithms, but rather a pre-assigned set of all training statements belonging to the same intent based on high-frequency word matching. It directly corresponds to a predefined semantic intent. This completely eliminates the overhead of runtime or offline dynamic clustering algorithms (such as the computational complexity of K-Means). The construction of clusters is based on rapid grouping according to the maximum high-frequency word count.
[0063] Step C6: Based on the clusters, calculate the explicit feature weights and implicit semantic weights for each training word; For each word in the vocabulary (or at least words appearing in the training corpus), two weights are calculated using pre-constructed clusters (each cluster representing an intent). Explicit feature weights capture the statistical significance and discriminative power of a word within a specific intent cluster. Implicit semantic weights capture the semantic similarity between a word and a specific intent cluster.
[0064] Specifically, step C6 includes steps C61 to C63: Step C61: Calculate word frequency, inter-cluster distribution frequency, and intra-cluster specificity factor; Word frequency refers to the frequency with which a word appears in all training statements within the current cluster. It measures how common the word is within the current intent cluster. The more frequently a word appears, the more relevant it is to the intent.
[0065] The inter-cluster distribution frequency refers to the extent to which a term appears in all clustering clusters. The inter-cluster distribution frequency is used to measure the discriminability of a term. If a word appears in almost all clusters (such as "的", "吗"), its inter-cluster frequency value will be very small and the discriminability is low; if a word appears only in a few clusters (especially the current cluster), its inter-cluster frequency value will be relatively large and the discriminability is high.
[0066] The intra-cluster specificity factor is a specifically calculated factor, aiming to further amplify the importance of terms that are very prominent (high frequency) within the current cluster and very rare (low frequency) in other clusters. The intra-cluster specificity factor emphasizes the exclusivity or representativeness of a term for the current specific cluster. Even if a term has a certain degree of discriminability, if it also appears frequently in another cluster, this factor can reduce its weight; on the contrary, if it appears almost only with high frequency in the current cluster, this factor will significantly increase its weight.
[0067] Specifically, step C61 specifically includes steps C611 to C618: Step C611: Obtain the current clustering cluster to which the training term belongs, and count the first quantity of training sentences in the current clustering cluster; Determine the training term for which the weight is currently being calculated. Determine the current clustering cluster to which this term belongs (i.e., the target intent cluster for which its weight is being calculated). Count the total number of all training sentences contained in this clustering cluster (the first quantity = |cluster|).
[0068] Step C612: Count the second quantity of training sentences containing the training term in the current clustering cluster; Count the number of sentences (the second quantity) that contain the training term at least once in all training sentences of the current clustering cluster. This value will be used as the numerator for calculating the word frequency. It measures the breadth of the term's appearance within the cluster (in how many sentences it appears), rather than the absolute number of times.
[0069] Step C613: Divide the second quantity by the first quantity to obtain the word frequency; Step C614: Count the first total quantity of clustering clusters, and count the third quantity of clustering clusters containing the training term; Count the total number of all predefined clustering clusters in the system (the first total quantity = total number of clusters). Count the number of clustering clusters that contain the training term at least once (in its training sentences) (the third quantity). This provides the core input for calculating the inter-cluster distribution frequency. The third quantity measures the extent to which the term appears across different intent clusters. The larger this value, the more common the term and the lower its discriminability.
[0070] Step C615: Add 1 to the third quantity to obtain the third value; Adding the third quantity to 1 is a smoothing operation. This prevents the denominator from being zero when the third quantity is zero (i.e., the word does not appear in any cluster). Fine-tuning is performed on low-frequency words (those with small third quantities) to prevent the frequency distribution between clusters from becoming too extreme.
[0071] Step C616: Divide the first total quantity by the third value and take the log to obtain the inter-cluster distribution frequency; The logarithmic operation is used to compress numerical ranges, making the results smoother. A higher inter-cluster frequency indicates that the word is more important for distinguishing different intentional clusters (because it only appears in a few clusters). A lower inter-cluster frequency (minimum 0) indicates that the word is more common and has lower discriminative power (appearing in almost all clusters).
[0072] Step C617: Count the fourth number of training sentences containing the training words in all clusters; The total number of sentences in all training sentences across all clusters in the entire system that contain the training word at least once (the fourth count).
[0073] Step C618: Divide the second quantity by the fourth quantity to obtain the intra-cluster specificity factor.
[0074] The second quantity is the number of statements in which the word appears in the current cluster. The fourth quantity is the total number of statements in which the word appears across all clusters.
[0075] When the cluster specificity factor is close to 1, it means that the word appears almost exclusively in the current cluster (second number ≈ fourth number), and is a highly specific word (exclusive term, keyword) for the current cluster. For example, "warranty" in the after-sales cluster.
[0076] When the intra-cluster specificity factor is close to 0, it indicates that although the word appears in the current cluster (second quantity > 0), it appears more widely in other clusters (fourth quantity >> second quantity), and its specificity or representativeness to the current cluster is weak. For example, the common word "how".
[0077] The intra-cluster specificity factor specifically quantifies the "specificity" or "representativeness" of a word to its current cluster. It amplifies the weights of words that primarily or exclusively contribute to the current cluster, while suppressing the weights of words that are dispersed across multiple clusters.
[0078] In the embodiments corresponding to steps C611 to C618, a precise calculation formula for explicit feature weights is constructed by defining word frequency as the proportion of document frequency within a cluster, inter-cluster distribution frequency as the smoothed inverse cluster frequency, and an innovative intra-cluster specific factor as the global proportion of document frequency within a cluster. This approach is computationally efficient, yields highly discriminative results, and perfectly aligns with the patent's core objective of reducing online computational overhead and improving the efficiency and accuracy of intent recognition.
[0079] Step C62: Multiply the word frequency, inter-cluster distribution frequency, and intra-cluster specificity factor to obtain the explicit feature weight; wherein, the explicit feature weight is used to quantify the discriminativeness of words in the current cluster; Explicit feature weights are a statistic that integrates local frequency, global rarity / discriminability, and intra-cluster specificity. It strongly favors assigning high weights to words that appear frequently in the current cluster, appear infrequently in other clusters, and are particularly prominent in the current cluster, thus effectively quantifying the discriminative power of words within the current cluster.
[0080] Step C63: Calculate implicit semantic weights based on the semantic correlation between training words; wherein the implicit semantic weights are used to evaluate the semantic importance of words to the current cluster in the training set.
[0081] Semantic relevance refers to the similarity or correlation of meaning between words or between a word and the overall semantic concept. This cannot be obtained directly from word frequency statistics and needs to be captured through semantic models.
[0082] Implicit semantic weights capture the semantic proximity of a word to the semantic intent represented by the entire cluster in the semantic space. Even if a word does not have the highest absolute frequency within the current cluster, it can still receive a high weight if it is semantically highly relevant.
[0083] In the embodiments corresponding to steps C61 to C63, explicit weights (statistical discriminability) and implicit weights (semantic relevance) evaluate word importance from different perspectives and complement each other. A word may have a high explicit weight due to statistical significance or a high implicit weight due to its semantic core; fusion can more comprehensively reflect its value. By introducing intra-cluster specific factors, the discriminative weights of key feature words are significantly improved; implicit weights supplement deep semantic associations using semantic models. The combination of the two, with the preset weights calculated offline, can more effectively support lightweight, high-precision semantic similarity matching and intent recognition.
[0084] Specifically, step C63 includes steps A1 to A10: Step A1: Count the fifth number of training sentences containing the current training word in all clusters; Iterate through all predefined intent clusters and count the total number of training sentences containing the words, denoted as the fifth count.
[0085] Step A2: Count the sixth number of training sentences containing other training words in each cluster; wherein, the other training words refer to words other than the current training word among all training words; For each word in the corpus other than the current training word, obtain its global occurrence count (sixth count).
[0086] Step A3: Count the seventh number of training sentences that share the training words and other words in all clusters; Step A4: Multiply the fifth quantity by the sixth quantity to obtain the fourth value; Calculate the product of the independent occurrence frequencies of the current training word and other training words, and use it as the expected benchmark for co-occurrence frequency (assuming that the two are independent).
[0087] Step A5: Divide the seventh quantity by the fourth value and take the log to obtain the semantic relevance. The seventh quantity divided by the fourth value is used to measure the deviation between the actual frequency of two words appearing together in the corpus and the expected frequency when they appear completely independently. `log` is used to compress large values and stretch small values.
[0088] Step A6: If the semantic correlation between two training words is greater than a preset value, then the two training words are regarded as two adjacent training words; Adjacent training words are filtered using preset values. That is, only significantly related word pairs are retained to avoid noise interference.
[0089] Step A7: Set the initial influence of each training word to 1; Assign an initial influence value of 1 to each word node in the corpus. This means that all words have the same base influence before the iteration begins.
[0090] Step A8: For each training word, obtain all adjacent training words corresponding to that training word; Step A9: The sum of the products of the influence and semantic relevance of all adjacent training words corresponding to the training word is taken as the new influence of the training word; The influence of a word is determined by the influence of its neighboring words and the strength of their association with those neighbors. The stronger the association, the greater the contribution from the neighboring words. Influential words (often core words strongly associated with many important words) will transfer their influence to their strongly associated neighbors.
[0091] Step A10: Iterate through steps A8 to A9 to obtain the final influence, and use the final influence as the implicit semantic weight corresponding to the training word.
[0092] Repeat steps A8 (update the neighbor list) and A9 (calculate the new influence), typically for a fixed number of rounds (e.g., 10 or 20 times) or until the influence change is less than a threshold (convergence). To avoid values that are too large or too small, the final influence is normalized.
[0093] Core business terms connected to many strong related terms (such as "price" and "features") will continuously increase in influence during iterations because many important neighbors will constantly pass on their influence. Terms with low relevance or few connections will gradually decrease in influence.
[0094] Ultimately, influence quantifies the centrality and importance of a word within the entire semantic network. Words with high semantic importance can acquire higher implicit weights even if their explicit statistical features are not high. This is precisely the goal of implicit semantic weighting.
[0095] In the embodiments corresponding to steps A1 to A10, the semantic relevance between words is quantified using computationally efficient point mutual information, and a weighted semantic association network is constructed. An iterative influence propagation algorithm is used to calculate the importance (implicit weight) of words on the semantic network. Words strongly associated with core words (even if their statistical features are not prominent) are assigned higher weights. The weights of general words or words weakly associated with core semantics are reduced. The calculated implicit semantic weights (along with explicit weights) are assigned to each word in its respective intent cluster during the offline phase. During the online phase, when the sentence to be identified matches these words, their preset weights (explicit + implicit) more accurately reflect the word's contribution to intent judgment, improving the accuracy and robustness of intent recognition while maintaining lightweight online computation.
[0096] Step C7: Add the explicit feature weights and the implicit semantic weights to obtain the preset weights of the training words.
[0097] For the same word, the calculated explicit feature weight value and implicit semantic weight value are added together (or weighted addition; since the weight is not specified in the claims, it is an equal weight addition) to obtain the final preset weight of the word for its intent cluster (or other related intent clusters).
[0098] In the embodiments corresponding to steps C1 to C7, all complex and resource-intensive calculations (corpus grouping, weight calculation) are completed in the offline preprocessing stage. During runtime, only word segmentation, matching, table lookup (weights), and simple arithmetic operations are required, resulting in extremely low computational load. Using manually set high-frequency keywords as initial guidance ensures the integration of domain knowledge while avoiding complete reliance on complex models. Cluster construction is rule-based (high-frequency word matching), and weight calculation integrates statistics and semantics, achieving a balance between efficiency and effectiveness. Predefined intent clusters and word weight libraries are constructed using prior knowledge (high-frequency words) and offline computation (corpus grouping, weight fusion). This process completely avoids the computational bottlenecks of traditional online or offline clustering and is a key preprocessing step in solving the technical problem of "high computational resource consumption based on machine learning methods."
[0099] like Figure 2 This invention provides a semantic clustering apparatus; please refer to [link / reference]. Figure 2 , Figure 2 A schematic diagram of a semantic clustering apparatus provided by the present invention is shown, as follows: Figure 2 The semantic clustering apparatus shown includes: The acquisition unit 21 is used to acquire the sentence to be identified and to perform word segmentation on the sentence to be identified to obtain multiple words to be identified. The calculation unit 22 is used to calculate the semantic similarity between multiple clusters and multiple words to be identified; wherein each cluster corresponds to a different semantic intent; the semantic intent includes price inquiry, function inquiry, specification inquiry, after-sales inquiry, or order inquiry; Calling unit 23 is used to invoke the business process according to the semantic intent corresponding to the semantic similarity when the semantic similarity is greater than the similarity threshold.
[0100] This invention provides a semantic clustering device that refines the granularity of semantic analysis by segmenting the statements to be identified, enabling the system to more accurately capture key information in user inquiries. Calculating the semantic similarity between multiple clusters and multiple words to be identified ensures the accuracy of semantic matching. Each cluster corresponds to a different semantic intent (such as price inquiries, function inquiries, etc.), allowing the system to accurately determine user intent. Employing a mechanism where semantic similarity exceeds a similarity threshold enables rapid filtering and matching of user intent. This process eliminates the need for complex model calculations, significantly improving response speed. Based on the semantic intent corresponding to semantic similarity, business processes are directly invoked, reducing manual intervention steps and achieving automation and efficiency in inquiry processing. The semantic clustering method can flexibly adapt to different business scenarios; by simply adjusting the clusters and corresponding semantic intents, it can be extended to applications in other fields. The system can quickly respond to changes in business needs by adding or adjusting clusters, maintaining high flexibility and adaptability. This provides a more scientific and comprehensive weight reduction solution. This invention obtains and comprehensively analyzes an individual's basic and activity information to accurately calculate non-exercise calorie consumption values, and combines these with calorie intake values from a customized diet plan to match corresponding exercise strategies, thereby improving the accuracy and effectiveness of weight loss strategies.
[0101] Figure 3 This is a schematic diagram of a terminal device provided in an embodiment of the present invention. Figure 3 As shown, a terminal device 3 in this embodiment includes: a processor 30, a memory 31, and a computer program 32 stored in the memory 31 and executable on the processor 30, such as a semantic clustering program. When the processor 30 executes the computer program 32, it implements the steps in the various semantic clustering method embodiments described above, for example... Figure 1Steps 101 to 103 are shown. Alternatively, when the processor 30 executes the computer program 32, it implements the functions of each unit in the above-described device embodiments, for example... Figure 2 The function of the unit shown.
[0102] For example, the computer program 32 can be divided into one or more units, which are stored in the memory 31 and executed by the processor 30 to complete the present invention. The one or more units can be a series of computer program instruction segments capable of performing a specific function, which describe the execution process of the computer program 32 in the terminal device 3. For example, the specific functions of each unit of the computer program 32 can be divided as follows: The acquisition unit is used to acquire the statement to be identified and to perform word segmentation on the statement to be identified to obtain multiple words to be identified. The computing unit is used to calculate the semantic similarity between multiple clusters and multiple words to be identified; wherein each cluster corresponds to a different semantic intent; the semantic intent includes price inquiry, function inquiry, specification inquiry, after-sales inquiry, or order inquiry; The invocation unit is used to invoke the business process according to the semantic intent corresponding to the semantic similarity when the semantic similarity is greater than the similarity threshold.
[0103] The terminal device includes, but is not limited to, a processor 30 and a memory 31. Those skilled in the art will understand that... Figure 3 This is merely an example of a terminal device 3 and does not constitute a limitation on a terminal device 3. It may include more or fewer components than shown, or combine certain components, or different components. For example, the terminal device may also include input / output devices, network access devices, buses, etc.
[0104] The processor 30 can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or any conventional processor.
[0105] The memory 31 can be an internal storage unit of the terminal device 3, such as a hard disk or memory of the terminal device 3. The memory 31 can also be an external storage device of the terminal device 3, such as a plug-in hard disk, smart media card (SMC), secure digital card (SD), flash card, etc., equipped on the terminal device 3. Furthermore, the memory 31 can include both internal and external storage units of the terminal device 3. The memory 31 is used to store the computer program and other programs and data required by the roaming control device. The memory 31 can also be used to temporarily store data that has been output or will be output.
[0106] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.
[0107] It should be noted that the information interaction and execution process between the above-mentioned devices / units are based on the same concept as the method embodiments of the present invention. For details on their specific functions and technical effects, please refer to the method embodiments section, which will not be repeated here.
[0108] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is merely an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit. Furthermore, the specific names of the functional units and modules are only for easy differentiation and are not intended to limit the scope of protection of this invention. The specific working process of the units and modules in the above system can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0109] This invention also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps described in the various method embodiments above.
[0110] This invention provides a computer program product that, when run on a mobile terminal, enables the mobile terminal to implement the steps described in the above-described method embodiments.
[0111] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments of the present invention can be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include at least: any entity or device capable of carrying the computer program code to a photographing device / terminal device, a recording medium, a computer memory, a read-only memory (ROM), a random access memory (RAM), an electrical carrier signal, a telecommunication signal, and a software distribution medium. Examples include USB flash drives, portable hard drives, magnetic disks, or optical disks.
[0112] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail or recorded in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0113] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.
[0114] In the embodiments provided by this invention, it should be understood that the disclosed apparatus / network devices and methods can be implemented in other ways. For example, the apparatus / network device embodiments described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.
[0115] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; they may be located in one place or distributed across multiple network units.
[0116] It should be understood that, when used in this specification and the appended claims, the term "comprising" indicates the presence of the described features, integrals, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or collections thereof.
[0117] It should also be understood that the term "and / or" as used in this specification and the appended claims refers to any combination of one or more of the associated listed items and all possible combinations, and includes such combinations.
[0118] As used in this specification and the appended claims, the term "if" may be interpreted, depending on the context, as "when," "once," "in response to determination," or "in response to detection." Similarly, the phrase "if determined" or "if [the described condition or event] is detected" may be interpreted, depending on the context, as meaning "once determined," "in response to determination," "once [the described condition or event] is detected," or "in response to detection of [the described condition or event]."
[0119] Furthermore, in the description of this invention and the appended claims, the terms "first," "second," "third," etc., are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.
[0120] References to "one embodiment" or "some embodiments" as described in this specification mean that one or more embodiments of the invention include a specific feature, structure, or characteristic described in connection with that embodiment. Therefore, the phrases "in one embodiment," "in some embodiments," "in other embodiments," "in still other embodiments," etc., appearing in different parts of this specification do not necessarily refer to the same embodiment, but rather mean "one or more, but not all, embodiments," unless otherwise specifically emphasized. The terms "comprising," "including," "having," and variations thereof mean "including but not limited to," unless otherwise specifically emphasized.
[0121] The above-described embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included within the protection scope of the present invention.
Claims
1. A method of semantic clustering, characterized by, The method for semantic clustering comprises: acquiring a to-be-recognized sentence, and performing word segmentation processing on the to-be-recognized sentence to obtain a plurality of to-be-recognized words; calculating semantic similarity between a plurality of clustering clusters and a plurality of to-be-recognized words; wherein the plurality of clustering clusters each correspond to a different semantic intent; the semantic intent comprises a price inquiry, a function inquiry, a specification inquiry, an after-sales inquiry or an order inquiry; when the semantic similarity is greater than a similarity threshold, calling a business process according to the semantic intent corresponding to the semantic similarity.
2. The method of semantic clustering as claimed in claim 1, wherein, The step of calculating semantic similarity between a plurality of clustering clusters and a plurality of to-be-recognized words comprises: acquiring a high-frequency keyword set corresponding to each of the plurality of clustering clusters; wherein the high-frequency keyword set refers to a word set pre-set based on a semantic intent; taking the high-frequency keyword set having one or more to-be-recognized words as a preselected high-frequency keyword set; extracting a plurality of sample word sets in the clustering cluster corresponding to the preselected high-frequency keyword set; taking the sample word set having one or more to-be-recognized words as a target sample word set; extracting a training sentence corresponding to the target sample word set; when the target sample word set has and only has one to-be-recognized word, taking a first pre-set word weight corresponding to the to-be-recognized word as a first similarity of the target sample word set; when the target sample word set has a plurality of to-be-recognized words, extracting a second pre-set word weight corresponding to each of the plurality of to-be-recognized words; calculating a second similarity of the target sample word set according to the distribution position of the plurality of to-be-recognized words and the second pre-set word weight.
3. The method of semantic clustering as claimed in claim 2, wherein, The step of calculating a second similarity of the target sample word set according to the distribution position of the plurality of to-be-recognized words and the second pre-set word weight comprises: calculating a word distribution error according to the distribution position of the to-be-recognized word in the training sentence and the to-be-recognized sentence; calculating a first average value between the plurality of second pre-set word weights; acquiring a first adjustment parameter corresponding to the pre-set word weight and a second adjustment parameter corresponding to the word distribution error; multiplying the first average value by the first adjustment parameter to obtain a first numerical value; multiplying the word distribution error by the second adjustment parameter to obtain a second numerical value; adding the first numerical value and the second numerical value to obtain the second similarity.
4. The method of semantic clustering as claimed in claim 3, wherein, The step of calculating a word distribution error according to the distribution position of the to-be-recognized word in the training sentence and the to-be-recognized sentence comprises: extracting a first distribution position of the word corresponding to the plurality of to-be-recognized words in the training sentence, and setting a first order for the plurality of to-be-recognized words based on the first distribution position; extracting a second distribution position of the word corresponding to the plurality of to-be-recognized words in the to-be-recognized sentence, and setting a second order for the plurality of to-be-recognized words based on the second distribution position; calculating a difference value between the first order and the second order corresponding to the same to-be-recognized word; dividing the difference value by the number of the plurality of to-be-recognized words to obtain a position error; calculating a second average value between the position errors corresponding to the plurality of to-be-recognized words; taking a difference value between 1 and the second average value as the word distribution error.
5. The method for semantic clustering as claimed in claim 1 wherein, Before the step of calculating semantic similarity between the plurality of clustering clusters and the plurality of to-be-recognized words, further comprising: obtaining a high-frequency keyword set corresponding to each of the plurality of target semantic intents, wherein the high-frequency keyword set is based on a plurality of high-frequency keywords set by artificial setting; obtaining a plurality of training sentences, and performing word segmentation processing on the training sentences to obtain a plurality of training words; for each training sentence, counting the number of training words in the high-frequency keyword set; for each training sentence, the target semantic intent corresponding to the maximum number of words is taken as the mapping relationship; the plurality of training sentences respectively mapped by each target semantic intent is taken as a clustering cluster; according to the clustering cluster, the explicit feature weight and the implicit semantic weight of each training word are calculated; the explicit feature weight and the implicit semantic weight are added to obtain the preset weight of the training word.
6. The method of semantic clustering as claimed in claim 5, wherein, The step of calculating the explicit feature weight and the implicit semantic weight of each training word according to the clustering cluster comprises: calculating the word frequency, the inter-cluster distribution frequency and the intra-cluster specificity factor; the word frequency, the inter-cluster distribution frequency and the intra-cluster specificity factor are multiplied to obtain the explicit feature weight; wherein the explicit feature weight is used to quantify the distinguishability of the word in the current clustering cluster; according to the semantic correlation degree between the training words, the implicit semantic weight is calculated; wherein the implicit semantic weight is used to evaluate the semantic importance of the word in the training set to the current clustering cluster.
7. The method of semantic clustering as claimed in claim 6, wherein, The step of calculating the word frequency, the inter-cluster distribution frequency and the intra-cluster specificity factor comprises: obtaining the current clustering cluster to which the training word belongs, and counting the first number of training sentences in the current clustering cluster; counting the second number of training sentences containing the training word in the current clustering cluster; the second number is divided by the first number to obtain the word frequency; counting the first total number of clustering clusters and the third number of clustering clusters containing the training word; the third number is added to 1 to obtain a third value; the first total number is divided by the third value and log is taken to obtain the inter-cluster distribution frequency; counting the fourth number of training sentences containing the training word in all clustering clusters; the second number is divided by the fourth number to obtain the intra-cluster specificity factor.
8. The method of semantic clustering as claimed in claim 6, wherein, The step of calculating the implicit semantic weight according to the semantic correlation degree between the training words comprises: Step A1: counting the fifth number of training sentences containing the current training word in all clustering clusters; Step A2: counting the sixth number of training sentences containing other training words in all clustering clusters respectively; wherein the other training words refer to the words other than the current training word in all training words; Step A3: counting the seventh number of training sentences containing the training word and the other word in all clustering clusters; Step A4: multiplying the fifth number and the sixth number to obtain a fourth value; Step A5: dividing the seventh number by the fourth value and taking log to obtain the semantic correlation degree; Step A6: if the semantic correlation degree between two training words is greater than a preset value, the two training words are taken as two adjacent training words; Step A7: setting the initial influence of each training word to 1; Step A8: for each training word, obtaining all adjacent training words corresponding to the training word; Step A9: taking the sum of the product between the influence and the semantic correlation degree of all adjacent training words corresponding to the training word as the new influence of the training word; Step A10: iteratively performing steps A8 to A9 to obtain the final influence, and taking the final influence as the implicit semantic weight corresponding to the training word.
9. An apparatus for semantic clustering, the apparatus comprising: The semantic clustering device comprises: An acquisition unit configured to acquire a to-be-identified sentence, and perform word segmentation processing on the to-be-identified sentence to obtain a plurality of to-be-identified words; A calculation unit configured to calculate semantic similarities between a plurality of clustering clusters and the plurality of to-be-identified words; each of the plurality of clustering clusters corresponds to a different semantic intent; the semantic intent includes a price inquiry, a function inquiry, a specification inquiry, an after-sales inquiry, or an order inquiry; A calling unit configured to, when the semantic similarity is greater than a similarity threshold, call a business process according to a semantic intent corresponding to the semantic similarity.
10. A computer-readable storage medium storing a computer program, the computer program comprising instructions that, when executed by a computer, cause the computer to perform the method of any one of claims 1 to 9. The computer program, when executed by a processor, implements the steps in the method of semantic clustering according to any one of claims 1 to 8.