Text clustering method, device, electronic device and computer-readable storage medium
By obtaining the anchor word model features of the training text and updating the text clustering model using the self-training objective function, the problem of low accuracy due to extra noisy features in text clustering is solved, and higher clustering accuracy and stability are achieved.
Patent Information
- Application Number
- CN202211653394.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-21
- Publication Date
- 2025-09-02
- Estimated Expiration
- 2042-12-21
AI Technical Summary
The prior art has low clustering accuracy due to the introduction of additional noisy features during text clustering.
By obtaining the anchor words of the training text, clustering based on the anchor word model features, and updating the text clustering model using the self-training objective function until the model converges, avoiding the influence of additional noisy features.
Improve the accuracy and stability of text clustering, avoiding the negative impact of additional noisy features on clustering accuracy.
Smart Images

Figure CN116150360B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing, and in particular to a text clustering method, device, electronic device, and computer-readable storage medium. Background Art
[0002] With the rapid development of information technology, texts as information carriers are growing explosively at a speed far beyond what people can handle. In order to obtain the texts people need from the massive amount of texts, it is often necessary to cluster multiple texts. However, in the process of clustering multiple texts, texts of the same category may be assigned to different categories, resulting in low accuracy in the process of clustering multiple texts. Summary of the Invention
[0003] The embodiments of the present application provide a text clustering method, apparatus, electronic device, and computer-readable storage medium, which can solve the technical problem of low accuracy in clustering multiple texts.
[0004] In a first aspect, an embodiment of the present application provides a text clustering method, the method comprising:
[0005] Obtaining anchor words corresponding to each training text from a plurality of training texts, and determining anchor word model features corresponding to each anchor word based on a text clustering model; wherein each anchor word is used to represent the full text semantics of the training text corresponding to each anchor word;
[0006] Inputting each anchor word model feature in each training text into the text clustering model to obtain a first clustering result for each training text, and performing normalization processing on each first clustering result to obtain a second clustering result corresponding to each first clustering result;
[0007] Determining a self-training objective function of the plurality of training texts based on each of the first clustering results and each of the second clustering results, and determining a self-training target value of the self-training objective function;
[0008] The text clustering model is updated based on the self-training target value until the text clustering model converges, and the converged text clustering model is applied to text clustering.
[0009] Optionally, obtaining an anchor word corresponding to each training text in the plurality of training texts includes:
[0010] Determining, based on the component words in each of the plurality of training texts, an information weight of each component word in each training text;
[0011] Sort the information weights of the constituent words corresponding to each training text from large to small, and obtain the information weights of the number of preset anchor words ranked first corresponding to each training text;
[0012] Based on the component words corresponding to the information weights of the preset number of anchor words, the anchor words corresponding to the preset number of anchor words in each training text are obtained.
[0013] Optionally, inputting each anchor word model feature in each training text into the text clustering model to obtain a first clustering result for each training text includes:
[0014] Inputting each anchor word model feature in each training text into the text clustering model respectively to obtain a pre-clustering result of each anchor word model feature in each training text;
[0015] The pre-clustering results corresponding to the anchor word model features in each training text are weighted averaged to obtain the first clustering result of each training text.
[0016] Optionally, determining the self-training objective function of the plurality of training texts based on each first clustering result and each second clustering result includes:
[0017] Based on the pre-clustering results of the anchor word model features in each training text and the second clustering results corresponding to each training text, a loss function of each anchor word model feature in each training text is obtained;
[0018] Based on the loss function of each anchor word model feature in each training text, a weighted loss function for each training text is obtained;
[0019] Based on the weighted loss function of each training text, a self-training objective function of the plurality of training texts is determined.
[0020] Optionally, the weighted loss function of each training text is obtained based on the loss function of each anchor word model feature in each training text, including:
[0021] Based on the information weight of each anchor word in each training text, determine a first coefficient corresponding to each anchor word model feature; wherein the first coefficient includes the norm of the product of the attention weight of each anchor word and the anchor word model feature;
[0022] Accumulate the first coefficients of the anchor word model features in each training text to obtain the second coefficients corresponding to all anchor word model features in each training text;
[0023] Determine a weighted coefficient corresponding to the loss function of each anchor word model feature in each training text according to the proportion of each first coefficient in each training text in the second coefficients corresponding to all anchor word model features in each training text;
[0024] The weighted loss function of each training text is determined based on the loss function of each anchor word model feature in each training text and the weight coefficient corresponding to the weighted loss function of each anchor word model feature.
[0025] Optionally, after normalizing each first clustering result to obtain a second clustering result corresponding to each first clustering result, the method further includes:
[0026] Determining an anchor word model feature expansion function based on each anchor word model feature and a target cluster in the second clustering results of the plurality of training texts; wherein the anchor word model feature expansion function includes a Gaussian distribution function, the mean of the Gaussian distribution function includes the anchor word model feature, and the variance of the Gaussian distribution function includes the target cluster;
[0027] The anchor word model features are expanded based on the anchor word model features and the anchor word model feature expansion functions corresponding to the anchor word model features.
[0028] Optionally, determining the self-training objective function of the plurality of training texts based on each first clustering result and each second clustering result includes:
[0029] Based on the pre-clustering results of the anchor word model features in each training text and the second clustering results corresponding to each training text, a loss function of each anchor word model feature in each training text is obtained;
[0030] Determine the weighted expectation function of each training text based on the loss function of each anchor word model feature in each training text;
[0031] Based on the weighted expectation function of each training text, a self-training objective function of the plurality of training texts is determined.
[0032] In a second aspect, an embodiment of the present application further provides a text clustering device, the device comprising:
[0033] an acquisition module adapted to acquire an anchor word corresponding to each training text from a plurality of training texts, and determine an anchor word model feature corresponding to each anchor word based on a text clustering model; wherein each anchor word is used to represent the full text semantics of the training text corresponding to the anchor word;
[0034] a calculation module adapted to input each anchor word model feature in each training text into the text clustering model to obtain a first clustering result for each training text, and to perform normalization processing on each first clustering result to obtain a second clustering result corresponding to each first clustering result;
[0035] a determination module adapted to determine the self-training objective functions of the plurality of training texts based on each of the first clustering results and each of the second clustering results, and to determine the self-training target values of the self-training objective functions;
[0036] The text clustering module is adapted to update the text clustering model based on the self-training target value until the self-training target value converges, and apply the text clustering model corresponding to the converged self-training target value to text clustering.
[0037] In a third aspect, an embodiment of the present application further provides an electronic device, the electronic device comprising:
[0038] processor; and
[0039] A memory arranged to store computer executable instructions which, when executed, cause the processor to perform any of the methods described above.
[0040] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, which stores one or more programs, and when the one or more programs are executed by a processor, implement any of the methods described above.
[0041] An embodiment of the present application provides a text clustering method, which obtains anchor word model features corresponding to the anchor words based on the full-text semantics of each training text, avoiding the introduction of additional noisy features. Then, a first clustering result and a second clustering result of each training text are obtained based on the anchor word model features, and a self-training objective function of multiple training texts is determined based on each first clustering result and each second clustering result, as well as a self-training target value of the self-training objective function; finally, the text clustering model is updated based on the self-training target value until the text clustering model converges, and the converged text clustering model is applied to text clustering. After continuous training until the convergence of the text clustering model, the accuracy and stability of the text clustering model are continuously improved, and the accuracy of text clustering is avoided from being affected by additional noisy features. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following is a brief introduction to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without paying any creative work.
[0043] Figure 1 An exemplary system architecture diagram of a text clustering method provided in an embodiment of the present application;
[0044] Figure 2 A flowchart of a text clustering method provided in an embodiment of the present application;
[0045] Figure 3 A flowchart of a method for obtaining anchor words provided in an embodiment of the present application;
[0046] Figure 4 A schematic diagram of a flow chart of a method for determining a first clustering result provided in an embodiment of the present application;
[0047] Figure 5 A flowchart of a method for determining a self-training objective function provided in this application;
[0048] Figure 6 A flowchart of a method for determining a weighted loss function for each training text provided in this application;
[0049] Figure 7 A flowchart of another text clustering method provided in an embodiment of the present application;
[0050] Figure 8 A flowchart of another text clustering method provided in an embodiment of the present application;
[0051] Figure 9 A schematic diagram of the overall process of a text clustering method provided in an embodiment of the present application;
[0052] Figure 10 A schematic structural diagram of a text clustering device provided by an exemplary embodiment of this specification;
[0053] Figure 11 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0054] In order to make the features and advantages of the embodiments of the present application more obvious and easy to understand, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of them. Based on the embodiments in the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative efforts shall fall within the scope of protection of the embodiments of the present application.
[0055] When the following description refers to the accompanying drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. Instead, they are merely examples of devices and methods consistent with certain aspects of the present application, as detailed in the appended claims.
[0056] In the past few decades, traditional text clustering methods such as k-means, Gaussian mixture models, and spectral clustering have been studied for a long time on text clustering tasks. However, their accuracy for text clustering is not high, mainly because the high-dimensional sparsity of text features makes it difficult to accurately measure the distance between texts.
[0057] To mitigate the high-dimensional sparsity of text features, existing technologies generally perform data augmentation on text to facilitate text clustering. Data augmentation refers to techniques that increase the diversity of training data without collecting new examples. For example, text data augmentation techniques can enhance text data through word-level random perturbations. These perturbations involve random insertion, swapping, and deletion of constituent words, and have been shown to improve text classification performance. Furthermore, back-translation methods can also enhance text data. Back-translation methods first translate text into another language and then translate it back to the original language, generating enhanced text data.
[0058] However, the text data augmentation techniques used in the above methods, namely back translation, random insertion and replacement of other constituent words, etc., produce noisy augmented text due to the introduction of additional noisy features, thereby hindering the improvement of text clustering accuracy.
[0059] In order to overcome the above problems, the text clustering method provided by the present application avoids the introduction of additional noisy features by obtaining anchor words that represent the text semantics of the training text, obtains the prediction result of the text clustering model based on the anchor words, that is, the first clustering result, and obtains the second clustering result for calibrating the first clustering result based on the first clustering result, and determines the self-training objective function of multiple training texts based on the second clustering result and the first clustering result, as well as the self-training target value of the self-training objective function. The text clustering model is updated based on the self-training target value until the text clustering model converges, indicating that the text clustering model has been trained. After that, the converged text clustering model is applied to text clustering. Since the present application avoids the introduction of additional noisy features, the text clustering method provided by the present application can solve the technical problem that the introduction of additional noisy features leads to the generation of noisy enhanced text, which hinders the improvement of the accuracy of text clustering.
[0060] See also Figure 1 , Figure 1 An exemplary system architecture diagram of a text clustering method provided in an embodiment of the present application.
[0061] like Figure 1As shown, the system architecture may include an electronic device 101, a network 102, and a server 103. The network 102 is used to provide a medium for a communication link between the electronic device 101 and the server 103. The network 102 may include various types of wired communication links or wireless communication links, for example, a wired communication link may include an optical fiber, a twisted pair, or a coaxial cable, and a wireless communication link may include a Bluetooth communication link, a Wireless-Fidelity (Wi-Fi) communication link, or a microwave communication link.
[0062] The electronic device 101 can interact with the server 103 through the network 102 to receive messages from the server 103 or send messages to the server 103, or the electronic device 101 can interact with the server 103 through the network 102 to receive messages or data sent by other users to the server 103. The electronic device 101 can be hardware or software. When the electronic device 101 is hardware, it can be various electronic devices, including but not limited to smart watches, smart phones, tablet computers, laptop portable computers and desktop computers. When the electronic device 101 is software, it can be installed in the electronic devices listed above, which can be implemented as multiple software or software modules (for example: for providing distributed services), or it can be implemented as a single software or software module, which is not specifically limited here.
[0063] In an embodiment of the present application, the electronic device 101 can obtain anchor words corresponding to each training text in a plurality of training texts, and determine the anchor word model features corresponding to each anchor word based on a text clustering model; wherein each anchor word is used to represent the full-text semantics of the training text corresponding to each anchor word. Afterwards, the anchor word model features in each training text are input into the text clustering model to obtain a first clustering result for each training text, and each first clustering result is normalized to obtain a second clustering result corresponding to each first clustering result. Based on each first clustering result and each second clustering result, a self-training objective function of the plurality of training texts is determined, as well as a self-training target value of the self-training objective function. Afterwards, the text clustering model is updated based on the self-training target value until the text clustering model converges, and the converged text clustering model is applied to text clustering.
[0064] The server 103 may be a business server that provides various services. It should be noted that the server 103 may be hardware or software. When the server 103 is hardware, it may be implemented as a distributed server cluster consisting of multiple servers, or it may be implemented as a single server. When the server 103 is software, it may be implemented as multiple software or software modules (for example, for providing distributed services), or it may be implemented as a single software or software module, which is not specifically limited herein.
[0065] Alternatively, the system architecture may also not include the server 103. In other words, the server 103 may be an optional device in the embodiments of this specification, that is, the method provided in the embodiments of this specification may be applied to a system structure that only includes the electronic device 101, and the embodiments of this application are not limited to this.
[0066] It should be understood that Figure 1 The number of electronic devices, networks, and servers in the embodiment is only illustrative and can be any number of electronic devices, networks, and servers according to implementation requirements.
[0067] See also Figure 2 , Figure 2 A flowchart of a text clustering method provided in an embodiment of the present application. The execution subject of the embodiment of the present application can be an electronic device that executes the text clustering method, a processor in an electronic device that executes the document rendering method, or a text clustering service in an electronic device that executes the text clustering method. For ease of description, the specific execution process of the text clustering method is described below using the example of a processor in an electronic device as the execution subject.
[0068] S202: Obtain anchor words corresponding to each training text from a plurality of training texts, and determine anchor word model features corresponding to each anchor word based on a text clustering model; wherein each anchor word is used to represent the full-text semantics of the training text corresponding to each anchor word.
[0069] The training text can be either pre-selected or randomly selected. Each training text typically contains at least one anchor word that represents the full semantics of the training text. Here, at least one anchor word can be understood as the one or more words in the text that contain the most information. For example, in a training text describing the origin of apples, both "apple" and "origin" can serve as anchor words.
[0070] The pre-trained language model includes the BERT (Bidirectional Encoder Representations from Transformers) model. The BERT model is a pre-trained language model that can be fine-tuned using different objective functions to be applied to different tasks. The text clustering model proposed in this application is obtained by fine-tuning BERT to obtain anchor word model features and text features suitable for text clustering tasks.
[0071] For example, the anchor word model feature can be Z ij =f θ (x ij ), θ is the learnable parameter of the BERT model, x ijRepresents the jth anchor word in the i-th training text. Assuming that the number of training texts is n, then n≥i≥1 and i is a natural number; assuming that the number of anchor words in each training text is k, then k≥j≥1, j is a natural number. Usually, in the BERT model, due to the existence of learnable Class Token, Class Token is generally used for classification prediction. Class Token can be defined as Z i0 .
[0072] S204: Inputting each anchor word model feature in each training text into the text clustering model to obtain a first clustering result of each training text, and performing normalization processing on each first clustering result to obtain a second clustering result corresponding to each first clustering result.
[0073] The first clustering result includes the probability distribution of each training text being assigned to a different category, or text subset. For example, if n training texts are assigned to L text subsets, each training text will have L possible assignments, each corresponding to a probability. Of course, the sum of these L probabilities for each training text is 1.
[0074] Here, the anchor word model features in each training text can be input into the linear layer with parameter W in the text clustering model to predict the distribution results of each training text to obtain the first clustering result P iJ , P iJ It represents the probability that the i-th training text is assigned to the J-th text subset, L≥J≥1, and J is a natural number.
[0075] Each first clustering result is normalized to achieve sharpening of each first clustering result, thereby obtaining a second clustering result. The second clustering result is used as a calibration benchmark for the first clustering result. Here, the second clustering result is obtained from the first clustering result so that the text clustering model can be trained under unsupervised conditions to achieve fine-tuning.
[0076] The second clustering results may include: Where, L≥J≥1, J is a natural number, n≥i≥1, i is a natural number. iJ The numerator of y represents the first ratio of the square of the predicted probability of the i-th training text assigned to the J-th text subset to the sum of the probabilities of all training texts assigned to the J-th text subset; iJ The denominator of represents the ratio of the square of the predicted probability of the i-th training text assigned to the h-th text subset to the sum of the probabilities of all training texts assigned to the h-th text subset, and the sum of 1 to L is taken in h. It is easy to understand that 1≥y iJ ≥0.
[0077] S206: Determine self-training objective functions of the plurality of training texts based on each first clustering result and each second clustering result, and determine self-training target values of the self-training objective functions.
[0078] The self-training objective function can be obtained by processing the first clustering results and the second clustering results of the plurality of training texts. The processing methods include, but are not limited to, loss functions or mathematical expectations. The loss function may include cross-entropy loss or KL (Kullback-Leibler Divergence) divergence. The self-training objective function can represent the degree of training of the text clustering model.
[0079] Substituting the numerical value of the corresponding first clustering result and the numerical value of the corresponding second clustering result into the self-training objective function can obtain the corresponding self-training target value, which is used to quantify the training degree of the text clustering model.
[0080] S208: updating the text clustering model based on the self-training target value until the text clustering model converges, and applying the converged text clustering model to text clustering.
[0081] The relevant learnable parameters in the text clustering model, including but not limited to θ, are updated based on the self-training target value. After the text clustering model is updated, the training text can remain unchanged or be randomly changed. The self-training target value is then obtained again based on the updated text clustering model until the obtained self-training target value converges to a certain constant, indicating that the text clustering model has converged and stabilized. Afterwards, the converged text clustering model can be applied to text clustering. Here, as the training text changes, the constant generally also changes.
[0082] In one feasible embodiment, when the multiple self-training target values obtained vary within a predetermined range greater than a constant, the text clustering model is considered to have converged. Of course, in other embodiments, when the multiple self-training target values obtained vary within a predetermined range less than a constant, the text clustering model is considered to have converged; or when the multiple self-training target values obtained vary within a predetermined range greater than or less than a constant, the text clustering model is considered to have converged.
[0083] The present application provides a text clustering method. Based on anchor words corresponding to the full-text semantics of each training text, anchor word model features corresponding to the anchor words are obtained to avoid the introduction of additional noisy features. Then, a first clustering result and a second clustering result of each training text are obtained based on the anchor word model features, and a self-training objective function of multiple training texts is determined based on each first clustering result and each second clustering result, as well as a self-training target value of the self-training objective function. Finally, the text clustering model is updated based on the self-training target value until the text clustering model converges, and the converged text clustering model is applied to text clustering. After continuous training until the convergence of the text clustering model, the accuracy and stability of the text clustering model are continuously improved, and the accuracy of text clustering is avoided from being affected by additional noisy features.
[0084] Figure 3 A flowchart of a method for obtaining anchor words provided in an embodiment of the present application is shown below. Figure 3 As shown, in an embodiment provided by the present application, obtaining the anchor words corresponding to each training text in the plurality of training texts in step S202 includes:
[0085] S302: Based on the component words in each training text among the multiple training texts, determine the information weight of each component word in each training text.
[0086] Among them, each training text generally includes multiple components, and each component word has its own corresponding full-text semantic information. First, obtain the attention weight α of each component word in each training text ij , input each component word into the text clustering model to obtain the component word model feature Z` corresponding to each component word ij , where the word model features Z` ij The acquisition method and anchor word model feature Z ij The method of obtaining is the same, and the meanings of i and j can be referred to above. ij Z` ij || represents the information weight of each word in each training text, that is, α ij Z` ij The norm of .
[0087] In one possible implementation, the information weight NA from the shallower layer of the BERT model can be used, i.e. 12≥H≥1 and H is a natural number. Here, H represents the Hth layer in which the BERT model participates in the operation. Because BERT describes a variety of information from surface to semantic, and the 3rd, 4th, 5th, 6th, 7th, 9th, and 12th layers have the strongest representation capabilities, H can be preferably any value among 3, 4, 5, 6, 7, 9, and 12.
[0088] S304: Sort the information weights of the constituent words corresponding to each training text from large to small, and obtain the information weights of the number of preset anchor words ranked first corresponding to each training text.
[0089] Among them, the component word with a larger information weight indicates that the component word can better represent the full-text semantics of the training text in which the component word is located. Therefore, the information weights of the component words corresponding to each training text can be sorted from large to small to obtain the component words that can better represent the full-text semantics of each training text.
[0090] In a feasible implementation, k information weights of the top ranked words corresponding to each training text may be obtained, where the value of k may be determined according to the proportion of the constituent words in each training text, or based on the information weight of each constituent word.
[0091] S306: Based on the component words corresponding to the information weights of the preset number of anchor words, obtain the corresponding preset number of anchor words in each training text.
[0092] The components corresponding to the information weight of the preset number of anchor words ranked first in each training text are used as the anchor words for the preset number of anchor words in each training text. It should be noted that the predicted distribution results of anchor words from the same training text can be consistent with each other and with the predicted distribution results of class tokens in the BERT model. In this case, consistency can be considered as the predicted probability distribution being consistent.
[0093] Figure 4 Schematic diagram of a process for determining a first clustering result provided in an embodiment of the present application. Figure 4 As shown, in step S204, each anchor word model feature in each training text is input into the text clustering model, and the first clustering result of each training text is obtained, including:
[0094] S402: Input each anchor word model feature in each training text into the text clustering model respectively to obtain a pre-clustering result of each anchor word model feature in each training text.
[0095] Among them, the anchor word model feature corresponding to each anchor word in each training text corresponds to a pre-clustering result, and the pre-clustering result includes the probability distribution of the training text containing the anchor word to different text subsets obtained based on the anchor word. Therefore, when each training text has k anchor words, the k anchor words can correspond to k anchor word model features, and the k anchor word model features can correspond to k pre-clustering results. The pre-clustering result can be expressed as q(Z ij) indicates that the values of i and j can refer to the above (the value of j can be 0). When the value of j is 0, it indicates a class token, which we treat as a special anchor word. Therefore, there can be a total of (k+1) anchor words.
[0096] S404: Perform weighted averaging on the pre-clustering results corresponding to the anchor word model features in each training text to obtain a first clustering result for each training text.
[0097] Each training text has a preset number of anchor words, the preset number of anchor words corresponds to a preset number of anchor word model features, and the preset number of anchor word model features corresponds to a preset number of pre-clustering results for the anchor words. Therefore, each training text corresponds to a preset number of pre-clustering results for the anchor words, and the pre-clustering results corresponding to each training text are weighted averaged to obtain a first clustering result for each training text.
[0098] In one possible implementation, P i represents the probability distribution of each training text being assigned to a different text subset. The number of training texts is n, then n≥i≥1 and i is a natural number, λ ij Z ij The second clustering result may include: Among them, L≥J≥1, J is a natural number, n≥i≥1, i is a natural number.
[0099] Figure 5 This is a flow chart of a method for determining a self-training objective function provided in this application. Figure 5 As shown, in step S206, determining the self-training objective functions of the plurality of training texts based on the first clustering results and the second clustering results respectively includes:
[0100] S502: Based on the pre-clustering result of each anchor word model feature in each training text and the second clustering result corresponding to each training text, a loss function of each anchor word model feature in each training text is obtained.
[0101] The sample features of the training text are enhanced by the loss function of each anchor word model feature in each training text. In a feasible implementation, the loss function of each anchor word model feature in each training text can be expressed as y i It can be another representation of the second clustering result, which can be expressed as the probability distribution of the i-th training text being assigned to different text subsets.
[0102] S504: Based on the loss function of each anchor word model feature in each training text, a weighted loss function of each training text is obtained.
[0103] Among them, the weighted loss function can be obtained by multiplying the weight of each anchor word model feature in each training text by the loss function of each anchor word model feature in each training text. In a feasible embodiment, the weighted loss function of each training text can be λ ij Z ij The weight of .
[0104] S506: Determine a self-training objective function for the plurality of training texts based on the weighted loss function of each training text.
[0105] The weighted loss functions of the anchor word model features of each training text are added together to obtain the self-training objective function of multiple training texts. In a feasible implementation, the self-training objective function of multiple training texts can be: Where θ is the learnable parameter of the BERT model, and W is the parameter of the linear layer in the text clustering model. Based on this self-training objective function, the text clustering model can be self-trained, gradually improving its accuracy and stability.
[0106] Figure 6 The following is a flow chart of a method for determining a weighted loss function for each training text provided in this application. Figure 6 As shown, in step S504, based on the loss function of each anchor word model feature in each training text, the weighted loss function of each training text is obtained, which includes:
[0107] S602: Based on the information weight of each anchor word in each training text, determine the first coefficient corresponding to each anchor word model feature; wherein the first coefficient includes the norm of the product of the attention weight of each anchor word and the anchor word model feature.
[0108] Among them, based on the anchor word model features of each anchor word in each training text, the attention weight of each anchor word in each training text is obtained. The anchor word model feature is Z ij , based on the anchor word model features, multiply the attention weight α of each anchor word in each training text ij , then, by ||α ij Z ij || represents the information weight of each anchor word model feature in each training text, that is, the first coefficient. The H-th layer BERT model based on the BERT model participates in the calculation of the first coefficient, and different first coefficients can be obtained, which can be expressed as The value of j can be any natural number from 0 to k.
[0109] S604: Accumulate the first coefficients of the anchor word model features in each training text to obtain the second coefficients corresponding to all the anchor word model features in each training text.
[0110] Among them, each training text has a preset number of anchor word model features, the preset number of anchor word model features corresponds to the first coefficient of the preset number of anchor words, and the first coefficient of the preset number of anchor words is accumulated to obtain the second coefficient corresponding to all anchor word model features in each training text.
[0111] In a feasible implementation, the second coefficient can be expressed as
[0112] S606: Determine the weighted coefficient corresponding to the loss function of each anchor word model feature in each training text according to the proportion of each first coefficient in each training text in the second coefficients corresponding to all anchor word model features in each training text.
[0113] Among them, the weighted coefficient corresponding to the loss function of each anchor word model feature in each training text is determined by dividing the first coefficient corresponding to each anchor word model feature in each training text by the second coefficient corresponding to each anchor word model feature in each training text.
[0114] In a feasible implementation, the weighting coefficient That is, the proportion of each first coefficient in each training text to the second coefficient corresponding to all anchor word model features in each training text.
[0115] S608: Determine a weighted loss function for each training text based on the loss function of each anchor word model feature in each training text and the weighted coefficient corresponding to the weighted loss function of each anchor word model feature.
[0116] The weighted loss function of each training text is determined by multiplying the loss function of each anchor word model feature in each training text by the weighted coefficient corresponding to the weighted loss function of each anchor word model feature and adding them together.
[0117] In one feasible implementation, the weighted loss function for each training text can be expressed as Right now The various parameters have been described above and will not be repeated here.
[0118] Figure 7 This is a flow chart of another text clustering method provided in the embodiment of the present application. Figure 7 As shown, after normalizing each first clustering result in step S204 to obtain a second clustering result corresponding to each first clustering result, the method further includes:
[0119] S702: Determine an anchor word model feature expansion function based on each anchor word model feature and a target cluster in a second clustering result of multiple training texts; wherein the anchor word model feature expansion function includes a Gaussian distribution function, the mean of the Gaussian distribution function includes the anchor word model feature, and the variance of the Gaussian distribution function includes the target cluster.
[0120] Among them, since the deep features learned by the network usually tend to be linearized, the enhanced anchor word model features can be directly obtained around the anchor word. Specifically, for each anchor word, we can start from a mean of Z ij And the covariance matrix is A large number of enhanced anchor word model features are obtained from the Gaussian distribution.
[0121] At this time, the Gaussian distribution function can be expressed as in, It is y i The largest cluster in . Here, γ≥0 is a scaling parameter, and argmax is a function that finds the parameter (set) of a function. When we have another function y=f(x), if the result x0=argmax(f(x)), it means that when the function f(x) takes x=x0, the maximum value of the value range of f(x) is obtained; if there are multiple points that make f(x) take the same maximum value, then the result of argmax(f(x)) is a point set. In other words, argmax(f(x)) is the variable point x (or set of x) corresponding to the maximum value of f(x). arg is argument, which means "independent variable" here.
[0122] S704: Expand the anchor word model features based on the anchor word model features and the anchor word model feature expansion functions corresponding to the anchor word model features.
[0123] Among them, the overall text features of the training text can be enhanced based on the expanded anchor word model features.
[0124] Figure 8 A flowchart of another text clustering method provided in the embodiment of the present application is shown below. Figure 8 As shown, in step S206, determining the self-training objective functions of the plurality of training texts based on the first clustering results and the second clustering results respectively includes:
[0125] S802: Based on the pre-clustering result of each anchor word model feature in each training text and the second clustering result corresponding to each training text, a loss function of each anchor word model feature in each training text is obtained.
[0126] The pre-clustering results of each anchor word model feature in each training text can be the pre-clustering results of each enhanced anchor word model feature, that is, The loss function can be expressed as
[0127] S804: Determine a weighted expectation function for each training text based on the loss function of each anchor word model feature in each training text.
[0128] Among them, based on the loss function of each anchor word model feature in each training text, the expected function of each anchor word model feature in each training text is obtained, and based on the expected function of each anchor word model feature in each training text, the weighted expected function of each training text is obtained.
[0129] In a feasible implementation, when the anchor word model feature is an enhanced anchor word model feature, the weighted expectation function of each training text can be Where E represents expectation, and other parameters have been described above and will not be repeated here.
[0130] S806: Determine a self-training objective function of the plurality of training texts based on the weighted expectation function of each training text.
[0131] The self-training objective function of multiple training texts is determined by accumulating the weighted expected functions of the training texts. This objective in the formulation is difficult to solve due to the expected form. Therefore, we ij A second-order Taylor expansion is applied to form a tractable approximation, namely, Among them, Tr represents the trace of a matrix, yes The Hansen matrix,
[0132] Figure 9 The overall process diagram of a text clustering method provided in the embodiment of the present application is as follows: Figure 9 As shown, the original text is input into BERT to generate anchor word model features and NA weights for the words. Class Token and other tokens with the top k NA weights are selected as anchor words (i.e., anchor word enhancement). Their anchor word model features are input into the prediction layer to calculate the sharpened target cluster membership assignment. For each anchor word, we formulate the expected form of the self-training loss between its enhanced anchor word model features and the target cluster membership assignment (i.e., expected word enhancement). A large number of experiments are conducted to evaluate the clustering performance of the proposed method on three benchmark text datasets. The experimental results show that the proposed method significantly outperforms the existing text clustering methods in terms of three indicators (accuracy, normalized mutual information, and average Rand index). In addition, the ablation study shows the effectiveness of the anchor word enhancement technique and the expected word enhancement technique.
[0133] An embodiment of the present application further provides a computer storage medium, which can store multiple instructions, and the instructions are suitable for being loaded by a processor and executing the steps of any method in the above embodiments.
[0134] Figure 10 An exemplary embodiment of this specification provides a structural diagram of a text clustering device. Figure 10 As shown, the embodiment of the present application further provides a text clustering device 1000, which includes:
[0135] The acquisition module 1010 is adapted to acquire the anchor words corresponding to each training text in a plurality of training texts, and determine the anchor word model features corresponding to each anchor word based on the text clustering model; wherein each anchor word is used to represent the full text semantics of the training text corresponding to each anchor word.
[0136] The calculation module 1020 is adapted to input each anchor word model feature in each training text into the text clustering model to obtain a first clustering result of each training text, and perform normalization processing on each first clustering result to obtain a second clustering result corresponding to each first clustering result.
[0137] The determination module 1030 is adapted to determine the self-training objective functions of the plurality of training texts based on each first clustering result and each second clustering result, and to determine the self-training target value of the self-training objective function.
[0138] The text clustering module 1040 is adapted to update the text clustering model based on the self-training target value until the self-training target value converges, and apply the text clustering model corresponding to the converged self-training target value to text clustering.
[0139] In one embodiment provided in this application, the acquisition module 1010 includes:
[0140] The determination submodule is adapted to determine the information weight of each component word in each training text based on the component words in each training text in a plurality of training texts.
[0141] The sorting submodule is adapted to sort the information weights of the constituent words corresponding to each training text from large to small, and obtain the information weights of the number of preset anchor words ranked first corresponding to each training text.
[0142] The anchor word acquisition submodule is adapted to obtain the corresponding preset number of anchor words in each training text based on the component words corresponding to the information weight of the preset number of anchor words.
[0143] In one embodiment provided in this application, the calculation module 1020 includes:
[0144] The pre-clustering result submodule is suitable for inputting the anchor word model features in each training text into the text clustering model respectively to obtain the pre-clustering results of the anchor word model features in each training text.
[0145] The first clustering result submodule is adapted to perform weighted averaging on the pre-clustering results corresponding to the anchor word model features in each training text to obtain the first clustering result of each training text.
[0146] In one embodiment provided in this application, the determining module 1030 includes:
[0147] The loss function submodule is adapted to obtain the loss function of each anchor word model feature in each training text based on the pre-clustering result of each anchor word model feature in each training text and the second clustering result corresponding to each training text.
[0148] The weighted loss function submodule is suitable for obtaining a weighted loss function for each training text based on the loss function of each anchor word model feature in each training text.
[0149] The self-training objective function determination submodule is adapted to determine the self-training objective functions of multiple training texts based on the weighted loss function of each training text.
[0150] In one embodiment provided in this application, the weighted loss function submodule includes:
[0151] The first submodule is adapted to determine a first coefficient corresponding to each anchor word model feature based on the information weight of each anchor word in each training text; wherein the first coefficient includes the norm of the product of the attention weight of each anchor word and the anchor word model feature.
[0152] The second submodule is adapted to accumulate the first coefficients of the anchor word model features in each training text to obtain the second coefficients corresponding to all the anchor word model features in each training text.
[0153] The third submodule is suitable for determining the weighted coefficient corresponding to the loss function of each anchor word model feature in each training text based on the proportion of each first coefficient in each training text in the second coefficient corresponding to all anchor word model features in each training text.
[0154] The fourth submodule is adapted to determine the weighted loss function of each training text based on the loss function of each anchor word model feature in each training text and the weight coefficient corresponding to the weighted loss function of each anchor word model feature.
[0155] In one embodiment provided in this application, text clustering 1000 further includes:
[0156] The anchor word model feature expansion function module is suitable for determining the anchor word model feature expansion function based on the target cluster in the second clustering results of each anchor word model feature and multiple training texts; wherein the anchor word model feature expansion function includes a Gaussian distribution function, the mean of the Gaussian distribution function includes the anchor word model feature, and the variance of the Gaussian distribution function includes the target cluster.
[0157] The expansion module is adapted to expand the anchor word model features based on the anchor word model features and the anchor word model feature expansion functions corresponding to the anchor word model features.
[0158] In one embodiment provided in this application, the determining module 1030 includes:
[0159] The first determination submodule is adapted to obtain a loss function of each anchor word model feature in each training text based on a pre-clustering result of each anchor word model feature in each training text and a second clustering result corresponding to each training text.
[0160] The second determination submodule is adapted to determine the weighted expectation function of each training text based on the loss function of each anchor word model feature in each training text.
[0161] The third determination submodule is adapted to determine the self-training objective function of the plurality of training texts based on the weighted expectation function of each training text.
[0162] See Figure 11 , Figure 11 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Figure 11 As shown, the electronic device 1100 may include: at least one processor 1101 , at least one network interface 1104 , a user interface 1103 , a memory 1105 , and at least one communication bus 1102 .
[0163] The communication bus 1102 is used to implement the connection and communication between these components.
[0164] The user interface 1103 may include a display screen (Display) and a camera (Camera). Optionally, the user interface 1103 may also include a standard wired interface and a wireless interface.
[0165] The network interface 1104 may optionally include a standard wired interface or a wireless interface (such as a WI-FI interface).
[0166] The processor 1101 may include one or more processing cores. The processor 1101 utilizes various interfaces and circuits to connect the various components within the entire electronic device 1100. By running or executing instructions, programs, code sets, or instruction sets stored in the memory 1105, and calling data stored in the memory 1105, the processor 1101 performs various functions of the electronic device 1100 and processes data. Optionally, the processor 1101 may be implemented in at least one hardware form of a digital signal processing (DSP), a field-programmable gate array (FPGA), or a programmable logic array (PLA). The processor 1101 may integrate one or a combination of a central processing unit (CPU), a graphics processing unit (GPU), and a modem. The CPU primarily processes the operating system, user interface, and application programs; the GPU is responsible for rendering and drawing the content to be displayed on the display; and the modem is used to handle wireless communications. It is understood that the modem may not be integrated into the processor 1101 and may be implemented separately on a single chip.
[0167] Among them, the memory 1105 may include a random access memory (RAM) or a read-only memory (ROM). Optionally, the memory 1105 includes a non-transitory computer-readable storage medium. The memory 1105 can be used to store instructions, programs, codes, code sets or instruction sets. The memory 1105 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the above-mentioned various method embodiments, etc.; the data storage area may store data involved in the above-mentioned various method embodiments, etc. The memory 1105 may also be optionally at least one storage device located away from the aforementioned processor 1101. As Figure 11 As shown, the memory 1105 as a computer storage medium may include an operating system, a network communication module, a user interface module, and a text clustering program.
[0168] exist Figure 11In the electronic device 1100 shown, the user interface 1103 is mainly used to provide an input interface for the user and obtain data input by the user; and the processor 1101 can be used to call the text clustering program stored in the memory 1105 and specifically perform the following operations:
[0169] Obtaining anchor words corresponding to each training text from a plurality of training texts, and determining anchor word model features corresponding to each anchor word based on a text clustering model; wherein each anchor word is used to represent the full text semantics of the training text corresponding to each anchor word;
[0170] Inputting each anchor word model feature in each training text into the text clustering model to obtain a first clustering result of each training text, and performing normalization processing on each first clustering result to obtain a second clustering result corresponding to each first clustering result;
[0171] Determining a self-training objective function of each of the plurality of training texts based on each of the first clustering results and each of the second clustering results, and determining a self-training target value of the self-training objective function;
[0172] The text clustering model is updated based on the self-training target value until the text clustering model converges, and the converged text clustering model is applied to text clustering.
[0173] In some embodiments, the processor 1101 executes the following steps to obtain an anchor word corresponding to each training text in the plurality of training texts:
[0174] Determining, based on the component words in each of the plurality of training texts, an information weight of each component word in each training text;
[0175] Sort the information weights of the constituent words corresponding to each training text from large to small, and obtain the information weights of the number of preset anchor words ranked first corresponding to each training text;
[0176] Based on the component words corresponding to the information weights of the preset number of anchor words, the corresponding preset number of anchor words in each training text is obtained.
[0177] In some embodiments, the processor 1101 inputs each anchor word model feature in each training text into the text clustering model to obtain a first clustering result for each training text, including:
[0178] Input each anchor word model feature in each training text into the text clustering model to obtain the pre-clustering result of each anchor word model feature in each training text;
[0179] The pre-clustering results corresponding to the anchor word model features in each training text are weighted averaged to obtain the first clustering result of each training text.
[0180] In some embodiments, the processor 1101 executes the self-training objective function of determining the plurality of training texts based on each first clustering result and each second clustering result, including:
[0181] Based on the pre-clustering results of the anchor word model features in each training text and the second clustering results corresponding to each training text, a loss function of each anchor word model feature in each training text is obtained;
[0182] Based on the loss function of each anchor word model feature in each training text, a weighted loss function for each training text is obtained;
[0183] Based on the weighted loss function of each training text, a self-training objective function of the plurality of training texts is determined.
[0184] In some embodiments, the processor 1101 executes a loss function based on the model features of each anchor word in each training text to obtain a weighted loss function for each training text, including:
[0185] Based on the information weight of each anchor word in each training text, determine the first coefficient corresponding to each anchor word model feature; wherein the first coefficient includes the norm of the product of the attention weight of each anchor word and the anchor word model feature;
[0186] Accumulate the first coefficients of the anchor word model features in each training text to obtain the second coefficients corresponding to all anchor word model features in each training text;
[0187] Determine a weighted coefficient corresponding to the loss function of each anchor word model feature in each training text according to the proportion of each first coefficient in each training text in the second coefficients corresponding to all anchor word model features in each training text;
[0188] The weighted loss function of each training text is determined based on the loss function of each anchor word model feature in each training text and the weight coefficient corresponding to the weighted loss function of each anchor word model feature.
[0189] In some embodiments, after the processor 1101 performs normalization processing on each first clustering result to obtain a second clustering result corresponding to each first clustering result, the process further includes:
[0190] Determining an anchor word model feature expansion function based on each anchor word model feature and a target cluster in a second clustering result of the plurality of training texts; wherein the anchor word model feature expansion function includes a Gaussian distribution function, a mean of the Gaussian distribution function includes the anchor word model feature, and a variance of the Gaussian distribution function includes the target cluster;
[0191] The anchor word model features are expanded based on the anchor word model features and the anchor word model feature expansion functions corresponding to the anchor word model features.
[0192] In some embodiments, the processor 1101 executes the self-training objective function of determining the plurality of training texts based on each first clustering result and each second clustering result, including:
[0193] Based on the pre-clustering results of the anchor word model features in each training text and the second clustering results corresponding to each training text, a loss function of each anchor word model feature in each training text is obtained;
[0194] Determine the weighted expectation function of each training text based on the loss function of each anchor word model feature in each training text;
[0195] Based on the weighted expectation function of each training text, a self-training objective function of the plurality of training texts is determined.
[0196] In the several embodiments provided in the embodiments of the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely schematic. For example, the division of the modules is only a logical function division. There may be other division methods in actual implementation, such as multiple modules or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or modules, which can be electrical, mechanical or other forms.
[0197] The modules described as separate components may or may not be physically separate, and the components shown as modules may or may not be physical modules, that is, they may be located in one place or distributed across multiple network modules. Some or all of the modules may be selected to achieve the purpose of the present embodiment according to actual needs.
[0198] In addition, the functional modules in each embodiment of the present application can be integrated into a processing module, or each module can exist physically separately, or two or more modules can be integrated into a single module. The above-mentioned integrated modules can be implemented in the form of hardware or software functional modules.
[0199] If the integrated module is implemented in the form of a software function module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0200] It should be noted that for the aforementioned method embodiments, for the sake of simplicity of description, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present application are not limited by the order of the actions described, because according to the embodiments of the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required for the embodiments of the present application.
[0201] In the above embodiments, the description of each embodiment has its own focus. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0202] The above is a description of the text clustering method, device, electronic device and computer-readable storage medium provided in the embodiments of the present application. For those skilled in the art, based on the ideas of the embodiments of the present application, there may be changes in the specific implementation methods and application scopes. In summary, the content of this specification should not be understood as a limitation on the embodiments of the present application.
Claims
1. A text clustering method, characterized in that: The method comprises: Obtaining anchor words corresponding to each training text from a plurality of training texts, and determining anchor word model features corresponding to each anchor word based on a text clustering model; wherein each anchor word is used to represent the full text semantics of the training text corresponding to each anchor word; Inputting each anchor word model feature in each training text into the text clustering model to obtain a first clustering result for each training text, and performing normalization processing on each first clustering result to obtain a second clustering result corresponding to each first clustering result; Determining a self-training objective function of the plurality of training texts based on each first clustering result and each second clustering result, and determining a self-training target value of the self-training objective function; Updating the text clustering model based on the self-training target value until the text clustering model converges, and applying the converged text clustering model to text clustering; The step of obtaining the anchor words corresponding to each training text in the plurality of training texts includes: Determining, based on the component words in each of the plurality of training texts, an information weight of each component word in each training text; Sort the information weights of the constituent words corresponding to each training text from large to small, and obtain the information weights of the number of preset anchor words ranked first corresponding to each training text; Based on the component words corresponding to the information weights of the preset number of anchor words, obtaining the anchor words corresponding to the preset number of anchor words in each training text; Inputting the anchor word model features in each training text into the text clustering model to obtain a first clustering result for each training text includes: Inputting each anchor word model feature in each training text into the text clustering model respectively to obtain a pre-clustering result of each anchor word model feature in each training text; The pre-clustering results corresponding to the anchor word model features in each training text are weighted averaged to obtain the first clustering result of each training text.
2. The text clustering method according to claim 1, wherein: The self-training objective function of determining the plurality of training texts based on the first clustering results and the second clustering results includes: Based on the pre-clustering results of the anchor word model features in each training text and the second clustering results corresponding to each training text, a loss function of each anchor word model feature in each training text is obtained; Based on the loss function of each anchor word model feature in each training text, a weighted loss function for each training text is obtained; Based on the weighted loss function of each training text, a self-training objective function of the plurality of training texts is determined.
3. The text clustering method according to claim 2, wherein: The weighted loss function of each training text is obtained based on the loss function of each anchor word model feature in each training text, including: Based on the information weight of each anchor word in each training text, determine a first coefficient corresponding to each anchor word model feature; wherein the first coefficient includes the norm of the product of the attention weight of each anchor word and the anchor word model feature; Accumulate the first coefficients of the anchor word model features in each training text to obtain the second coefficients corresponding to all anchor word model features in each training text; Determine a weighted coefficient corresponding to the loss function of each anchor word model feature in each training text according to the proportion of each first coefficient in each training text in the second coefficients corresponding to all anchor word model features in each training text; The weighted loss function of each training text is determined based on the loss function of each anchor word model feature in each training text and the weight coefficient corresponding to the weighted loss function of each anchor word model feature.
4. The text clustering method according to claim 1, wherein: After normalizing each first clustering result to obtain a second clustering result corresponding to each first clustering result, the method further includes: Determining an anchor word model feature expansion function based on each anchor word model feature and a target cluster in the second clustering results of the plurality of training texts; wherein the anchor word model feature expansion function includes a Gaussian distribution function, the mean of the Gaussian distribution function includes the anchor word model feature, and the variance of the Gaussian distribution function includes the target cluster; The anchor word model features are expanded based on the anchor word model features and the anchor word model feature expansion functions corresponding to the anchor word model features.
5. The text clustering method according to any one of claims 1 to 4, characterized in that: The self-training objective function of determining the plurality of training texts based on the first clustering results and the second clustering results includes: Based on the pre-clustering results of the anchor word model features in each training text and the second clustering results corresponding to each training text, a loss function of each anchor word model feature in each training text is obtained; Determine the weighted expectation function of each training text based on the loss function of each anchor word model feature in each training text; Based on the weighted expectation function of each training text, a self-training objective function of the plurality of training texts is determined.
6. A text clustering device, wherein: The device comprises: an acquisition module adapted to acquire an anchor word corresponding to each training text from a plurality of training texts, and determine an anchor word model feature corresponding to each anchor word based on a text clustering model; wherein each anchor word is used to represent the full text semantics of the training text corresponding to the anchor word; a calculation module adapted to input each anchor word model feature in each training text into the text clustering model to obtain a first clustering result for each training text, and to perform normalization processing on each first clustering result to obtain a second clustering result corresponding to each first clustering result; a determination module adapted to determine the self-training objective functions of the plurality of training texts based on each of the first clustering results and each of the second clustering results, and to determine the self-training target values of the self-training objective functions; A text clustering module adapted to update the text clustering model based on the self-training target value until the self-training target value converges, and apply the text clustering model corresponding to the converged self-training target value to text clustering; The acquisition module includes: a determination submodule adapted to determine, based on the component words in each of the plurality of training texts, an information weight of each component word in each training text; A sorting submodule is adapted to sort the information weights of the constituent words corresponding to each training text from large to small, and obtain the information weights of the number of preset anchor words ranked first corresponding to each training text; An anchor word acquisition submodule, adapted to obtain the corresponding preset number of anchor words in each training text based on the component words corresponding to the information amount weights of the preset number of anchor words; The calculation module includes: A pre-clustering result submodule is adapted to input each anchor word model feature in each training text into the text clustering model to obtain a pre-clustering result of each anchor word model feature in each training text; The first clustering result submodule is adapted to perform weighted averaging on the pre-clustering results corresponding to the anchor word model features in each training text to obtain the first clustering result of each training text.
7. An electronic device, wherein: The electronic device includes: processor; and A memory arranged to store computer executable instructions which, when executed, cause the processor to perform a method according to any one of claims 1 to 5.
8. A computer-readable storage medium, wherein: The computer-readable storage medium stores one or more programs, which, when executed by a processor, implement the method of any one of claims 1 to 5.
Citation Information
Patent Citations
Text classification method and device based on reinforcement learning, computer equipment and medium
CN114780727A
Method and system for clustering identified forms
US20090210406A1