Government affair label library generation method, government affair text label determination method and device
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- BEIJING BAIDU NETCOM SCI & TECH CO LTD
- Filing Date
- 2022-12-22
- Publication Date
- 2026-08-07
AI Technical Summary
然而,采用上述方式进行标签体系的更新需要浪费较多的人力,且效率较低
[0028] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this disclosure, nor is it intended to limit the scope of this disclosure. Other features of this disclosure will become readily apparent from the following description.
Smart Images

Figure CN115952258B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of artificial intelligence, specifically to natural language processing, deep learning, and pre-trained model technology, which can be applied to smart cities, smart government affairs, and other scenarios; in particular, it relates to a method for generating a government affairs tag library, a method and apparatus for determining the tags of government affairs texts. Background Technology
[0002] Currently, with the development of information technology, various institutions can set up their own government affairs platforms to push government affairs information from different regions and institutions to users; and users can also submit petition information through the government affairs platforms.
[0003] In related technologies, the tag systems corresponding to the government affairs platforms of various institutions can be manually constructed, and users can manually extract the tags they need from different texts to modify and update the tag system. However, updating the tag system in the above way requires a lot of manpower and is inefficient. Therefore, there is an urgent need for a method for generating a government affairs tag library, a method and device for determining tags for government affairs texts, to solve the above problems. Summary of the Invention
[0004] This disclosure provides a method for generating a government affairs tag library, a method for determining tags for government affairs texts, and an apparatus for improving the efficiency of generating government affairs tag libraries.
[0005] According to a first aspect of this disclosure, a method for generating a government affairs tag library is provided, comprising:
[0006] The text to be processed is obtained, and phrase mining is performed on the text to obtain mined words; wherein, the probability of the mined words forming a word is greater than a preset threshold; the probability of forming a word represents the probability value of the mined words being a complete word;
[0007] If the initial government affairs tag library does not contain the mined words, then hierarchical clustering is performed on the words in the initial government affairs tag library and the mined words to obtain clustering results; wherein, the initial government affairs tag library includes at least one word; the clustering results include: the cluster to which the word belongs and the hierarchical relationship information of the word, wherein the hierarchical relationship information represents the hierarchical relationship of the word in the cluster to which the word belongs;
[0008] Based on the clustering results, the initial government affairs tag library is updated to generate an updated government affairs tag library; the updated government affairs tag library is used to determine the tags corresponding to the text to be labeled.
[0009] According to a second aspect of this disclosure, a method for determining the label of government documents is provided, comprising:
[0010] Get the text to be annotated;
[0011] The text to be labeled is input into a preset second classification model to determine the government affairs tags corresponding to the text to be labeled; the preset second classification model is trained based on the training text with government affairs tags; the government affairs tags of the training text are determined based on the updated government affairs tag library;
[0012] The updated government affairs tag library is obtained by the method described in any one of the first aspects; the updated government affairs tag library includes multiple words, the clusters to which the words belong, and hierarchical relationship information of the words, wherein the hierarchical relationship information represents the hierarchical relationship of the words in the clusters to which the words belong.
[0013] According to a third aspect of this disclosure, an apparatus for generating a government affairs tag library is provided, comprising:
[0014] The first acquisition unit is used to acquire the text to be processed;
[0015] The first processing unit is used to perform phrase mining processing on the text to be processed to obtain mined words; wherein the probability of the mined words forming a word is greater than a preset threshold; the probability of forming a word represents the probability value of the mined words being a complete word;
[0016] The second processing unit is configured to perform hierarchical clustering on the words in the initial government affairs tag library and the mined words if the initial government affairs tag library does not contain the mined words, and obtain a clustering result; wherein the initial government affairs tag library includes at least one word; the clustering result includes: the cluster to which the word belongs and the hierarchical relationship information of the word, wherein the hierarchical relationship information represents the hierarchical relationship of the word in the cluster to which the word belongs;
[0017] The update unit is used to update the initial government affairs tag library according to the clustering results to generate an updated government affairs tag library; the updated government affairs tag library is used to determine the tags corresponding to the text to be labeled.
[0018] According to a fourth aspect of this disclosure, a label determination device for government documents is provided, comprising:
[0019] The second acquisition unit is used to acquire the text to be labeled;
[0020] The determining unit is used to input the text to be labeled into a preset second classification model to determine the government affairs tags corresponding to the text to be labeled; the preset second classification model is trained based on the training text with government affairs tags; the government affairs tags of the training text are determined based on the updated government affairs tag library;
[0021] The updated government affairs tag library is obtained by the device according to any one of the third aspects; the updated government affairs tag library includes multiple words, the clusters to which the words belong and the hierarchical relationship information of the words, wherein the hierarchical relationship information represents the hierarchical relationship of the words in the clusters to which the words belong.
[0022] According to a fifth aspect of this disclosure, an electronic device is provided, comprising:
[0023] At least one processor; and
[0024] A memory communicatively connected to the at least one processor; wherein,
[0025] The memory stores instructions executable by the at least one processor, which, when executed by the at least one processor, enable the at least one processor to perform the method described in the first aspect; or enable the at least one processor to perform the method described in the second aspect.
[0026] According to a sixth aspect of this disclosure, a non-transitory computer-readable storage medium is provided storing computer instructions, wherein the computer instructions are configured to cause the computer to perform the method of the first aspect; or, the computer instructions are configured to cause the computer to perform the method of the second aspect.
[0027] According to a seventh aspect of this disclosure, a computer program product is provided, the computer program product comprising: a computer program stored in a readable storage medium, wherein at least one processor of an electronic device can read the computer program from the readable storage medium, the at least one processor executing the computer program causing the electronic device to perform the method of the first aspect; or, the at least one processor executing the computer program causing the electronic device to perform the method of the second aspect.
[0028] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this disclosure, nor is it intended to limit the scope of this disclosure. Other features of this disclosure will become readily apparent from the following description. Attached Figure Description
[0029] The accompanying drawings are provided to better understand this solution and do not constitute a limitation of this disclosure. Wherein:
[0030] Figure 1 This is a schematic diagram based on the first embodiment of the present disclosure;
[0031] Figure 2 This is a schematic diagram according to the second embodiment of the present disclosure;
[0032] Figure 3 This is a schematic diagram according to the third embodiment of the present disclosure;
[0033] Figure 4 This is a schematic diagram according to the fourth embodiment of the present disclosure;
[0034] Figure 5 This is a schematic diagram according to the fifth embodiment of the present disclosure;
[0035] Figure 6 This is a schematic diagram according to the sixth embodiment of the present disclosure;
[0036] Figure 7 This is a schematic diagram according to the seventh embodiment of the present disclosure;
[0037] Figure 8 This is a schematic diagram according to the eighth embodiment of the present disclosure;
[0038] Figure 9 This is a schematic diagram according to the ninth embodiment of the present disclosure;
[0039] Figure 10 This is a block diagram of an electronic device that can implement the method for generating a government affairs tag library or the method for determining tags for government affairs texts according to the embodiments of this disclosure. Detailed Implementation
[0040] The exemplary embodiments of this disclosure are described below with reference to the accompanying drawings, including various details of the embodiments to aid understanding, and should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of this disclosure. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.
[0041] Currently, with the continuous development of information technology, when displaying information to users, it is common practice to tag the information to facilitate user browsing and access. For example, in the systems provided by government websites, information is divided into government news and information corresponding to user feedback tags. Specifically, under the user feedback tag, multiple different tags are further subdivided based on the issues raised in the user feedback.
[0042] In related technologies, when generating tags for a system, application, or website, designers typically determine which tags to build and the relationships between them based on their experience and available information. This leads to a low efficiency in the tag creation process. Furthermore, in practical applications, some websites use fixed tags to push information to users, making it difficult to ensure that the current tags are well-suited for information updates and iterations. Manually updating tags is also inefficient and requires significant manpower.
[0043] To avoid at least one of the aforementioned technical problems, the inventors of this disclosure, through creative effort, arrived at the inventive concept of this disclosure: By performing phrase mining on the acquired text to be processed, words with a probability of forming words greater than a preset threshold are mined. Then, if it is determined that the initial government affairs tag library does not contain the mined words, hierarchical clustering is performed on the words in the initial government affairs tag library and the mined words to obtain clustering results; wherein, the initial government affairs tag library includes at least one word; the clustering results include: the cluster to which the word belongs and the hierarchical relationship information of the word, wherein the hierarchical relationship information represents the hierarchical relationship of the word within its cluster; based on the clustering results, the initial government affairs tag library is updated to generate an updated government affairs tag library; the updated government affairs tag library is used to determine the tags corresponding to the text to be labeled.
[0044] Based on the above-mentioned inventive concept, this disclosure provides a method for generating a government affairs tag library, a method and apparatus for determining tags for government affairs texts, in the field of artificial intelligence, specifically involving natural language processing, deep learning, and pre-trained model technology, which can be applied in smart city, smart government affairs and other scenarios to improve the efficiency of tag generation.
[0045] The collection, storage, use, processing, transmission, provision, and disclosure of user personal information involved in the technical solution disclosed herein comply with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0046] Figure 1 This is a schematic diagram based on the first embodiment of this disclosure. (See diagram below.) Figure 1 As shown, the method for generating a government affairs tag library according to an embodiment of this disclosure includes:
[0047] S101. Obtain the text to be processed.
[0048] For example, the execution subject of this embodiment can be a government tag library generation device. The generation device can be a server (such as a cloud server or a local server), a computer, a terminal device, a processor, a chip, etc. This embodiment does not limit the device.
[0049] In this embodiment, when generating the government affairs tag library, multiple texts to be processed can first be obtained. In practical applications, the texts to be processed can be government news, policies, etc., that need to be published, or feedback forms submitted by users to government websites.
[0050] In one example, as information is continuously updated, when updating the government affairs tag library, the text to be processed can be retrieved at preset time intervals to update the government affairs tag library.
[0051] S102. Perform phrase mining on the text to be processed to obtain mined words; wherein, the probability of the mined words forming a word is greater than a preset threshold; the probability of forming a word represents the probability value of the mined words being a complete word.
[0052] For example, in this embodiment, after obtaining the text to be processed, phrase mining processing can be performed on the text to be processed so as to mine words in the text to be processed whose probability value of forming a complete word is greater than a preset threshold, and then new words can be mined from the text to be processed through phrase mining processing.
[0053] In one example, when performing phrase mining on the text to be processed, a preset phrase mining model can be used, such as the BERT model, N-GRAM model, or other deep learning models provided in related technologies. No specific restrictions are imposed in this embodiment.
[0054] S103. If the initial government affairs tag library does not contain the mined words, then perform hierarchical clustering on the words in the initial government affairs tag library and the mined words to obtain the clustering results; wherein, the initial government affairs tag library includes at least one word; the clustering results include: the cluster to which the word belongs and the hierarchical relationship information of the word, the hierarchical relationship information representing the hierarchical relationship of the word in the cluster to which the word belongs.
[0055] For example, in this embodiment, when the mined words are obtained, the mined words can be compared with the initial government affairs tag library, wherein the initial government affairs tag library is used to store at least one original word, and the words in the initial government affairs tag library can be used as government affairs tags corresponding to the text to be labeled.
[0056] When it is determined that the initial government tag library includes the mined words, no further processing is required; that is, there is no need to update the initial government tag library.
[0057] When it is determined that the initial government affairs tag library does not include the mined words, it indicates that the initial government affairs tag library needs to be expanded, that is, the tags in it need to be updated so that the tags determined when tagging the documents to be labeled later are more accurate.
[0058] In this embodiment, when updating the initial government affairs tag library, the mined words obtained based on phrase mining can be subjected to hierarchical clustering with the words contained in the initial government affairs tag library to determine the cluster to which each word belongs and the hierarchical relationship of the word within its cluster. For example, in practical applications, the hierarchical relationship of a word within a cluster can be understood as the parent and child words of that word. The parent word of a word can be understood as the parent tag of a tag. The child words of a word can be understood as how many tags a tag can be specifically divided into.
[0059] In one example, when performing hierarchical clustering on multiple words, the similarity between each group of words is determined. Words with similar meanings are grouped into a single cluster, resulting in multiple clusters. Then, a central word is selected within each cluster. To determine the central word, the sum of the similarities between each word and the remaining words in that cluster is calculated, and the central word is the word with the highest sum of similarities in that cluster. This central word then serves as the parent word of the remaining words in that cluster. Next, the central words corresponding to each cluster are further subdivided into clusters based on their similarity. Central words are then selected from these subdivided clusters, and this process is repeated layer by layer upwards until a user-defined stopping condition is met, resulting in a hierarchical group of words.
[0060] S104. Based on the clustering results, update the initial government affairs tag library to generate an updated government affairs tag library; the updated government affairs tag library is used to determine the tags corresponding to the text to be labeled.
[0061] For example, after obtaining the clustering results, the tags in the initial government affairs tag library can be directly replaced with the clustering results. This involves updating the initial government affairs tag library with the words, their corresponding clusters, and the hierarchical relationships within those clusters, thus obtaining an updated government affairs tag library. After obtaining the updated tag library, the text to be annotated can be tagged using this updated library, allowing for better categorization and easier user browsing.
[0062] Understandably, in this implementation, phrase mining is performed on the acquired text to be processed to identify words with high probability of becoming words. Then, hierarchical clustering is applied to the words in the initial government affairs tag library and the mined words to obtain multiple clusters. Each cluster contains at least one word. When a cluster contains multiple words, the hierarchical relationship between the words is determined to update the initial government affairs tag library. This method automatically updates the initial government affairs tag library, improving its generation efficiency. Furthermore, the updated government affairs tag library can be applied to different government affairs systems, unifying the tag system across them. This allows for unified analysis of data across different government affairs systems, avoiding inaccurate data analysis results caused by different tags for the same text in different systems.
[0063] To help readers gain a deeper understanding of the implementation principles of this disclosure, the following will be discussed in conjunction with... Figure 2 and Figure 3 right Figure 1 The illustrated embodiments are further refined.
[0064] Figure 2 This is a schematic diagram according to the second embodiment of this disclosure. (See diagram below.) Figure 2 As shown, the method for generating a government affairs tag library according to an embodiment of this disclosure includes:
[0065] S201. Obtain the text to be processed.
[0066] For example, the execution subject of this embodiment can be a government tag library generation device. The generation device can be a server (such as a cloud server or a local server), a computer, a terminal device, a processor, a chip, etc. This embodiment does not limit the device.
[0067] S202. Perform phrase mining on the text to be processed to obtain mined words; wherein, the probability of the mined words forming a word is greater than a preset threshold; the probability of forming a word represents the probability value of the mined words being a complete word.
[0068] For example, the specific principles of steps S201 and S202 can be found in steps S101 and S102, and will not be repeated here.
[0069] S203. If the initial government affairs tag library does not include the mined words, then determine the word vectors corresponding to the words in the initial government affairs tag library, and determine the word vectors corresponding to the mined words; the word vectors are the numerical vectors corresponding to the words.
[0070] For example, in this embodiment, when it is determined that the initial government affairs tags do not include the words mined in step S202, when performing hierarchical clustering on the words in the initial government affairs tag library and the mined words, the words that need to be hierarchically clustered can first be vectorized to obtain the word vectors corresponding to the words. The word vectors corresponding to the words can be seen as numerically identifying the words using numerical vectors. Through the above vectorization process, the word vectors corresponding to the words in the initial government affairs tag library and the word vectors corresponding to the mined words can be obtained.
[0071] In one example, when vectorizing words, word embedding encoding and one-hot encoding provided by relevant technologies can be used to determine the word vectors corresponding to the words.
[0072] In one example, when the hierarchical relationship of the words in the initial government affairs tag library is also obtained based on hierarchical clustering, the word vectors corresponding to the words in the initial government affairs tag library can be directly obtained from the word vectors of each word in the initial tag library generated when the initial government affairs tag library was established, without the need to vectorize the words in the initial government affairs tag library again.
[0073] It is understandable that in this embodiment, by obtaining the word vectors corresponding to the words in the initial government affairs tag library and the word vectors corresponding to the mined words, each word can be accurately identified during subsequent hierarchical clustering processing.
[0074] S204. Perform hierarchical clustering on the word vectors corresponding to the words in the initial government affairs tag library and the word vectors corresponding to the mined words to obtain clustering results; wherein, the initial government affairs tag library includes at least one word; the clustering results include: the cluster to which the word belongs and the hierarchical relationship information of the word, wherein the hierarchical relationship information represents the hierarchical relationship of the word in the cluster to which the word belongs.
[0075] For example, in this embodiment, after obtaining the word vectors of words in the initial government affairs tag library and the word vectors corresponding to the mined words, hierarchical clustering can be performed based on the obtained word vectors, that is, the word vectors are used to uniquely represent the words corresponding to them.
[0076] In practical applications, when performing hierarchical clustering on multiple word vectors, the similarity between the word vectors can be considered.
[0077] In one example, step S204 includes the following steps: "Based on the word vectors corresponding to the words in the initial government label library and the word vectors in the word vectors corresponding to the mined words, determine multiple clusters, wherein each cluster includes a word vector; repeat the following steps until the first preset stopping condition is reached: determine the first similarity of each pair of clusters; determine that the two clusters corresponding to the first similarity with the largest value are located in the same cluster."
[0078] For example, in this embodiment, when performing hierarchical clustering, the obtained multiple word vectors (i.e., word vectors corresponding to words in the initial government tag library and word vectors corresponding to mined words) can be first divided into clusters. Each word vector is treated as a cluster, meaning that a cluster contains one word vector, and different clusters contain different word vectors. After obtaining multiple clusters, the clusters are paired to form multiple pairs of clusters. For each pair of clusters, the similarity between the clusters within that pair is determined, resulting in multiple similarity scores. The pair of clusters with the highest similarity score is then identified as two sub-clusters within the same cluster. The above steps are repeated to further determine the similarity between each pair of clusters, and the clusters are merged until a preset first stopping condition is reached. The preset first stopping condition can be that the number of merged clusters reaches a preset threshold, or that merging stops when the similarity between clusters is less than a preset value.
[0079] It is understood that in this embodiment, when performing hierarchical clustering, word vectors can be hierarchically clustered by continuously calculating the similarity between clusters. Then, multiple word vectors can be agglomerated into at least one cluster through the above-mentioned non-gradual merging method. The hierarchical relationship of words in the cluster can be determined by the number of repetitions during the above-mentioned repeated execution. The smaller the number of repetitions, the lower the level of the corresponding word, thereby obtaining the clustering result, so as to improve the update efficiency of the initial government label library.
[0080] In one example, the first similarity is determined based on any one of the following: minimum distance, center distance, average distance, and maximum distance; minimum distance indicates the minimum distance between word vectors in the first cluster of a pair of clusters and word vectors in the second cluster of a pair of clusters; center distance indicates the median distance between word vectors in the first cluster of a pair of clusters and word vectors in the second cluster of a pair of clusters; average distance indicates the average of the sum of the distances between word vectors in the first cluster of a pair of clusters and word vectors in the second cluster of a pair of clusters; and maximum distance indicates the maximum distance between word vectors in the first cluster of a pair of clusters and word vectors in the second cluster of a pair of clusters, wherein a pair of clusters includes the first cluster and the second cluster.
[0081] For example, in this embodiment, the first similarity between two different clusters can be determined based on any one of the minimum distance, center distance, average distance, and maximum distance.
[0082] When two clusters in a pair are classified as cluster 1 and cluster 2, the distances between word vectors in cluster 1 and cluster 2 can be determined. When multiple distances are obtained, the minimum distance is the minimum distance at that point; the maximum distance is the maximum distance; the average distance is the average distance; and the median distance is the center distance. Furthermore, the smaller the minimum distance chosen, the greater the similarity between the corresponding clusters.
[0083] It is understood that in this embodiment, the similarity between different clusters is determined by using any of the above distance determination methods. The above methods are relatively simple to implement and do not require the word features of the extracted words to determine word similarity.
[0084] In one example, step S204 includes the following steps: "The word vectors corresponding to the words in the initial government tag library and the word vectors corresponding to the mined words are determined as vectors in the initial cluster; the following steps are repeated until the second preset stopping condition is reached: the second similarity between the two word vectors in the initial cluster is determined; the two word vectors corresponding to the minimum second similarity are determined as the first vector and the second vector, respectively; the initial cluster is divided into the first cluster and the second cluster, wherein the first cluster includes the first vector and the second cluster includes the second vector; the third similarity between the remaining vectors in the initial cluster and the first vector is determined, and the fourth similarity between the remaining vectors and the second vector is determined; the cluster to which the remaining vectors belong is determined based on the third similarity and the fourth similarity; the initial cluster is determined based on the first cluster and the second cluster."
[0085] For example, in this embodiment, when performing hierarchical clustering on multiple word vectors, a splitting approach can be adopted. First, all acquired word vectors are treated as an initial cluster. Then, the second similarity between any two word vectors in the initial cluster is determined, resulting in multiple second similarities. Next, the two word vectors corresponding to the smallest second similarity are selected and divided into a first vector and a second vector. Then, the initial cluster is divided into two clusters: one containing the first vector and the other containing the second vector. For the remaining vectors in the initial cluster (i.e., the remaining vectors in the initial cluster besides the first and second vectors), the similarity between the remaining vectors and the first vector (i.e., the third similarity) and the similarity between the remaining vectors and the second vector (i.e., the fourth similarity) can be calculated. By comparing the third and fourth similarities, it can be determined whether the remaining vectors belong to the cluster of the first vector or the cluster of the second vector. That is, when the third similarity is less than the fourth similarity, the remaining vectors can be assigned to the cluster of the first vector; otherwise, they belong to the cluster of the second vector. For the two divided clusters, initial clusters are determined. The above division process is repeated for the two divided clusters as two initial clusters until a preset second stopping condition is reached. For example, the second stopping condition can be determined based on the hierarchical clustering time or the number of hierarchical clusters. No specific restrictions are imposed in this embodiment.
[0086] It is understandable that in this embodiment, when performing hierarchical clustering, a cluster can be continuously split according to the similarity between word vectors to obtain multiple clusters with hierarchical relationships. This allows the initial government label library to be updated based on the divided clusters, thereby improving the accuracy of determining the labels corresponding to the text to be labeled.
[0087] S205. Based on the clustering results, update the initial government affairs tag library to generate an updated government affairs tag library; the updated government affairs tag library is used to determine the tags corresponding to the text to be labeled.
[0088] For example, the specific principle of step S205 can be found in step S104, and will not be repeated here.
[0089] In this embodiment, when performing hierarchical clustering on multiple acquired words, the word vectors corresponding to the words in the initial government affairs tag library and the word vectors corresponding to the mined words can be obtained. This allows for accurate identification of each word during subsequent hierarchical clustering processing. Furthermore, during hierarchical clustering based on the obtained word vectors, the similarity between clusters is continuously calculated to perform hierarchical clustering. This gradual merging process gradually agglomerates multiple word vectors into at least one cluster, yielding the clustering result. Alternatively, the similarity between word vectors can be combined to continuously split multiple word vectors to obtain the clustering result. Therefore, the hierarchical clustering method described above allows for hierarchical division of multiple word vectors, enabling subsequent updates to the initial government affairs tag library based on the clustering results, thus improving the accuracy of subsequent text tagging.
[0090] Figure 3 This is a schematic diagram according to the third embodiment of this disclosure. (See diagram below.) Figure 3 As shown, the method for generating a government affairs tag library according to an embodiment of this disclosure includes:
[0091] S301. Obtain the text to be processed.
[0092] For example, the execution subject of this embodiment can be a government tag library generation device. The generation device can be a server (such as a cloud server or a local server), a computer, a terminal device, a processor, a chip, etc. This embodiment does not limit the device.
[0093] For example, the technical principle of step S301 can be found in step S101, and will not be repeated here.
[0094] S302. Perform word segmentation on the text to be processed to obtain multiple word segmentation results.
[0095] For example, in this embodiment, after obtaining the text to be processed, word segmentation can be performed on the text to be processed, that is, the various sentences contained in the text to be processed are divided, and then the word segmentation results contained in the sentences are obtained.
[0096] S303. Determine the degree of correlation between two adjacent word segmentation results in multiple word segmentation results; wherein, the degree of correlation includes at least one of: cohesion, degree of freedom, and word frequency; cohesion is used to characterize the degree of cohesion between the characters contained in two adjacent word segmentation results; degree of freedom is used to characterize the degree of cohesion of two adjacent word segmentation results forming a word; word frequency is used to indicate the frequency of occurrence of two adjacent word segmentation results in the text to be processed.
[0097] For example, after obtaining multiple word segmentation results, the correlation between two adjacent word segmentation results is determined.
[0098] In one example, the degree of association between two segmentation results can be characterized by cohesion. Cohesion characterizes the tightness between characters in two adjacent segmentation results; the higher the cohesion, the greater the probability that a single segmentation result constitutes a word. The method for determining cohesion can be found in the principles of related technologies, and will not be elaborated here.
[0099] In one example, the degree of correlation between two segmentation results can be represented by degrees of freedom. Degrees of freedom characterize the tightness with which two adjacent segmentation results can form a word. Understandably, the higher the determined degrees of freedom, the greater the probability that two adjacent segmentation results will form a word. The method for determining degrees of freedom can be found in the principles of related technologies, and will not be elaborated here.
[0100] In one example, the correlation between two segmentation results can be represented by term frequency. Term frequency represents the frequency with which two adjacent segmentation results appear in the text being processed. It can be understood that the higher the determined frequency, the greater the probability that the two adjacent segmentation results form a word. The method for determining term frequency can be found in the principles of related technologies, and will not be elaborated here.
[0101] Furthermore, in practical applications, the relevance can specifically include one or more of the three representation methods mentioned above. When multiple methods are included, a preset value can be set for each representation method to filter the word segmentation results.
[0102] S304. If the correlation is determined to be less than the preset value, then remove the two adjacent word segmentation results corresponding to the correlation from the multiple word segmentation results to obtain the mined words; wherein, the probability of the mined words forming a word is greater than the preset threshold; the probability of forming a word represents the probability value of the mined words being a complete word.
[0103] For example, when the relevance between two adjacent word segmentation results is greater than a preset threshold, it indicates that the probability of the two adjacent word segmentation results forming a word is high; if the relevance is less than or equal to the preset threshold, it indicates that the probability of the two adjacent word segmentation results forming a word is low. In this case, the two word segmentation results with a relevance less than or equal to the preset value can be removed from the multiple word segmentation results. Then, the remaining word segmentation results are used as the mined words.
[0104] Understandably, in this embodiment, when performing phrase mining—that is, mining new words in the text to be processed—the text is initially segmented, and new words are selected based on the correlation between the segmentation results. These new words can then be used to update the initial government tag library. Furthermore, this embodiment can also combine the three correlation methods mentioned above—cohesion, freedom, and word frequency—to filter the segmentation results, making the mined words more accurate.
[0105] S305. Based on the preset stop word library, filter the mined words to obtain the filtered words.
[0106] For example, in this embodiment, after obtaining the mined words, the mined words can be filtered according to a preset stop word library to remove some words without any meaning.
[0107] Words with actual semantic meaning. Among them, the preset stop word library may include some commonly used modal particles, auxiliary words, etc.
[0108] In one example, after obtaining multiple word segmentation results through step S302, it is also possible to base...
[0109] When filtering multiple word segmentation results using a preset stop word library, the computational workload for determining the relevance of word segmentation results with a score of 0 is reduced.
[0110] It is understood that in this embodiment, the mined words can be filtered by a preset stop word library to make the filtered words more accurate, which is beneficial to improving the accuracy of subsequent label determination.
[0111] S306. Input the mined words into the preset first classification model to obtain the classification results; the preset first classification model is used to determine whether the input words have government affairs attributes; government affairs attributes are used to indicate...
[0112] Attributes that are related to government information.
[0113] S307. If the classification results indicate that the mined words do not have government attributes, then delete the mined words.
[0114] For example, in this embodiment, after filtering the mined words using a preset stop word library, the filtered words can be further classified based on a preset first classification model to determine whether the filtered words have government affairs attributes. Here, government affairs attributes indicate the association between the meaning of the words and government affairs information.
[0115] In one example, when the classification result output by the preset first classification model can characterize the input to...
[0116] The first classification model uses a first confidence level for words that possess political attributes, and a second confidence level for word 5 input into the model that does not possess political attributes. The confidence level is determined by comparing the magnitude of the first and second confidence levels.
[0117] Small, determine whether the word has political attributes.
[0118] In one example, when training a preset first classification model, you can select words with political attributes, such as political news headlines and political policy documents, as well as some words without political attributes, such as entertainment news and sports news, to train the model so that the trained first classification model can determine whether a word has political attributes.
[0119] It is understandable that in this embodiment, a preset first classification model is used to determine whether the mined words have government-related attributes, so as to filter out government-related words from the mined words, and then select government-related words to update and expand the government-related tag library, which helps to ensure the accuracy of the words stored in the updated government-related tag library.
[0120] S308. If the initial government affairs tag library does not contain the mined words, then perform hierarchical clustering on the words in the initial government affairs tag library and the mined words to obtain the clustering results; wherein, the initial government affairs tag library includes at least one word; the clustering results include: the cluster to which the word belongs and the hierarchical relationship information of the word, wherein the hierarchical relationship information represents the hierarchical relationship of the word in the cluster to which the word belongs.
[0121] S309. Based on the clustering results, update the initial government affairs tag library to generate an updated government affairs tag library; the updated government affairs tag library is used to determine the tags corresponding to the text to be labeled.
[0122] For example, the specific principles of steps S308 and S309 can be found in steps S103 and S104, and will not be repeated here.
[0123] In this embodiment, when mining new words in the text to be processed, the text is initially segmented, and new words are selected based on the correlation between the segmentation results. These new words can then be used to update the initial government affairs tag library. Furthermore, this embodiment can combine the three correlation methods mentioned above—consolidation, freedom, and word frequency—to filter the segmentation results, ensuring the accuracy of the mined words. A preset first classification model is used to determine whether the mined words possess government affairs attributes, allowing for the selection of government affairs-related words from the mined words. These government affairs-related words are then selected to update and expand the government affairs tag library, ensuring the accuracy of the words stored in the updated government affairs tag library. In addition, a preset stop word list can be used to filter the mined words, making the filtered words more accurate and improving the accuracy of subsequent tag determination.
[0124] Figure 4 This is a schematic diagram according to the fourth embodiment of this disclosure. (See diagram below.) Figure 4 As shown, the method for determining the tags of government documents in this embodiment includes:
[0125] S401. Obtain the text to be annotated.
[0126] For example, the executing entity in this embodiment can be a tag determination device for government documents. This determination device can be a server (such as a cloud server or a local server), a computer, a terminal device, a processor, a chip, etc., and this embodiment is not limited thereto. Furthermore, the executing entity of the determination device in this embodiment can be... Figures 1-3 The generating device mentioned in the document refers to the same device, but it can also be different devices. No specific restrictions are made in this embodiment.
[0127] In this embodiment, the text to be labeled can be government information text to be pushed to users, or it can be complaint or suggestion work order text uploaded by users to the government system, etc. There are no specific restrictions in this embodiment.
[0128] S402. Input the text to be labeled into the preset second classification model to determine the government affairs tags corresponding to the document to be labeled; the preset second classification model is trained based on the training documents with government affairs tags; the government affairs tags of the training text are determined based on the updated government affairs tag library; wherein, the updated government affairs tag library is based on... Figures 1-3 The updated government tag library is obtained by any of the following methods; it includes multiple words, the clusters to which the words belong, and hierarchical relationship information of the words, wherein the hierarchical relationship information represents the hierarchical relationship of the words in the clusters to which the words belong.
[0129] For example, in this embodiment, a preset second classification model can be used to determine the tags corresponding to the text input to the model. Furthermore, the preset second classification model in this embodiment is trained based on an updated government affairs tag library. Specifically, when training the preset second classification model, it can be trained based on training text with government affairs tags, and the government affairs tags corresponding to the training text are determined by words in the updated government affairs tag library. Moreover, the multiple words contained in the updated government affairs tag library have their own corresponding clusters, and the hierarchical relationship of the words within their respective clusters. For example, users can manually annotate the training text based on the updated government affairs tag library to obtain training text with government affairs tags.
[0130] When it is necessary to annotate the text to be labeled, the text to be labeled can be used as input to a preset second classification model so that the preset second classification model can output the label corresponding to the text to be labeled, so that the text to be labeled can be displayed under its corresponding label in the future.
[0131] It is understood that in this embodiment, after obtaining the updated government tag library, training text can be generated based on the updated government tag library, and a preset second classification model can be trained based on the training text, so that the text to be labeled can be labeled subsequently based on the preset second classification model. In addition, the preset second classification model provided in this embodiment can be provided to different government agencies, so that different government agencies can use the same updated government tag library, which is beneficial for subsequent statistical analysis of data from different government agencies.
[0132] In one example, if the text to be annotated is a government complaint work order, the number of texts to be annotated corresponding to the government label is obtained in real time. If it is determined that the number of texts to be annotated is greater than a preset value, a prompt message is sent to the user.
[0133] For example, based on the above embodiments, the text to be annotated in this embodiment can be a government complaint work order. After determining the tag corresponding to the text to be annotated, the number of texts to be annotated under each government tag can be counted in real time, that is, the number of government complaint work orders corresponding to each government tag can be determined. When the number of texts to be annotated corresponding to a government tag is greater than a preset value, a prompt message can be sent to the user to remind the user to pay attention to the work orders corresponding to that government tag.
[0134] Figure 5 This is a schematic diagram according to the fifth embodiment of this disclosure. (See diagram below.) Figure 5 As shown, the government tag library generation apparatus 500 of this embodiment includes:
[0135] The first acquisition unit 501 is used to acquire the text to be processed.
[0136] The first processing unit 502 is used to perform phrase mining processing on the text to be processed to obtain mined words; wherein, the probability of the mined words forming a word is greater than a preset threshold; the probability of forming a word represents the probability value of the mined words being a complete word.
[0137] The second processing unit 503 is used to perform hierarchical clustering on the words in the initial government affairs tag library and the mined words if the initial government affairs tag library does not contain the mined words, and to obtain the clustering result; wherein the initial government affairs tag library includes at least one word; the clustering result includes: the cluster to which the word belongs and the hierarchical relationship information of the word, wherein the hierarchical relationship information represents the hierarchical relationship of the word in the cluster to which the word belongs.
[0138] Update unit 504 is used to update the initial government label library based on the clustering results, and generate an updated government label library; the updated government label library is used to determine the label corresponding to the text to be labeled.
[0139] For example, the apparatus of this embodiment can execute the technical solutions in the above method, and its specific implementation process and technical principles are the same, which will not be repeated here.
[0140] Figure 6 This is a schematic diagram according to the sixth embodiment of this disclosure. (See diagram below.) Figure 6 As shown, the government affairs tag library generation device 600 of this embodiment includes:
[0141] The first acquisition unit 601 is used to acquire the text to be processed.
[0142] The first processing unit 602 is used to perform phrase mining processing on the text to be processed to obtain mined words; wherein, the probability of the mined words forming a word is greater than a preset threshold; the probability of forming a word represents the probability value of the mined words being a complete word.
[0143] The second processing unit 603 is used to perform hierarchical clustering on the words in the initial government affairs tag library and the mined words if the initial government affairs tag library does not contain the mined words, and to obtain the clustering result; wherein the initial government affairs tag library includes at least one word; the clustering result includes: the cluster to which the word belongs and the hierarchical relationship information of the word, wherein the hierarchical relationship information represents the hierarchical relationship of the word in the cluster to which the word belongs.
[0144] The update unit 604 is used to update the initial government label library based on the clustering results, and generate an updated government label library; the updated government label library is used to determine the label corresponding to the text to be labeled.
[0145] In one example, the second processing unit 603 includes:
[0146] The first determining module 6031 is used to determine the word vectors corresponding to the words in the initial government tag library if the initial government tag library does not include the mined words.
[0147] The second determining module 6032 is used to determine the word vectors corresponding to the mined words; the word vectors are the numerical vectors corresponding to the words.
[0148] The first processing module 6033 is used to perform hierarchical clustering on the word vectors corresponding to the words in the initial government tag library and the word vectors corresponding to the mined words to obtain the clustering results.
[0149] In one example, the first processing module 6033 includes:
[0150] The first determination submodule is used to determine multiple clusters based on the word vectors corresponding to words in the initial government tag library and the word vectors in the word vectors corresponding to the mined words. Each cluster includes a word vector.
[0151] Repeat the second and third determination submodules until the first preset stopping condition is met: The second determination submodule is used to determine the first similarity of each pair of clusters; the third determination submodule is used to determine that the two clusters corresponding to the first similarity with the largest value are located in the same cluster.
[0152] In one example, the first similarity is determined based on any one of the following: minimum distance, center distance, average distance, and maximum distance; minimum distance indicates the minimum distance between word vectors in the first cluster of a pair of clusters and word vectors in the second cluster of a pair of clusters; center distance indicates the median distance between word vectors in the first cluster of a pair of clusters and word vectors in the second cluster of a pair of clusters; average distance indicates the average of the sum of the distances between word vectors in the first cluster of a pair of clusters and word vectors in the second cluster of a pair of clusters; and maximum distance indicates the maximum distance between word vectors in the first cluster of a pair of clusters and word vectors in the second cluster of a pair of clusters, wherein a pair of clusters includes the first cluster and the second cluster.
[0153] In one example, the first processing module 6033 includes:
[0154] The fourth determination submodule is used to determine the word vectors corresponding to the words in the initial government tag library and the word vectors corresponding to the mined words as vectors in the initial cluster.
[0155] Repeat the following fifth, sixth, partitioning, seventh, eighth, and ninth determination submodules until the second preset stopping condition is met: The fifth determination submodule is used to determine the second similarity between two word vectors in the initial cluster; the sixth determination submodule is used to determine the two word vectors corresponding to the minimum second similarity value as the first vector and the second vector, respectively; the partitioning submodule is used to divide the initial cluster into a first cluster and a second cluster, wherein the first cluster includes the first vector and the second cluster includes the second vector; the seventh determination submodule is used to determine the third similarity between the remaining vectors in the initial cluster and the first vector, and to determine the fourth similarity between the remaining vectors and the second vector; the eighth determination submodule is used to determine the cluster to which the remaining vectors belong based on the third and fourth similarities; the ninth determination submodule is used to determine the initial cluster based on the first and second clusters.
[0156] In one example, the first processing unit 602 includes:
[0157] The second processing module 6021 is used to perform word segmentation on the text to be processed, and obtain multiple word segmentation results.
[0158] The third determining module 6022 is used to determine the degree of correlation between two adjacent word segmentation results in multiple word segmentation results; wherein, the degree of correlation includes at least one of: cohesion, degree of freedom, and word frequency; cohesion is used to characterize the degree of cohesion between the characters contained in two adjacent word segmentation results; degree of freedom is used to characterize the degree of cohesion that two adjacent word segmentation results can form a word; word frequency is used to indicate the frequency of occurrence of two adjacent word segmentation results in the text to be processed.
[0159] The removal module 6023 is used to remove the two adjacent word segmentation results corresponding to the correlation from multiple word segmentation results if the correlation is determined to be less than a preset value, so as to obtain the mined words.
[0160] In one example, the device also includes:
[0161] The filtering unit 605 is used to perform phrase mining processing on the text to be processed by the first processing unit 602, and after obtaining the mined words, to filter the mined words according to a preset stop word library to obtain the filtered words.
[0162] In one example, the device also includes:
[0163] The classification unit 606 is used to input the mined words into a preset first classification model after the first processing unit 602 performs phrase mining processing on the text to be processed and obtains the mined words, so as to obtain the classification result; the preset first classification model is used to determine whether the input words have government affairs attributes; government affairs attributes are used to indicate attributes that are related to government affairs information.
[0164] Deletion unit 607 is used to delete the mined words if the classification result indicates that the mined words do not have government attributes.
[0165] For example, the apparatus of this embodiment can execute the technical solutions in the above method, and its specific implementation process and technical principles are the same, which will not be repeated here.
[0166] Figure 7 This is a schematic diagram according to the seventh embodiment of this disclosure. (See diagram below.) Figure 7 As shown, the label determination device 700 for government documents according to an embodiment of this disclosure includes:
[0167] The second acquisition unit 701 is used to acquire the text to be labeled.
[0168] The determining unit 702 is used to input the text to be labeled into a preset second classification model to determine the government affairs tags corresponding to the document to be labeled; the preset second classification model is trained based on the training document with government affairs tags; the government affairs tags of the training text are determined based on the updated government affairs tag library.
[0169] Among them, the updated government affairs tag library is based on Figure 5 or Figure 6 The updated government tag library obtained by the apparatus provided in any embodiment includes multiple words, the clusters to which the words belong, and hierarchical relationship information of the words, wherein the hierarchical relationship information represents the hierarchical relationship of the words in the clusters to which the words belong.
[0170] For example, the apparatus of this embodiment can execute the technical solutions in the above method, and its specific implementation process and technical principles are the same, which will not be repeated here.
[0171] Figure 8 This is a schematic diagram according to the eighth embodiment of this disclosure. (See diagram below.) Figure 8 As shown, the label determination device 800 for government documents according to an embodiment of this disclosure includes:
[0172] The second acquisition unit 801 is used to acquire the text to be labeled.
[0173] The determining unit 802 is used to input the text to be labeled into a preset second classification model to determine the government affairs tags corresponding to the document to be labeled; the preset second classification model is trained based on the training document with government affairs tags; the government affairs tags of the training text are determined based on the updated government affairs tag library.
[0174] Among them, the updated government affairs tag library is based on Figure 5 or Figure 6 The updated government tag library obtained by the apparatus provided in any embodiment includes multiple words, the clusters to which the words belong, and hierarchical relationship information of the words, wherein the hierarchical relationship information represents the hierarchical relationship of the words in the clusters to which the words belong.
[0175] In one example, the device further includes a third acquisition unit 803, which is used to acquire the number of texts to be labeled corresponding to the government affairs label in real time if the text to be labeled is a government affairs complaint work order.
[0176] The prompting unit 804 is used to issue a prompt message to the user if it is determined that the number of texts to be annotated is greater than a preset value.
[0177] For example, the apparatus of this embodiment can execute the technical solutions in the above method, and its specific implementation process and technical principles are the same, which will not be repeated here.
[0178] Figure 9 This is a schematic diagram based on the ninth embodiment of the present disclosure, as shown below. Figure 9 As shown, the electronic device 900 in this disclosure may include a processor 901 and a memory 902.
[0179] Memory 902 is used to store programs. Memory 902 may include volatile memory, such as random-access memory (RAM), such as static random-access memory (SRAM), double data rate synchronous dynamic random-access memory (DDR SDRAM), etc.; memory may also include non-volatile memory, such as flash memory. Memory 902 is used to store computer programs (such as application programs, functional modules, etc. that implement the above methods), computer instructions, etc. The computer programs, computer instructions, etc., can be partitioned and stored in one or more memories 902. Furthermore, the computer programs, computer instructions, data, etc., can be accessed by processor 901.
[0180] The aforementioned computer programs and instructions can be stored in one or more partitions of memory 902. Furthermore, the aforementioned computer programs and instructions can be invoked by processor 901.
[0181] The processor 901 is configured to execute the computer program stored in the memory 902 to implement the various steps in the methods described in the above embodiments.
[0182] For details, please refer to the relevant descriptions in the preceding method embodiments.
[0183] The processor 901 and the memory 902 can be independent structures or integrated structures. When the processor 901 and the memory 902 are independent structures, the memory 902 and the processor 901 can be coupled together via bus 903.
[0184] The electronic device in this embodiment can perform the above-described... Figures 1-4 The technical solution described above is the same in terms of its specific implementation process and technical principles, and will not be repeated here.
[0185] According to embodiments of this disclosure, this disclosure also provides an electronic device, a readable storage medium, and a computer program product.
[0186] According to embodiments of this disclosure, this disclosure also provides a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to cause a computer to execute the scheme provided in any of the above embodiments.
[0187] According to embodiments of this disclosure, this disclosure also provides a computer program product comprising: a computer program stored in a readable storage medium, at least one processor of an electronic device being able to read the computer program from the readable storage medium, and the at least one processor executing the computer program causing the electronic device to perform the scheme provided in any of the above embodiments.
[0188] Figure 10 A schematic block diagram of an example electronic device 1000 that can be used to implement embodiments of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present disclosure described and / or claimed herein.
[0189] like Figure 10 As shown, device 1000 includes a computing unit 1001, which can perform various appropriate actions and processes according to a computer program stored in read-only memory (ROM) 1002 or a computer program loaded from storage unit 1008 into random access memory (RAM) 1003. The RAM 1003 may also store various programs and data required for the operation of device 1000. The computing unit 1001, ROM 1002, and RAM 1003 are interconnected via bus 1004. Input / output (I / O) interface 1005 is also connected to bus 1004.
[0190] Multiple components in device 1000 are connected to I / O interface 1005, including: input unit 1006, such as keyboard, mouse, etc.; output unit 1007, such as various types of monitors, speakers, etc.; storage unit 1008, such as disk, optical disk, etc.; and communication unit 1009, such as network card, modem, wireless transceiver, etc. Communication unit 1009 allows device 1000 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0191] The computing unit 1001 can be various general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 1001 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 1001 performs the various methods and processes described above, such as methods for generating a government affairs tag library or methods for determining the tags of government affairs texts. For example, in some embodiments, the methods for generating a government affairs tag library or methods for determining the tags of government affairs texts can be implemented as computer software programs, which are tangibly contained in a machine-readable medium, such as storage unit 1008. In some embodiments, part or all of the computer program can be loaded and / or installed on device 1000 via ROM 1002 and / or communication unit 1009. When the computer program is loaded into RAM 1003 and executed by the computing unit 1001, one or more steps of the methods for generating a government affairs tag library or methods for determining the tags of government affairs texts described above can be performed. Alternatively, in other embodiments, the computing unit 1001 may be configured by any other suitable means (e.g., by means of firmware) to perform a method for generating a government affairs tag library or a method for determining tags for government affairs texts.
[0192] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0193] The program code used to implement the methods of this disclosure may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing apparatus, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0194] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0195] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0196] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as a data server), or computing systems that include middleware components (e.g., an application server), or computing systems that include frontend components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with embodiments of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., a communication network). Examples of communication networks include local area networks (LANs), wide area networks (WANs), and the Internet.
[0197] Computer systems can include clients and servers. Clients and servers are generally geographically separated and typically interact via communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. A server can be a cloud server, also known as a cloud computing server or cloud host, a hosting product within the cloud computing service ecosystem, addressing the shortcomings of traditional physical hosts and VPS (Virtual Private Server, or simply "VPS") services, such as high management difficulty and weak business scalability. Servers can also be servers for distributed systems or servers incorporating blockchain technology.
[0198] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this disclosure can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution disclosed in this disclosure can be achieved, and this is not limited herein.
[0199] The specific embodiments described above do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure should be included within the scope of protection of this disclosure.
Claims
1. A method for generating a government affairs tag library, comprising: The text to be processed is obtained, and phrase mining is performed on the text to obtain mined words; wherein, the probability of the mined words forming a word is greater than a preset threshold; the probability of forming a word represents the probability value of the mined words being a complete word; The mined words are input into a preset first classification model to obtain classification results; the preset first classification model is used to determine whether the input words have government affairs attributes; the government affairs attributes are used to indicate attributes that are related to government affairs information; if the classification results indicate that the mined words do not have government affairs attributes, then the mined words are deleted. If the initial government affairs tag library does not contain the mined words, then hierarchical clustering is performed on the words in the initial government affairs tag library and the mined words to obtain clustering results; wherein, the initial government affairs tag library includes at least one word; the clustering results include: the cluster to which the word belongs and the hierarchical relationship information of the word, wherein the hierarchical relationship information represents the hierarchical relationship of the word in the cluster to which the word belongs; The words, their corresponding clusters, and the hierarchical relationships of the words within the clusters from the clustering results are updated in the initial government affairs tag library to obtain the updated government affairs tag library. The updated government affairs tag library is used to determine the tags corresponding to the text to be labeled and serves as the basis for training the preset second classification model, so that the preset second classification model can predict the tags of the text to be labeled based on the updated government affairs tag library.
2. The method according to claim 1, wherein, If the initial government affairs tag library does not contain the mined words, then hierarchical clustering is performed on the words in the initial government affairs tag library and the mined words to obtain the clustering results, including: If the initial government affairs tag library does not include the mined words, then the word vectors corresponding to the words in the initial government affairs tag library are determined, and the word vectors corresponding to the mined words are also determined; the word vectors are the numerical vectors corresponding to the words. Hierarchical clustering is performed on the word vectors corresponding to the words in the initial government tag library and the word vectors corresponding to the mined words to obtain the clustering results.
3. The method according to claim 2, wherein, Hierarchical clustering is performed on the word vectors corresponding to the words in the initial government tag library and the word vectors corresponding to the mined words to obtain the clustering results, including: Based on the word vectors corresponding to the words in the initial government tag library and the word vectors in the word vectors corresponding to the mined words, multiple clusters are determined, wherein each cluster includes a word vector; Repeat the following steps until the first preset stopping condition is reached: determine the first similarity of each pair of clusters; determine that the two clusters corresponding to the first similarity with the largest value are in the same cluster.
4. The method according to claim 3, wherein, The first similarity is determined based on any one of minimum distance, center distance, average distance, and maximum distance; the minimum distance indicates the minimum distance between word vectors in the first cluster and word vectors in the second cluster of a pair of clusters; the center distance indicates the median distance between word vectors in the first cluster and word vectors in the second cluster of a pair of clusters; the average distance indicates the average of the sum of the distances between word vectors in the first cluster and word vectors in the second cluster of a pair of clusters; the maximum distance indicates the maximum distance between word vectors in the first cluster and word vectors in the second cluster of a pair of clusters, wherein a pair of clusters includes the first cluster and the second cluster.
5. The method according to claim 2, wherein, Hierarchical clustering is performed on the word vectors corresponding to the words in the initial government tag library and the word vectors corresponding to the mined words to obtain the clustering results, including: The word vectors corresponding to the words in the initial government tag library and the word vectors corresponding to the mined words are determined as vectors in the initial cluster; Repeat the following steps until a second preset stopping condition is met: determine the second similarity between two word vectors in the initial cluster; determine the two word vectors corresponding to the minimum second similarity value as the first vector and the second vector, respectively; divide the initial cluster into a first cluster and a second cluster, wherein the first cluster includes the first vector and the second cluster includes the second vector; determine the third similarity between the remaining vector in the initial cluster and the first vector, and determine the fourth similarity between the remaining vector and the second vector; determine the cluster to which the remaining vector belongs based on the third similarity and the fourth similarity; determine the initial cluster based on the first cluster and the second cluster.
6. The method according to any one of claims 1-5, wherein, The text to be processed is subjected to phrase mining to obtain the mined words, including: The text to be processed is segmented into words to obtain multiple segmentation results; The correlation between two adjacent word segmentation results is determined among the multiple word segmentation results; wherein, the correlation includes at least one of: cohesion, degree of freedom, and word frequency; the cohesion is used to characterize the tightness between the characters contained in the two adjacent word segmentation results; the degree of freedom is used to characterize the tightness of the two adjacent word segmentation results forming a word; the word frequency is used to indicate the frequency of the two adjacent word segmentation results appearing in the text to be processed; If the correlation is determined to be less than a preset value, then the two adjacent word segmentation results corresponding to the correlation are removed from the multiple word segmentation results to obtain the mined words.
7. The method according to claim 6, after performing phrase mining processing on the text to be processed to obtain the mined words, further comprising: Based on a preset stop word list, the mined words are filtered to obtain filtered words.
8. A method for identifying labels on government documents, comprising: Get the text to be annotated; The text to be labeled is input into a preset second classification model to determine the government affairs label corresponding to the text to be labeled; The preset second classification model is trained on training texts with government affairs tags; the government affairs tags of the training texts are determined based on the updated government affairs tag library; The updated government affairs tag library is obtained by the method according to any one of claims 1-7; the updated government affairs tag library includes multiple words, the clusters to which the words belong and the hierarchical relationship information of the words, wherein the hierarchical relationship information represents the hierarchical relationship of the words in the clusters to which the words belong.
9. The method according to claim 8, further comprising: If the text to be annotated is a government complaint work order, the number of texts to be annotated corresponding to the government label is obtained in real time. If it is determined that the number of texts to be annotated is greater than a preset value, a prompt message is sent to the user.
10. An apparatus for generating a government affairs tag library, comprising: The first acquisition unit is used to acquire the text to be processed; The first processing unit is used to perform phrase mining processing on the text to be processed to obtain mined words; wherein the probability of the mined words forming a word is greater than a preset threshold; the probability of forming a word represents the probability value of the mined words being a complete word; The classification unit is used to perform phrase mining processing on the text to be processed by the first processing unit to obtain mined words, and then input the mined words into a preset first classification model to obtain classification results; the preset first classification model is used to determine whether the input words have government affairs attributes; the government affairs attributes are used to indicate attributes that are related to government affairs information; The deletion unit is used to delete the mined words if the classification result indicates that the mined words do not have political attributes. The second processing unit is configured to perform hierarchical clustering on the words in the initial government affairs tag library and the mined words if the initial government affairs tag library does not contain the mined words, and obtain a clustering result; wherein the initial government affairs tag library includes at least one word; the clustering result includes: the cluster to which the word belongs and the hierarchical relationship information of the word, wherein the hierarchical relationship information represents the hierarchical relationship of the word in the cluster to which the word belongs; The update unit is used to update the words, the clusters to which the words correspond, and the hierarchical relationship of the words in the clusters to the initial government label library, so as to obtain the updated government label library. The updated government label library is used to determine the label corresponding to the text to be labeled, and serves as the basis for training the preset second classification model, so that the preset second classification model can predict the label of the text to be labeled based on the updated government label library.
11. The apparatus according to claim 10, wherein, The second processing unit includes: The first determining module is used to determine the word vectors corresponding to the words in the initial government affairs tag library if the mined words are not included in the initial government affairs tag library. The second determining module is used to determine the word vectors corresponding to the mined words; the word vectors are numerical vectors corresponding to the words. The first processing module is used to perform hierarchical clustering on the word vectors corresponding to the words in the initial government tag library and the word vectors corresponding to the mined words to obtain clustering results.
12. The apparatus according to claim 11, wherein, The first processing module includes: The first determining submodule is used to determine multiple clusters based on the word vectors corresponding to the words in the initial government tag library and the word vectors in the word vectors corresponding to the mined words, wherein each cluster includes a word vector; Repeat the second and third determination submodules until the first preset stopping condition is met: The second determination submodule is used to determine the first similarity of each pair of clusters; the third determination submodule is used to determine that the two clusters corresponding to the first similarity with the largest value are located in the same cluster.
13. The apparatus according to claim 12, wherein, The first similarity is determined based on any one of minimum distance, center distance, average distance, and maximum distance; the minimum distance indicates the minimum distance between word vectors in the first cluster and word vectors in the second cluster of a pair of clusters; the center distance indicates the median distance between word vectors in the first cluster and word vectors in the second cluster of a pair of clusters; the average distance indicates the average of the sum of the distances between word vectors in the first cluster and word vectors in the second cluster of a pair of clusters; the maximum distance indicates the maximum distance between word vectors in the first cluster and word vectors in the second cluster of a pair of clusters, wherein a pair of clusters includes the first cluster and the second cluster.
14. The apparatus according to claim 11, wherein, The first processing module includes: The fourth determining submodule is used to determine the word vectors corresponding to the words in the initial government affairs tag library and the word vectors corresponding to the mined words as vectors in the initial cluster; Repeat the following fifth, sixth, division, seventh, eighth, and ninth determination submodules until a second preset stopping condition is met: The fifth determination submodule is used to determine the second similarity between two word vectors in the initial cluster; the sixth determination submodule is used to determine that the two word vectors corresponding to the minimum second similarity value are the first vector and the second vector, respectively; the division submodule is used to divide the initial cluster into a first cluster and a second cluster, wherein the first cluster includes the first vector and the second cluster includes the second vector; the seventh determination submodule is used to determine the third similarity between the remaining vectors in the initial cluster and the first vector, and to determine the fourth similarity between the remaining vectors and the second vector; the eighth determination submodule is used to determine the cluster to which the remaining vectors belong based on the third and fourth similarities; the ninth determination submodule is used to determine the initial cluster based on the first and second clusters.
15. The apparatus according to any one of claims 10-14, wherein, The first processing unit includes: The second processing module is used to perform word segmentation on the text to be processed, and obtain multiple word segmentation results; The third determining module is used to determine the correlation degree between two adjacent word segmentation results among the multiple word segmentation results; wherein, the correlation degree includes at least one of: cohesion, degree of freedom, and word frequency; the cohesion degree is used to characterize the tightness between the characters contained in the two adjacent word segmentation results; the degree of freedom is used to characterize the tightness of the two adjacent word segmentation results forming a word; the word frequency is used to indicate the frequency of the two adjacent word segmentation results appearing in the text to be processed; The removal module is used to remove the two adjacent word segmentation results corresponding to the correlation degree from multiple word segmentation results if it is determined that the correlation degree is less than a preset value, so as to obtain the mined words.
16. The apparatus of claim 15, further comprising: The filtering unit is used to filter the mined words according to a preset stop word library after the first processing unit performs phrase mining processing on the text to be processed and obtains the mined words.
17. A labeling device for government documents, comprising: The second acquisition unit is used to acquire the text to be labeled; The determining unit is used to input the text to be labeled into a preset second classification model to determine the government affairs label corresponding to the text to be labeled; the preset second classification model is trained based on the training text with government affairs labels; the government affairs labels of the training text are determined based on the updated government affairs label library; The updated government affairs tag library is obtained by the device according to any one of claims 10-16; the updated government affairs tag library includes multiple words, the clusters to which the words belong and the hierarchical relationship information of the words, wherein the hierarchical relationship information represents the hierarchical relationship of the words in the clusters to which the words belong.
18. The apparatus of claim 17, further comprising: The third acquisition unit is used to acquire the number of texts to be labeled corresponding to the government affairs label in real time if the text to be labeled is a government affairs complaint work order. The prompting unit is used to issue a prompt message to the user if it is determined that the number of texts to be annotated is greater than a preset value.
19. An electronic device comprising: At least one processor; as well as A memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor, which, when executed by the at least one processor, enables the at least one processor to perform the method of any one of claims 1-9.
20. A non-transitory computer-readable storage medium storing computer instructions, wherein, The computer instructions are used to cause the computer to perform the method according to any one of claims 1-9.
21. A computer program product comprising a computer program that, when executed by a processor, implements the steps of the method according to any one of claims 1-9.
Citation Information
Patent Citations
Public opinion topic data clustering method and device, and storage medium
CN110377695A
Vocabulary mining method and device based on artificial intelligence, server and storage medium
CN110457708A
Label generation method, system and device based on semantic similarity model and medium
CN114443850A