Graph optimization method, device, terminal and storage medium
By using neural network filters and collaborative filtering algorithms in the graph construction, the problem of noise and supernatural words in the graph is solved, and the high accuracy and high usage value of the graph are achieved.
Patent Information
- Application Number
- CN201911040792.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-10-29
- Publication Date
- 2024-12-27
- Estimated Expiration
- 2040-01-12
AI Technical Summary
When constructing the graph, the existing technology causes low quality of the graph data and is difficult to use, and lacks effective self-test methods, which easily leads to error diffusion and incomplete hyperwords, reducing the accuracy of the graph. .
A filter based on neural network is used to verify the upper and lower relationships, and a collaborative filtering algorithm and matrix decomposition algorithm are used to expand the relationship. A hierarchical construction and a pruning algorithm based on graph structure are used to remove abnormal nodes to ensure the accuracy of the graph.
Effectively remove noise in the map, improve the accuracy and use value of the map, and ensure the completeness and accuracy of the supernatural word.
Smart Images

Figure CN110795562B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of Internet technology, specifically to the field of computer processing technology, and in particular to a graph optimization method, a graph optimization device, a terminal and a computer storage medium. Background Art
[0002] An entity word is a word that is used to represent a real, specific thing and cannot be further subordinated; an entity word usually has multiple hypernyms, and the so-called hypernym refers to a subject word with a broader conceptual extension; for example, if the entity word is "Persian cat", the hypernyms of the entity word usually include "cat", "feline", "animal", etc. At present, for entity words with multiple hypernyms, the entity word and the corresponding multiple hypernyms are usually used to construct a graph corresponding to the entity word, so that the graph can be used to perform a series of business processes related to the entity word in the future. However, studies have shown that since the hypernyms of entity words are usually obtained from Internet data, there may be some erroneous hypernyms; these erroneous hypernyms easily lead to greater noise in the data in the constructed graph, making the graph difficult to use. Therefore, how to optimize the constructed graph to improve the accuracy of the graph has become a research hotspot. Summary of the invention
[0003] The embodiments of the present invention provide a graph optimization method, device, terminal and computer storage medium, which can effectively remove the noise of the data in the graph and improve the accuracy and use value of the graph.
[0004] On the one hand, an embodiment of the present invention provides a graph optimization method, the graph optimization method comprising:
[0005] Acquire an initial graph of the target entity word, wherein the initial graph includes multiple layers of nodes, wherein the bottom layer nodes store the target entity word, and non-bottom layer nodes store hypernyms of the target entity word, and an edge connecting any two nodes represents a hypernym relationship between the words stored in the two nodes;
[0006] Obtaining node information of at least one non-bottom-level node in the initial graph, wherein the node information of any non-bottom-level node includes: a probability value of a hypernym stored in the non-bottom-level node being located in a node layer where the non-bottom-level node is currently located, or a cluster of hypernyms stored in the non-bottom-level node;
[0007] Performing abnormal node detection on the at least one non-bottom-layer node according to the node information of the at least one non-bottom-layer node;
[0008] If it is detected that there is an abnormal node in the at least one non-bottom-level node, the initial graph is pruned and processed according to the abnormal node to obtain a target graph of the target entity word.
[0009] On the other hand, an embodiment of the present invention provides a graph optimization device, the graph optimization device comprising:
[0010] An acquisition unit is used to acquire an initial graph of a target entity word, wherein the initial graph includes multiple layers of nodes, wherein the bottom layer nodes store the target entity word, and non-bottom layer nodes store hypernyms of the target entity word, and an edge connecting any two nodes represents a hypernym relationship between the words stored in the two nodes;
[0011] The acquisition unit is used to acquire node information of at least one non-bottom-level node in the initial graph, wherein the node information of any non-bottom-level node includes: a probability value of a hypernym stored in the non-bottom-level node being located in a node layer where the non-bottom-level node is currently located, or a cluster of hypernyms stored in the non-bottom-level node;
[0012] A processing unit, configured to perform abnormal node detection on the at least one non-bottom-layer node according to the node information of the at least one non-bottom-layer node;
[0013] The processing unit is used to prune the initial graph according to the abnormal node to obtain the target graph of the target entity word if an abnormal node is detected in the at least one non-bottom-level node.
[0014] In another aspect, an embodiment of the present invention provides a terminal, the terminal including an input device and an output device, the terminal further including:
[0015] a processor adapted to implement one or more instructions; and,
[0016] A computer storage medium storing one or more instructions, wherein the one or more instructions are suitable for being loaded by the processor and executing the following steps:
[0017] Acquire an initial graph of the target entity word, wherein the initial graph includes multiple layers of nodes, wherein the bottom layer nodes store the target entity word, and non-bottom layer nodes store hypernyms of the target entity word, and an edge connecting any two nodes represents a hypernym relationship between the words stored in the two nodes;
[0018] Obtaining node information of at least one non-bottom-level node in the initial graph, wherein the node information of any non-bottom-level node includes: a probability value of a hypernym stored in the non-bottom-level node being located in a node layer where the non-bottom-level node is currently located, or a cluster of hypernyms stored in the non-bottom-level node;
[0019] Performing abnormal node detection on the at least one non-bottom-layer node according to the node information of the at least one non-bottom-layer node;
[0020] If it is detected that there is an abnormal node in the at least one non-bottom-level node, the initial graph is pruned and processed according to the abnormal node to obtain a target graph of the target entity word.
[0021] In another aspect, an embodiment of the present invention provides a computer storage medium, wherein the computer storage medium stores one or more instructions, wherein the one or more instructions are suitable for being loaded by a processor and executing the following steps:
[0022] Acquire an initial graph of the target entity word, wherein the initial graph includes multiple layers of nodes, wherein the bottom layer nodes store the target entity word, and non-bottom layer nodes store hypernyms of the target entity word, and an edge connecting any two nodes represents a hypernym relationship between the words stored in the two nodes;
[0023] Obtaining node information of at least one non-bottom-level node in the initial graph, wherein the node information of any non-bottom-level node includes: a probability value of a hypernym stored in the non-bottom-level node being located in a node layer where the non-bottom-level node is currently located, or a cluster of hypernyms stored in the non-bottom-level node;
[0024] Performing abnormal node detection on the at least one non-bottom-layer node according to the node information of the at least one non-bottom-layer node;
[0025] If it is detected that there is an abnormal node in the at least one non-bottom-level node, the initial graph is pruned and processed according to the abnormal node to obtain a target graph of the target entity word.
[0026] The embodiment of the present invention is directed to an initial graph constructed by using a target entity word and multiple hypernyms. Since the target entity word is stored in the bottom-level nodes of the initial graph, and the hypernyms of the target entity word are stored in the non-bottom-level nodes, the node information of at least one non-bottom-level node in the initial graph can be obtained first, and then abnormal node detection can be performed on at least one non-bottom-level node based on the node information of the at least one non-bottom-level node. If an abnormal node is detected in at least one non-bottom-level node, the initial graph can be pruned and post-processed based on the abnormal node; by using the structural characteristics of the initial graph to perform pruning and post-processing, the wrong hypernyms (i.e., the hypernyms stored in the abnormal nodes) and the wrong hypernym relationships in the initial graph can be effectively removed, thereby ensuring that the target graph obtained by pruning and post-processing has high accuracy and use value. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying any creative work.
[0028] Figure 1a is a schematic diagram of a graph optimization solution provided by an embodiment of the present invention;
[0029] Figure 1b is a schematic diagram of the structure of a filter provided by an embodiment of the present invention;
[0030] Figure 1c is a schematic diagram of a spectrum provided by an embodiment of the present invention;
[0031] Figure 2 It is a flow chart of a graph optimization method provided by an embodiment of the present invention;
[0032] Figure 3 is a schematic diagram of post-pruning processing provided by an embodiment of the present invention;
[0033] Figure 4 is a flow chart of a graph optimization method provided by another embodiment of the present invention;
[0034] Figure 5a It is a schematic diagram of the principle of a matrix decomposition algorithm provided by an embodiment of the present invention;
[0035] Figure 5b It is a schematic diagram of marking items on a graph provided by an embodiment of the present invention;
[0036] Figure 5c It is an application scenario diagram of a hierarchical relationship graph provided by an embodiment of the present invention;
[0037] Figure 6a It is a schematic diagram of test results of a solution test provided by an embodiment of the present invention;
[0038] Figure 6b is a schematic diagram of test results of a solution test provided by another embodiment of the present invention;
[0039] Figure 6c is a schematic diagram of test results of a solution test provided by another embodiment of the present invention;
[0040] Figure 7 It is a structural schematic diagram of a graph optimization device provided by an embodiment of the present invention;
[0041] Figure 8 It is a schematic diagram of the structure of a terminal provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0042] The technical solutions in the embodiments of the present invention will be described clearly and completely below in conjunction with the accompanying drawings in the embodiments of the present invention.
[0043] A graph is a mesh data structure composed of multiple connected nodes; each node can store a word (such as an entity word, hypernym, etc.). The related technology of the embodiments of the present invention mentions that when constructing a graph of a target entity word, it is usually necessary to first obtain a large number of hypernyms of the target entity word from the Internet, and then use the large number of hypernyms and the target entity word to directly construct the graph of the target entity word. The inventors have found in practice that the existing graph construction method has the following problems ①-③:
[0044] ① The data obtained from the Internet has a large amount of noise, which can easily lead to a low accuracy rate of the hypernyms obtained; and for the wrong hypernyms, there is a lack of effective self-checking methods, which can easily lead to error diffusion phenomenon; the so-called error diffusion phenomenon means that other hypernyms obtained based on the wrong hypernym and connected to the wrong hypernym are also wrong, which leads to the entire path where the wrong hypernym is located being wrong. For example, the target entity word is "intelligent robot", if the wrong hypernym of the target entity word obtained from the Internet is "use value", then the hypernym "value" obtained based on the wrong hypernym must also be wrong, so the path "intelligent robot→use value→value" is an incorrect path. It can be seen that incorrect hypernyms can easily lead to a large amount of noise in the data in the constructed graph, making the graph difficult to use.
[0045] ② As there are many websites and web pages on the Internet, it is usually impossible to search all the websites; therefore, some hypernyms will inevitably be missed, resulting in incomplete hypernyms in the graph, reducing the accuracy of the graph. For example, if only "Persian cat → animal" is searched on the Internet, the hypernym relationship "Persian cat → feline animal" will be missed, resulting in the absence of the hypernym "feline animal" in the graph.
[0046] ③ If the target entity word has multiple meanings, there is not enough support for the polysemy of the target entity word, and the hypernyms of each meaning are mixed together; where the meaning refers to the narrative content of each thing with different conceptual meanings; for example, let the target entity word be "Persian cat", because "Persian cat" can refer to the title of a song, the type of animal, the brand of a telescope, or the name of a cocktail; then the target entity word has multiple meanings: mammals, telescope brands, cocktails with the same name, songs, etc. If the hypernyms of multiple meanings are mixed together, for application scenarios such as content understanding and intent recognition that require the use of a graph of hypernyms, it will be impossible to identify which meaning the user really wants; it can be seen that this will make it difficult to use the graph of the target entity word in actual use.
[0047] In order to solve the above problems, the embodiment of the present invention proposes a method as follows Figure 1a The graph optimization scheme shown in the figure can be applied in a terminal, where the terminal may include any of the following: a smart phone, a tablet computer, a laptop computer, a desktop computer, etc. Figure 1a As shown, the graph optimization solution proposed in the embodiment of the present invention mainly includes the following five improvements:
[0048] (1) Adding a filter based on a neural network: The embodiment of the present invention adds a neural network model based on an autoencoder as a filter; Figure 1b As shown: the filter may include an autoencoder and a classifier. The autoencoder is a neural network that can copy input to output after being trained by machine learning. It has a hidden layer h inside that can generate a code to represent the input; the network can be composed of the following two parts: an encoder represented by a function h = f(x) and a decoder r = g(h) that generates reconstruction.
[0049] After mining multiple candidate word pairs about the target entity word by using sentence template matching, the filter can be called to verify the hypernymy relationship of the multiple candidate word pairs. Specifically, a pair of candidate word pairs and their corresponding pre-trained word vectors can be input into the filter. The autoencoder in the filter is responsible for obtaining the semantic features of the candidate word pairs and predicting the relationship vector between the candidate word pairs based on the semantic features; then, a subsequent classifier is used to determine whether the predicted relationship vector obtained by the filter is a correct hypernymy relationship, thereby filtering out candidate word pairs with incorrect hypernymy relationships. It can be seen that the filter added in the embodiment of the present invention can effectively filter out incorrect hypernyms obtained from the Internet, thereby effectively reducing a large amount of data noise and ensuring the correctness of the graph.
[0050] (2) Relationship pair expansion: New hyponym and hyponym pairs are predicted based on the mined target entity word pairs, and the new hyponym and hyponym pairs are scored by introducing the recommendation system's CF algorithm (Collaborative Filtering) and MF algorithm (Matrix Factorization) to obtain expanded word pairs (i.e., relationship pairs), which effectively supplements the relationship pairs (word pairs); the hypernyms included in the graph are more complete, which can effectively improve the accuracy of the graph. In addition, by improving the CF algorithm and assisting the MF algorithm, the accuracy of relationship pair expansion can also be effectively improved.
[0051] (3) Hierarchical graph construction: Using the frequent item mining algorithm, a large number of accurate relationships between hypernyms are mined from a large number of word pairs with hyponymy, thereby constructing a hierarchical graph; the bottom nodes of the graph store the target entity words, and the non-bottom nodes store the hypernyms of the target entity words, such as Figure 1c In addition, for a target entity word with multiple meanings, the hypernyms corresponding to each meaning can be separated and hierarchicalized to obtain an initial graph of multiple meanings.
[0052] (4) Graph pruning post-processing: Two pruning algorithms based on graph structure (such as the contradictory edge pruning algorithm and the statistical Bayesian probability pruning algorithm) are proposed, and the pruning post-processing of each initial graph is realized by using these two pruning algorithms. Among them, the principle of the contradictory pruning algorithm is: obtain the clusters of hypernyms stored in each non-bottom-level node and determine the reference node, and remove the paths of non-bottom-level nodes where the clusters and the clusters corresponding to the reference nodes do not belong to the same clustering cluster as contradictory edges from the graph; the cluster here refers to the category of words obtained by clustering words. The principle of the statistical Bayesian probability pruning algorithm is: calculate the probability value that the hypernyms stored in each non-bottom-level node (such as isolated nodes, top nodes of each path) are located in the node layer where the non-bottom-level node is currently located, and remove the paths of non-bottom-level nodes corresponding to the probability values less than the preset probability threshold from the graph.
[0053] An isolated node refers to a node that appears in the first layer (i.e., the node layer adjacent to the bottom layer) and has no connection with any node in the second layer. The top node of any path refers to the last node in the path. Figure 1cAs shown, non-bottom-level node a appears in the first layer and has no connection with any node in the second layer, so non-bottom-level node a is an isolated node; non-bottom-level node b is the last node of path 1, so non-bottom-level node b is the top node in path 1. For ease of explanation, isolated nodes and top nodes are referred to as end nodes (i.e., the last node in the path) in the following; when the path includes only two nodes (i.e., a bottom-level node and one non-bottom-level node), the end node is the isolated node mentioned above; when the path includes only at least three nodes (i.e., a bottom-level node and at least two non-bottom-level nodes), the end node is the top node in the path mentioned above. By utilizing the characteristics of the graph structure for post-pruning processing, a large amount of data noise (such as incorrect hypernyms and incorrect hyponymy in the initial graph) can be further effectively removed, thereby ensuring that the graph obtained by post-pruning processing has a high accuracy.
[0054] (5) Graph-based term marking: For target entity words with multiple meanings, the graphs after pruning can be merged to obtain the final hyponymy graph. The term is determined by calculating the priority of each meaning, so that the graph corresponding to the term is marked in the final hyponymy graph; this can effectively improve the use value of the graph in practical applications.
[0055] Based on the description of the above graph optimization solution, an embodiment of the present invention proposes a graph optimization method, which can be executed by the above-mentioned terminal. Figure 2 The graph optimization method may specifically include the following steps S201-S204:
[0056] S201, obtaining an initial graph of the target entity word.
[0057] The target entity word here can be any entity word, and the initial spectrum of the target entity word can be obtained by hierarchically constructing multiple word pairs including the target entity word; wherein each word pair can be composed of the target entity word and a hypernym of the target entity word. The initial spectrum of the target entity word can include multiple layers of nodes; and the lower the number of layers, the more detailed the hypernym, such as "popular songs in China in the 1960s"; on the contrary, the higher the number of layers, the more generalized the hypernym, such as "songs" and "movies".
[0058] Among them, the bottom-level nodes of the initial graph store the target entity words, and the non-bottom-level nodes store the hypernyms of the target entity words. The edge connecting any two nodes represents the hypernym relationship between the words stored in any two nodes, and the edges connecting any two nodes are directed edges (i.e., directional edges); and the node pointed to by the directed edge in any two nodes is the hypernym node, and the other node is the hyponym node, that is, the directed edge connected to any node in any node layer can point to the hypernym node of the node. Among them, hypernyms refer to subject terms with broader conceptual extensions, and hyponyms refer to subject terms with narrower conceptual connotations; so-called subject terms, also known as descriptors, are artificial languages used to express topics in indexing and retrieval, and have the characteristics of conceptualization and standardization. For example, see Figure 1c In the graph shown, the directed edge A connects the non-bottom-level node c and the non-bottom-level node d. The directed edge A can indicate that the hypernym "robot" stored in the non-bottom-level node c and the hypernym "technology product" stored in the non-bottom-level node d have a hierarchical relationship. Specifically, the hierarchical relationship is: "technology product" is the hypernym of "robot", and "robot" is the hyponym of "technology product"; correspondingly, among these two non-bottom-level nodes, the non-bottom-level node c is a hyponym node, and the non-bottom-level node d is a hypernym node.
[0059] S202, obtaining node information of at least one non-bottom-level node in the initial graph.
[0060] Research has shown that if there are erroneous hypernyms in the initial graph, the node storing the erroneous hypernyms can be considered as an abnormal node. Since the embodiment of the present invention uses non-bottom-level nodes to store the hypernyms of the target entity words, the embodiment of the present invention can detect whether each non-bottom-level node used to store each hypernym of the target entity word is an abnormal node, thereby detecting whether there are erroneous hypernyms in the initial graph. Since the node information of abnormal nodes is usually problematic, the embodiment of the present invention can obtain the node information of at least one non-bottom-level node in the initial graph after obtaining the initial graph, so that the abnormal node detection of at least one non-bottom-level node in the initial graph can be implemented according to the node information of each non-bottom-level node. Since the acquisition of the node information of the non-bottom-level node is a crucial factor affecting the accuracy of the subsequent abnormal node detection, in order to make the node information of each non-bottom-level node obtained have a higher role value for the subsequent abnormal node detection; the embodiment of the present invention has studied a large number of erroneous hypernyms and corresponding abnormal nodes, and determined how to obtain the node information of each non-bottom-level node based on the research results; the details are as follows:
[0061] In a specific implementation, research has shown that: the target entity word usually has multiple hypernyms. If these multiple hypernyms contradict each other, then there must be an erroneous hypernym among these multiple hypernyms. For example, for the same meaning of the target entity word, two hypernyms, "movies in the 1960s" and "songs in the 1960s", may be obtained. Since the clusters of these two hypernyms are different, the cluster of "movies in the 1960s" is movies, and the cluster of "songs in the 1960s" is songs, these two hypernyms are contradictory; then it can be determined that there must be an erroneous hypernym among the two hypernyms, that is, there must be an abnormal node in the non-bottom-level nodes storing these two hypernyms. It can be seen from this that abnormal nodes can be detected based on the clusters of hypernyms stored in each non-bottom-level node; based on this, the embodiment of the present invention can obtain the clusters of hypernyms stored in each non-bottom-level node as the node information of each non-bottom-level node.
[0062] In another specific implementation, research has shown that if there are erroneous hypernyms in the initial graph, these erroneous hypernyms may include the following two categories: ① the first type of erroneous hypernyms whose hypernyms can no longer be obtained, and ② the second type of erroneous hypernyms whose hypernyms can be obtained. For the first type of erroneous hypernyms, since the first type of erroneous hypernyms (especially meaningless words introduced by noise) cannot obtain their hypernyms, the first type of erroneous hypernyms are stored in isolated nodes of the initial graph. And since the hypernyms stored in normal isolated nodes must be within the range of common subject words, and the hypernyms stored in erroneous isolated nodes must be low-frequency for a large amount of data; therefore, it can be determined that the probability of the first type of erroneous hypernyms appearing in isolated nodes is usually relatively low. Based on this, the probability of the hypernyms stored in the isolated node appearing in the first layer can be used to detect whether the isolated node is an abnormal node.
[0063] For the second type of wrong hypernyms, since the hypernyms stored in the last node (top node) of each path of the graph are mostly subject words, such as "entertainment", "character", etc.; the subject words stored in the top layer of each path should be relatively fixed (within the range of common subject words) and lack diversity. If there are second type of wrong hypernyms, since they will inevitably deduce wrong subject words on their own paths, such as the entity word "intelligent robot" gets the wrong hypernym "use value", and the wrong hypernym gets its hypernym "value" as the subject word at the top layer; and the probability of these wrong subject words appearing in the top nodes of each path of the graph is usually low. Therefore, the probability of the hypernym (i.e., subject word) stored in the top nodes of each path appearing in the top layer can be used to detect whether the top node is an abnormal node. In summary, the embodiment of the present invention can obtain the probability value of the hypernym stored in each non-bottom node being located in the node layer where the non-bottom node is currently located as the node information of each non-bottom node. Further, the non-bottom nodes here can specifically include the end nodes in each path in the initial graph.
[0064] S203: Perform abnormal node detection on at least one non-bottom-layer node according to node information of at least one non-bottom-layer node.
[0065] S204: If an abnormal node is detected in at least one non-bottom-level node, the initial graph is pruned and processed according to the abnormal node to obtain a target graph of the target entity word.
[0066] In steps S203-S204, since the node information of any non-bottom-level node may include: the probability value of the hypernym stored in the non-bottom-level node being located in the node layer where the non-bottom-level node is currently located, or the cluster of hypernyms stored in the non-bottom-level node; wherein the cluster corresponding to the non-bottom-level node is obtained by clustering the hypernyms in multiple word pairs in the word pair database. Therefore, at least one non-bottom-level node may be detected for abnormal nodes according to the clusters or probability values corresponding to each non-bottom-level node; and after the abnormal node is detected, the above-mentioned contradictory edge pruning algorithm or the statistical Bayesian probability pruning algorithm is used to perform post-pruning processing on the initial graph, and the post-pruning processing here refers to: the process of pruning the path where the abnormal node is located in the initial graph from the initial graph.
[0067] In one embodiment, if the node information of any non-bottom-level node includes: the cluster of hypernyms stored by the non-bottom-level node, then the specific implementation of abnormal node detection for at least one non-bottom-level node according to the node information of at least one non-bottom-level node may be: first determine a reference node from at least one non-bottom-level node according to the reliability of the hypernyms stored by each non-bottom-level node, and use the cluster corresponding to the reference node as the reference cluster; or use the cluster corresponding to the upper node of the reference node as the reference cluster. Among them, the hypernym reliability is used to reflect the degree of reliability of the hypernym, and the reliability of each hypernym can be determined according to the data source of each hypernym; for example, the reliability of the hypernym whose data source is the disambiguation item in Baidu Encyclopedia is higher than the reliability of the hypernym whose data source is the entry label in Baidu Encyclopedia. Alternatively, the reliability of each hypernym can also be determined according to the number of times each hypernym appears in Internet data, and the number is proportional to the reliability; that is, the more times, the higher the reliability, and the smaller the number, the lower the reliability. The embodiment of the present invention can select non-bottom-level nodes corresponding to one or more hypernyms with the highest reliability as reference nodes, thereby determining a reference cluster. After determining the reference cluster, an abnormal node can be screened out from at least one non-bottom-level node according to the clusters corresponding to each non-bottom-level node and the reference cluster; the cluster corresponding to the abnormal node is different from the reference cluster. For example, see Figure 3 As shown in Figure a, the non-bottom node m is an error node. Since the cluster corresponding to the inferred upper node n and the cluster corresponding to the reference node (REF node) are not in the same cluster, the path where the non-bottom node m and the non-bottom node n are located will be removed as a contradictory edge. It can be seen that the contradictory edge pruning algorithm can effectively remove a large amount of noise data (i.e., incorrect hypernyms) introduced by the entry tags in the encyclopedia website.
[0068] In another embodiment, if the non-bottom-level nodes include: the end nodes in each path in the initial graph; the node information of the non-bottom-level nodes includes: the probability value of the hypernym stored in the end node being located in the node layer where the end node is currently located; then the specific implementation method of performing abnormal node detection on at least one non-bottom-level node based on the node information of at least one non-bottom-level node may be: determining the end node corresponding to a probability value greater than a probability threshold as an abnormal node. For example, see Figure 3 As shown in Figure b in , the non-bottom-level node z is an isolated node (i.e., the last node); since the probability value of the hypernym stored in the non-bottom-level node z being located in the first level is less than the probability threshold, the non-bottom-level node z is an abnormal node, and the path it is located in will be removed from the graph. For another example, see Figure 3As shown in Figure c in , the hypernym stored in the non-bottom-level node x is an incorrect hypernym, and another incorrect hypernym stored in the non-bottom-level node y is inferred based on the incorrect hypernym (i.e., error diffusion phenomenon); that is, the abnormal node y is inferred based on the abnormal node x. Since the probability value of the hypernym stored in the non-bottom-level node y being located in the current node layer (i.e., the top layer) is less than the probability threshold, the non-bottom-level node y is an abnormal node, and the path it is located in will be removed from the graph.
[0069] The embodiment of the present invention is directed to an initial graph constructed by using a target entity word and multiple hypernyms. Since the target entity word is stored in the bottom-level nodes of the initial graph, and the hypernyms of the target entity word are stored in the non-bottom-level nodes, the node information of at least one non-bottom-level node in the initial graph can be obtained first, and then abnormal node detection can be performed on at least one non-bottom-level node based on the node information of the at least one non-bottom-level node. If an abnormal node is detected in at least one non-bottom-level node, the initial graph can be pruned and post-processed based on the abnormal node; by using the structural characteristics of the initial graph to perform pruning and post-processing, the wrong hypernyms (i.e., the hypernyms stored in the abnormal nodes) and the wrong hypernym relationships in the initial graph can be effectively removed, thereby ensuring that the target graph obtained by pruning and post-processing has high accuracy and use value.
[0070] See also Figure 4 , is a flow chart of another graph optimization method provided by an embodiment of the present invention. The method can be executed by the terminal mentioned above. Figure 4 , the graph optimization method may include the following steps S401-S406:
[0071] S401, obtaining a target data set about a target entity word.
[0072] The target data set here may include multiple word pairs, each of which is composed of a target entity word and a hypernym of the target entity word. The embodiment of the present invention provides at least the following two implementation methods for obtaining the target data set:
[0073] The first implementation method: First, a text data set may be obtained, which includes multiple texts about the target entity word. Secondly, at least one candidate word pair may be extracted from multiple texts in the text data set based on a preset sentence template, and each candidate word pair is composed of a target entity word and a hypernym of the target entity word. Specifically, the sentence template may be set according to actual needs or experience values, for example, the sentence template may be set to "A is a kind of B" or "A belongs to B"; wherein A represents the target entity word, and B represents the hypernym of the target entity word. Then, the word corresponding to B may be extracted from each text as a hypernym, thereby forming a candidate word pair; for example, if the target entity word is "Persian cat" and the text is "Persian cat is an animal", the word "animal" corresponding to B may be extracted from the text as a hypernym, thereby forming a candidate word pair "Persian cat→animal". Since the hypernyms obtained by sentence template matching only consider grammatical features and ignore semantic connections, and the text dataset may contain erroneous texts, which may cause the matched hypernyms to be erroneous hypernyms. For example, if the text is "Persian cat is a plant", the hypernym obtained by sentence template matching is "plant", but it is obviously an erroneous hypernym. Therefore, after obtaining candidate word pairs based on the preset sentence template, at least one candidate word pair can be filtered according to the semantic relationship between the hypernym in at least one candidate word pair and the target entity word; and then the filtered word pairs are added to the target dataset of the target entity word.
[0074] Among them, according to the semantic relationship between the hypernym in at least one candidate word pair and the target entity word, the specific implementation method of filtering at least one candidate word pair can be: for any candidate word pair, obtain the hypernym vector of the hypernym in any candidate word pair, and the entity word vector of the target entity word; wherein the word vector can be used to represent the semantic features of the word, the hypernym vector can be represented as y, and the entity word vector can be represented as x. Secondly, the actual relationship vector of any candidate word pair can be calculated based on the hypernym vector and the entity word vector. The specific calculation method can be shown in the following formula 1.1:
[0075] r=yx Formula 1.1
[0076] In addition to calculating the actual relationship vector, the autoencoder can also be called to predict the predicted relationship vector r' of any candidate word pair based on the hypernym and target entity word in any candidate word pair. Then, the hypernym relationship between the hypernym and the target entity word in any candidate word pair can be verified based on the actual relationship vector and the predicted relationship vector; specifically, the classifier can be called to calculate the difference between the actual relationship vector and the predicted relationship vector. If the difference is less than the preset difference, it can be considered that the verification is successful, otherwise the verification fails. If the verification is successful, it indicates that the hypernym relationship of any candidate word pair is correct, so any candidate word pair can be retained; otherwise, any candidate word pair is filtered out. It can be seen that the embodiment of the present invention can well verify the sentence matching results (i.e., candidate word pairs) containing a large amount of noise, so that it can achieve both full use of a large amount of text as a data source and a high accuracy rate.
[0077] The second implementation method: first obtain structured data about the target entity word from the Internet, where the structured data refers to data containing the entry tag of the target entity word; the terminal can obtain the structured data of the target entity word from an encyclopedia website such as Baidu Encyclopedia or an information box. Secondly, a structured word pair containing the target entity word can be extracted from the structured data, and each structured word pair is composed of the target entity word and the hypernym of the target entity word; specifically, the word indicated by the entry tag included in the structured data can be used as the hypernym of the target entity word, thereby obtaining a structured word pair. For example, the target entity word is "Persian cat", and the entry tag of the target entity word includes "animal" and "biological species", then the structured word pairs obtained are "Persian cat→animal" and "Persian cat→biological species". Then, the obtained structured word pairs can be filtered based on the filtering rules, and the filtered structured word pairs are added to the target data set of the target entity word; wherein the filtering rules may include: if the number of times the structured word pair appears on the Internet is greater than the preset number of times, then the structured word pair is retained; otherwise, the structured word pair is filtered out.
[0078] Optionally, due to the large number of website pages involved in the Internet, it is usually impossible to search all structured data and all texts containing the target entity word; therefore, this will inevitably miss some hypernyms and hyponyms, resulting in the hypernyms contained in the graph being incomplete. Based on this, the embodiment of the present invention can also perform word pair expansion on the target entity word based on the existing word pairs in the word pair database (i.e., the aforementioned relationship pair expansion). Among them, the existing word pairs in the word pair database refer to word pairs with hypernyms and hyponyms obtained through historical mining, and each existing word pair consists of a hypernym and a hyponym; the specific implementation method of performing word pair expansion on the target entity word based on the existing word pairs can include the following steps s11-s14:
[0079] s11, performing hypernym prediction processing on the target entity word according to the word pairs stored in the word pair database to obtain at least one predicted hypernym of the target entity word.
[0080] In the specific implementation process, the historical superordinate words of the existing target entity word can be extracted from each word pair in the word pair database according to the target entity word; secondly, the matching word pairs containing the historical superordinate words can be matched from the word pairs stored in the word pair database according to the historical superordinate words; then, another word in the matching word pair other than the historical superordinate word (the hypernym or hyponym of the historical superordinate word) can be used as the predicted superordinate word of the target entity word.
[0081] For example, if the target entity word is "Persian cat", and the word pair database includes the word pair "Persian cat→animal", then the historical superordinate word "animal" can be extracted; if the matching word pair "feline animals→animal" is obtained from the word pair database based on the historical superordinate word, then the other word "feline animals" (i.e., the hyponym of the historical superordinate word) in the matching word pair other than the historical superordinate word can be used as the predicted hypernym of the target entity word. For another example, if the target entity word is "intelligent robot", and the word pair database includes the word pair "Western world→science fiction drama", then the historical superordinate word "science fiction drama" can be extracted; if the matching word pair "science fiction drama→TV series" is obtained from the word pair database based on the historical superordinate word, then the other word "TV series" (i.e., the hypernym of the historical superordinate word) in the matching word pair other than the historical superordinate word can be used as the predicted hypernym of the target entity word.
[0082] s12, using each predicted hypernym and target entity word to form at least one predicted word pair, and scoring each predicted word pair.
[0083] After obtaining at least one predicted hypernym, each predicted hypernym and the target entity word may be used to form at least one predicted word pair. For example, if the target entity word is "Persian cat", it has two predicted hypernyms: "feline" and "pet", and the predicted word pairs include: "Persian cat→feline" and "Persian cat→pet". After obtaining at least one predicted word pair, each predicted word pair may be scored in any of the following ways:
[0084] ①Only use the improved CF algorithm to score each predicted word pair.
[0085] Research has shown that the calculation formula of the existing CF algorithm (as shown in Formula 1.2) is prone to the problem of low-frequency word diffusion in terms of numerical values; this will result in the prediction word pairs containing low-frequency hypernyms (i.e., low-frequency words) having higher scores when using Formula 1.2 to score each predicted word, thereby mistakenly using these predicted word pairs containing low-frequency hypernyms as expanded word pairs of the target entity word, introducing a large number of erroneous word pairs, and causing the subsequent constructed graph to have greater noise. Therefore, the embodiment of the present invention improves the existing CF algorithm, and the improved calculation formula can be seen in Formula 1.3:
[0086]
[0087] P u,i '=P(y i )tanh∑ items,N S i,N *R u,N Formula 1.3
[0088] Among them, P u,i ' represents the score obtained by the scoring process; S i,N Represents the predicted hypernym y of the target entity word i and the historical superordinate words y of the target entity word that already exist in the target dataset N The similarity between u,N Represents the target entity word u and the historical superordinate word y N The correlation between them; tanh represents the hyperbolic tangent function; P(y i ) indicates the predicted hypernym y i The frequency coefficient of the hypernym in the word pairs stored in the word pair database. For example, the number of word pairs stored in the word pair database is 1000, and the predicted hypernym y i As a hypernym, it only appears in 20 word pairs stored in the word pair database, that is, only the hypernyms of 20 word pairs in the word pair database are the predicted hypernym y i , then the frequency coefficient of the predicted hypernym yi is: 20 / 1000=0.02. By comparing the above formula 1.2 and formula 1.3, it can be seen that the embodiment of the present invention can effectively avoid the problem of low word frequency diffusion by introducing the frequency coefficient, greatly improve the accuracy of the CF algorithm in scoring each predicted word pair, and greatly improve the accuracy of the CF algorithm in expanding the hyponym and hyponym pairs.
[0089] Specifically, when the formula shown in the above formula 1.3 is used to score each predicted word pair, for any predicted word pair, the frequency coefficient of the predicted hypernym in any predicted word pair as the hypernym in the word pair stored in the word pair database can be calculated first. Secondly, the historical hypernym of the target entity word that already exists in the target data set can be obtained. Then, the correlation between the target entity word and each historical hypernym, as well as the similarity between the predicted hypernym in any predicted word pair and each historical hypernym can be calculated. Finally, the first score of any predicted word pair can be determined based on the frequency coefficient of the predicted hypernym in any predicted word pair, the calculated correlation, and the calculated similarity.
[0090] ② Only use the MF algorithm to score each predicted word pair.
[0091] The specific principle of MF algorithm (matrix decomposition algorithm) can be found in Figure 5a As shown; specifically, for any predicted word pair, the MF algorithm can be first used to solve and obtain the representation vector of the target entity word; then the representation vector of the target entity word and the hypernym vector of the predicted hypernym in any predicted word pair are inner-producted to obtain the second score of any predicted word pair.
[0092] Among them, the specific implementation method of using the MF algorithm to solve and obtain the representation vector of the target entity word is as follows: first, a scoring matrix and a hypernym representation matrix can be obtained; wherein, the scoring matrix is calculated based on the word pairs stored in the word pair database, and it may specifically include the correlation r(u, i) between any entity word and any hypernym in the word pair database; and if hypernym i has appeared as a hypernym of entity word u in the word pair database, then the correlation between hypernym i and entity word u is higher than the correlation corresponding to other hypernyms that have not appeared as hypernyms of entity word u; the hypernym representation matrix may include the hypernym vectors of each hypernym in the word pair database. Secondly, the entity word representation vector matrix can be calculated based on the scoring matrix and the hypernym representation matrix, and the entity word representation vector matrix includes the representation vectors of each entity word in the word pair database; then, the target entity word x can be found from the entity word representation vector matrix. u The representation vector of .
[0093] ③ Use the improved CF algorithm and MF algorithm to score each predicted word pair.
[0094] Since the MF algorithm takes into account the differences between different entity words when considering the similarity between hypernyms, the MF algorithm is more refined than the CF algorithm in considering the similarity; therefore, the improved CF algorithm and the MF algorithm can also be combined to score each predicted word pair, so that the score of each predicted word pair is more accurate. In one embodiment, the improved CF algorithm and the MF algorithm can be used to score each predicted word pair, respectively, to obtain the first score and the second score of each predicted word pair; the first score and the second score of each predicted word pair are added to the score of each predicted word pair. That is, under this embodiment, the score of each predicted word pair may include the first score and the second score.
[0095] In another embodiment, the improved CF algorithm and the MF algorithm may be used to score each predicted word pair to obtain a first score and a second score for each predicted word pair; then, the weight value of the improved CF algorithm and the weight value of the MF algorithm are used to perform a weighted sum of the first score and the second score for each predicted word pair to obtain the score for each predicted word pair. That is, in this embodiment, the score for each predicted word pair is obtained by weighted summing the first score and the second score. Among them, the weight value of the improved CF algorithm and the weight value of the MF algorithm can be set according to experience or actual needs; for example, the weight value of the improved CF algorithm and the weight value of the MF algorithm can both be set to 0.5; for another example, if the actual need is to avoid the problem of low-frequency word diffusion, the weight value of the improved CF algorithm can be set greater than the weight value of the MF algorithm, such as the weight value of the improved CF algorithm can be set to 0.7, and the weight value of the MF algorithm can be set to 0.3; for another example, if the actual need is to improve the accuracy of similarity, the weight value of the MF algorithm can be set greater than the weight value of the improved CF algorithm, such as the weight value of the improved CF algorithm can be set to 0.3, and the weight value of the MF algorithm can be set to 0.7, and so on.
[0096] s13, selecting an expanded word pair from at least one predicted word pair according to the score of each predicted word pair, and adding the selected expanded word pair to the target data set.
[0097] After obtaining the scores of each predicted word pair, an expanded word pair may be selected from at least one predicted word pair according to the scores of each predicted word pair, and the selected expanded word pair may be added to the target data set. The selection of the expanded word pair may include the following selection methods:
[0098] If the above-mentioned method ① is used for scoring, the score of each predicted word pair includes a first score. Then, when selecting an expanded word pair from at least one predicted word pair according to the score of each predicted word pair, a predicted word pair with a first score greater than a preset score can be selected from at least one predicted word pair as an expanded word pair; or a predicted word pair with the highest first score can be selected from at least one predicted word pair as an expanded word pair; or a word pair to be expanded can be selected from at least one predicted word pair according to the first score of each predicted word pair, and then each word pair to be expanded can be scored twice using the MF algorithm, thereby selecting the expanded word pair. Specifically, at least one word pair to be expanded can be selected from each predicted word pair according to the first score of each predicted word pair, and the first score of the word pair to be expanded can be greater than a first preset value; then, a matrix decomposition algorithm (i.e., MF algorithm) is used to score each word pair to be expanded to obtain a second score of each word pair to be expanded; then, an expanded word pair is selected from at least one word pair to be expanded according to the second score of each word pair to be expanded, and the second score of the expanded word pair is greater than a second preset value. Among them, the first preset value and the second preset value can be set according to actual needs or experience values, and the two can be the same or different.
[0099] If the above method ② is used for scoring, the score of each predicted word pair includes the second score. Then, when selecting an expanded word pair from at least one predicted word pair according to the scores of each predicted word pair, the predicted word pair with a second score greater than the preset score can be selected from at least one predicted word pair as the expanded word pair; the predicted word pair with the highest second score can also be selected from at least one predicted word pair as the expanded word pair; or the word pair to be expanded can be selected from at least one predicted word pair according to the second score of each predicted word pair, and then the improved MF algorithm is used to perform secondary scoring on each word pair to be expanded, thereby selecting the expanded word pair.
[0100] If the above method ③ is used for scoring, the score of each predicted word pair may include the first score and the second score, or the score obtained by weighted summing the first score and the second score. If the score of each predicted word pair includes the first score and the second score, when selecting an expanded word pair from at least one predicted word pair according to the score of each predicted word pair, the first predicted word pair may be selected from at least one predicted word pair according to the first score of each predicted word pair, and the second predicted word pair may be selected from at least one predicted word pair according to the second score of each predicted word pair; the first predicted word pair includes: the predicted word pair with the largest first score or the predicted word pair with the first score greater than the preset score, and the second predicted word pair includes the predicted word pair with the largest second score or the predicted word pair with the second score greater than the preset score. Then, both the first predicted word pair and the second predicted word pair may be used as expanded word pairs; or, the intersection of the first predicted word pair and the second predicted word pair may be obtained, and the predicted word pairs in the intersection may be used as expanded word pairs, that is, the predicted word pairs that exist in both the first predicted word pair and the second predicted word pair may be used as expanded word pairs. If the score of each predicted word pair includes a score obtained by weighted summing the first score and the second score, then when selecting an expanded word pair from at least one predicted word pair based on the scores of each predicted word pair, a predicted word pair with a score greater than a preset score may be selected from at least one predicted word pair as the expanded word pair; or a predicted word pair with the highest score may be selected from at least one predicted word pair as the expanded word pair.
[0101] S402, using multiple word pairs in the target data set to hierarchically construct an initial graph of the target entity words.
[0102] In the specific implementation process, a frequent item mining algorithm (such as the Apriori algorithm) can be used to infer the hypernym relationship between the hypernyms in multiple word pairs in the target data set, and then the initial graph of the target entity word can be hierarchically constructed based on the inferred hypernym relationship between each hypernym. For example, if the target data set includes "Persian cat→animal" and "Persian cat→feline", then the frequent item mining algorithm can be used to infer the hypernym relationship between the hypernym "animal" and the hypernym "feline": "animal" is the hypernym of "feline", and "feline" is the hyponym of "animal"; therefore, based on this hypernym relationship, the initial graph can be hierarchically constructed to include the path "Persian cat→feline→animal".
[0103] It should be noted that if the target entity word has multiple meanings, when executing step S302, the multiple word pairs in the target data set can be first divided into multiple subsets according to each meaning, and the word pairs included in each subset correspond to the same meaning; then the word pairs in each subset are used to construct the initial graph corresponding to each meaning.
[0104] S403, obtaining node information of at least one non-bottom-level node in the initial graph.
[0105] In one embodiment, a clustering algorithm can be used in advance to cluster the hypernyms in multiple word pairs in the word pair database to obtain clusters of each hypernym; and the clusters of each hypernym obtained by clustering are stored in the information library; wherein each cluster can represent a class of hypernyms, for example, cluster A represents the "song" class, cluster B represents the "movie" class, and so on. Accordingly, when obtaining the node information of at least one non-bottom-level node in the initial graph, the clusters of each hypernym stored in the initial graph can be obtained from the information library, and the obtained clusters can be added to the node information of each corresponding non-bottom-level node; that is, in this embodiment, the node information of any non-bottom-level node includes: the clusters of hypernyms stored in the non-bottom-level node. For example, if the cluster of hypernyms stored in the non-bottom-level node a is the "song" class, then the cluster is added to the node information of the non-bottom-level node a; for another example, if the cluster of hypernyms stored in the non-bottom-level node b is the "movie" class, then the cluster can be added to the node information of the non-bottom-level node b.
[0106] In another implementation, a Bayesian model characterized by word frequency can be used to first calculate the probability value of the hypernym stored in the non-bottom-level node being located in the node layer where the non-bottom-level node is currently located; then, the probability value of each hypernym being located in the node layer where the non-bottom-level node is currently located can be added to the node information of each corresponding non-bottom-level node; in this implementation, the node information of any non-bottom-level node includes: the probability value of the hypernym stored in the non-bottom-level node being located in the node layer where the non-bottom-level node is currently located. The calculation formula of the Bayesian model can be shown in the following formula 1.4:
[0107]
[0108] Among them, D n Indicates the event that a node appears at the nth layer; P(D n ) represents the probability of a node appearing in the nth layer; for example, the graph has a total of 100 nodes, n = 1; if there are 20 nodes in the first layer of the graph, then P(D n )=20 / 100=0.2;P(y i ) indicates the predicted hypernym y i The frequency coefficient of the word pair stored in the word pair database as a hypernym; P(y i |D n ) represents the non-bottom-level node y i The stored hypernym y i The probability value of being at the nth layer.
[0109] S404: Perform abnormal node detection on at least one non-bottom-layer node according to node information of at least one non-bottom-layer node.
[0110] S405: If it is detected that there is an abnormal node in at least one non-bottom-level node, the path where the abnormal node is located in the initial graph is used as a path to be pruned.
[0111] S406, removing the path to be pruned from the initial graph to obtain a target graph of the target entity word.
[0112] It should be noted that the specific implementation of steps S404-S406 can refer to the relevant description of steps S203-S204 of the above-mentioned invention embodiment, which will not be repeated here. It should also be noted that if the target entity word has multiple senses, the number of initial graphs and the number of target graphs are both multiple, and one sense corresponds to one initial graph and one target graph. Then, accordingly, after obtaining multiple target graphs, the multiple target graphs can be merged to obtain a hyponym-hypernym relationship graph of the target entity word; then the hyponym-hypernym relationship graph and the target entity word can be associated and stored.
[0113] In one embodiment, after obtaining the hyponymy graph, the hyponymy graph can also be marked with terms so that the hyponymy graph can be better used for business processing later. Specifically, the web page information corresponding to each sense of the target entity word can be obtained, and the priority of each sense can be calculated based on the web page information of each sense. Among them, the web page information may include at least one item: the number of views of the web page interface where the sense is located (such as the interface in Baidu Encyclopedia), the number of clicks on the web page interface where the sense is located, the number of searches for the sense, and so on. Taking the example of the web page information including the number of views of the web page interface where the sense is located, the priority of each sense can be calculated as: the number of views of the web page interface where any sense is located / the number of views of the web page interfaces where all senses are located. For example, the target entity word includes three senses: the web page interface where sense 1 is located has been viewed 2500 times, the web page interface where sense 2 is located has been viewed 1200 times, and the web page interface where sense 3 is located has been viewed 300 times; then the priority of sense 1 is: 2500 / (2500+1200+300)=0.625, the priority of sense 2 is: 1200 / (2500+1200+300)=0.3, and the priority of sense 3 is: 300 / (2500+1200+300)=0.075.
[0114] After obtaining the priority of each meaning, the meaning with the highest priority can be selected from multiple meanings as the thesis term according to the priority of each meaning, and the target graph corresponding to the thesis term can be marked in the upper and lower relationship graph. Among them, the method of marking the target graph corresponding to the thesis term may include but is not limited to: marking with preset marking elements (such as preset colors, preset graphics), marking with text, etc. For example, each node in the target graph corresponding to the thesis term can be marked with black, such as Figure 5b After the hypernymy graph is marked with the ism term, the hypernymy graph with the ism term mark and the target entity word can be associated and stored. By marking the hypernymy graph with the ism term mark, the use value of the hypernymy graph can be further improved.
[0115] Optionally, the terminal can detect in real time whether there is a business demand for the target entity word. If a business request for the target entity word is detected, the target graph corresponding to the thesis term can be obtained from the hyponymy graph; and business processing can be performed based on the hypernyms stored in the target graph corresponding to the thesis term. Among them, the business request for the target entity word can be sent by the user, or generated by the terminal according to actual business needs (such as information push needs); the business request can include but is not limited to: information query request, semantic recognition request, content recommendation request, information mining request, etc. Taking the business request as an information query request as an example, the specific implementation method of performing business processing based on the hypernyms stored in the target graph corresponding to the thesis term can be: obtaining the query information input by the user, and extracting the query term from the query information; the query term can be the target entity word, or it can be a hypernym of the target entity word; then the hypernym of the query term can be obtained from the hypernyms stored in the target graph corresponding to the thesis term, and feedback information is generated based on the hypernyms of the query term, thereby outputting the feedback information. For example, the input information is "What is a Persian cat?", and the target entity word extracted is "Persian cat"; because the subject of the target entity word is animal, the hypernyms that can be obtained include "feline" and "animal", thereby generating and outputting feedback information, such as Figure 5c As shown; it can be seen that since the hierarchical terms are marked in the hierarchical relationship map of the embodiment of the present invention, the information query results can be made more accurate.
[0116] It should be noted that the embodiment of the present invention can use the above steps S401-S406 to construct a large number of hyponymy graphs of entity words, and store each hyponymy graph in association with the corresponding entity word. In practical applications, these hyponymy graphs of entity words can also be used in different application scenarios according to actual needs, such as information query scenarios, semantic recognition scenarios, information recommendation scenarios (information mining scenarios), etc. The following takes information query scenarios and information recommendation scenarios as examples to explain the specific application of hyponymy graphs:
[0117] In the information query scenario: when the user wants to query certain information, the query information can be entered in the query interface. After obtaining the query information, the terminal can extract the target entity word contained in the query information; secondly, obtain the hyponymy and hyponymy graph of the target entity word, and query the hypernym of the target entity word from the hyponymy and hyponymy graph of the target entity word; then, generate feedback information based on the queried hypernym, and output the feedback information. It should be noted that if the target entity word has multiple meanings, since the embodiment of the present invention can mark the graph of the thesis term in the hyponymy and hyponymy graph, when querying the hypernym of the target entity word from the hyponymy and hyponymy graph of the target entity word, the target graph corresponding to the thesis term can be obtained from the hyponymy and hyponymy graph first, and the corresponding hypernym can be obtained from the target graph corresponding to the thesis term, so as to obtain feedback information.
[0118] In the information recommendation scenario, if the terminal wants to push information to a certain user, it can obtain the user's historical behavior data (such as historical web browsing data, historical text browsing data), and extract historical entity words from the historical behavior data; then obtain the hyponym-hypernym relationship graph corresponding to the historical entity words, and obtain the graph corresponding to the thesaurus from the hyponym-hypernym relationship graph, so as to recommend information based on the hypernyms stored in the graph corresponding to the thesaurus.
[0119] The embodiment of the present invention is directed to an initial graph constructed by using a target entity word and multiple hypernyms. Since the target entity word is stored in the bottom-level nodes of the initial graph, and the hypernyms of the target entity word are stored in the non-bottom-level nodes, the node information of at least one non-bottom-level node in the initial graph can be obtained first, and then abnormal node detection can be performed on at least one non-bottom-level node based on the node information of the at least one non-bottom-level node. If an abnormal node is detected in at least one non-bottom-level node, the initial graph can be pruned and post-processed based on the abnormal node; by using the structural characteristics of the initial graph to perform pruning and post-processing, the wrong hypernyms (i.e., the hypernyms stored in the abnormal nodes) and the wrong hypernym relationships in the initial graph can be effectively removed, thereby ensuring that the target graph obtained by pruning and post-processing has high accuracy and use value.
[0120] In order to further demonstrate the beneficial effects of the graph optimization method proposed in the embodiment of the present invention, the inventors conducted a series of comparative tests, as follows:
[0121] First, the inventors used the hyponymous relationship graph obtained by the graph optimization method of the embodiment of the present invention and the graph constructed by the prior art to conduct a query test on the same entity word (such as "user A"). The test results can be seen in Figure 6a As shown. Among them, Figure 6a The left figure corresponds to the query result of the hyponymous and hyponymous relationship map of the embodiment of the present invention. Figure 6a The right figure corresponds to the query result of the prior art map. By comparing the two query results, it can be seen that: compared with the prior art map, the hyponymy map of the embodiment of the present invention will not query wrong hypernyms such as "cabbage" and "plant"; it can be seen that the hyponymy map of the embodiment of the present invention is more accurate and can be more suitable for actual use scenarios.
[0122] Secondly, the inventors also used the graph obtained from 1000 entity words as test data and conducted a graph accuracy test. The test results can be found in Figure 6b As shown. Among them, Figure 6b The left side of represents the accuracy of the hyponym-hypernym relationship graph obtained by optimizing and constructing the graph of 1000 entity words using the graph optimization method of the embodiment of the present invention; Figure 6b The right side of represents the accuracy of the graph obtained by constructing the graph of 1000 entity words using the existing technology. Comparing the two accuracy rates, it can be seen that the accuracy of the hyponymous relationship graph constructed by the graph optimization method proposed in the embodiment of the present invention is significantly higher than the accuracy of the graph constructed by the existing technology.
[0123] As can be seen from the above, the graph optimization method proposed in the embodiment of the present invention has made many improvements compared with the prior art, such as: adding a filter based on a neural network, relationship pair expansion, pruning post-processing, etc. In order to further illustrate the effect gain brought by the various improved technologies used in the embodiment of the present invention, the inventors have also tested the effect gain brought by the various improved technologies respectively, and the test results can be found in Figure 6cAs shown. Among them, the calculation method of the gain effect of the filter based on the neural network is: for the entity words in the above test data, sentence template matching is used to obtain multiple candidate word pairs; the data accuracy before using the filter and the data accuracy after using the filter are calculated respectively, so as to compare and obtain the gain effect of the filter. The calculation method of the gain effect of the relationship pair expansion is: for the entity words in the above test data, the accuracy of the expanded word pairs obtained without using the expansion method proposed in the embodiment of the present invention and the accuracy of the expanded word pairs obtained using the expansion method proposed in the embodiment of the present invention are calculated respectively, so as to compare and obtain the gain effect of the relationship pair expansion. The calculation method of the gain effect of post-pruning processing is: the data accuracy without using the pruning algorithm proposed in the embodiment of the present invention and the data accuracy using the pruning algorithm proposed in the embodiment of the present invention are calculated respectively, so as to obtain the gain effect of post-pruning processing. By Figure 6c It can be seen that the various improved technologies proposed in the embodiments of the present invention can bring great gains in actual test data, and can be applied to application scenarios such as content understanding and information mining.
[0124] Based on the description of the above-mentioned graph optimization method embodiment, the present invention also discloses a graph optimization device, which can be a computer program (including program code) running in a terminal. Figure 2 or Figure 4 See the method shown in Figure 7 , the graph optimization device can run the following units:
[0125] An acquisition unit 101 is used to acquire an initial graph of a target entity word, wherein the initial graph includes multiple layers of nodes, wherein the bottom layer nodes store the target entity word, and non-bottom layer nodes store hypernyms of the target entity word, and an edge connecting any two nodes represents a hypernym relationship between the words stored in the two nodes;
[0126] The acquisition unit 101 is used to acquire node information of at least one non-bottom-level node in the initial graph, and the node information of any non-bottom-level node includes: a probability value of a hypernym stored in the non-bottom-level node being located in a node layer where the non-bottom-level node is currently located, or a cluster of hypernyms stored in the non-bottom-level node;
[0127] The processing unit 102 is configured to perform abnormal node detection on the at least one non-bottom-layer node according to the node information of the at least one non-bottom-layer node;
[0128] The processing unit 102 is used to perform pruning and post-processing on the initial graph according to the abnormal node to obtain a target graph of the target entity word if an abnormal node is detected in the at least one non-bottom-level node.
[0129] In one embodiment, the non-bottom-level nodes include: the end nodes in each path in the initial graph; the node information of the non-bottom-level nodes includes: the probability value of the hypernym stored in the end node being located in the node layer where the end node is currently located; accordingly, when the processing unit 102 is used to perform abnormal node detection on the at least one non-bottom-level node based on the node information of the at least one non-bottom-level node, it can be specifically used to: determine the end node corresponding to a probability value less than the probability threshold as an abnormal node.
[0130] In another embodiment, the node information of any non-bottom-level node includes: a cluster of hypernyms stored in the non-bottom-level node; the cluster corresponding to the non-bottom-level node is obtained by clustering hypernyms in a plurality of word pairs in a word pair database; accordingly, when the processing unit 102 is used to perform abnormal node detection on the at least one non-bottom-level node according to the node information of the at least one non-bottom-level node, it can be specifically used to:
[0131] Determine a reference node from the at least one non-bottom-level node according to the reliability of the hypernym stored in each non-bottom-level node, and use the cluster corresponding to the reference node as the reference cluster;
[0132] According to the clusters corresponding to each non-bottom-level node and the reference clusters, an abnormal node is screened out from the at least one non-bottom-level node, and the cluster corresponding to the abnormal node is different from the reference cluster.
[0133] In another embodiment, when the processing unit 102 is used to perform post-pruning processing on the initial graph according to the abnormal node to obtain the target graph of the target entity word if an abnormal node is detected in the at least one non-bottom-level node, the processing unit 102 may be specifically used to:
[0134] If it is detected that there is an abnormal node in the at least one non-bottom-level node, the path where the abnormal node is located in the initial graph is used as a path to be pruned;
[0135] The to-be-pruned path is removed from the initial graph to obtain a target graph for the target entity word.
[0136] In another embodiment, when the acquisition unit 101 is used to acquire the initial graph of the target entity word, it can be specifically used to:
[0137] Acquire a target data set about a target entity word, wherein the target data set includes a plurality of word pairs, each word pair consisting of the target entity word and a hypernym of the target entity word;
[0138] An initial graph of the target entity word is constructed hierarchically using multiple word pairs in the target data set.
[0139] In another embodiment, when the acquisition unit 101 is used to acquire the target data set about the target entity word, it can be specifically used to:
[0140] Acquire a text dataset, wherein the text dataset includes a plurality of texts related to the target entity word;
[0141] Based on a preset sentence template, extract at least one candidate word pair from multiple texts in the text data set, each candidate word pair consisting of the target entity word and a hypernym of the target entity word;
[0142] Filtering the at least one candidate word pair according to the semantic relationship between the hypernym in the at least one candidate word pair and the target entity word;
[0143] The filtered word pairs are added to the target dataset of the target entity word.
[0144] In another embodiment, when the acquisition unit 101 is used to filter the at least one candidate word pair according to the semantic relationship between the hypernym in the at least one candidate word pair and the target entity word, it can be specifically used to:
[0145] For any candidate word pair, obtain the hypernym vector of the hypernym in the candidate word pair and the entity word vector of the target entity word; the word vector is used to represent the semantic features of the word;
[0146] According to the hypernym vector and the entity word vector, the actual relationship vector of any candidate word pair is calculated; and the autoencoder is called to predict the predicted relationship vector of any candidate word pair according to the hypernym in any candidate word pair and the target entity word;
[0147] Verify the hypernym relationship between the hypernym in any candidate word pair and the target entity word according to the actual relationship vector and the predicted relationship vector;
[0148] If the verification is successful, any candidate word pair is retained; otherwise, any candidate word pair is filtered out.
[0149] In another implementation manner, the acquisition unit 101 may also be used to:
[0150] Perform hypernym prediction processing on the target entity word according to the word pairs stored in the word pair database to obtain at least one predicted hypernym of the target entity word;
[0151] Using each predicted hypernym and the target entity word to form at least one predicted word pair, and scoring each predicted word pair;
[0152] An expanded word pair is selected from the at least one predicted word pair according to the scores of the predicted word pairs, and the selected expanded word pair is added to the target data set.
[0153] In another embodiment, the score of each predicted word pair includes a first score; accordingly, when the acquisition unit 101 is used to score each predicted word pair, it can be specifically used to:
[0154] For any predicted word pair, calculating a frequency coefficient of a predicted hypernym in the predicted word pair as a hypernym appearing in the word pair stored in the word pair database;
[0155] Acquire the historical superordinate words of the target entity word that already exist in the target data set;
[0156] Calculating the relevance between the target entity word and each historical hypernym, and the similarity between the predicted hypernym in any predicted word pair and each historical hypernym;
[0157] A first score of any predicted word pair is determined according to the frequency coefficient of the predicted hypernym in any predicted word pair, the calculated relevance, and the calculated similarity.
[0158] In another embodiment, when the acquisition unit 101 is used to select an expanded word pair from the at least one predicted word pair according to the scores of the predicted word pairs, it can be specifically used to:
[0159] selecting at least one word pair to be expanded from the predicted word pairs according to the first scores of the predicted word pairs;
[0160] Using a matrix decomposition algorithm to score each word pair to be expanded, to obtain a second score for each word pair to be expanded;
[0161] An expanded word pair is selected from the at least one word pair to be expanded according to the second score of each word pair to be expanded.
[0162] In another embodiment, if the target entity word has multiple meanings, the number of the initial graphs and the number of the target graphs are both multiple, and one meaning corresponds to one initial graph and one target graph; accordingly, the processing unit 102 can also be used to:
[0163] Merging multiple target graphs to obtain a hyponym-hypernym relationship graph of the target entity word;
[0164] Acquire web page information corresponding to each meaning of the target entity word, and calculate the priority of each meaning according to the web page information corresponding to each meaning;
[0165] According to the priorities of the various meanings, the meaning with the highest priority is selected from the multiple meanings as the thesis term, and the target map corresponding to the thesis term is marked in the hierarchical relationship map.
[0166] In another implementation, the processing unit 102 may also be configured to:
[0167] In response to a service request regarding a target entity word, obtaining a target graph corresponding to the idem item from the hyponymy graph;
[0168] Business processing is performed according to the hypernyms stored in the target graph corresponding to the said term.
[0169] According to one embodiment of the present invention, Figure 2 or Figure 4 Each step involved in the method shown can be performed by Figure 7 The graph optimization device shown in FIG. 1 is executed by each unit in the graph optimization device. For example, Figure 2 Steps S201 and S202 shown in FIG. 1 can be represented by Figure 7 The acquisition unit 101 shown in FIG. 1 is executed, and steps S203 and S204 can be performed by Figure 7 , the processing unit 102 shown in is executed; for example, Figure 4 The steps S401-S403 shown in FIG. 4 can be performed by Figure 7 The acquisition unit 101 shown in FIG. 1 is executed, and steps S404-S406 can be performed by Figure 7 The processing unit 102 shown in FIG.
[0170] According to another embodiment of the present invention, Figure 7 The various units in the graph optimization device shown can be separately or completely combined into one or several other units to form, or one (some) of the units can be further divided into multiple functionally smaller units to form, which can achieve the same operation without affecting the realization of the technical effects of the embodiments of the present invention. The above-mentioned units are divided based on logical functions. In practical applications, the function of one unit can also be implemented by multiple units, or the functions of multiple units can be implemented by one unit. In other embodiments of the present invention, other units can also be included based on the graph optimization device. In practical applications, these functions can also be implemented with the assistance of other units, and can be implemented by the collaboration of multiple units.
[0171] According to another embodiment of the present invention, the program can be executed by running a program on a general computing device such as a computer including a central processing unit (CPU), a random access memory medium (RAM), a read-only memory medium (ROM), and other processing elements and storage elements. Figure 2 or Figure 4A computer program (including program code) for each step involved in the corresponding method shown in Figure 7 The graph optimization device shown in the figure can be used to implement the graph optimization method of the embodiment of the present invention. The computer program can be recorded on a computer-readable recording medium, for example, and loaded into the above-mentioned computing device through the computer-readable recording medium and run therein.
[0172] The embodiment of the present invention is directed to an initial graph constructed by using a target entity word and multiple hypernyms. Since the target entity word is stored in the bottom-level nodes of the initial graph, and the hypernyms of the target entity word are stored in the non-bottom-level nodes, the node information of at least one non-bottom-level node in the initial graph can be obtained first, and then abnormal node detection can be performed on at least one non-bottom-level node based on the node information of the at least one non-bottom-level node. If an abnormal node is detected in at least one non-bottom-level node, the initial graph can be pruned and post-processed based on the abnormal node; by using the structural characteristics of the initial graph to perform pruning and post-processing, the wrong hypernyms (i.e., the hypernyms stored in the abnormal nodes) and the wrong hypernym relationships in the initial graph can be effectively removed, thereby ensuring that the target graph obtained by pruning and post-processing has high accuracy and use value.
[0173] Based on the description of the above method embodiment and device embodiment, the embodiment of the present invention further provides a terminal. Figure 8 The terminal at least includes a processor 201, an input device 202, an output device 203, and a computer storage medium 204. The processor 201, the input device 202, the output device 203, and the computer storage medium 204 in the terminal may be connected via a bus or other means.
[0174] The computer storage medium 204 can be stored in the memory of the terminal, and the computer storage medium 204 is used to store a computer program, and the computer program includes program instructions. The processor 201 is used to execute the program instructions stored in the computer storage medium 204. The processor 201 (or CPU (Central Processing Unit)) is the computing core and control core of the terminal, which is suitable for implementing one or more instructions, and is specifically suitable for loading and executing one or more instructions to implement corresponding method flows or corresponding functions; in one embodiment, the processor 201 described in the embodiment of the present invention can be used to perform a series of graph optimization processing on the initial graph of the target entity word, including: obtaining the initial graph of the target entity word, the initial graph includes multiple layers of nodes, the bottom-level nodes store the target entity word, the non-bottom-level nodes store the hypernyms of the target entity word, and the edge connecting any two nodes represents the words stored by the any two nodes. The hypernym relationship between words; obtaining the node information of at least one non-bottom-level node in the initial graph, the node information of any non-bottom-level node including: the probability value of the hypernym stored in the non-bottom-level node being located in the node layer where the non-bottom-level node is currently located, or the cluster of the hypernym stored in the non-bottom-level node; performing abnormal node detection on the at least one non-bottom-level node according to the node information of the at least one non-bottom-level node; if an abnormal node is detected in the at least one non-bottom-level node, performing post-pruning processing on the initial graph according to the abnormal node to obtain the target graph of the target entity word, and so on.
[0175] The embodiment of the present invention also provides a computer storage medium (Memory), which is a memory device in the terminal for storing programs and data. It is understandable that the computer storage medium here can include both the built-in storage medium in the terminal and the extended storage medium supported by the terminal. The computer storage medium provides a storage space, which stores the operating system of the terminal. In addition, one or more instructions suitable for being loaded and executed by the processor 201 are also stored in the storage space, and these instructions can be one or more computer programs (including program codes). It should be noted that the computer storage medium here can be a high-speed RAM memory, or a non-volatile memory (non-volatile memory), such as at least one disk storage; optionally, it can also be at least one computer storage medium located away from the aforementioned processor.
[0176] In one embodiment, the processor 201 may load and execute one or more instructions stored in a computer storage medium to implement the corresponding steps of the method in the above-mentioned graph optimization embodiment; in a specific implementation, the processor 201 may load and execute the following steps:
[0177] Acquire an initial graph of the target entity word, wherein the initial graph includes multiple layers of nodes, wherein the bottom layer nodes store the target entity word, and non-bottom layer nodes store hypernyms of the target entity word, and an edge connecting any two nodes represents a hypernym relationship between the words stored in the two nodes;
[0178] Obtaining node information of at least one non-bottom-level node in the initial graph, wherein the node information of any non-bottom-level node includes: a probability value of a hypernym stored in the non-bottom-level node being located in a node layer where the non-bottom-level node is currently located, or a cluster of hypernyms stored in the non-bottom-level node;
[0179] Performing abnormal node detection on the at least one non-bottom-layer node according to the node information of the at least one non-bottom-layer node;
[0180] If it is detected that there is an abnormal node in the at least one non-bottom-level node, the initial graph is pruned and processed according to the abnormal node to obtain a target graph of the target entity word.
[0181] In one embodiment, the non-bottom-level nodes include: the end nodes in each path in the initial graph; the node information of the non-bottom-level nodes includes: the probability value of the hypernym stored in the end node being located in the node layer where the end node is currently located; accordingly, when performing abnormal node detection on the at least one non-bottom-level node based on the node information of the at least one non-bottom-level node, the one or more instructions are loaded and specifically executed by the processor 201: the end node corresponding to the probability value less than the probability threshold is determined as an abnormal node.
[0182] In another embodiment, the node information of any non-bottom-level node includes: a cluster of hypernyms stored in the non-bottom-level node; the cluster corresponding to the non-bottom-level node is obtained by clustering hypernyms in multiple word pairs in a word pair database; accordingly, when abnormal node detection is performed on at least one non-bottom-level node according to the node information of the at least one non-bottom-level node, the one or more instructions are loaded and specifically executed by the processor 201:
[0183] Determine a reference node from the at least one non-bottom-level node according to the reliability of the hypernym stored in each non-bottom-level node, and use the cluster corresponding to the reference node as the reference cluster;
[0184] According to the clusters corresponding to each non-bottom-level node and the reference clusters, an abnormal node is screened out from the at least one non-bottom-level node, and the cluster corresponding to the abnormal node is different from the reference cluster.
[0185] In another embodiment, if an abnormal node is detected in the at least one non-bottom-level node, the initial graph is pruned and processed according to the abnormal node to obtain a target graph of the target entity word, and the one or more instructions are loaded and specifically executed by the processor 201:
[0186] If it is detected that there is an abnormal node in the at least one non-bottom-level node, the path where the abnormal node is located in the initial graph is used as a path to be pruned;
[0187] The to-be-pruned path is removed from the initial graph to obtain a target graph for the target entity word.
[0188] In another embodiment, when obtaining the initial graph of the target entity word, the one or more instructions are loaded and specifically executed by the processor 201:
[0189] Acquire a target data set about a target entity word, wherein the target data set includes a plurality of word pairs, each word pair consisting of the target entity word and a hypernym of the target entity word;
[0190] An initial graph of the target entity word is constructed hierarchically using multiple word pairs in the target data set.
[0191] In another embodiment, when acquiring a target data set about a target entity word, the one or more instructions are loaded and specifically executed by the processor 201:
[0192] Acquire a text dataset, wherein the text dataset includes a plurality of texts related to the target entity word;
[0193] Based on a preset sentence template, extract at least one candidate word pair from multiple texts in the text data set, each candidate word pair consisting of the target entity word and a hypernym of the target entity word;
[0194] Filtering the at least one candidate word pair according to the semantic relationship between the hypernym in the at least one candidate word pair and the target entity word;
[0195] The filtered word pairs are added to the target dataset of the target entity word.
[0196] In another embodiment, when filtering the at least one candidate word pair according to the semantic relationship between the hypernym in the at least one candidate word pair and the target entity word, the one or more instructions are loaded and specifically executed by the processor 201:
[0197] For any candidate word pair, obtain the hypernym vector of the hypernym in the candidate word pair and the entity word vector of the target entity word; the word vector is used to represent the semantic features of the word;
[0198] According to the hypernym vector and the entity word vector, the actual relationship vector of any candidate word pair is calculated; and the autoencoder is called to predict the predicted relationship vector of any candidate word pair according to the hypernym in any candidate word pair and the target entity word;
[0199] Verify the hypernym relationship between the hypernym in any candidate word pair and the target entity word according to the actual relationship vector and the predicted relationship vector;
[0200] If the verification is successful, any candidate word pair is retained; otherwise, any candidate word pair is filtered out.
[0201] In another implementation manner, the one or more instructions may also be loaded and specifically executed by the processor 201:
[0202] Perform hypernym prediction processing on the target entity word according to the word pairs stored in the word pair database to obtain at least one predicted hypernym of the target entity word;
[0203] Using each predicted hypernym and the target entity word to form at least one predicted word pair, and scoring each predicted word pair;
[0204] An expanded word pair is selected from the at least one predicted word pair according to the scores of the predicted word pairs, and the selected expanded word pair is added to the target data set.
[0205] In another embodiment, the score of each predicted word pair includes a first score; accordingly, when scoring each predicted word pair, the one or more instructions are loaded and specifically executed by the processor 201:
[0206] For any predicted word pair, calculating a frequency coefficient of a predicted hypernym in the predicted word pair as a hypernym appearing in the word pair stored in the word pair database;
[0207] Acquire the historical superordinate words of the target entity word that already exist in the target data set;
[0208] Calculating the relevance between the target entity word and each historical hypernym, and the similarity between the predicted hypernym in any predicted word pair and each historical hypernym;
[0209] A first score of any predicted word pair is determined according to the frequency coefficient of the predicted hypernym in any predicted word pair, the calculated relevance, and the calculated similarity.
[0210] In another embodiment, when selecting an expanded word pair from the at least one predicted word pair according to the scores of the predicted word pairs, the one or more instructions are loaded and specifically executed by the processor 201:
[0211] selecting at least one word pair to be expanded from the predicted word pairs according to the first scores of the predicted word pairs;
[0212] Using a matrix decomposition algorithm to score each word pair to be expanded, to obtain a second score for each word pair to be expanded;
[0213] An expanded word pair is selected from the at least one word pair to be expanded according to the second score of each word pair to be expanded.
[0214] In another embodiment, if the target entity word has multiple meanings, the number of the initial graphs and the number of the target graphs are both multiple, and one meaning corresponds to one initial graph and one target graph; accordingly, the one or more instructions can also be loaded and specifically executed by the processor 201:
[0215] Merging multiple target graphs to obtain a hyponym-hypernym relationship graph of the target entity word;
[0216] Acquire web page information corresponding to each meaning of the target entity word, and calculate the priority of each meaning according to the web page information corresponding to each meaning;
[0217] According to the priorities of the various meanings, the meaning with the highest priority is selected from the multiple meanings as the thesis term, and the target map corresponding to the thesis term is marked in the hierarchical relationship map.
[0218] In another implementation manner, the one or more instructions may also be loaded and specifically executed by the processor 201:
[0219] In response to a service request regarding a target entity word, obtaining a target graph corresponding to the idem item from the hyponymy graph;
[0220] Business processing is performed according to the hypernyms stored in the target graph corresponding to the said term.
[0221] The embodiment of the present invention is directed to an initial graph constructed by using a target entity word and multiple hypernyms. Since the target entity word is stored in the bottom-level nodes of the initial graph, and the hypernyms of the target entity word are stored in the non-bottom-level nodes, the node information of at least one non-bottom-level node in the initial graph can be obtained first, and then abnormal node detection can be performed on at least one non-bottom-level node based on the node information of the at least one non-bottom-level node. If an abnormal node is detected in at least one non-bottom-level node, the initial graph can be pruned and post-processed based on the abnormal node; by using the structural characteristics of the initial graph to perform pruning and post-processing, the wrong hypernyms (i.e., the hypernyms stored in the abnormal nodes) and the wrong hypernym relationships in the initial graph can be effectively removed, thereby ensuring that the target graph obtained by pruning and post-processing has high accuracy and use value.
[0222] The above disclosure is only the preferred embodiment of the present invention, which certainly cannot be used to limit the scope of the present invention. Therefore, equivalent changes made according to the claims of the present invention are still within the scope of the present invention.
Claims
1. A graph optimization method, characterized in that: include: Obtain an initial graph of a target entity word, the initial graph comprising multiple layers of nodes, the bottom-level nodes storing the target entity word, the non-bottom-level nodes storing hypernyms of the target entity word, and the edge connecting any two nodes representing the hypernym relationship between the words stored in the any two nodes; wherein the initial graph is constructed using a target data set about the target entity word, and the process of obtaining the target data set comprises: performing hypernym prediction processing on the target entity word according to the word pairs stored in a word pair database to obtain at least one predicted hypernym of the target entity word; respectively using each predicted hypernym and the target entity word to form at least one predicted word pair, and scoring each predicted word pair; selecting an expanded word pair from the at least one predicted word pair according to the score of each predicted word pair, and adding the selected expanded word pair to the target data set; Obtaining node information of at least one non-bottom-level node in the initial graph, wherein the node information of any non-bottom-level node includes: a probability value of a hypernym stored in the non-bottom-level node being located in a node layer where the non-bottom-level node is currently located, or a cluster of hypernyms stored in the non-bottom-level node; Performing abnormal node detection on the at least one non-bottom-layer node according to the node information of the at least one non-bottom-layer node; If it is detected that there is an abnormal node in the at least one non-bottom-level node, the initial graph is pruned and processed according to the abnormal node to obtain a target graph of the target entity word.
2. The method according to claim 1, characterized in that The non-bottom-level nodes include: the end nodes in each path in the initial graph; the node information of the non-bottom-level nodes includes: the probability value of the hypernym stored in the end node being located in the node layer where the end node is currently located; The performing abnormal node detection on the at least one non-bottom-level node according to the node information of the at least one non-bottom-level node includes: determining a tail node corresponding to a probability value less than a probability threshold as an abnormal node.
3. The method according to claim 1, characterized in that The node information of any non-bottom-level node includes: a cluster of hypernyms stored in the non-bottom-level node; the cluster corresponding to the non-bottom-level node is obtained by clustering hypernyms in a plurality of word pairs in a word pair database; The performing abnormal node detection on the at least one non-bottom-layer node according to the node information of the at least one non-bottom-layer node comprises: Determine a reference node from the at least one non-bottom-level node according to the reliability of the hypernym stored in each non-bottom-level node, and use the cluster corresponding to the reference node as the reference cluster; According to the clusters corresponding to each non-bottom-level node and the reference clusters, an abnormal node is screened out from the at least one non-bottom-level node, and the cluster corresponding to the abnormal node is different from the reference cluster.
4. The method according to any one of claims 1 to 3, characterized in that: If an abnormal node is detected in the at least one non-bottom-level node, the initial graph is pruned and processed according to the abnormal node to obtain a target graph of the target entity word, including: If it is detected that there is an abnormal node in the at least one non-bottom-level node, the path where the abnormal node is located in the initial graph is used as a path to be pruned; The to-be-pruned path is removed from the initial graph to obtain a target graph for the target entity word.
5. The method according to claim 1, characterized in that The step of obtaining an initial graph of a target entity word includes: Acquire a target data set about a target entity word, wherein the target data set includes a plurality of word pairs, each word pair consisting of the target entity word and a hypernym of the target entity word; An initial graph of the target entity word is constructed hierarchically using multiple word pairs in the target data set.
6. The method according to claim 5, characterized in that The process of acquiring the target data set also includes: Acquire a text dataset, wherein the text dataset includes a plurality of texts related to the target entity word; Based on a preset sentence template, extract at least one candidate word pair from multiple texts in the text data set, each candidate word pair consisting of the target entity word and a hypernym of the target entity word; Filtering the at least one candidate word pair according to the semantic relationship between the hypernym in the at least one candidate word pair and the target entity word; The filtered word pairs are added to the target dataset of the target entity word.
7. The method according to claim 6, characterized in that The filtering process of the at least one candidate word pair according to the semantic relationship between the hypernym in the at least one candidate word pair and the target entity word comprises: For any candidate word pair, obtain the hypernym vector of the hypernym in the candidate word pair and the entity word vector of the target entity word; the word vector is used to represent the semantic features of the word; According to the hypernym vector and the entity word vector, the actual relationship vector of any candidate word pair is calculated; and the autoencoder is called to predict the predicted relationship vector of any candidate word pair according to the hypernym in any candidate word pair and the target entity word; Verify the hypernym relationship between the hypernym in any candidate word pair and the target entity word according to the actual relationship vector and the predicted relationship vector; If the verification is successful, any candidate word pair is retained; otherwise, any candidate word pair is filtered out.
8. The method according to claim 1, characterized in that The score of each predicted word pair includes a first score, and the scoring process for each predicted word pair includes: For any predicted word pair, calculating a frequency coefficient of a predicted hypernym in the predicted word pair as a hypernym appearing in the word pair stored in the word pair database; Acquire the historical superordinate words of the target entity word that already exist in the target data set; Calculating the relevance between the target entity word and each historical hypernym, and the similarity between the predicted hypernym in any predicted word pair and each historical hypernym; A first score of any predicted word pair is determined according to the frequency coefficient of the predicted hypernym in any predicted word pair, the calculated relevance, and the calculated similarity.
9. The method according to claim 8, characterized in that The step of selecting an expanded word pair from the at least one predicted word pair according to the scores of the predicted word pairs comprises: selecting at least one word pair to be expanded from the predicted word pairs according to the first scores of the predicted word pairs; Using a matrix decomposition algorithm to score each word pair to be expanded, to obtain a second score for each word pair to be expanded; An expanded word pair is selected from the at least one word pair to be expanded according to the second score of each word pair to be expanded.
10. The method according to claim 1, characterized in that If the target entity word has multiple meanings, the number of the initial graphs and the number of the target graphs are both multiple, and one meaning corresponds to one initial graph and one target graph; the method further includes: Merging multiple target graphs to obtain a hyponym-hypernym relationship graph of the target entity word; Acquire web page information corresponding to each meaning of the target entity word, and calculate the priority of each meaning according to the web page information corresponding to each meaning; According to the priorities of the various meanings, the meaning with the highest priority is selected from the multiple meanings as the thesis term, and the target map corresponding to the thesis term is marked in the hierarchical relationship map.
11. The method according to claim 10, characterized in that The method further comprises: In response to a service request regarding a target entity word, obtaining a target graph corresponding to the idem item from the hyponymy graph; Business processing is performed according to the hypernyms stored in the target graph corresponding to the said term.
12. A graph optimization device, characterized in that: include: An acquisition unit is used to acquire an initial graph of a target entity word, wherein the initial graph includes multiple layers of nodes, wherein the bottom-layer nodes store the target entity word, and the non-bottom-layer nodes store hypernyms of the target entity word, and the edge connecting any two nodes represents the hypernym relationship between the words stored in the any two nodes; wherein the initial graph is constructed using a target data set about the target entity word, and the acquisition process of the target data set includes: performing hypernym prediction processing on the target entity word according to the word pairs stored in a word pair database to obtain at least one predicted hypernym of the target entity word; respectively using each predicted hypernym and the target entity word to form at least one predicted word pair, and scoring each predicted word pair; selecting an expanded word pair from the at least one predicted word pair according to the score of each predicted word pair, and adding the selected expanded word pair to the target data set; The acquisition unit is used to acquire node information of at least one non-bottom-level node in the initial graph, wherein the node information of any non-bottom-level node includes: a probability value of a hypernym stored in the non-bottom-level node being located in a node layer where the non-bottom-level node is currently located, or a cluster of hypernyms stored in the non-bottom-level node; A processing unit, configured to perform abnormal node detection on the at least one non-bottom-layer node according to the node information of the at least one non-bottom-layer node; The processing unit is used to prune the initial graph according to the abnormal node to obtain the target graph of the target entity word if an abnormal node is detected in the at least one non-bottom-level node.
13. A terminal comprising an input device and an output device, characterized in that: Also includes: a processor adapted to implement one or more instructions; as well as, A computer storage medium storing one or more instructions, wherein the one or more instructions are suitable for being loaded by the processor and executing the graph optimization method as described in any one of claims 1-11.
14. A computer storage medium, characterized in that: The computer storage medium stores one or more instructions, and the one or more instructions are suitable for being loaded by a processor and executing the graph optimization method as described in any one of claims 1-11.
Citation Information
Patent Citations
Optimization method and device for natural language generation sentences
CN106294325A
Statement analysis method and device, terminal equipment and storage medium
CN107943792A
Knowledge graph-based hypernym mining method and apparatus
CN108304493A
Knowledge data storage method and device, computer device and storage medium
CN109885692A
Knowledge graph human cancer lethal prediction method based on hybrid network and knowledge graph construction method
CN114969369A
