Text script clustering method and device, computer device and storage medium
By employing an online greedy algorithm, Bart model for intra-group clustering, and RoBERTa model for random grouping, this paper addresses the issues of long processing times and inaccurate results in text-based speech clustering algorithms, achieving efficient text-based speech clustering that supports complex business scenarios in finance, commerce, and insurance.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-19
- Publication Date
- 2026-03-31
AI Technical Summary
Existing text-based clustering algorithms are time-consuming to run in scenarios with massive amounts of data, and the clustering results are not effective enough, resulting in high trial-and-error costs.
An online greedy algorithm is used to randomly group, cluster within groups, and cluster across groups of text data. The Bart model is used for error correction and sentence segmentation. The RoBERTa model is used for random grouping and clustering. The final clustering result is obtained by merging the central sentence of each cluster.
It improves the accuracy of text-based clustering, reduces clustering time, and can obtain high-quality clustering results within a reasonable time, making full use of massive amounts of data to support complex business scenarios.
Smart Images

Figure CN116484003B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of artificial intelligence technology, and in particular to a method, apparatus, computer device, and storage medium for text speech clustering. Background Technology
[0002] As fintech development deepens, people's demands for financial services are increasing. The construction of smart branches has become a key focus of branch transformation for various banks, and a symbol of their digital transformation in information technology, supporting various financial scenarios such as operations, payments, and marketing. To better serve customers, companies have corresponding customer service agents who can answer customer calls and resolve their issues.
[0003] User intent recognition is a major challenge facing intelligent customer service agents today. Due to the complexity and variability of user intent, accurate identification requires manual intervention to mine standard questions and create business-specific intent labels from massive amounts of historical dialogue data to train an intent classification model. In this scenario, large-scale text and speech clustering algorithms can be used to mine similar user speech patterns, reducing the cost of manual annotation of massive amounts of data. Existing technologies commonly use text speech clustering algorithms such as k-means and DBSCAN. However, these algorithms have limitations for large-scale text processing: they are time-consuming to run on massive datasets. Furthermore, due to limitations in clustering algorithm parameters and data quality, the clustering results of existing algorithms cannot guarantee effectiveness, resulting in significant trial-and-error costs. Summary of the Invention
[0004] This application provides a text speech clustering method, apparatus, computer device, and storage medium, aiming to solve the technical problems of existing text speech clustering algorithms, such as long running time and inability to guarantee the validity of clustering results.
[0005] To solve the above-mentioned technical problems, the technical solution adopted in this application is as follows:
[0006] A text-based speech clustering method includes:
[0007] Obtain the text data to be clustered, and randomly divide the text data to be clustered into K groups on an average basis;
[0008] An online greedy algorithm is used to perform intra-group clustering on the text data in each group to obtain the intra-group clustering result set of the text data to be clustered. The intra-group clustering result set includes a list of clusters for each group, cluster members in each cluster, and the central sentence of each cluster.
[0009] An online greedy algorithm is used to perform cross-group clustering on the central sentences in the intra-group clustering result set to obtain the central sentence clustering result set.
[0010] Obtain the clusters corresponding to each central sentence in the same cluster of the clustering result set of the central sentences in the clustering result set of the group, and merge the clustering members of the clusters to obtain the clustering result of the text data to be clustered.
[0011] The technical solution adopted in this application embodiment further includes: the specific method of obtaining the text data to be clustered is:
[0012] The system acquires historical dialogue data between agents and users, and filters the historical dialogue data based on dialogue characteristics to obtain filtered dialogue data. The dialogue characteristics include the call duration, number of dialogue rounds, whether a transaction was completed, and the records made by the agents for the historical dialogue data for each historical dialogue data.
[0013] The ASR algorithm is used to convert the filtered dialogue data into speech, resulting in speech-converted text data.
[0014] The Bart model is used to perform error correction, punctuation, and sentence segmentation on the transformed text data to obtain the text data to be clustered.
[0015] The technical solution adopted in this application embodiment further includes: the step of randomly and evenly dividing the text data to be clustered into K groups specifically involves:
[0016] The text data to be clustered is encoded into sentence vectors of fixed dimension using the RoBERTa model, and the encoded sentence vectors are randomly and evenly divided into K groups according to the number of text data to be clustered.
[0017] The technical solution adopted in this application embodiment further includes: the specific method of using an online greedy algorithm to perform intra-group clustering of the text data in each group is as follows:
[0018] Set the maximum intra-cluster distance d, the maximum number of clusters, the minimum number of texts per cluster m, and the percentage of recurrent texts δ in each group. The recurrent texts refer to the texts that were not assigned to any cluster after the clustering was completed. The number of recurrent texts does not exceed the total number of texts in the group × the percentage of recurrent texts.
[0019] Initialize the set of unclustered texts S' = S in each group, and the list of clusters clusters clusters = [].
[0020] Determine whether the number of texts in the unclustered text set S' in each group is greater than the number of returned texts. If it is greater, randomly select a text from the unclustered text set S' and calculate the distance between the text and other texts in the group. Find the text whose distance to the text is less than the maximum distance d in the cluster as the cluster member, and obtain the clustered text set C.
[0021] Determine whether |C|≥m holds true. If it holds true, calculate the cluster center of the clustered text set C, obtain the text text closest to the cluster center, take the text text as the central sentence of the clustered text set C, and add a tuple (C,text) to the cluster list clusters=[].
[0022] Remove the clustered text set C from the unclustered text set S', and re-execute the step of determining whether the number of texts in the unclustered text set S' in each group is greater than the number of returned texts.
[0023] The technical solution adopted in this application embodiment further includes: after determining whether the number of texts in the unclustered text set S' in each group is greater than the number of returned texts, it further includes:
[0024] If the number of texts in the unclustered text set S' is less than the number of reflowed texts, then all reflowed texts in each group are collected, and the step of initializing the unclustered text set S' in each group is repeated.
[0025] Another technical solution adopted in this application embodiment is: a text speech clustering device, comprising:
[0026] Data acquisition module: used to acquire text data to be clustered, and randomly divide the text data to be clustered into K groups on an average basis;
[0027] Intra-group clustering module: Used to perform intra-group clustering on the text data in each group using an online greedy algorithm, to obtain the intra-group clustering result set of the text data to be clustered. The intra-group clustering result set includes a list of clusters for each group, cluster members in each cluster, and the central sentence of each cluster.
[0028] Cross-group clustering module: Used to perform cross-group clustering on the central sentences in the intra-group clustering result set using an online greedy algorithm, to obtain the central sentence clustering result set;
[0029] Data merging module: used to obtain the clusters corresponding to each central sentence in the same cluster of the clustering result set of the central sentences in the clustering result set of the group, and merge the clustering members of the clusters to obtain the clustering result of the text data to be clustered.
[0030] The technical solution adopted in this application embodiment also includes: the data acquisition module acquires the text data to be clustered specifically as follows:
[0031] The system acquires historical dialogue data between agents and users, and filters the historical dialogue data based on dialogue features to obtain filtered dialogue data. The dialogue features include the call duration, number of dialogue rounds, whether a transaction was completed, and the records made by the agents for the historical dialogue data. The filtered dialogue data is converted into speech using the ASR algorithm to obtain speech-converted text data. The Bart model is used to perform error correction, punctuation, and sentence segmentation on the converted text data to obtain text data to be clustered.
[0032] The technical solution adopted in this application embodiment further includes: the intra-group clustering module uses an online greedy algorithm to perform intra-group clustering on the text data in each group, specifically:
[0033] Set the maximum intra-cluster distance d, the maximum number of clusters, the minimum number of texts per cluster m, and the percentage of recurrent texts δ in each group. The recurrent texts refer to the texts that were not assigned to any cluster after the clustering was completed. The number of recurrent texts does not exceed the total number of texts in the group × the percentage of recurrent texts.
[0034] Initialize the set of unclustered texts S' = S in each group, and the list of clusters clusters clusters = [].
[0035] Determine whether the number of texts in the unclustered text set S' in each group is greater than the number of returned texts. If it is greater, randomly select a text from the unclustered text set S' and calculate the distance between the text and other texts in the group. Find the text whose distance to the text is less than the maximum distance d in the cluster as the cluster member, and obtain the clustered text set C.
[0036] Determine whether |C|≥m holds true. If it holds true, calculate the cluster center of the clustered text set C, obtain the text text closest to the cluster center, take the text text as the central sentence of the clustered text set C, and add a tuple (C,text) to the cluster list clusters=[].
[0037] Remove the clustered text set C from the unclustered text set S', and re-execute the step of determining whether the number of texts in the unclustered text set S' in each group is greater than the number of returned texts.
[0038] Another technical solution adopted in this application embodiment is: a computer device, the computer device comprising:
[0039] A memory that stores executable program instructions;
[0040] The processor connected to the memory;
[0041] The processor calls the executable program instructions stored in the memory to execute the text speech clustering method described above.
[0042] Another technical solution adopted in this application embodiment is: a storage medium storing processor-executable program instructions, the program instructions being used to execute the above-mentioned text speech clustering method.
[0043] The text-based speech clustering method, apparatus, computer device, and storage medium of this application embodiment randomly group text data, employ an online greedy algorithm to perform intra-group clustering of the text data in each group, calculate the central sentence of each cluster, and then perform cross-group clustering of the central sentences of all clusters. Based on the cross-group clustering results, the cluster members corresponding to the central sentences of each cluster in the intra-group clustering result set are merged to obtain the final clustering result of the text data. This application uses random grouping, intra-group clustering, and cross-group clustering of central sentences to perform text-based speech clustering, which can effectively improve the clustering accuracy of text-based speech, reduce the clustering time, make full use of massive amounts of data, obtain high-quality clustering results within a reasonable time frame, and better empower many complex business scenarios. Attached Figure Description
[0044] Figure 1 This is a flowchart illustrating the text-based speech clustering method of the first embodiment of this application;
[0045] Figure 2 This is a flowchart illustrating the text-based speech clustering method according to the second embodiment of this application;
[0046] Figure 3 This is a schematic diagram illustrating the clustering process of performing intra-group clustering of sentence vectors in each group using an online greedy algorithm in this embodiment of the application;
[0047] Figure 4 This is a schematic diagram of the structure of the text speech clustering device according to an embodiment of this application;
[0048] Figure 5 This is a schematic diagram of the computer device structure according to an embodiment of this application;
[0049] Figure 6 This is a schematic diagram of the storage medium structure according to an embodiment of this application. Detailed Implementation
[0050] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of the embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.
[0051] The terms "first," "second," and "third" in this application are for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Therefore, a feature defined as "first," "second," or "third" may explicitly or implicitly include at least one of that feature. In the description of this application, "multiple" means at least two, such as two, three, etc., unless otherwise explicitly specified. All directional indications (such as up, down, left, right, front, back, etc.) in the embodiments of this application are only used to explain the relative positional relationships and movements between components in a specific orientation (as shown in the figures). If the specific orientation changes, the directional indications also change accordingly. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products, or devices.
[0052] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.
[0053] This application's embodiments can acquire and process relevant data based on artificial intelligence (AI) technology. AI is the theory, methods, technology, and application system that uses digital computers or computers-controlled machines to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to obtain optimal results. Basic AI technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing technology, operating / interactive systems, and mechatronics. AI software technologies mainly include computer vision, robotics, biometrics, speech processing, natural language processing, and machine learning / deep learning, and can be applied to business, finance, healthcare, transactions, online banking, and other application scenarios.
[0054] Please see Figure 1 This is a flowchart illustrating the text-based speech clustering method of the first embodiment of this application. The text-based speech clustering method of the first embodiment of this application includes the following steps:
[0055] S100: Obtain the text data to be clustered, and randomly divide the text data to be clustered into K groups on an average basis;
[0056] S110: An online greedy algorithm is used to perform intra-group clustering on the text data in each group to obtain the intra-group clustering result set of the text data to be clustered. The intra-group clustering result set includes a list of clusters for each group, cluster members in each cluster, and the central sentence of each cluster.
[0057] S120: Use an online greedy algorithm to perform cross-group clustering on the central sentences in the intra-group clustering result set to obtain the central sentence clustering result set;
[0058] S130: Obtain the clusters corresponding to each central sentence in the same cluster of the clustering result set of the central sentences in the clustering result set of the group, and merge the clustering members of the clusters to obtain the clustering result of the text data to be clustered.
[0059] Based on the above, the text-based speech clustering method of the first embodiment of this application randomly groups the text data, uses an online greedy algorithm to perform intra-group clustering of the text data in each group, calculates the central sentence of each cluster, and then performs cross-group clustering of the central sentences of all clusters. Based on the cross-group clustering results, the cluster members corresponding to the central sentences of each cluster in the intra-group clustering result set are merged to obtain the final clustering result of the text data. This embodiment of the application, based on clustering algorithms in artificial intelligence, uses random grouping, intra-group clustering, and cross-group clustering of central sentences to perform text-based speech clustering. This can effectively improve the clustering accuracy of text-based speech, reduce the clustering time, fully utilize massive amounts of data, obtain high-quality clustering results within a reasonable time frame, and better empower many complex business scenarios.
[0060] The embodiments of this application can be widely applied to various technical fields, such as fintech and digital healthcare. Taking fintech as an example, the text-based speech clustering method of this application can be applied to human-computer dialogue scenarios in insurance or banking. Taking the medical field as an example, the text-based speech clustering method of this application can be applied to human-computer dialogue scenarios in medical institutions or hospital consultations. The text-based speech clustering method of this application can also be applied to various other fields such as speech recognition, medical diagnosis, and application testing, which will not be elaborated upon further in this application.
[0061] Please see Figure 2 This is a flowchart illustrating the text-based speech clustering method of the second embodiment of this application. The text-based speech clustering method of the second embodiment of this application includes the following steps:
[0062] S200: Obtain historical dialogue data between agents and users, and filter the historical dialogue data according to dialogue characteristics to obtain filtered dialogue data;
[0063] In this step, the historical dialogue data includes, but is not limited to, human-computer dialogue data between agents and users in business scenarios such as insurance and banking. Taking the banking business scenario as an example, users can inquire about or apply for services such as loans, credit cards, insurance, and wealth management products by calling. In this case, the historical call audio text between the agent and the user is obtained. It can be considered that the obtained historical call audio is the audio data of the conversation between the customer and the customer service agent in the past calls. Dialogue features include, but are not limited to, the call duration, the number of dialogue rounds, whether a transaction was completed, and the records made by the agent for each historical dialogue. The historical dialogue data is filtered through dialogue features to obtain meaningful dialogue data for subsequent text script clustering. Here, there are no further restrictions on the specific setting of dialogue features.
[0064] S210: The ASR (Automatic Speech Recognition) algorithm is used to convert the filtered dialogue data into speech, resulting in text data after speech conversion.
[0065] S220: The Bart model is used to preprocess the transformed text data, such as error correction, punctuation, and sentence segmentation, to obtain the preprocessed text data to be clustered.
[0066] In this step, since the function of ASR is to faithfully convert speech into text without understanding the content of the dialogue itself, the quality of the first text data after ASR conversion is low, with problems such as missing words and missing punctuation. In addition, ASR systems generally use their own silence detection module as the breakpoint for semantic expression. Sentences segmented in this way often cannot express a complete semantic meaning, which will ultimately affect the accuracy of text speech clustering.
[0067] For example, the original dialogue data is: "Hello, how can I help you?" The first text data after ASR conversion might be: "Hello, how can I help you?" For example, in a bank transaction scenario, the original dialogue data is: "Hello, please confirm the following transaction information." The first text data after ASR conversion might be: "Hello, please confirm the following information." Clearly, the quality of the first text data after ASR conversion is low, with missing words and punctuation, affecting the accuracy of text speech clustering.
[0068] To address this deficiency, this embodiment employs the Bart model before text clustering to preprocess the first text data after ASR conversion, including error correction, punctuation, and sentence segmentation. Punctuation marks are used to break the first text data into independent sentences with complete meaning, which improves the accuracy of subsequent text clustering. Specifically, the Bart model is a noise-reducing automatic decoder implemented as a sequence-to-sequence model. It has a bidirectional encoder (Transformer Encoder) for corrupted text and a left-to-right autoregressive decoder (Transformer Decoder). The pre-training of the BART model involves corrupting and reconstructing the original text data; therefore, the loss function is the cross-entropy between the Transformer decoder output and the original text data. The first text data is encoded using the bidirectional encoder and then input into the autoregressive decoder. The autoregressive decoder calculates the probability of the original text data based on the input data, performs error correction, punctuation, and sentence segmentation on the input data, and outputs the final text data to be clustered.
[0069] For example, the first text data after ASR conversion is: "Hello, how can I help you?" The final output text data to be clustered by the autoregressive decoder is: "Hello, how can I help you?" For example, in a bank transaction scenario, the first text data after ASR conversion is: "Hello, please confirm the following information." The final output text data to be clustered by the autoregressive decoder is: "Hello, please confirm the following transaction information." Clearly, by using the Bart model to correct errors, add punctuation, and segment sentences in the first text data after ASR conversion, the accuracy of subsequent text speech clustering can be effectively improved.
[0070] S230: The RoBERTa model is used to encode the text data to be clustered into sentence vectors of fixed dimension, and the encoded sentence vectors are randomly and evenly divided into K groups according to the number of text data to be clustered.
[0071] In this step, the RoBERTa model is an improved version of BERT. Compared to BERT, RoBERTa uses a larger number of model parameters, a larger batch size, and more training data. Furthermore, RoBERTa removes the next-sentence prediction (NSP) task in its training method and uses dynamic masking. This means that a new mask pattern is generated each time a sequence is input into the model, allowing it to gradually adapt to different masking strategies and learn different language representations through continuous input of large amounts of data. It can be understood that the number of sentence vector groups can be set according to the actual application scenario.
[0072] S240: An online greedy algorithm is used to perform intra-group clustering on the sentence vectors in each group to obtain an intra-group clustering result set of the text data to be clustered. The intra-group clustering result set includes a list of clusters for each group, cluster members in each cluster, and the central sentence of each cluster.
[0073] In this step, please refer to Figure 3 This diagram illustrates the clustering process in this application embodiment, where an online greedy algorithm is used to perform intra-group clustering of sentence vectors in each group. The specific steps include:
[0074] S241: Define the maximum intra-cluster distance d, the maximum number of clusters, the minimum number of texts per cluster m, and the percentage of recurrent texts δ for each group. Recurrent texts refer to texts that were not assigned to any cluster after clustering. Assume the total number of texts in a group is |S k |=n, the number of reflowed texts cannot exceed the total number of texts in the group × the percentage of reflowed texts, that is, the number of reflowed texts is no greater than n*δ;
[0075] S242: Initialize the set of unclustered texts S' = S in each group, and the list of clusters clusters clusters = [];
[0076] S243: Determine whether the number of texts in the unclustered text set S' in each group is greater than the number of backflowed texts (n*δ). If it is greater, execute S244; otherwise, execute S248.
[0077] S244: Randomly select a text from the unclustered text set S', calculate the distance between the text and other texts, find the text whose distance to the text is less than the maximum distance d within the cluster and take it as a cluster member, thus obtaining the clustered text set C;
[0078] S245: Determine whether |C|≥m is true. If true, execute S246.
[0079] S246: Calculate the cluster center of the clustered text set C, obtain the text text closest to the cluster center, take the text text as the center sentence of the clustered text set C, and add a tuple (C, text) to the cluster list clusterers;
[0080] S247: Remove the clustered text set C from the unclustered text set S', i.e., the unclustered text set S' = S' - C, and re-execute S243;
[0081] S248: Collect all reflow text from each group and re-execute S242.
[0082] S250: An online greedy algorithm is used to perform cross-group clustering on the central sentences in the intra-group clustering result set to obtain the central sentence clustering result set;
[0083] In this step, the cross-group clustering method for the central sentence is the same as the intra-group clustering method in S240. To avoid redundancy, it will not be described again here.
[0084] S260: Find the clusters corresponding to each central sentence in the same cluster of the central sentence clustering result set in the intra-group clustering result set, and merge the clustering members of each cluster to obtain the clustering result of the text data to be clustered;
[0085] In this step, assuming that each cluster in the clustering result set of the central sentences contains two clustering central sentences, we find the two clusters corresponding to these two clustering central sentences in the in-group clustering result set, and merge the clustering members of these two clusters to obtain the clustering result of the text data to be clustered.
[0086] Based on the above, the text-based speech clustering method of the second embodiment of this application proposes a hierarchical clustering scheme, which can be applied to fields such as finance, commerce, and insurance. Based on clustering algorithms in artificial intelligence, it uses the Bart model to correct errors, add punctuation, and segment sentences in the text data after speech conversion. The RoBERTa Chinese pre-trained model is used to randomly group the text data. An online greedy algorithm is used to perform intra-group clustering of the text data in each group and calculate the central sentence of each cluster. Then, cross-group clustering is performed on the central sentences of all clusters. Based on the cross-group clustering results, the cluster members corresponding to the central sentences of each cluster in the intra-group clustering result set are merged to obtain the final clustering result of the text data. This application uses random grouping, intra-group clustering, and cross-group clustering of central sentences to cluster text-based speech, which can effectively improve the clustering accuracy of text-based speech, reduce the clustering time, fully utilize massive amounts of data, obtain high-quality clustering results within a reasonable time frame, and better empower many complex business scenarios.
[0087] In an optional implementation, the results of the text-based speech clustering method can also be uploaded to the blockchain. Specifically, based on the results of the text-based speech clustering method, corresponding summary information is obtained. Specifically, the summary information is obtained by hashing the results of the text-based speech clustering method, for example, using the SHA256s algorithm. Uploading the summary information to the blockchain ensures its security and fairness and transparency to users. Users can download the summary information from the blockchain to verify whether the results of the text-based speech clustering method have been tampered with. The blockchain referred to in this example is a new application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanisms, and encryption algorithms. A blockchain is essentially a decentralized database, a chain of data blocks linked using cryptographic methods. Each data block contains information about a batch of network transactions, used to verify the validity of the information (anti-counterfeiting) and generate the next block. A blockchain can include a blockchain underlying platform, a platform product service layer, and an application service layer, and can also include bank business data, transaction data, and payment data.
[0088] Please see Figure 4 This is a schematic diagram of the structure of the text speech clustering device according to an embodiment of this application. The text speech clustering device 40 according to an embodiment of this application includes:
[0089] Data acquisition module 41: Used to acquire text data to be clustered, and randomly divide the text data to be clustered into K groups on an average basis; wherein, the data acquisition module 41 acquires the text data to be clustered specifically by: acquiring historical dialogue data between agents and users, and filtering the historical dialogue data according to dialogue characteristics to obtain filtered dialogue data. As an optional implementation method, the above-mentioned historical dialogue data includes, but is not limited to, human-computer dialogue data between agents and users in business scenarios such as insurance and banking. Taking the banking business scenario as an example, users can inquire about or apply for services such as loans, credit cards, insurance, and wealth management products by calling. In this case, acquiring the historical call audio text between agents and users can be considered as the audio data of the conversation between customers and customer service agents in historical calls.
[0090] The aforementioned dialogue features include the call duration, number of dialogue rounds, whether a transaction was completed, and the records made by the agent for each historical dialogue data. The ASR algorithm is used to convert the filtered dialogue data into speech, resulting in speech-converted text data. The Bart model is used to perform error correction, punctuation, and sentence segmentation on the converted text data, resulting in text data to be clustered.
[0091] For example, the original dialogue data is: "Hello, how can I help you?" The first text data after ASR conversion might be: "Hello, how can I help you?" For example, in a bank transaction scenario, the original dialogue data is: "Hello, please confirm the following transaction information." The first text data after ASR conversion might be: "Hello, please confirm the following information." Clearly, the quality of the first text data after ASR conversion is low, with issues such as missing characters and punctuation, affecting the accuracy of text-based speech clustering. To address this deficiency, this application embodiment uses the Bart model to preprocess the first text data after ASR conversion, including error correction, punctuation addition, and sentence segmentation, before text-based speech clustering. Using punctuation marks breaks the first text data into independent sentences with complete meaning, which helps improve the accuracy of subsequent text-based speech clustering.
[0092] Intra-group clustering module 42: This module uses an online greedy algorithm to perform intra-group clustering on the text data in each group, obtaining an intra-group clustering result set of the text data to be clustered. The intra-group clustering result set includes a list of clusters for each group, cluster members in each cluster, and the central sentence of each cluster. Specifically, the intra-group clustering module 42 uses an online greedy algorithm to perform intra-group clustering on the text data in each group as follows: It sets the maximum intra-cluster distance d, the maximum number of clusters, the minimum number of texts per cluster m, and the percentage of returning texts δ for each group. Returning texts refer to texts that are not assigned to any cluster after clustering, and the number of returning texts does not exceed the total number of texts in the group × the percentage of returning texts. It initializes the set of unclustered texts S' = S in each group, and the cluster list clusters = []. It then determines the number of unclustered texts in each group. If the number of texts in text set S' is greater than the number of returned texts, and if so, a text is randomly selected from the unclustered text set S', and the distance between the text and other texts in the group is calculated. The text whose distance to the selected text is less than the maximum distance d in the cluster is selected as a cluster member, and a clustered text set C is obtained. If |C|≥m holds true, the cluster center of the clustered text set C is calculated, and the text text closest to the cluster center is obtained. The text text is selected as the center sentence of the clustered text set C, and a tuple (C,text) is added to the cluster list clusters=[]. The clustered text set C is removed from the unclustered text set S', and the step of judging whether the number of texts in the unclustered text set S' in each group is greater than the number of returned texts is executed again.
[0093] Cross-group clustering module 43: Used to perform cross-group clustering on the central sentences in the intra-group clustering result set using an online greedy algorithm to obtain the central sentence clustering result set;
[0094] Data merging module 44: used to obtain the clusters corresponding to each central sentence in the same cluster of the clustering result set of the central sentences in the clustering result set of the group, and merge the clustering members of the clusters to obtain the clustering result of the text data to be clustered.
[0095] The text-based speech clustering device of this application, based on clustering algorithms in artificial intelligence, can be applied to fields such as finance, commerce, and insurance. It employs the Bart model to correct errors, add punctuation, and segment sentences in the text data after speech conversion. The RoBERTa Chinese pre-trained model is used to randomly group the text data. An online greedy algorithm is used to perform intra-group clustering of the text data in each group and calculate the central sentence of each cluster. Then, cross-group clustering is performed on the central sentences of all clusters. Based on the cross-group clustering results, the cluster members corresponding to the central sentences of each cluster in the intra-group clustering result set are merged to obtain the final clustering result of the text data. This application uses random grouping, intra-group clustering, and cross-group clustering of central sentences for text-based speech clustering, which can effectively improve the clustering accuracy of text-based speech, reduce the clustering time, fully utilize massive amounts of data, obtain high-quality clustering results within a reasonable time frame, and better empower many complex business scenarios.
[0096] Please see Figure 5 This is a schematic diagram of a computer device structure according to an embodiment of this application. The computer device 50 includes:
[0097] Memory 51 storing executable program instructions;
[0098] Processor 52 connected to memory 51;
[0099] The processor 52 is used to call the executable program instructions stored in the memory 51 and perform the following steps: acquire the text data to be clustered, and randomly divide the text data to be clustered into K groups; use an online greedy algorithm to perform intra-group clustering on the text data in each group to obtain the intra-group clustering result set of the text data to be clustered, the intra-group clustering result set including the cluster list of each group, the cluster members in each cluster, and the central sentence of each cluster; use an online greedy algorithm to perform cross-group clustering on the central sentences in the intra-group clustering result set to obtain the central sentence clustering result set; acquire the cluster corresponding to each central sentence in the same cluster of the central sentence clustering result set in the intra-group clustering result set, and merge the cluster members of the cluster to obtain the clustering result of the text data to be clustered.
[0100] The processor 52 can also be referred to as a CPU (Central Processing Unit). The processor 52 may be an integrated circuit chip with signal processing capabilities. The processor 52 can also be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), an off-the-shelf programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. A general-purpose processor can be a microprocessor or any conventional processor.
[0101] The computer device in this application, based on clustering algorithms from artificial intelligence, can be applied to fields such as finance, commerce, and insurance. It randomly groups text data, employs an online greedy algorithm to perform intra-group clustering of the text data within each group, and calculates the central sentence of each cluster. Then, it performs cross-group clustering of the central sentences of all clusters. Based on the cross-group clustering results, it merges the cluster members corresponding to the central sentences of each cluster within the intra-group clustering result set to obtain the final clustering result of the text data. This application uses random grouping, intra-group clustering, and cross-group clustering of central sentences to cluster text statements, which can effectively improve the clustering accuracy of text statements, reduce the clustering time, fully utilize massive amounts of data, obtain high-quality clustering results within a reasonable time frame, and better empower many complex business scenarios.
[0102] Please see Figure 6 , Figure 6This is a schematic diagram of the structure of the storage medium in an embodiment of this application. The storage medium in this embodiment stores program instructions 61 capable of implementing the following steps: acquiring text data to be clustered; randomly and evenly dividing the text data to be clustered into K groups; using an online greedy algorithm to perform intra-group clustering on the text data in each group, obtaining an intra-group clustering result set of the text data to be clustered, the intra-group clustering result set including a list of clusters for each group, cluster members in each cluster, and a central sentence for each cluster; using an online greedy algorithm to perform cross-group clustering on the central sentences in the intra-group clustering result set, obtaining a central sentence clustering result set; acquiring the clusters corresponding to each central sentence in the same cluster of the central sentence clustering result set in the intra-group clustering result set, and merging the cluster members of the clusters to obtain the clustering result of the text data to be clustered. The program instructions 61 can be stored in the above-mentioned storage medium in the form of a software product, including several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute all or part of the steps of the methods of various embodiments of this application. The aforementioned storage media include: USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, optical disks, and other media capable of storing program instructions, or terminal devices such as computers, servers, mobile phones, and tablets. Servers can be independent servers or cloud servers providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms.
[0103] The storage medium in this application embodiment is based on a clustering algorithm in artificial intelligence and can be applied to fields such as finance, commerce, and insurance. It randomly groups text data and uses an online greedy algorithm to perform intra-group clustering of the text data in each group, calculating the central sentence of each cluster. Then, it performs cross-group clustering of the central sentences of all clusters. Based on the cross-group clustering results, it merges the cluster members corresponding to the central sentences of each cluster in the intra-group clustering result set to obtain the final clustering result of the text data. This application uses random grouping, intra-group clustering, and cross-group clustering of central sentences to cluster text statements, which can effectively improve the clustering accuracy of text statements, reduce the clustering time, fully utilize massive amounts of data, obtain high-quality clustering results within a reasonable time frame, and better empower many complex business scenarios.
[0104] 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 system embodiments described above are merely illustrative; for instance, the division of 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 an indirect coupling or communication connection through some interfaces, apparatuses, or units, and may be electrical, mechanical, or other forms.
[0105] Furthermore, the functional units 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 units described above can be implemented in hardware or as software functional units. The above are merely embodiments of this application and do not limit the patent scope of this application. Any equivalent structural or procedural transformations made based on the description and drawings of this application, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of this application.
Claims
1. A method of text dialogue clustering, characterized by, The method comprises the following steps: obtaining text data to be clustered, and randomly and evenly dividing the text data to be clustered into K groups; performing intra-group clustering on the text data in each group by using an online greedy algorithm to obtain an intra-group clustering result set of the text data to be clustered, wherein the intra-group clustering result set comprises a cluster list of each group, cluster members in each cluster, and a center sentence of each cluster; performing cross-group clustering on the center sentences in the intra-group clustering result set by using the online greedy algorithm to obtain a center sentence clustering result set; obtaining corresponding clusters of each center sentence in the center sentence clustering result set in the intra-group clustering result set, and merging the cluster members of the clusters to obtain a clustering result of the text data to be clustered; The online greedy algorithm is used for intra-group clustering of the text data in each group, specifically by setting the maximum intra-cluster distance , the maximum number of clusters, the minimum number of texts in a cluster , and the percentage of backflow texts , wherein the backflow texts refer to texts that are not assigned to any cluster after clustering, and the number of backflow texts is not more than the total number of texts in the group multiplied by the percentage of backflow texts. initializing a set of unclustered texts in each group , a list of clustering clusters ; Determine the set of unclustered texts in each group If the number of texts is greater than the number of returned texts, then from the unclustered text set... Randomly select a text and calculate the distance between that text and other texts in the group. Find the text whose distance to the selected text is less than the maximum distance within the cluster. The text is used as a cluster member to obtain a clustered text set. ; determining whether the condition is met, if the condition is met, calculating a cluster center of the cluster text set , obtaining a text closest to the cluster center , taking the text as a center sentence of the cluster text set , and adding a binary tuple in a cluster cluster list ; from the unclustered text set eliminate the clustered text set and re-perform the step of determining whether the number of texts in the unclustered text set in each group is greater than the number of backflow texts.
2. The text dialogue clustering method of claim 1, wherein, The text data to be clustered is obtained in the following manner: obtaining historical dialogue data between an agent and a user, and filtering the historical dialogue data according to dialogue features to obtain filtered dialogue data; the dialogue features include call duration, dialogue round number, whether a deal is made, and records made by the agent for the historical dialogue data; performing voice conversion on the filtered dialogue data by using an ASR algorithm to obtain text data after voice conversion; performing error correction, punctuation addition, and sentence segmentation on the converted text data by using a Bart model to obtain text data to be clustered.
3. The text dialogue clustering method of claim 2, wherein, The text data to be clustered is randomly and evenly divided into K groups in the following manner: encoding the text data to be clustered into sentence vectors of a fixed dimension by using a RoBERTa model, and randomly and evenly dividing the encoded sentence vectors into K groups according to the number of the text data to be clustered.
4. The text dialogue clustering method of claim 1, wherein, judging whether the number of texts in each group is greater than the number of backflow texts after judging whether the number of texts in each group is greater than the number of backflow texts, further comprising: If the number of unclustered text collections is less than the number of flow text, all flow text in each group is collected and the step of initializing each group with unclustered text collections is re-executed.
5. An apparatus for clustering text dialogues, characterized by The method comprises the following steps: a data acquisition module for obtaining text data to be clustered, and randomly and evenly dividing the text data to be clustered into K groups; an intra-group clustering module for performing intra-group clustering on the text data in each group by using an online greedy algorithm to obtain an intra-group clustering result set of the text data to be clustered, wherein the intra-group clustering result set comprises a cluster list of each group, cluster members in each cluster, and a center sentence of each cluster; a cross-group clustering module for performing cross-group clustering on the center sentences in the intra-group clustering result set by using the online greedy algorithm to obtain a center sentence clustering result set; a data merging module for obtaining corresponding clusters of each center sentence in the center sentence clustering result set in the intra-group clustering result set, and merging the cluster members of the clusters to obtain a clustering result of the text data to be clustered; The online greedy algorithm is used to perform intra-group clustering of the text data in each group, specifically by setting the maximum intra-cluster distance for each group. Maximum number of clusters, minimum number of texts per cluster and the percentage of reflowed text The reflow text refers to the text that was not assigned to any cluster after the clustering was completed, and the number of reflow texts does not exceed the percentage of the total number of texts in the group × the number of reflow texts. initializing a set of unclustered texts in each group , a list of clustering clusters ; Determine the set of unclustered texts in each group If the number of texts is greater than the number of returned texts, then from the unclustered text set... Randomly select a text and calculate the distance between that text and other texts in the group. Find the text whose distance to the selected text is less than the maximum distance within the cluster. The text is used as a cluster member to obtain a clustered text set. ; determining if the condition is met, calculating the cluster center of the cluster text set , obtaining the text closest to the cluster center , taking the text as the central sentence of the cluster text set , and adding a binary tuple to the cluster cluster list ; from the unclustered text set eliminate the clustered text set and re-perform the step of determining whether the number of texts in the unclustered text set in each group is greater than the number of backflow texts.
6. The text dialogue clustering apparatus according to claim 5, characterized by The data acquisition module obtains text data to be clustered in the following manner: The historical conversation data of the agent and the user is acquired, and the historical conversation data is filtered according to a conversation feature, to obtain filtered conversation data; the conversation feature includes a call duration, a conversation round number, whether a deal is made, and a record made by the agent for the historical conversation data; an ASR algorithm is used to convert the filtered conversation data into speech, to obtain text data converted from speech; a Bart model is used to perform error correction, punctuation, and sentence breaking on the converted text data, to obtain to-be-clustered text data.
7. A computer device, comprising: The computer device comprises: a memory storing executable program instructions; a processor connected with the memory; the processor invokes the executable program instructions stored in the memory to execute the text dialogue clustering method according to any one of claims 1-4.
8. A storage medium storing processor-executable program instructions, wherein the program instructions cause a processor to perform: The program instructions are used to execute the text dialogue clustering method according to any one of claims 1-4.
Citation Information
Patent Citations
Data query method, device and equipment
CN113407700A