Similar network subgraph search method and device based on semantic distance, storage medium and terminal
Through the semantic distance -based similar network sub -graph search method, the accuracy of the accuracy of dependent vector search in the existing technology is solved, and the efficient and accurate network sub -chart search is realized, reducing the consumption of computing resources and time.
Patent Information
- Application Number
- CN202411237914.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-05
- Publication Date
- 2025-01-24
- Estimated Expiration
- 2044-09-05
AI Technical Summary
The existing network subgraph search method relies on vector search, requiring a large amount of corpus data and controlling the data quality, resulting in low accuracy.
Use a similar network sub -diagram search method based on semantic distance. By obtaining the connection edge of the settings in the reference network subgraphs, the text unit is connected into a search subgraph, and the preset is to use depth to search, breadth priority search or random walking method to obtain the preset method Search sequence, obtain a collection of search text units for each text unit based on semantic distance and access.
No vectorization process is required, information loss is reduced, calculation speed is fast, accuracy is high, and it can effectively improve the accuracy of similar network subgraph search.
Smart Images

Figure CN118760780B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of network subgraph retrieval, and in particular to a similar network subgraph search method and device based on semantic distance, a storage medium and a terminal. Background Art
[0002] Similar network subgraph search is a basic operation in graph data processing. Its goal is to match network subgraphs in complex networks and find network subgraph structures that meet the requirements. This type of query is widely used in many fields, including but not limited to question-answering systems, data retrieval, social network analysis, etc.
[0003] The current similar network subgraph search process often uses a vector search method, that is, by training on a large amount of text data to learn the semantic relationship between text units, and then mapping the nodes in the graph into the vector space, the obtained vector can be used to calculate the similarity between nodes, thereby comparing the similarity of subgraphs. There is a tendency for information loss to occur in the above vector acquisition process, and the accuracy of the learned semantic relationship is closely related to the quality of the training data. Therefore, in order to train high-quality vectors, not only a large amount of corpus data is required, and the quality of the corpus data is controlled, but also large computing resources and more computing time are required. If the quantity or quality of the corpus is not properly controlled, it is easy to cause the final similar network subgraph to have a low accuracy.
[0004] Therefore, there is an urgent need for a similar network subgraph search method that uses less data, does not require data quality control, takes less computing time, and has high accuracy. Summary of the invention
[0005] The purpose of the present application is to provide a similar network subgraph search method and device based on semantic distance, a storage medium and a terminal, which are used to solve the problem that the current network subgraph search method relies on vector search, which not only requires a large amount of corpus data, but also requires control of the quality of the corpus data, and is prone to the problem of low accuracy of similar network subgraphs.
[0006] In a first aspect, the present application provides a similar network subgraph search method based on semantic distance, comprising:
[0007] Obtain a reference network subgraph, obtain set connection edges between all text units in the reference network subgraph based on a preset screening condition, and connect all text units in the reference network subgraph into a search subgraph based on all the set connection edges;
[0008] Obtain a search text unit set of a target text unit in the search subgraph in an inference database, and based on the search text unit set of the target text unit, obtain a search text unit set of all text units in the search subgraph in an inference database along a preset search order using a preset search set acquisition method;
[0009] Based on the search text unit set of all the text units in the reference network subgraph, all similar network subgraphs of the reference network subgraph are obtained;
[0010] Among them, the target text unit is any text unit in the reference network subgraph.
[0011] In one embodiment of the present application, a preset search order of all text units in the search subgraph is obtained by a depth-first search method, a breadth-first search method, or a random walk method;
[0012] Based on the search text unit set of the target text unit, obtaining the search text unit set of all text units in the search subgraph in the inference database along a preset search order by a preset search set acquisition method includes:
[0013] Acquire all adjacent text unit pairs in the search subgraph based on the preset search order and the set connection edges in the search subgraph;
[0014] Based on the search text unit set of the target text unit, all adjacent text unit pairs in the search subgraph are searched in a sequential access search manner to obtain the search text unit set of all text units in the search subgraph in the inference database.
[0015] In one embodiment of the present application, all search links in the search subgraph are obtained along each set connection edge with the target text unit as the path acquisition starting point, the number of text units on the search link obtained first is as large as possible, and all the search links are sorted to obtain a preset search order;
[0016] Based on the search text unit set of the target text unit, obtaining the search text unit set of all text units in the search subgraph in the inference database along a preset search order by a preset search set acquisition method includes:
[0017] Acquire the search starting point of each search link along the preset search order, the search starting point of the search link being the text unit in the search link that is closest to the target text unit along the set connection edge;
[0018] Based on the search starting point of each search link, all adjacent text unit pairs with a sequential access relationship in the search subgraph are obtained, and based on the search text unit set of the target text unit, all adjacent text unit pairs in the search subgraph are searched by a sequential access search method to obtain the search text unit set of all text units in the search subgraph in the inference database.
[0019] In one embodiment of the present application, the access order search method includes:
[0020] The text unit in the adjacent text unit pair that has obtained the corresponding search text unit set is used as the first visited text unit, and the text unit in the adjacent text unit pair that has not obtained the corresponding search text unit set is used as the second visited text unit, and a semantic distance search range is obtained based on the semantic distance between the first visited text unit and the second visited text unit;
[0021] All text units in the search text unit set of the first-accessed text unit are taken as search text units, all text units in the inference database within the semantic distance search range of each of the search text units are grouped as search text unit subsets corresponding to the search text units, and all the search text unit subsets are grouped as the search text unit set of the later-accessed text unit.
[0022] In one embodiment of the present application, the search text unit set of combining all the search text unit subsets into the later accessed text unit includes:
[0023] Acquire the search feature of the post-access text unit, filter all text units in the search text unit subset based on the search feature to obtain a filtered search text unit subset, and combine all the filtered search text unit subsets into a search text unit set of the post-access text unit;
[0024] The search feature of the later accessed text unit is a preset text unit corresponding to the later accessed text unit or a preset attribute or preset category of the later accessed text unit.
[0025] In one embodiment of the present application, based on the search text unit set of all the text units in the reference network subgraph, obtaining all similar network subgraphs of the reference network subgraph includes:
[0026] Acquire all similar network subgraphs of the reference network subgraph by selecting one text unit from the search text unit set of each text unit of the reference network subgraph along the preset search order to form a similar network subgraph;
[0027] Among them, any two similar network subgraphs of the reference network subgraph are different from each other, and the first-visited text unit in any adjacent text unit pair in the reference network subgraph is set as the first text unit to be selected, and the later-visited text unit is set as the second text unit to be selected, and the text unit selected from the search text unit set of the first text unit to be selected is the prior text unit. When selecting a text unit from the search text unit set of the second text unit to be selected, it is required to satisfy that the selected text unit belongs to the search text unit subset of the prior text unit.
[0028] In one embodiment of the present application, when the text unit includes multiple pre-accessed text units, the search text unit sets obtained based on each pair of adjacent text units of the text unit are all pre-search text unit sets, and the intersection of all pre-search text unit sets of the text unit is the search text unit set of the text unit.
[0029] In an embodiment of the present application, the preset screening condition includes at least one of the setting conditions, and the setting condition includes:
[0030] Setting a connection edge between two text units in the reference network subgraph whose semantic distance is less than a preset threshold as a set connection edge;
[0031] A connection edge is set between two text units as a set connection edge;
[0032] Deletes the default connection edge between two text units.
[0033] In a second aspect, the present application also provides a similar network subgraph search device based on semantic distance, including a search subgraph acquisition module, a search text unit set acquisition module and a similar network subgraph acquisition module;
[0034] The search subgraph acquisition module is used to acquire a reference network subgraph, acquire set connection edges between all text units in the reference network subgraph based on a preset screening condition, and connect all text units in the reference network subgraph into a search subgraph based on all the set connection edges;
[0035] The search text unit set acquisition module is used to acquire the search text unit set of the target text unit in the search subgraph in the inference database, and based on the search text unit set of the target text unit, acquire the search text unit set of all text units in the search subgraph in the inference database along a preset search order through a preset search set acquisition method;
[0036] The similar network subgraph acquisition module is used to acquire all similar network subgraphs of the reference network subgraph based on the search text unit set of all the text units in the reference network subgraph;
[0037] Among them, the target text unit is any text unit in the reference network subgraph.
[0038] In a third aspect, the present application also provides a storage medium on which a computer program is stored, and when the program is executed by a processor, the similar network subgraph search method based on semantic distance is implemented.
[0039] In a fourth aspect, the present application further provides a terminal, comprising: a processor and a memory, wherein the memory is communicatively connected to the processor;
[0040] The memory is used to store a computer program, and the processor is used to execute the computer program stored in the memory, so that the terminal executes the similar network subgraph search method based on semantic distance.
[0041] Compared with the prior art, one or more embodiments of the above scheme may have the following advantages or beneficial effects:
[0042] The similar network subgraph search method based on semantic distance provided by the embodiment of the present invention is applied, and the set connection edge in the reference network subgraph is determined by semantic distance or set conditions to connect the text units with similar characteristics in the reference network subgraph to form a search subgraph; the preset search order is obtained by depth-first search, breadth-first search, random walk, and search link; all adjacent text unit pairs in the search subgraph are obtained based on the preset search order, and the search text unit set of each text unit is obtained based on the access order relationship and the semantic distance search range, so as to realize the process of deriving the text unit set similar to each text unit in turn according to the search method of semantic distance, so as to achieve a reasonable search based on the semantics of the text unit. The present application also screens the search text unit set based on the characteristics of the corresponding text unit in the process of obtaining the search text unit set, so as to obtain the final text unit set based on the set conditions, thereby improving the accuracy of the similar network subgraph search; at the same time, the above setting can also achieve the purpose of adjusting the search direction by setting conditions. The method of the present invention does not require a vectorization process and has no word order problem, reduces the information loss caused by training, and has the advantages of fast calculation speed and high accuracy.
[0043] Other features and advantages of the present invention will be described in the following description, and partly become apparent from the description, or understood by practicing the present invention. The purpose and other advantages of the present invention can be realized and obtained by the structures particularly pointed out in the description, claims and drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] The accompanying drawings are used to provide a further understanding of the present invention and constitute a part of the specification. Together with the embodiments of the present invention, they are used to explain the present invention and do not constitute a limitation of the present invention. In the accompanying drawings:
[0045] Figure 1 Shown is a flow chart of a similar network subgraph search method based on semantic distance described in an embodiment of the present application.
[0046] Figure 2 Shown is a schematic diagram of a search subgraph in the similar network subgraph search method based on semantic distance described in an embodiment of the present application.
[0047] Figure 3 Shown is a schematic diagram of another search subgraph in the similar network subgraph search method based on semantic distance described in an embodiment of the present application.
[0048] Figure 4 Shown is an example schematic diagram of an original text network subgraph and a similar network subgraph in the similar network subgraph search method based on semantic distance described in an embodiment of the present application.
[0049] Figure 5 Shown is a structural schematic diagram of a similar network subgraph search device based on semantic distance described in an embodiment of the present application.
[0050] Figure 6 Shown is a schematic diagram of the structure of the terminal described in an embodiment of the present application. DETAILED DESCRIPTION
[0051] The following will describe the implementation methods of the present invention in detail with reference to the accompanying drawings and embodiments, so that the implementation process of how the present invention applies technical means to solve technical problems and achieve technical effects can be fully understood and implemented accordingly. It should be noted that as long as there is no conflict, the various embodiments of the present invention and the various features in the embodiments can be combined with each other, and the technical solutions formed are all within the protection scope of the present invention.
[0052] It should be noted that the illustrations provided in the following embodiments are only schematic illustrations of the basic concept of the present application, and thus the drawings only show components related to the present application rather than being drawn according to the number, shape and size of components in actual implementation. In actual implementation, the type, quantity and proportion of each component may be changed at will, and the component layout may also be more complicated.
[0053] Data Curation refers to the activity of organizing and integrating data collected from different sources to establish a trustworthy data repository. It includes a series of activities throughout the entire life cycle of effective data management, such as collection, screening, evaluation, preservation, maintenance, and utilization. Data Curation can be done manually or processed by machines. The data quality after Data Curation is usually high.
[0054] A knowledge base is a tool for storing and managing knowledge, which can be used to support applications such as knowledge systems, knowledge discovery, and knowledge sharing. A knowledge base usually contains relevant information and data in a certain domain or subject, as well as knowledge representation forms such as rules, methods, and concepts. The knowledge base can be classified, organized, and retrieved according to a certain structure and semantics, thereby improving the comprehensibility, reusability, and interoperability of knowledge. Text units (i.e., tokens) include words, phrases, and sentences. In a knowledge base, they refer to objects and categories, that is, the words, phrases, and sentences that make them up. They can be specific token objects, such as "Cogito, ergo sum", "Homo homini lupus", "Knowledge is power", "NBA Finals Most Valuable Player Award", etc., or token categories, such as "NBA Finals", "Chinese actors", etc.
[0055] Entities are the basic elements in a knowledge base, which represent objects, events, situations, or concepts in the real world. Here, entities are a subset of tokens, which are some things in tokens that represent the real world.
[0056] Semantic distance refers to the concept used to measure the semantic similarity or difference between two words, phrases, or sentences in a semantic space. It can be used to complete tasks such as word sense disambiguation, text classification, and information retrieval.
[0057] Equivalents refer to a group of tokens that represent the same meaning, including a group of tokens with the same meaning in different languages. For example, "北大" and "北京大学" are equivalent, and the Chinese "北京大学" and the English "Peking University" are equivalent. Equivalents not only include synonyms but also other words that can achieve the same function or effect.
[0058] Connotation refers to the sum of the essential attributes of things reflected by a concept, that is, the content of the concept. It reveals the inherent characteristics and essence of the object to which the concept refers. Extension refers to the scope of objects that a concept refers to, that is, the specific things to which the concept applies. It reveals the breadth and boundaries of the concept in space and time. For example, the connotation of "commodity" is "labor products produced for exchange", and the extension of "commodity" is the class composed of various commodity objects.
[0059] The similar network subgraph search method based on semantic distance in this embodiment can be applied to the field of artificial intelligence, and further applied to machine translation, machine reading comprehension, question-answering system, and data retrieval of natural language processing in the field of artificial intelligence. The similar network subgraph search method based on semantic distance in this embodiment can also be applied to other suitable application fields, which are not specifically limited here.
[0060] The following embodiments of the present application provide a similar network subgraph search method and device based on semantic distance, a storage medium and a terminal, which are used to solve the problem that the current network subgraph search method relies on vector search, which not only requires a large amount of corpus data, but also requires control of the quality of the corpus data, and is prone to low accuracy of similar network subgraphs.
[0061] The following will describe in detail the principles and implementation methods of a similar network subgraph search method and device based on semantic distance, a storage medium and a terminal of this embodiment in conjunction with the accompanying drawings, so that those skilled in the art can understand the similar network subgraph search method and device based on semantic distance, a storage medium and a terminal of this embodiment without creative work.
[0062] like Figure 1 As shown, this embodiment provides a similar network subgraph search method based on semantic distance, including the following steps.
[0063] Step S101, obtain a reference network subgraph, obtain set connection edges between all text units in the reference network subgraph based on preset screening conditions, and connect all text units in the reference network subgraph into a search subgraph based on all set connection edges.
[0064] Specifically, the network subgraph used as a reference or retrieval condition is taken as the original network subgraph, and the original network subgraph is often composed of multiple text units. At the same time, the database used in the search process is set to be an inference database, and the inference database is a database obtained through data curation. Under normal circumstances, the text units in the original network subgraph may be text units in the inference database, or may not be text units in the inference database. If the text units in the original network subgraph are all text units in the inference database, the original network subgraph can be directly used as a reference network subgraph for search. If there are text units in the original network subgraph that are not text units in the inference database, it is necessary to convert the text units in the original network subgraph that do not belong to the inference database into the corresponding text units in the inference database based on the equivalent body mapping relationship of the text units in the inference database, and use the original network subgraph after the text unit conversion as the reference network subgraph.
[0065] Before the text unit conversion is realized based on the equivalent body mapping relationship of the text unit in the inference database, the language type of the text unit in the original network subgraph may be different from the language type of the inference database. In this case, in order to implement the subsequent search process, the text unit in the original network subgraph needs to be translated into the language type of the inference database. That is, for each text unit in the original network subgraph: first determine whether the language type of the text unit is the same as the language type of the inference database. If so, it does not need to be translated, otherwise it needs to be translated into the language type of the inference database.
[0066] At the same time, there may be polysemous words in the translation process. For example, the text unit "apple" can be translated as "apple" or "Apple Company". Therefore, when translating a text unit, it is necessary to first determine which word the text unit "apple" specifically refers to in the inference database. The specific determination process is: set the translation text of the text unit that is different from the language type of the inference database to the language type of the inference database as the mapping text unit, and then determine whether the mapping text unit corresponds to a single text unit in the inference database. If the mapping text unit corresponds to a single text unit in the inference database, the mapping text unit is used as the text unit for searching similar network subgraphs; if the mapping text unit corresponds to multiple text units in the inference database, it is necessary to select the text unit with the correct meaning from the multiple text units corresponding to the mapping text unit in the inference database based on the limiting features of the mapping text unit corresponding to the text unit before translation, so as to use it as the text unit for searching similar network subgraphs in the reference network subgraph. The text unit corresponding to the mapped text unit is defined as: the text unit identical to the mapped text unit in the inference database; if the text unit identical to the mapped text unit does not exist in the inference database, it can be determined whether there is a mapped text unit in the equivalent set corresponding to a certain text unit in the inference database. If so, the text unit corresponding to the equivalent set is used as the text unit corresponding to the mapped text unit.
[0067] For the mapping text units with polysemous words, the limiting features of this type of text units will be set when the original network subgraph is given, so that the text units corresponding to the corresponding mapping text units can be clarified based on the limiting features in the future. The limiting features can be attributes, types, etc. Any text unit with limiting features in the original network subgraph is set as a given text unit, and then the text units with correct meanings can be selected from multiple text units corresponding to the mapping text unit based on the limiting features of the given text unit. It can be set as: obtaining all the text units corresponding to the mapping text unit translated by the given text unit in the inference database, and then obtaining the knowledge structure corresponding to each text unit in the inference database as the comparison knowledge structure. Then determine which comparison knowledge structure among all the comparison knowledge structures contains the limiting features of the given text unit, and select the text units containing the above limiting features in the comparison knowledge structure as the text units with correct meanings corresponding to the mapping text unit translated by the given text unit. For example, for the text unit "apple", if the limiting feature is "company" and the knowledge structure of "Apple Company" contains the category "company", then the text unit "apple" refers to "Apple Company"; and if the limiting feature is "fruit" and the knowledge structure of "apple" contains the category "fruit", then the text unit "apple" refers to the fruit "apple".
[0068] The semantic distance between the text unit and the limiting feature can also be used to determine the text unit with the correct meaning referred to by the polysemous word. Specifically, all text units corresponding to the mapped text unit translated by the given text unit in the inference database are obtained, and then the semantic distance between each text unit and the limiting feature of the given text unit is calculated, and the text unit with the closest semantic distance to the limiting feature is selected from all the text units corresponding to the mapped text unit, as the text unit with the correct meaning corresponding to the mapped text unit translated by the given text unit. For example, determine whether "apple" is closer to the semantic distance of the company "google" or the semantic distance of the fruit "banana". If the semantic distance to "google" is close, then the text unit "apple" refers to "Apple Company"; otherwise, it refers to the fruit "apple".
[0069] By repeating the above process, all text units in the original network subgraph can be converted into text units in the inference database, that is, the reference network subgraph can be obtained.
[0070] After obtaining the reference network subgraph, all the set connection edges that can realize the connection between text units in the reference network subgraph can be obtained based on the preset screening conditions. The preset screening conditions specifically include at least one of the set conditions, and the set conditions specifically include: setting a connection edge between any two text units whose semantic distance between the two text units in the reference network subgraph is less than the preset threshold as the set connection edge; setting a connection edge between the set two text units as the set connection edge; deleting the set connection edge between the preset two text units. The above setting of the set connection edge based on the semantic distance can connect the text units in the reference network subgraph based on semantics to form a semantically related search path in the reference network subgraph. By setting the set connection edge semantically, there may be a situation where the text units in the reference network subgraph cannot form an overall network, or some or two types of text units need to be strongly associated. At this time, the above purpose can be achieved by setting the set connection edge between the set two text units. Similarly, if it is found through the above setting that the set connection edge is set between some text units that do not need to realize semantic association, the above purpose can be achieved by deleting the set connection edge between the preset two text units. It should be noted that the preset screening condition may also be set to other reasonable connection edge setting methods, and is not fixed here.
[0071] After obtaining all the set connection edges in the reference network subgraph, all the text units in the reference network subgraph can be connected into a search subgraph based on all the set connection edges.
[0072] Step S102, obtaining a search text unit set of a target text unit in a search subgraph in an inference database, and based on the search text unit set of the target text unit, obtaining a search text unit set of all text units in the search subgraph in an inference database along a preset search order through a preset search set acquisition method.
[0073] Specifically, a preset search order for all text units in the search subgraph can be obtained by depth-first search, breadth-first search or random walk, and then all adjacent text unit pairs with a sequential visit relationship in the search subgraph can be obtained based on the preset search order and the set connecting edges in the search subgraph. Figure 2 FIG. 1 shows a schematic diagram of a search subgraph in the present application. Figure 2 Taking the search subgraph shown as an example, based on the depth-first search method, it can be known that the preset search order should be: ABDGCEFH; along the preset search order, the adjacent text unit pairs with a sequential access relationship in the search subgraph obtained based on the set connection edges are: (A, B), (B, D), (D, G), (A, C), (C, E), (C, F), (F, H). Based on the breadth-first search method, it can be known that the preset search order should be: ABCDEFGH; along the preset search order, the adjacent text unit pairs with a sequential access relationship in the search subgraph obtained based on the set connection edges are: (A, B), (A, C), (B, D), (C, E), (C, F), (D, G), (F, H). The preset search order obtained based on the random walk method can be: ABDGC-FHE; along the preset search order, the adjacent text unit pairs with a sequential access relationship in the search subgraph obtained based on the set connection edge are: (A, B), (B, D), (D, G), (A, C), (C, F), (F, H), (C, E). This embodiment can also obtain the preset search order through other reasonable methods, which are not exhaustive here.
[0074] On the other hand, the present embodiment can also obtain a preset search order based on the search link. Specifically, any text unit in the search subgraph is used as the target text unit, and multiple search links are obtained with the target text unit as the path acquisition starting point. The specific process can be: taking the target text unit as the starting point to obtain the first search link, the search link contains as many text units as possible; then taking the bifurcation point between the first search link and other links as the starting point, obtain other search links, each link contains as many text units as possible; and so on, until all search links are obtained, and in the process of obtaining each link, the text units contained must be as many as possible; then all the obtained search links are sorted to obtain the preset search order. It can be seen from the above process that the target text unit is at least the starting point of the first search link, but it is not necessarily the starting point of each search link. For example Figure 3 In the search subgraph shown, the black dots represent text units, and the lines between the black dots represent the set connection edges. The search subgraph includes text units A1 to A10. If text unit A1 is set as the target text unit, the first search link is composed of text units A1 to A6, text units A3, A7 and A8 constitute the second search link, and text units A3, A9 and A10 constitute the third search link. At this time, the preset search order can be: the text units on the first search link, the text units on the third search link, and the text units on the second search link are obtained in sequence; other link arrangements can also be used, which are not exhaustively listed here.
[0075] All the search links obtained above are connected by text units but do not overlap, and all the search links above must satisfy the purpose of including all text units in the reference network subgraph, that is, all search links must include all text units in the reference network subgraph to avoid the problem of not obtaining the corresponding search text unit set due to some text units not being added to the search link.
[0076] After obtaining the preset search order, the search starting point of each search link can be obtained along the preset search order, that is, the text unit on the preset search order is judged in turn whether it is in the search link to which it belongs, and the text unit closest to the target text unit is moved along the set connection edge. If so, the point is determined to be the search starting point of the search link to which it belongs. For example, the search link includes text unit A, text unit B and text unit C. Text unit A needs to pass through 3 text units to move to the target text unit along the set connection edge, text unit B needs to pass through 4 text units to move to the target text unit along the set connection edge, and text unit C needs to pass through 5 text units to move to the target text unit along the set connection edge; at this time, text unit A is set as the starting text unit of the search link. Then, based on the search starting point of each search link, all adjacent text unit pairs with a sequential access relationship in the search subgraph are obtained. For example, the search starting point (i.e., target text unit) of the first search link is text unit A1, and the adjacent text unit pairs with a sequential access relationship obtained along the search link include: (A1, A2), (A2, A3), (A3, A4), (A4, A5), (A5, A6). The corresponding adjacent text unit pairs are obtained for other search links in the same way, and all adjacent text unit pairs with a sequential access relationship in the search subgraph can be obtained.
[0077] After obtaining all adjacent text unit pairs with a sequential access relationship in the search subgraph through the above two methods, all adjacent text unit pairs in the search subgraph can be searched through the sequential access search method. Specifically, the search text set of the target text unit is first obtained in a certain way. The search text set of the target text unit can be obtained by directly setting it or by other reasonable forms. There is no fixed restriction on it here. A specific way to obtain the search text set of the target text unit is to obtain the similar semantic distance threshold of the target text unit, and then obtain all text units in the inference database that are within the range of the similar semantic distance threshold from the target text unit, and collect all the obtained text units into the search text unit set of the target text unit.
[0078] After obtaining the search text unit set of the target text unit, all adjacent text unit pairs in the search subgraph are searched by accessing the sequential search method to obtain the search text unit set of all text units in the search subgraph in the inference database. Specifically, the method includes: when processing the adjacent text unit pairs by accessing the sequential search method, it is required to satisfy that the first accessed text unit in the adjacent text unit pair has obtained the corresponding search text unit set. That is, the text unit in the adjacent text unit pair that has obtained the corresponding search text unit set is taken as the first accessed text unit, and the text unit in the adjacent text unit pair that has not obtained the corresponding search text unit set is taken as the second accessed text unit. The semantic distance search range is determined based on the semantic distance between the first accessed text unit and the second accessed text unit. All text units in the search text unit set of the first accessed text unit are taken as the search text units, and then for each search text unit, all text units in the inference database within the semantic distance search range of the search text unit are set as the search text unit subset of the search text unit, that is, the search text unit subsets corresponding to all search text units are obtained. Finally, all the obtained search text unit subsets are merged and used as the search text unit set of the second accessed text unit.
[0079] In the above process, if the semantic distance between the first-visited text unit and the second-visited text unit is directly used as the semantic distance search range, then when obtaining the search text unit subset corresponding to the search text unit based on the semantic distance search range, there may be a problem that the set is empty or the number of text units in the set is too small. Therefore, it is necessary to set an error range parameter to assist the semantic distance between the first-visited text unit and the second-visited text unit to set the semantic distance search range, so as to determine a suitable semantic distance search range based on the specific situation of the search text unit subset corresponding to the search text unit. In the process of obtaining the search text unit subset corresponding to a certain search text unit, the specific setting process of the semantic distance search range is: first, the semantic distance between the first-visited text unit and the second-visited text unit is used as the semantic distance search range, and the search text unit subset corresponding to the search text unit is obtained based on the current semantic distance search range; then, it is determined whether the number of text units in the current search text unit subset is less than a preset threshold value. If the number of text units in the current search text unit subset is less than the preset threshold value, the current semantic distance search range is increased by a step distance to form a new semantic distance search range, and then the search text unit subset corresponding to the search text unit is obtained based on the new semantic distance search range, and the above determination process is repeated until it is determined that the number of text units in the current search text unit subset is not less than the preset threshold value, or the current semantic distance search range is equal to or greater than the range maximum value (the range maximum value is the sum of the semantic distance between the first-visited text unit and the second-visited text unit and the error range parameter); if the number of text units in the current search text unit subset is not less than the preset threshold value, the current search text unit subset can be used as the search text unit subset corresponding to the search text unit. The final semantic distance search range corresponding to all search text units in the search text unit set of the first access text unit can be determined in the above manner.
[0080] It should be noted that, in order to improve the search accuracy of similar network subgraphs, this embodiment can also filter the search text unit set of the text unit by the set search features when obtaining it. Specifically, the search features of the later-visited text unit in the adjacent text unit pair are first obtained, and then after obtaining the final search text unit subset of each search text unit, the text units in all search text unit subsets can be filtered based on the search features of the later-visited text unit to obtain the filtered search text unit subset; finally, all the filtered search text unit subsets are merged to serve as the search text unit set of the later-visited text unit. The target text unit can also be set with a corresponding search feature. When obtaining the search text unit set of the target text unit based on the similar semantic distance threshold, the obtained search text unit set can be filtered based on the search features corresponding to the target text unit to obtain the final search text unit set of the target text unit.
[0081] The search feature of the post-visit text unit can be obtained synchronously when the original network subgraph is obtained. The search feature of the post-visit text unit can be a preset text unit corresponding to the post-visit text unit, that is, a certain text unit is set as the search feature of the post-visit text unit; the search feature of the post-visit text unit can also be set as a preset attribute or preset classification of the post-visit text unit. The preset attribute is an explicit definition or an intensional definition, and the preset classification is an extensional definition. For example, the preset classification of South Korea can be a country or a location in Southeast Asia.
[0082] In the above-mentioned process of searching all adjacent text unit pairs in the search subgraph by the first-visit search method, when a certain text unit is used as a later-visited text unit in multiple adjacent text unit pairs (that is, when the text unit includes multiple first-visited text units), the search text unit sets obtained by the text unit based on each pair of adjacent text unit pairs are set as pre-search text unit sets, and then the intersection of all pre-search text unit sets of the text unit is taken as the search text unit set of the text unit.
[0083] Step S103, based on the search text unit set of all text units in the reference network subgraph, all similar network subgraphs of the reference network subgraph are obtained.
[0084] A similar network subgraph of the reference network subgraph can be formed by selecting a text unit from the search text unit set of each text unit of the reference network subgraph along a preset order, and all similar network subgraphs of the reference network subgraph can be obtained in the above manner. It should be noted that in order to avoid repeated acquisition of similar network subgraphs, it is necessary to set the specific text unit contents contained in any two similar network subgraphs of the reference network subgraph to be different. At the same time, the following settings must be met in the text unit selection process: the first accessed text unit in any adjacent text unit pair in the reference network subgraph is set as the first text unit to be selected, and the second accessed text unit is set as the second text unit to be selected, and assuming that the text unit selected from the search text unit set of the first text unit to be selected is the prior text unit, then when selecting a text unit from the search text unit set of the second text unit to be selected, it must be satisfied that the selected text unit belongs to the search text unit subset of the prior text unit. For example, the search text unit set X1 of text unit A is [text unit x11, text unit x12], and the search text unit set X2 of text unit B is [text unit x21, text unit x22]. Text unit A and text unit B form an adjacent text unit pair (A, B). Text unit A is set as the first text unit to be selected, and text unit B is set as the second text unit to be selected. When the text unit selected from the search text unit set X1 of text unit A to form a similar network subgraph is text unit x11, when selecting a text unit to form a similar network subgraph from the search text unit set X2 of text unit B, it must be satisfied that the selected text unit, for example, text unit x21 belongs to the search text unit subset of text unit x11. Similarly, when the text unit x12 is selected from the search text unit set X1 of text unit A to form a similar network subgraph, then when the text unit x2 is selected from the search text unit set X2 of text unit B to form a similar network subgraph, it must be satisfied that the selected text unit, for example, text unit x22 belongs to the search text unit subset of text unit x12.
[0085] For the scheme of obtaining a preset search order in the form of search links, based on the search text unit set of all text units in the reference network subgraph, the process of obtaining all similar network subgraphs of the reference network subgraph can also be: because all search links have all text units in the reference network subgraph, when forming a similar network subgraph of the reference network subgraph, all search sets corresponding to each search link need to be combined with all search sets corresponding to other search links to form a similar network subgraph.
[0086] The specific similar network subgraph acquisition process is: for each search link, a text unit is selected from the search text unit set of each text unit in turn along the search direction of the search link to form the search set of the search link. It should be noted that in the search set, between all two adjacent text units along the search direction, the next text unit belongs to the search text unit subset of the previous text unit. For example, suppose that the search link L1 includes text unit A-text unit B-text unit; the search text unit set X1 of text unit A = [text unit x11, text unit x12], the search text unit subset about text unit B obtained based on the search text unit set of text unit A is X1 includes Ux11 = [text unit x21], Ux12 = [text unit x22], that is, the search text unit set of text unit B is X2 = [text unit x21, text unit x22]; the search text unit subset about text unit C obtained based on the search text unit set X2 of text unit B includes Ux21 = [text unit x31], Ux22 = [text unit x32], that is, the search text unit set of text unit C is X3 = [text unit x31, text unit x32]; since text unit x31 belongs to the search text unit subset including Ux21, and text unit x21 belongs to the search text unit subset Ux11, therefore a search set Ux11 of the search link L1 is L1,1 =[text unit x11, text unit x21, text unit x31], and similarly, we can know that another search set U for the search link L1 L1,2 =[text unit x12, text unit x22, text unit x32]; therefore, the search set corresponding to the search link L1 is the search set U L1,1 and search set U L1,2 .
[0087] By using the above method, all search sets of each search link can be obtained, and then a search set is obtained from all search sets of each search link and merged to obtain a similar network subgraph of a reference network subgraph; by using the above method, all similar network subgraphs of the reference network subgraph can be obtained. It should be noted that the specific text unit content contained in all similar network subgraphs is different. Figure 4 An example diagram of an original network subgraph and a similar network subgraph.
[0088] In order to explain in detail the similar network subgraph search method based on semantic distance in this embodiment, a specific example of obtaining a preset search order by searching for links is used for explanation below.
[0089] Assume that the original network subgraph includes text unit a1 = "China", text unit a2 = "Beijing" and text unit a3 = "Tsinghua University". Since the text units in the original network subgraph are all text units in the inference database, the original network subgraph is the reference network subgraph. And set text unit a1 as the target text unit, and the similar semantic distance threshold of the target text unit D = 0.5.
[0090] The preset screening condition is set as follows: a connection edge is set between two text units in the reference network subgraph whose semantic distance is less than a preset threshold as a set connection edge. Based on the preset screening condition, it is found that a set connection edge needs to be set between text units a1 and a3 in the reference network subgraph, and a set connection edge needs to be set between text units a2 and a3. Text units a1, a2 and a3 are connected to form a search subgraph. And there is only one search link L1 a1- a2- a3 in the search subgraph. The order of text units in the search link L1 is the preset search order.
[0091] Based on the text unit a1 and the similar semantic distance threshold D, all text units whose semantic distance from the text unit a1 is within the range of D can be obtained, and they are grouped into the search text unit set X1=["Shanghai", "Nanjing", "Japan", "Korea", ...] of the text unit a1. Since the feature of the target text unit is "country", the search text unit set X1=["Japan", "Korea", ...] of the target text unit after screening by this feature.
[0092] For the adjacent text unit pair formed by text unit a1 and text unit a2 in the search link L1, the semantic distance d1 between text unit a1 and text unit a2 is calculated, and the corresponding semantic distance search range d1+e1 is obtained based on the semantic distance d1. For "Japan" in the search text unit set X1, all text units within the range of d1+e1 are obtained to form a search text unit subset ["Tokyo", "Osaka", "Nagoya", ...], and since the search feature of text unit a2 is "capital", the search text unit subset corresponding to "Japan" after screening is ["Tokyo"]; for "Korea" in the search text unit set X1, all text units within the range of d1+e1 are obtained to form a search text unit subset ["Seoul", "Pusan", "Inchon", ...], and since the search feature of text unit a2 is "capital", the search text unit subset corresponding to "Korea" after screening is ["Seoul"]; and so on. From the above, we can deduce that the search text unit set X2 of the text unit a2 is [“Tokyo”, “Seoul”, …].
[0093] Since the search text unit set of the known text unit a2 is known above, the search text unit set of the text unit a3 can be searched based on the adjacent text unit pairs formed by the text unit a2 and the text unit a3 in the search link L1. The semantic distance d2 between the text unit a2 and the text unit a3 is calculated, and the corresponding semantic distance search range d2+e2 is obtained based on the semantic distance d2. Since the search feature of the text unit a3 is "school", the search text unit subset corresponding to "Tokyo" in the search text unit set X2 after screening is ["Waseda University", "University ofTokyo", ...]; the search text unit subset corresponding to "Seoul" in the search text unit set X2 after screening is ["Seoul National University", "Korea University", ...]; and so on. Therefore, it can be deduced that the search text unit set X3 of the text unit a3 is ["Waseda University", "University of Tokyo", "Seoul National University", "Korea University", ...].
[0094] The similar network subgraphs of the reference network subgraph obtained based on the search text unit set X1 of the text unit a1, the search text unit set X2 of the text unit a2, and the search text unit set X3 of the text unit a3 are:
[0095] ["Japan", "Tokyo", "Waseda University",...];
[0096] ["Japan", "Tokyo", "University of Tokyo",...];
[0097] ["Korea","Seoul","Seoul National University",...];
[0098] ["Korea", "Seoul", "Korea University",...] etc.
[0099] The similar network subgraph search method based on semantic distance in this embodiment can also be applied to the partial text unit completion operation in a given network subgraph. For example, given a network subgraph:
[0100] A=["China","Beijing",A3="?",]
[0101] B=[B1=“?”,“Tokyo”,“Waseda University”] ,
[0102] C=["Japan","Tokyo",C3=""],
[0103] D=[D1=“?”,“Seoul”,“Seoul National University”],
[0104] E=[E1=“?”,E2=“?”,“Korea University”]
[0105] Based on network subgraph A and network subgraph C, it can be searched that the search feature of the first text unit of the above network subgraph should be "country", based on network subgraph A and network subgraph D, it can be searched that the search feature of the second text unit of the above network subgraph should be "capital", and based on network subgraph B and network subgraph D, it can be searched that the search feature of the third text unit of the above network subgraph should be "university". Taking the partial network subgraph Ua=[“China”, “Beijing” ] in the network subgraph A as the reference network subgraph, the partial network subgraph Ub=[ B1=“?”, “Tokyo” ] in the network subgraph B is searched. Specifically, the semantic distance search range da+ea is obtained based on the semantic distance da between the text unit “China” and the text unit “Beijing”. Therefore, the search text unit subset of the text unit “Tokyo” is obtained based on the semantic distance search range da+ea. Then, the search text unit subset of “Tokyo” is filtered based on the search feature “country” of the text unit “China”, so that the search text unit set of “Tokyo” only includes the text unit “Japan”. Therefore, it is deduced that B1 in the network subgraph B is “Japan”.
[0106] By performing the remaining text unit filling operation on the given network subgraph in the above manner, the given network subgraph can be obtained as follows:
[0107] A=["China","Beijing",A3="Tsinghua University",]
[0108] B=[B1=“Japan”,“Tokyo”,“Waseda University”] ,
[0109] C=["Japan","Tokyo",C3="University of Tokyo"],
[0110] D=[D1=“Korea”,“Seoul”,“Seoul National University”],
[0111] E=[E1=“Korea”,E2=“Seoul”,“Korea University”] etc.
[0112] The similar network subgraph search method based on semantic distance provided by the embodiment of the present invention determines the set connection edge in the reference network subgraph by semantic distance or set conditions, so as to connect the text units with similar characteristics in the reference network subgraph to form a search subgraph; obtains the preset search order by depth-first search, breadth-first search, random walk and search link; obtains all adjacent text unit pairs in the search subgraph based on the preset search order, and obtains the search text unit set of each text unit based on the sequential access relationship and the semantic distance search range, so as to realize the process of deriving the text unit set similar to each text unit in turn according to the search method of semantic distance, so as to achieve the reasonable search process based on the semantics of the text unit. The present application also screens the search text unit set based on the characteristics of the corresponding text unit in the process of obtaining the search text unit set, so as to obtain the final text unit set based on the set conditions, and improve the accuracy of the similar network subgraph search; at the same time, the above setting can also achieve the purpose of adjusting the search direction by setting conditions. The method of the present invention does not require a vectorization process and has no word order problem, reduces the information loss caused by training, and has the advantages of fast calculation speed and high accuracy.
[0113] refer to Figure 5 As shown, an embodiment of the present application also provides a similar network subgraph search device based on semantic distance, including a search subgraph acquisition module, a search text unit set acquisition module and a similar network subgraph acquisition module.
[0114] The search subgraph acquisition module is used to acquire a reference network subgraph, acquire set connection edges between all text units in the reference network subgraph based on preset screening conditions, and connect all text units in the reference network subgraph into a search subgraph based on all set connection edges.
[0115] The search text unit set acquisition module is used to obtain the search text unit set of the target text unit in the search subgraph in the inference database. Based on the search text unit set of the target text unit, the search text unit set of all text units in the search subgraph in the inference database is obtained along a preset search order through a preset search set acquisition method.
[0116] The similar network subgraph acquisition module is used to acquire all similar network subgraphs of the reference network subgraph based on the search text unit set of all text units in the reference network subgraph.
[0117] Among them, the target text unit is any text unit in the reference network subgraph.
[0118] The similar network subgraph search device based on semantic distance provided by the embodiment of the present invention determines the set connection edge in the reference network subgraph by semantic distance or set conditions, so as to connect the text units with similar characteristics in the reference network subgraph to form a search subgraph; obtains the preset search order by depth-first search, breadth-first search, random walk, and search link; obtains all adjacent text unit pairs in the search subgraph based on the preset search order, and obtains the search text unit set of each text unit based on the sequential access relationship and the semantic distance search range, so as to realize the process of deriving the text unit set similar to each text unit in turn according to the search method of semantic distance, so as to achieve the reasonable search process based on the semantics of the text unit. The present application also screens the search text unit set based on the characteristics of the corresponding text unit in the process of obtaining the search text unit set, so as to obtain the final text unit set based on the set conditions, thereby improving the accuracy of the similar network subgraph search; at the same time, the above setting can also achieve the purpose of adjusting the search direction by setting conditions. The device of the present invention does not require a vectorization process and has no word order problem, reduces the information loss caused by training, and has the advantages of fast calculation speed and high accuracy.
[0119] The embodiment of the present application also provides a computer-readable storage medium. A person of ordinary skill in the art can understand that all or part of the steps in the above-mentioned embodiment method can be completed by instructing the processor through a program, and the program can be stored in a computer-readable storage medium, and the storage medium is a non-transitory medium, such as a random access memory, a read-only memory, a flash memory, a hard disk, a solid-state hard disk, a magnetic tape, a floppy disk, an optical disc, and any combination thereof. The above-mentioned storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server or a data center that includes one or more available media integrated. The available medium can be a magnetic medium (for example, a floppy disk, a hard disk, a tape), an optical medium (for example, a digital video disc (DVD)), or a semiconductor medium (for example, a solid-state disk (SSD)), etc.
[0120] like Figure 6 As shown, an embodiment of the present application provides a terminal.
[0121] The terminal of this embodiment includes a processor and a memory connected to each other; the memory is used to store computer programs, and the processor is used to execute the computer programs stored in the memory, so that all or part of the steps in the method of the above embodiment can be implemented when the terminal executes.
[0122] The beneficial effects of all or part of the steps of the method in the above embodiment are the same as the beneficial effects obtained by applying the terminal provided by the embodiment of the present invention, and will not be described in detail here.
[0123] It should be noted that the memory may include random access memory (RAM) and may also include non-volatile memory, such as at least one disk storage. Similarly, the processor may also be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it may also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components.
[0124] Although the embodiments disclosed in the present invention are as above, the contents described are only embodiments adopted for facilitating the understanding of the present invention and are not intended to limit the present invention. Any technician in the technical field to which the present invention belongs can make any modifications and changes in the form and details of the implementation without departing from the spirit and scope disclosed in the present invention, but the protection scope of the present invention shall still be subject to the scope defined in the attached claims.
Claims
1. A similar network subgraph search method based on semantic distance, comprising: Obtain a reference network subgraph, obtain set connection edges between all text units in the reference network subgraph based on a preset screening condition, and connect all text units in the reference network subgraph into a search subgraph based on all the set connection edges; Obtain a search text unit set of a target text unit in the search subgraph in an inference database, and based on the search text unit set of the target text unit, obtain a search text unit set of all text units in the search subgraph in an inference database along a preset search order using a preset search set acquisition method; Based on the search text unit set of all the text units in the reference network subgraph, all similar network subgraphs of the reference network subgraph are obtained; Wherein, the target text unit is any text unit in the reference network subgraph; when the preset search order of all text units in the search subgraph is obtained by a depth-first search method, a breadth-first search method or a random walk method; Based on the search text unit set of the target text unit, obtaining the search text unit set of all text units in the search subgraph in the inference database along a preset search order by a preset search set acquisition method includes: Acquire all adjacent text unit pairs having a sequential access relationship in the search subgraph based on the preset search order and the set connection edges in the search subgraph; Based on the search text unit set of the target text unit, all adjacent text unit pairs in the search subgraph are searched by accessing the search subgraph in a sequential search manner to obtain the search text unit set of all text units in the search subgraph in the inference database; When all search links in the search subgraph are obtained along each set connection edge with the target text unit as the path acquisition starting point, the number of text units on the search link obtained first is as large as possible, and all the search links are sorted to obtain a preset search order; Based on the search text unit set of the target text unit, obtaining the search text unit set of all text units in the search subgraph in the inference database along a preset search order by a preset search set acquisition method includes: Acquire the search starting point of each search link along the preset search order, the search starting point of the search link being the text unit in the search link that is closest to the target text unit along the set connection edge; Based on the search starting point of each search link, all adjacent text unit pairs with a sequential access relationship in the search subgraph are obtained, and based on the search text unit set of the target text unit, all adjacent text unit pairs in the search subgraph are searched by a sequential access search method to obtain the search text unit set of all text units in the search subgraph in the inference database; Based on the search text unit set of all the text units in the reference network subgraph, obtaining all similar network subgraphs of the reference network subgraph comprises: By selecting one text unit from the search text unit set of each text unit of the reference network subgraph along the preset search order to form a similar network subgraph, all similar network subgraphs of the reference network subgraph are obtained.
2. The search method according to claim 1, characterized in that: The access order search method includes: The text unit in the adjacent text unit pair that has obtained the corresponding search text unit set is used as the first visited text unit, and the text unit in the adjacent text unit pair that has not obtained the corresponding search text unit set is used as the second visited text unit, and a semantic distance search range is obtained based on the semantic distance between the first visited text unit and the second visited text unit; All text units in the search text unit set of the first-accessed text unit are taken as search text units, all text units in the inference database that are within the semantic distance search range of each of the search text units are grouped as search text unit subsets corresponding to the search text units, and all the search text unit subsets are grouped as the search text unit set of the later-accessed text unit.
3. The search method according to claim 2, characterized in that: The search text unit set that combines all the search text unit subsets into the post-access text unit includes: Acquire the search feature of the post-access text unit, filter all text units in the search text unit subset based on the search feature to obtain a filtered search text unit subset, and combine all the filtered search text unit subsets into a search text unit set of the post-access text unit; The search feature of the later accessed text unit is a preset text unit corresponding to the later accessed text unit or a preset attribute or preset category of the later accessed text unit.
4. The search method according to claim 3, characterized in that: Any two similar network subgraphs of the reference network subgraph are different from each other. In any adjacent text unit pair in the reference network subgraph, the first-visited text unit is set as the first text unit to be selected, and the second-visited text unit is set as the second text unit to be selected. If the text unit selected from the search text unit set of the first text unit to be selected is the prior text unit, then when selecting a text unit from the search text unit set of the second text unit to be selected, it must be satisfied that the selected text unit belongs to the search text unit subset of the prior text unit.
5. The search method according to claim 2, characterized in that: When the text unit includes multiple pre-accessed text units, the search text unit sets obtained based on each pair of adjacent text units are all pre-search text unit sets, and the intersection of all pre-search text unit sets of the text unit is the search text unit set of the text unit.
6. The search method according to claim 1, characterized in that: The preset screening condition includes at least one of the set conditions, and the set condition includes: Setting a connection edge between two text units in the reference network subgraph whose semantic distance is less than a preset threshold as a set connection edge; A connection edge is set between two text units as a set connection edge; Deletes the default connection edge between two text units.
7. A similar network subgraph search device based on semantic distance, characterized in that: It includes a search subgraph acquisition module, a search text unit set acquisition module and a similar network subgraph acquisition module; The search subgraph acquisition module is used to acquire a reference network subgraph, acquire set connection edges between all text units in the reference network subgraph based on a preset screening condition, and connect all text units in the reference network subgraph into a search subgraph based on all the set connection edges; The search text unit set acquisition module is used to acquire the search text unit set of the target text unit in the search subgraph in the inference database, and based on the search text unit set of the target text unit, acquire the search text unit set of all text units in the search subgraph in the inference database along a preset search order through a preset search set acquisition method; The similar network subgraph acquisition module is used to acquire all similar network subgraphs of the reference network subgraph based on the search text unit set of all the text units in the reference network subgraph; Wherein, the target text unit is any text unit in the reference network subgraph; When a preset search order of all text units in the search subgraph is obtained by a depth-first search method, a breadth-first search method or a random walk method; Based on the search text unit set of the target text unit, obtaining the search text unit set of all text units in the search subgraph in the inference database along a preset search order by a preset search set acquisition method includes: Acquire all adjacent text unit pairs having a sequential access relationship in the search subgraph based on the preset search order and the set connection edges in the search subgraph; Based on the search text unit set of the target text unit, all adjacent text unit pairs in the search subgraph are searched by accessing the search subgraph in a sequential search manner to obtain the search text unit set of all text units in the search subgraph in the inference database; When all search links in the search subgraph are obtained along each set connection edge with the target text unit as the path acquisition starting point, the number of text units on the search link obtained first is as large as possible, and all the search links are sorted to obtain a preset search order; Based on the search text unit set of the target text unit, obtaining the search text unit set of all text units in the search subgraph in the inference database along a preset search order by a preset search set acquisition method includes: Acquire the search starting point of each search link along the preset search order, the search starting point of the search link being the text unit in the search link that is closest to the target text unit along the set connection edge; Based on the search starting point of each search link, all adjacent text unit pairs with a sequential access relationship in the search subgraph are obtained, and based on the search text unit set of the target text unit, all adjacent text unit pairs in the search subgraph are searched by a sequential access search method to obtain the search text unit set of all text units in the search subgraph in the inference database; Based on the search text unit set of all the text units in the reference network subgraph, obtaining all similar network subgraphs of the reference network subgraph comprises: By selecting one text unit from the search text unit set of each text unit of the reference network subgraph along the preset search order to form a similar network subgraph, all similar network subgraphs of the reference network subgraph are obtained.
8. A storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the similar network subgraph search method based on semantic distance described in any one of claims 1 to 6 is implemented.
9. A terminal, characterized in that: include: A processor and a memory, wherein the memory is communicatively connected to the processor; The memory is used to store a computer program, and the processor is used to execute the computer program stored in the memory, so that the terminal performs the similar network subgraph search method based on semantic distance as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Network structure construction method and device for multi-task scene
CN111666763A
Text unit reasoning method and device based on semantic distance, storage medium and terminal
CN117973544A
Cited By
Graph similarity search method based on sub-graph matching
CN119415744A
A subgraph matching based graph similarity search method
CN119415744B