Textual intent clustering method, electronic device, and storage medium
Patent Information
- Application Number
- CN202611231690.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-13
- Publication Date
- 2026-10-30
AI Technical Summary
[0005]鉴于以上内容,有必要提供一种文本意图聚类方法、电子设备及存储介质,能够解决文本意图聚类效果不佳及聚类效率低的技术问题
在本申请实施例提供的文本意图聚类方案中,对文本集的特征向量集进行聚类,得到多个向量子簇,根据多个向量子簇对文本集进行划分,不仅能够产出一批粒度较细的文本子簇作为语言模型的候选输入,还能够有效规避相关技术中的聚类算法在全局数据上直接计算所面临的O(n²)复杂度问题,从而显著降低计算开销。将意图划分的粒度规则通过第一提示内容输入至语言模型,使得语言模型能够根据粒度规则的指示,为文本子簇生成粒度精细且准确的标准意图名称,相较于相关技术中仅依据聚类阶段所采用的距离阈值进行粗略意图划分的方法,本方案能够有效提升意图识别的粒度精度与语义准确性。通过从文本子簇中抽取代表问法文本作为代表文本,并与第一提示内容共同输入语言模型,使得语言模型的调用次数为文本子簇的总数量级相当,而无需对各文本子簇内的全量文本逐条两两比较,从而显著降低了计算成本与推理耗时。对相似的标准意图进行归一化处理,既能够有效避免同一意图被拆分为多个不同的名称,也可降低因名称不一致而对后续频次统计造成的影响。利用语言模型,能够精确及快速地生成归一化后的每个标准意图所属的标准主题,基于归一化后的每个标准意图,对文本集进行分类,能够精确地确定文本集中的每条文本对应的标准意图与所属的标准主题。如此,不仅能够确定文本对应的粒度精细的标准意图与准确的标准主题,有效提高文本意图聚类在粒度层面的精细程度,还能够提高聚类效率。
Smart Images

Figure CN123012178A_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of data processing, and in particular relates to a text intent clustering method, electronic device and storage medium. Background Technology
[0002] In business scenarios such as intelligent customer service, user feedback analysis, public opinion summarization, and knowledge base governance, a large amount of user text is accumulated every day. In order to quickly grasp user needs, it is usually necessary to cluster these colloquial and diverse texts to identify the user's true intention in the consultation or feedback.
[0003] Related technologies often use distance-based clustering algorithms such as K-means for text clustering. However, the clustering parameters of these algorithms (such as distance thresholds and K-values) are unrelated to business semantics and cannot perceive business semantic principles in real-world application scenarios, such as "different question angles represent different intentions" or "different sub-functions within the same product represent different intentions." This misalignment between clustering granularity and the business intent level can easily lead to inaccurate text intent clustering results, making it difficult to directly apply to real-world business scenarios.
[0004] In addition, text clustering methods in related technologies often employ a pairwise comparison approach, which has a complexity of O(n²), meaning the computational cost increases quadratically with the amount of text. When the data volume is large, the computational cost rises sharply, easily leading to resource shortages or excessively long processing times. Summary of the Invention
[0005] In view of the above, it is necessary to provide a text intent clustering method, electronic device and storage medium that can solve the technical problems of poor text intent clustering effect and low clustering efficiency.
[0006] On one hand, this application provides a text intent clustering method, the method comprising: clustering the feature vector set of a text set to obtain multiple vector subclusters; dividing the text set into multiple text subclusters according to the multiple vector subclusters; inputting a first prompt content and a representative text in each text subcluster into a language model to generate a standard intent corresponding to each text subcluster, wherein the first prompt content is used to indicate the granularity rules of the diagram division; normalizing similar standard intents; using the language model to generate a standard topic to which each normalized standard intent belongs; classifying the text set based on each normalized standard intent; and determining the standard intent and standard topic corresponding to each text in the text set.
[0007] In some embodiments of this application, classifying the text set based on each normalized standard intent and determining the standard intent and standard topic corresponding to each text in the text set includes: generating an intent anchor vector corresponding to each standard intent based on the feature vector of each normalized standard intent and the feature vector of the representative text in the text sub-cluster corresponding to each standard intent; determining the similarity between the feature vector of each text in the text set and the intent anchor vectors corresponding to all standard intents; and determining the standard intent and standard topic corresponding to each text based on the standard intent corresponding to the highest similarity and the associated standard topic.
[0008] In some embodiments of this application, generating the intent anchor vector corresponding to each standard intent based on the normalized feature vector of each standard intent and the feature vector of the representative text in the text sub-cluster corresponding to each standard intent includes: averaging the feature vector of each standard intent and the feature vector of the representative text in the text sub-cluster corresponding to each standard intent to obtain the intent anchor vector corresponding to each standard intent.
[0009] In some embodiments of this application, determining the standard intent and associated standard topic of each text based on the standard intent corresponding to the highest similarity and the associated standard topic includes: for any text in the text set, if the highest similarity corresponding to any text is greater than or equal to a preset threshold, determining the standard intent and associated standard topic corresponding to the highest similarity as the standard intent and associated standard topic of the text; if the highest similarity corresponding to any text is less than the preset threshold, filtering out the text from the text set.
[0010] In some embodiments of this application, clustering the feature vector set to obtain multiple vector subclusters includes: dividing the feature vector set into multiple vector subsets using the category labels corresponding to the text set; if the data volume of any vector subset is greater than a preset value, dividing the vector subset into blocks; clustering each vector subset to obtain multiple vector subclusters corresponding to each vector subset; or clustering the feature vector set to obtain the multiple vector subclusters.
[0011] In some embodiments of this application, generating a normalized standard topic for each standard intent using the language model includes: inputting each standard intent and a second prompt into the language model to generate an original topic for each standard intent, wherein the second prompt is used to indicate the association between the topic and the intent, and the original topic is used to indicate the business object corresponding to each standard intent; inputting each original topic and a third prompt into the language model to generate a standard topic for each original topic, wherein the third prompt is used to indicate the original topic of the same normalized business object.
[0012] In some embodiments of this application, the method further includes: normalizing similar standard topics.
[0013] In some embodiments of this application, the method further includes: filtering out fuzzy text from the plurality of text subclusters, wherein the fuzzy text does not include preset words, and the preset words include at least one or more of action words, interrogative words, and state words.
[0014] On the other hand, this application provides an electronic device, the electronic device including: a memory, a processor and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the electronic device implements the text intent clustering method described above.
[0015] On the other hand, this application provides a computer-readable storage medium storing a computer program that, when executed by a processor in an electronic device, implements the text intent clustering method described above. In the text intent clustering scheme provided in this application embodiment, the feature vector set of the text set is clustered to obtain multiple vector subclusters. The text set is then divided according to these multiple vector subclusters. This not only produces a batch of fine-grained text subclusters as candidate inputs for the language model, but also effectively avoids the O(n²) complexity problem faced by clustering algorithms in related technologies when directly calculating on global data, thus significantly reducing computational overhead. The granularity rules for intent division are input into the language model through the first prompt content, enabling the language model to generate fine-grained and accurate standard intent names for the text subclusters according to the instructions of the granularity rules. Compared with the method in related technologies that only uses the distance threshold used in the clustering stage for coarse intent division, this scheme can effectively improve the granularity accuracy and semantic accuracy of intent recognition. By extracting representative question texts from the text subclusters as representative texts and inputting them into the language model along with the first prompt content, the number of calls to the language model is comparable to the total number of text subclusters, without having to compare each text in each subcluster pairwise, thus significantly reducing computational cost and inference time. Normalizing similar standard intents effectively prevents the same intent from being split into multiple different names and reduces the impact of inconsistent names on subsequent frequency statistics. Using a language model, the standard topic to which each normalized standard intent belongs can be generated accurately and quickly. Based on each normalized standard intent, the text set is classified, accurately determining the standard intent and its corresponding standard topic for each text in the set. This not only identifies fine-grained standard intents and accurate standard topics for each text, effectively improving the granularity of text intent clustering, but also enhances clustering efficiency. Attached Figure Description
[0016] Figure 1 This is a flowchart of a text intent clustering method provided in an embodiment of this application.
[0017] Figure 2 This is a flowchart of a text set classification method provided in an embodiment of this application.
[0018] Figure 3 This is a functional block diagram of a text intent clustering device provided in an embodiment of this application.
[0019] Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0020] It should be noted that in this application, "at least one" means one or more, and "more than one" means two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone, where A and B can be singular or plural. The terms "first," "second," "third," "fourth," etc. (if present) in the specification, claims, and drawings of this application are used to distinguish similar objects, not to describe a specific order or sequence.
[0021] In the embodiments of this application, the terms "exemplary" or "for example" are used to indicate examples, illustrations, or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of this application should not be construed as being more preferred or advantageous than other embodiments or design solutions. Specifically, the use of terms such as "exemplary" or "for example" is intended to present the relevant concepts in a specific manner. Unless otherwise specified, the following embodiments and features described herein can be combined with each other.
[0022] In business scenarios such as intelligent customer service, user feedback analysis, public opinion summarization, and knowledge base governance, a large amount of user text is accumulated every day. In order to quickly grasp user needs, it is usually necessary to cluster these colloquial and diverse texts to identify the user's true intention in the consultation or feedback.
[0023] Related technologies often use distance-based clustering algorithms such as K-means for text clustering. However, the clustering parameters of these algorithms (such as distance thresholds and K-values) are unrelated to business semantics and cannot perceive business semantic principles in real-world application scenarios, such as "different question angles represent different intentions" or "different sub-functions within the same product represent different intentions." This misalignment between clustering granularity and the business intent level can easily lead to inaccurate text intent clustering results, making it difficult to directly apply to real-world business scenarios.
[0024] In addition, text clustering methods in related technologies often employ a pairwise comparison approach, which has a complexity of O(n²), meaning the computational cost increases quadratically with the amount of text. When the data volume is large, the computational cost rises sharply, easily leading to resource shortages or excessively long processing times.
[0025] To address the aforementioned technical problems, this application provides a text intent clustering method that can not only determine the fine-grained standard intent and accurate standard topic corresponding to the text, effectively improving the fineness of text intent clustering at the granular level, but also improve clustering efficiency.
[0026] The text intent clustering method provided in this application can be applied to one or more electronic devices. Exemplarily, electronic devices can be computers, mobile phones, tablets, laptops, servers, and embedded devices, where the server can be a cloud server or a server cluster. The above examples of electronic devices are merely illustrative, and practical applications are not limited to them.
[0027] like Figure 1 The diagram shown is a flowchart of a text intent clustering method provided in an embodiment of this application. Depending on different needs, the order of the steps in this flowchart can be adjusted according to actual requirements, and some steps can be omitted. The method is applied to electronic devices, such as… Figure 4 The method for the electronic device 10 shown includes the following steps: S11 clusters the feature vector set of the text set to obtain multiple vector sub-clusters.
[0028] In some embodiments of this application, the text set may include multiple texts to be clustered, and the text may be user text. User text may be various natural language descriptions generated by users, including but not limited to feedback, inquiries, complaints, comments, and suggestions.
[0029] User text can originate from any business scenario, such as e-commerce, manufacturing, or government consultation. This application does not restrict the business scenario to which the user text belongs. For example, in an e-commerce scenario, user text could be "website cannot be opened," "store cannot be accessed," or "page is 502," etc.
[0030] In some embodiments of this application, the electronic device can utilize an embedding layer to vectorize a text set, obtaining a feature vector set. The feature vector set may include the feature vector corresponding to each text in the text set; texts with similar semantics are closer in the vector space. Vectorization can be implemented through embedding encoding, statistical encoding, or other methods. For example, each feature vector may be a high-dimensional, dense embedding vector.
[0031] In some embodiments of this application, the electronic device may preprocess the text set before vectorizing it, including deduplication. By performing deduplication on the text set, duplicate text can be filtered out, thereby reducing the computational overhead of subsequent clustering.
[0032] In some embodiments, the electronic device can record the frequency of each unique text retained after deduplication in the original text set, thereby reducing the loss of data distribution information caused by deduplication.
[0033] In some embodiments of this application, the electronic device clusters a feature vector set to obtain multiple vector sub-clusters, including: dividing the feature vector set into multiple vector subsets using the category labels corresponding to the text set; if the data volume of any vector subset is greater than a preset value, dividing the vector subset into blocks; clustering each vector subset to obtain multiple vector sub-clusters corresponding to each vector subset; or clustering the feature vector set (global clustering) to obtain the multiple vector sub-clusters.
[0034] Each text in the text set can have a corresponding category label. The category label can indicate the business category, business theme, business domain, etc., to which the corresponding text belongs. The category label can be derived from manual annotation or existing classifications in the business system. The electronic device can group feature vectors with the same category label in the feature vector set into the same vector subset according to the correspondence between the text set and the feature vector set, thereby obtaining multiple vector subsets.
[0035] In some embodiments, the method of electronic devices directly performing global clustering of feature vector sets can be applied to situations where the text set does not carry category labels.
[0036] In some embodiments, the preset value can be customized, and this application embodiment does not limit this. Dividing the vector subset whose data stream is greater than the preset value into blocks can form multiple smaller vector subsets, which can also be called vector blocks or vector clusters.
[0037] The method of segmentation can be flexibly selected, and this application embodiment does not limit it. For example, the electronic device can use a linear method (such as MiniBatchKMeans) to segment a vector subset with a data size greater than a preset value.
[0038] In some embodiments, the electronic device may employ a combination of one or more clustering algorithms, such as agglomerative clustering, DBSCAN, HDBSCAN, spectral clustering, and K-Means, to cluster each vector subset, thereby obtaining multiple vector sub-clusters corresponding to each vector subset. This application does not limit the specific type of clustering algorithm used.
[0039] In this embodiment, when the text set carries category labels, these labels can be used to quickly divide the feature vector set into multiple smaller vector subsets, achieving preliminary category division. When the text set does not carry category labels, regular expressions are used to perform regular expression matching on the text set, and the feature vector set is divided into multiple smaller vector subsets based on the matching results, thus achieving global-level category division in the unlabeled case. When the data size of any vector subset is large, this vector subset is divided into blocks, and each vector subset is clustered to obtain multiple vector subclusters corresponding to each vector subset.
[0040] S12, divide the text set into multiple text subclusters based on multiple vector subclusters.
[0041] In some embodiments of this application, the electronic device can group the text corresponding to each vector subcluster in the text set into the same text subcluster, thereby obtaining multiple text subclusters. These multiple vector subclusters can correspond one-to-one with multiple text subclusters.
[0042] In this embodiment, dividing the text set according to multiple vector subclusters not only produces a batch of fine-grained text subclusters as candidate inputs for the language model, but also effectively avoids the O(n²) complexity problem faced by clustering algorithms in related technologies when directly calculating on global data, thereby significantly reducing computational overhead.
[0043] In some embodiments of this application, the electronic device can perform data cleaning on multiple text subclusters. For example, the electronic device filters out ambiguous text from multiple text subclusters, where the ambiguous text does not include preset words, and the preset words include at least one or more of action words, interrogative words, and state words.
[0044] In this embodiment, data cleaning of multiple text subclusters filters out vague text containing only product names without any action or interrogative words, as well as words and / or sentences with no substantial intent, such as mere pleasantries or confirmations. In related technologies, such low-quality text is often forcibly assigned to the nearest cluster, which can easily lead to biases in high-frequency statistics. This embodiment filters out these low-quality texts through data cleaning, reducing token consumption and minimizing the interference of text noise on subsequent clustering, resulting in cleaner clustering results.
[0045] S13, input the first prompt content and the representative text in each text sub-cluster into the language model to generate the standard intent corresponding to each text sub-cluster. The first prompt content is used to indicate the granularity rules of the schematic diagram division.
[0046] In some embodiments of this application, the granularity criteria for classifying the intent indicated by the first prompt content may include 5W granularity and subject granularity. The 5W granularity can instruct the language model to distinguish intents from one or more question angles such as how, what, where, why, and who, thereby treating the requests corresponding to different question angles like how, what, where, why, and who as different intent categories. For the same business object, "what" and "how" belong to different intents. The business object can be various software or hardware products, and this application does not limit this. For example, taking SHOPLINE Payments (SLP) in the e-commerce field as an example, "how to activate SLP," "what is SLP," and "what is the SLP fee rate" belong to three intents, not the same intent.
[0047] Subject granularity can instruct the language model to distinguish intents by sub-entities of a business object. This can be understood as different sub-functions of the same product or business object should also be broken down into different intents. For example, taking the business object SLP as an example, different sub-functions of SLP, such as "SLP activation", "SLP rate", and "SLP review", belong to three different intents.
[0048] The 5W granularity and subject granularity mentioned above are merely examples of granularity rules. In practical applications, the 5W granularity and subject granularity can also be augmented with additional dimensions (such as sentiment or channel) based on business needs, achieved by modifying the initial prompt content.
[0049] The intent described in this application embodiment can refer to a specific request expressed in user text that can be understood independently, such as "the store / website cannot be accessed", which is a level more granular than the topic usually referred to.
[0050] In some embodiments of this application, the language model can be a large-scale pre-trained model for understanding, generating, and discriminating natural language. For example, it can be a Large Language Model (LLM). Exemplarily, the language model can be a series of GPT models, Tongyi Qianwen, or other large language models. This application does not limit the specific type of language model.
[0051] In some embodiments of this application, the electronic device may select some text subclusters from multiple text subclusters and generate corresponding standard intents for the selected text subclusters using a language model. Alternatively, it may generate corresponding standard intents for each text subcluster in the multiple text subclusters using a language model. This application does not limit this.
[0052] In some embodiments of this application, representative text within a text sub-cluster can be used to represent the representative question corresponding to that text sub-cluster, carrying the representative semantics of that text sub-cluster. For example, an electronic device can use a preset number of texts closest to the center of a text sub-cluster as the representative text of that text sub-cluster. The preset number can be customized, and this application does not limit this setting.
[0053] In some embodiments of this application, the electronic device can input the first prompt content and the representative text of the text sub-cluster into a language model, so that the language model can generate a corresponding standard intent for the text sub-cluster based on the semantic analysis of the representative text and using the 5W granularity and subject granularity intent segmentation rules indicated by the first prompt content. The standard intent can be a standardized intent name, also known as a canonical intent.
[0054] In this embodiment, the granularity rules for intent segmentation are input into the language model via the first prompt content. This allows the language model to generate fine-grained and accurate standard intent names for text subclusters based on the granularity rules. Compared to related technologies that rely solely on distance thresholds used in the clustering stage for coarse intent segmentation, this approach effectively improves the granularity and semantic accuracy of intent recognition. By extracting representative question texts from text subclusters as representative texts and inputting them along with the first prompt content into the language model, the number of language model calls is comparable to the total number of text subclusters. This eliminates the need for pairwise comparisons of all text within each subcluster, significantly reducing computational costs and inference time.
[0055] S14, normalize similar standard intentions.
[0056] In some embodiments of this application, the electronic device can perform vectorization processing on each standard intent to obtain the feature vector of each standard intent, calculate the similarity between the feature vectors of any two standard intents, and if the similarity between the feature vectors of any two standard intents is greater than a preset similarity threshold, the electronic device determines that the two standard intents are similar.
[0057] For details on the specific method of vectorizing each standard intent, please refer to the description of step S11. For example, the electronic device can use an embedding layer to embed and encode each standard intent to obtain a feature vector for each standard intent.
[0058] In some embodiments of this application, the electronic device normalizes similar standard intents, unifying semantically identical but differently expressed standard intents into a single standard representation. The normalization method can be flexible and varied. For example, the electronic device can select a standard intent from similar standard intents and adjust unselected standard intents to the selected one, thereby achieving normalization. The selection of the standard intent can be random or based on the number or size of the vector clusters corresponding to each of the similar standard intents. Alternatively, the electronic device can generate new standard intents based on similar standard intents and adjust similar standard intents to the corresponding new standard intents, thereby achieving normalization.
[0059] In some embodiments of this application, after determining whether any two standard intents are similar based on the similarity between their feature vectors, and after normalizing the similar standard intents, the electronic device can input each normalized standard intent and a fourth prompt content into the language model. The fourth prompt content can indicate to the language model that the normalized standard intents have the same semantics. The specific process can be referred to in step S15 below, which describes the process of normalizing similar standard topics.
[0060] When using a language model to generate corresponding standard intent names for each text sub-cluster, it is easy to produce results with the same semantics but slightly different expressions, such as "Unable to log in to account" and "Account login failed". To address this issue, this embodiment normalizes similar standard intents, which can effectively prevent the same intent from being split into multiple different names and reduce the impact of inconsistent names on subsequent frequency statistics.
[0061] S15 uses a language model to generate the standard topic to which each standard intent belongs after normalization.
[0062] In some embodiments of this application, the electronic device uses a language model to generate a standard topic to which each normalized standard intent belongs, including: inputting each normalized standard intent and a second prompt into the language model to generate an original topic to which each standard intent belongs; inputting each original topic and a third prompt into the language model to generate a standard topic to which the standard intent to belong corresponds to each original topic.
[0063] In some embodiments, the second prompt content is used to indicate the association between the topic and the intent, and the original topic is used to indicate the business object corresponding to each standard intent. For example, taking the business object as SLP, the second prompt content may indicate that the schematic diagrams "SLP Activation Process", "SLP Rate", and "SLP Withdrawal" are all included in the topic "SHOPLINEPayments".
[0064] In some embodiments, the electronic device inputs each normalized standard intent and a second prompt into a language model, such that the language model, based on semantic analysis of each standard intent, utilizes the association between the topic indicated by the second prompt and the intent to generate an original topic corresponding to each standard intent. The original topic can be an initial or original topic name output by the language model.
[0065] In some embodiments, the third prompt content is used to indicate the original topic of the same business object to be normalized by the language model. For example, each original topic and the third prompt content are input into the language model, such that the language model generates a mapping table between the original topics and standard topics based on semantic analysis of each original topic and the indication of the third prompt content.
[0066] In some embodiments of this application, the electronic device may normalize similar standard topics. Specific methods for normalizing similar standard topics can be found in the description of normalizing similar standard topics in step S14.
[0067] In this embodiment, a language model is used to accurately and quickly generate the standard topic to which each normalized standard intent belongs. Specifically, each normalized standard intent and the second prompt content are input into the language model to quickly and accurately generate the original topic to which each standard intent belongs. Since the language model may generate inconsistent standard topic names in different batches of reasoning, for example, the expressions "decoration / topic" and "topic" may coexist, this embodiment further inputs the third prompt content, which instructs the language model to normalize the original topic of the same business object, along with the original topic name, into the language model. This allows the language model to uniformly map semantically identical original topics to standardized topic names, thereby eliminating naming drift.
[0068] By normalizing similar standard topics, the consistency of topics is effectively maintained without affecting processing speed, thus solving the problem of inconsistent naming of the same topic when calling the language model in parallel. This embodiment adopts a two-stage strategy: first, the language model normalizes the original topics, and then the standard topics are normalized. The necessity of this strategy lies in the fact that directly relying on feature vectors for topic merging is unreliable. For example, "SLP" and "SHOPLINEPayments" have the same semantics and should be merged, but their feature vectors are far apart. If they are not normalized with the language model first, it is easy to miss the merge. On the other hand, although "SHOPLINE Payments" and "SHOPLINE Flow" have similar feature vectors, they are actually two different products or business objects and should not be merged. If they are not normalized with the language model first, it is easy to mis-merge.
[0069] S16. Based on each normalized standard intent, classify the text set to determine the standard intent and standard topic corresponding to each text in the text set.
[0070] In some embodiments of this application, the electronic device classifies a text set based on each normalized standard intent, and determines the standard intent and standard topic corresponding to each text in the text set, including: generating an intent anchor vector corresponding to each standard intent based on the feature vector of each normalized standard intent and the feature vector of the representative text in the text sub-cluster corresponding to each standard intent; determining the similarity between the feature vector of each text in the text set and the intent anchor vectors corresponding to all standard intents; and determining the standard intent and standard topic corresponding to each text based on the standard intent corresponding to the highest similarity and the associated standard topic.
[0071] In some embodiments, the feature vector of each standard intent after normalization can be obtained by vectorizing each standard intent. The specific generation method of the feature vector of each standard intent and the feature vector representing the text can be referred to the description of step S14.
[0072] Each normalized standard intent corresponds to a text subcluster that can be multiple similar text subclusters corresponding to standard intents before normalization. For example, if standard intent A is similar to standard intent B, and standard intent A corresponds to text subcluster a, while standard intent B corresponds to text subcluster b, and standard intent A and standard intent B are normalized to standard intent C, then the text subclusters corresponding to standard intent C include text subclusters a and b. The electronic device can select the corresponding representative text from text subclusters a and b. The method for selecting the representative text can be found in the description of step S13.
[0073] In some embodiments, generating an intent anchor vector corresponding to each standard intent based on the normalized feature vector of each standard intent and the feature vector of the representative text in the text sub-cluster corresponding to each standard intent includes: averaging the feature vector of each standard intent and the feature vector of the representative text in the text sub-cluster corresponding to each standard intent to obtain the intent anchor vector corresponding to each standard intent.
[0074] The average operation can be either an arithmetic average or a weighted average, and this application does not limit the specific method used.
[0075] In other embodiments, the intent anchor vector may be determined solely by the mean of the feature vectors representing the text, or solely by the feature vectors of the standard intent; this application does not impose any limitations on this.
[0076] In some embodiments, the electronic device determines the standard intent and associated standard topic of each text based on the standard intent corresponding to the highest similarity and the associated standard topic, including: for any text in the text set, if the highest similarity corresponding to the any text is greater than or equal to a preset threshold, the standard intent and associated standard topic corresponding to the highest similarity are determined as the standard intent and associated standard topic of the any text; if the highest similarity corresponding to the any text is less than the preset threshold, the any text is filtered out from the text set.
[0077] The preset threshold can be customized, and this application embodiment does not impose any restrictions on it. For example, the preset threshold can be 0.65, 0.68, or 0.70.
[0078] In other embodiments, the preset threshold can be set according to standard intents. The similarity between any text and each normalized standard intent has a corresponding preset threshold. If there are multiple similarities between any text and all normalized standard intents that are greater than the corresponding preset threshold, the standard intent corresponding to the highest similarity and the associated standard topic can be selected as the standard topic and the standard topic to which the text belongs. If there is only one similarity between any text and all normalized standard intents that is greater than the corresponding preset threshold, the standard intent corresponding to that similarity and the associated standard topic can be selected as the standard topic and the standard topic to which the text belongs.
[0079] In other embodiments, the electronic device may use a language model for secondary verification instead of a simple similarity judgment.
[0080] Based on the clustering operation in step S11, step S12 can easily group multiple texts with similar intents into the same text subcluster. Therefore, in this embodiment, based on the feature vector of each normalized standard intent and the feature vector of the representative text in the corresponding text subcluster of each standard intent, an intent anchor vector is generated for each standard intent. This ensures that the anchor intent vector carries both instance semantics and intent label semantics, thereby improving the stability of the text set classification results. For each text in the text set, the similarity between it and all intent anchor vectors is calculated. Based on the standard intent corresponding to the highest similarity and the topic to which that standard intent belongs, the standard intent and its corresponding standard topic are determined for that text, instead of using the standard intent and its corresponding standard topic from its original text subcluster. This effectively corrects clustering bias. For example, even if multiple vector subclusters are obtained based on the clustering in step S11, step S12 merges "how to activate SLP" and "how long does it take to activate SLP" into the same text subcluster. Through this step, each text in the text set can be aligned to the standard intent and the standard topic corresponding to its nearest intent anchor point, thereby achieving more accurate intent alignment at a fine-grained level.
[0081] When the similarity between any text in the text set and all intent anchors is below a preset threshold, it is not forcibly assigned to any intent, but rather filtered out from the text set. This rejection mechanism effectively ensures that low-quality text that is not closely related to any intent will not interfere with subsequent results. Step S12, which filters out ambiguous text from multiple text subclusters, can also be considered a rejection mechanism.
[0082] In some embodiments of this application, the electronic device can perform text merging processing based on the classification results, count the number of text entries under each standard intent, and sort them from high to low frequency, ultimately outputting two tables: one is an intent clustering result table, with each row containing one intent, including ranking, corresponding standard intent name, standard topic name, number of questions, representative question, and merging details; the other is a text-to-intent mapping table, with each row containing one text entry and its corresponding standard intent name and standard topic name. This mapping table can be used as label data for training or test sets.
[0083] like Figure 2 The diagram shown is a flowchart of a text set classification method provided in an embodiment of this application. Figure 2 The candidate subclusters can be the text subclusters in the embodiments of this application. Figure 2 The various processes shown can be referred to in the explanation above.
[0084] In some embodiments of this application, the electronic device can use the hash value of the input content as a cache key to cache text sets and corresponding feature vectors, standard intents stored according to representative questions, standard topics, and normalized mapping relationships of standard topics. Therefore, when only purely computational parameters such as clustering thresholds and merging thresholds are adjusted, re-executing the process does not require re-calling the language model or embedding layer, and can quickly obtain the output results under the new granularity partitioning. This caching mechanism decouples the "high-cost semantic generation process" from the "low-cost aggregation parameter adjustment process," making granularity tuning an iterative operation with almost zero marginal cost.
[0085] The text intent clustering method provided in this application can serve as the underlying algorithm support for the "high-frequency intent analysis" function in intelligent customer service and operational analysis platforms. It is applicable to product scenarios such as intelligent customer service backends, user voice or customer feedback analysis, knowledge base governance tools, and test set construction. The specific usage is as follows: Operations personnel upload customer service conversations or user feedback forms over a period of time. The file must contain a text set, which may carry corresponding category labels. The electronic device responds to the "intent clustering" control triggered by the user on the user interface, executes the text intent clustering method described in this application, and after calculation, the electronic device can output two result tables: one is an intent clustering result table, with one intent per row, including ranking, corresponding standard intent name, belonging standard topic name, number of questions, representative question, and merging details; the other is a text-to-intent mapping table, with one text per row and its corresponding standard intent name and belonging standard topic name. Functionally, it supports setting the output of the top N standard intents, supports quick recalculation using a caching mechanism after adjusting granularity parameters, and controls the purity of results through a rejection threshold. The results can be exported with one click and used as candidate data for knowledge base completion or label data for model training and testing. In the interaction flow, users sequentially upload files, select text sets and category tags, set the number of output intents and related thresholds, start the process, preview the ranking of high-frequency intents and the corresponding question frequency bar chart, and can follow the steps such as... Figures 1 to 2 The process shown is divided into stages to view the processing progress.
[0086] In the text intent clustering scheme provided in this application embodiment, the feature vector set of the text set is clustered to obtain multiple vector subclusters. The text set is then divided according to these multiple vector subclusters. This not only produces a batch of fine-grained text subclusters as candidate inputs for the language model, but also effectively avoids the O(n²) complexity problem faced by clustering algorithms in related technologies when directly calculating on global data, thus significantly reducing computational overhead. The granularity rules for intent division are input into the language model through the first prompt content, enabling the language model to generate fine-grained and accurate standard intent names for the text subclusters according to the instructions of the granularity rules. Compared with the method in related technologies that only uses the distance threshold used in the clustering stage for coarse intent division, this scheme can effectively improve the granularity accuracy and semantic accuracy of intent recognition. By extracting representative question texts from the text subclusters as representative texts and inputting them into the language model along with the first prompt content, the number of calls to the language model is comparable to the total number of text subclusters, without having to compare each text in each subcluster pairwise, thus significantly reducing computational cost and inference time. Normalizing similar standard intents effectively prevents the same intent from being split into multiple different names and reduces the impact of inconsistent names on subsequent frequency statistics. Using a language model, the standard topic to which each normalized standard intent belongs can be generated accurately and quickly. Based on each normalized standard intent, the text set is classified, accurately determining the standard intent and its corresponding standard topic for each text in the set. This not only identifies fine-grained standard intents and accurate standard topics for each text, effectively improving the granularity of text intent clustering, but also enhances clustering efficiency.
[0087] like Figure 3 The diagram shown is a functional block diagram of a text intent clustering device provided in an embodiment of this application. The text intent clustering device 11 includes a clustering unit 111, a partitioning unit 112, a generation unit 113, a normalization unit 114, and a classification unit 115. The module / unit referred to in this application refers to a type of unit capable of being clustered... Figure 4 The processor 103 in the middle acquires a series of computer-readable instruction segments that are capable of performing a fixed function, and these segments are stored in Figure 4 The memory 102 is used for this purpose. In this embodiment, the functions of each module / unit will be described in detail in subsequent embodiments.
[0088] Clustering unit 111 is used to cluster the feature vector set of the text set to obtain multiple vector sub-clusters.
[0089] The partitioning unit 112 is used to divide the text set into multiple text subclusters based on multiple vector subclusters.
[0090] The generation unit 113 is used to input the first prompt content and the representative text in each text sub-cluster into the language model to generate the standard intent corresponding to each text sub-cluster. The first prompt content is used to indicate the granularity rules of the schematic diagram division.
[0091] Normalization unit 114 is used to normalize similar standard intentions.
[0092] The generation unit 113 is also used to generate, using a language model, the standard topic to which each standard intent belongs after normalization.
[0093] Classification unit 115 classifies the text set based on each normalized standard intent, and determines the standard intent and standard topic corresponding to each text in the text set.
[0094] like Figure 4 The diagram shown is a structural schematic of an electronic device provided in an embodiment of this application. Figure 4 The electronic device 10 shown can be a computer, mobile phone, tablet computer, laptop computer, server, etc. The specific type of electronic device 10 is not limited in this application embodiment.
[0095] exist Figure 4 The electronic device 10 may include a communication module 101, a memory 102, a processor 103, an input / output (I / O) interface 104, and a bus 105. The processor 103 is coupled to the communication module 101, the memory 102, and the input / output interface 104 via the bus 105.
[0096] Communication module 101 may include a wired communication module and / or a wireless communication module. The wired communication module may provide one or more wired communication solutions such as Universal Serial Bus (USB) and Controller Area Network (CAN). The wireless communication module may provide one or more wireless communication solutions such as Wireless Fidelity (Wi-Fi), Bluetooth (BT), mobile communication networks, frequency modulation (FM), near field communication (NFC), and infrared (IR).
[0097] Memory 102 may include one or more random access memory (RAM) and one or more non-volatile memory (NVM). The RAM can be directly read and written by the processor 103, and can be used to store executable programs (e.g., machine instructions) of other running programs, as well as user and application data. The RAM may include static random-access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), etc.
[0098] Non-volatile memory can also store executable programs and user and application data, and can be pre-loaded into random access memory for direct reading and writing by the processor 103. Non-volatile memory can include disk storage devices and flash memory.
[0099] Memory 102 is used to store one or more computer programs. The one or more computer programs are configured to be executed by processor 103. The one or more computer programs include multiple instructions that, when executed by processor 103, can implement a text intent clustering method that is executed on electronic device 10.
[0100] In other embodiments, such as Figure 4 The electronic device 10 shown also includes an external memory interface for connecting to an external memory to expand the storage capacity of the electronic device 10.
[0101] Processor 103 may include one or more processing units, such as application processors (APs), modem processors, graphics processing units (GPUs), image signal processors (ISPs), controllers, video codecs, digital signal processors (DSPs), and / or neural network processing units (NPUs). These different processing units may be independent devices or integrated into one or more processors.
[0102] The processor 103 provides computing and control capabilities, for example, the processor 103 is used to execute computer programs stored in memory 102 to implement the text intent clustering method described above.
[0103] The input / output interface 104 is used to provide a channel for user input or output. For example, the input / output interface 104 can be used to connect various input / output devices, such as a mouse, keyboard, touch device, display screen, etc., so that users can enter information or visualize information.
[0104] Bus 105 is used at least to provide a channel for communication between communication modules 101, memory 102, processor 103, and input / output interface 104 in electronic device 10.
[0105] It is understood that the structures illustrated in the embodiments of this application do not constitute a specific limitation on the electronic device 10. In other embodiments of this application, the electronic device 10 may include more or fewer components than illustrated, or combine some components, or split some components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
[0106] This application also provides a computer-readable storage medium storing a computer program, which includes program instructions. When the program instructions are executed, the method implemented can refer to the methods in the above embodiments of this application.
[0107] The computer-readable storage medium can be the internal memory of the electronic device described in the above embodiments, such as the hard disk or memory of the electronic device. Alternatively, the computer-readable storage medium can be an external storage device of the electronic device, such as a plug-in hard disk, smart media card (SMC), secure digital card (SD), flash card, etc., installed on the electronic device.
[0108] In some embodiments, a computer-readable storage medium may include a stored program area and a stored data area, wherein the stored program area may store an operating system, an application program required for at least one function, etc.; and the stored data area may store data created based on the use of the electronic device, etc.
[0109] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of modules is only a logical functional division, and other division methods may be used in actual implementation.
[0110] The modules described as separate components may or may not be physically separate. The components shown as modules may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.
[0111] Furthermore, the functional modules in the various embodiments of this application 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 in the form of hardware plus software functional modules.
[0112] Therefore, the embodiments should be considered exemplary and non-limiting in all respects, and the scope of this application is defined by the appended claims rather than the foregoing description. Thus, all variations falling within the meaning and scope of equivalents of the claims are intended to be embraced within this application. No appended diagram markings in the claims should be construed as limiting the scope of the claims.
[0113] Furthermore, it is clear that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or devices described in this application may also be implemented by a single unit or device through software or hardware. The terms "first," "second," etc., are used to indicate names and do not indicate any specific order.
[0114] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application and are not intended to limit it. Although this application has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of this application without departing from the spirit and scope of the technical solutions of this application.
Claims
1. A text intent clustering method, characterized in that, The method includes: Cluster the feature vector set of the text set to obtain multiple vector sub-clusters; The text set is divided into multiple text subclusters based on the multiple vector subclusters; The first prompt content and the representative text in each text sub-cluster are input into the language model to generate the standard intent corresponding to each text sub-cluster. The first prompt content is used to indicate the granularity rules of the schematic diagram division. Normalize similar standard intentions; Using the language model, the standard topic to which each standard intent belongs is generated after normalization; Based on each normalized standard intent, the text set is classified to determine the standard intent and standard topic corresponding to each text in the text set.
2. The text intent clustering method as described in claim 1, characterized in that, The process of classifying the text set based on each normalized standard intent, and determining the standard intent and corresponding standard topic for each text in the text set, includes: Based on the feature vector of each standard intent after normalization and the feature vector of the representative text in the text subcluster corresponding to each standard intent, an intent anchor vector corresponding to each standard intent is generated. Determine the similarity between the feature vector of each text in the text set and the intent anchor vectors corresponding to all standard intents; Based on the standard intent corresponding to the highest similarity and the associated standard topic, the standard intent and the standard topic to which each text belongs are determined.
3. The text intent clustering method as described in claim 2, characterized in that, The step of generating the intent anchor vector corresponding to each standard intent based on the normalized feature vector of each standard intent and the feature vector of the representative text in the text subcluster corresponding to each standard intent includes: The feature vector of each standard intent is averaged with the feature vector of the representative text in the text subcluster corresponding to each standard intent to obtain the intent anchor vector corresponding to each standard intent.
4. The text intent clustering method as described in claim 2, characterized in that, The process of determining the standard intent and associated standard topic for each text based on the highest similarity standard intent and associated standard topic includes: For any text in the text set, if the highest similarity corresponding to any text is greater than or equal to a preset threshold, the standard intent and associated standard topic corresponding to the highest similarity are determined as the standard intent and standard topic corresponding to any text. If the highest similarity score corresponding to any of the texts is less than the preset threshold, then any of the texts is filtered out from the text set.
5. The text intent clustering method as described in claim 1, characterized in that, The step of clustering the feature vector set to obtain multiple vector sub-clusters includes: Using the category labels corresponding to the text set, the feature vector set is divided into multiple vector subsets; If the data size of any vector subset exceeds a preset value, the vector subset is divided into blocks; Clustering is performed on each vector subset to obtain multiple vector subclusters corresponding to each vector subset, or clustering is performed on the feature vector set to obtain the multiple vector subclusters.
6. The text intent clustering method as described in claim 1, characterized in that, The process of generating the normalized standard topic to which each standard intent belongs using the language model includes: Each standard intent and the second prompt content are input into the language model to generate the original topic to which each standard intent belongs. The second prompt content is used to indicate the relationship between the topic and the intent, and the original topic is used to indicate the business object corresponding to each standard intent. Each original topic and the third prompt content are input into the language model to generate the standard topic to which the standard intent belongs for each original topic. The third prompt content is used to indicate the original topic of the same business object in normalization.
7. The text intent clustering method as described in claim 6, characterized in that, The method further includes: Normalize similar standard topics.
8. The text intent clustering method as described in any one of claims 1 to 7, characterized in that, The method further includes: Filter out fuzzy text from the plurality of text subclusters, wherein the fuzzy text does not include preset words, and the preset words include at least one or more of action words, interrogative words, and state words.
9. An electronic device, characterized in that, The electronic device includes: Memory; A processor and a computer program stored on the memory and executable on the processor, wherein when the processor executes the computer program, the electronic device implements the text intent clustering method as described in any one of claims 1 to 8.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor in an electronic device, implements the text intent clustering method as described in any one of claims 1 to 8.
