A question-answering search method, system, device and medium based on knowledge graph
By classifying and mapping entity nodes in the knowledge graph, matching and generating candidate paths, the problem of poor generalization ability of knowledge graph search in the existing technology is solved, more flexible user query matching is achieved, and the user experience is improved.
Patent Information
- Application Number
- CN202210593748.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-27
- Publication Date
- 2024-09-13
- Estimated Expiration
- 2042-05-27
AI Technical Summary
Existing knowledge graph search methods have poor generalization capabilities and cannot effectively match users' non-standard question queries.
Classify the entity nodes in the knowledge graph through preset business attribution, establish the mapping relationship between entity nodes and entity identifiers, obtain the entities in the query text, match the entity nodes in the knowledge graph, determine the business attribution, generate candidate paths, and pass The matching model compares the candidate path with the query text and outputs the matching candidate text.
It enhances the generalization performance of search, can match more flexible user questions, and improves user experience.
Smart Images

Figure CN114911915B
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence, and in particular to a question-and-answer search method, system, device, and medium based on a knowledge graph. Background Art
[0002] At this stage, data is the primary productive force. Every company and enterprise will accumulate a large amount of data during its development. The potential value of data itself is also enormous. With the advancement of science and technology and the continuous development of intelligent robots, how to make intelligent robots more intelligent is undoubtedly the top priority of the industry. Knowledge graph, as one of the brains of intelligent robots, how to effectively mine and utilize the knowledge in the knowledge graph is also a major problem at present.
[0003] The existing methods use retrieval to accurately retrieve nodes in the knowledge graph, and then integrate the answer body into a complete sentence based on the attributes and names of the returned nodes to output the answer. The disadvantage of this type of method is that the generalization ability is very poor. In actual scenarios, users' questions will definitely not be executed according to the standard, so this method has great limitations.
[0004] Application Contents
[0005] In view of the above problems existing in the prior art, the present application proposes a question-answering search method, system, device and medium based on knowledge graph, which mainly solves the problem of poor generalization ability of existing knowledge graph search methods.
[0006] In order to achieve the above-mentioned purpose and other purposes, the technical solution adopted in this application is as follows.
[0007] This application provides a question-answering search method based on a knowledge graph, including:
[0008] Classify the entity nodes in the preset knowledge graph according to the preset business attribution, obtain the entity identifier and establish a mapping relationship between the entity node and the entity identifier;
[0009] Obtaining a query entity in the query text, matching entity nodes in the knowledge graph according to the query entity to obtain matching nodes, wherein the matching nodes include one or more;
[0010] Determine the business affiliation of the matching node according to the mapping relationship between the entity node and the entity identifier, and determine the entity node and attribute node connected to the matching node according to the business affiliation to obtain a candidate path;
[0011] Generate candidate texts according to the candidate paths, compare the candidate texts with the query texts, and output matching candidate texts.
[0012] In an embodiment of the present application, the entity nodes in the preset knowledge graph are classified according to the preset business attribution, the entity identifiers are obtained, and a mapping relationship between the entity nodes and the entity identifiers is established, including:
[0013] Compare the entity node in the knowledge graph with the business vocabulary in the preset business dictionary to obtain the business vocabulary matching the entity node;
[0014] The business attribution of the matched business vocabulary is determined according to the preset index information of each business vocabulary in the business dictionary as the entity identifier of the entity node.
[0015] In an embodiment of the present application, obtaining a query entity in a query text includes:
[0016] Segmenting the query text according to preset business scenario vocabulary to obtain multiple query words;
[0017] The query word is input into a preset named entity recognition model to obtain the query entity.
[0018] In one embodiment of the present application, matching entity nodes in the knowledge graph according to the query entity to obtain matching nodes includes:
[0019] Obtaining historical access records of each user, and determining words with a usage frequency higher than a set threshold as high-frequency words according to the historical access records;
[0020] The knowledge graph is screened according to the high-frequency words to determine the boundary of the knowledge graph, and the query entity is matched with the entity node in the screened knowledge graph to obtain the matching node.
[0021] In an embodiment of the present application, determining the entity node and the attribute node connected to the matching node according to the service attribution to obtain the candidate path includes:
[0022] When the matching node is a single node or corresponds to the same business, the knowledge graph is traversed to obtain attribute nodes having an attribute relationship with the matching node, a subgraph relationship including the matching node is obtained, and the nodes in the subgraph relationship and the attributes corresponding to the nodes are used as candidate paths;
[0023] When the matching node contains multiple different business attributes, the matching nodes are associated, and the matching subgraph relationship in the knowledge graph is obtained based on the associated matching nodes, and a candidate path is generated according to the subgraph relationship.
[0024] In an embodiment of the present application, generating candidate texts according to the candidate paths, comparing the candidate texts with the query texts, and outputting matching candidate texts include:
[0025] Converting the nodes and node attributes in the candidate path into standard text as the candidate text;
[0026] Inputting the candidate text and the query text into a preset matching model to obtain the similarity between each candidate text and the query text;
[0027] The candidate texts are sorted from high to low according to the similarity, and the candidate texts ranked first are output as matching candidate texts.
[0028] In one embodiment of the present application, the matching model includes at least two input paths, an attention layer, a pooling layer, a fusion layer, and a similarity calculation network;
[0029] Each of the input paths includes at least one recurrent network layer for obtaining sequence information of the input text and one convolutional network layer for obtaining keyword information in the input text, and the input text is encoded serially through the recurrent network layer and the convolutional network layer in sequence;
[0030] The output sequence obtained after each input path encodes its own input text is passed through the attention layer, pooling layer, fusion layer and similarity calculation network in sequence to obtain the similarity of the input texts of the two input paths.
[0031] The present application also provides a question-answering search system based on a knowledge graph, comprising:
[0032] A graph mapping module is used to classify entity nodes in a preset knowledge graph according to preset business attribution, obtain entity identifiers and establish a mapping relationship between entity nodes and entity identifiers;
[0033] A query matching module, used to obtain a query entity in a query text, and match entity nodes in the knowledge graph according to the query entity to obtain a matching node, wherein the matching node includes one or more nodes;
[0034] A candidate matching module, used to determine the business attribution of the matching node according to the mapping relationship between the entity node and the entity identifier, and determine the entity node and attribute node connected to the matching node according to the business attribution to obtain a candidate path;
[0035] A matching output module is used to generate candidate texts according to the candidate paths, compare the candidate texts with the query text, and output matching candidate texts.
[0036] The present application also provides a computer device, including: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the knowledge graph-based question-and-answer search method when executing the computer program.
[0037] The present application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the question-and-answer search method based on the knowledge graph.
[0038] As described above, the present application provides a question-and-answer search method, system, device and medium based on a knowledge graph, which has the following beneficial effects.
[0039] The present application classifies entity nodes in a preset knowledge graph according to preset business affiliations, obtains entity identifiers and establishes a mapping relationship between entity nodes and entity identifiers; obtains query entities in the query text, matches entity nodes in the knowledge graph according to the query entities, obtains matching nodes, and the matching nodes include one or more; determines the business affiliation of the matching node according to the mapping relationship between the entity node and the entity identifier, and determines the entity nodes and attribute nodes connected to the matching node according to the business affiliation to obtain candidate paths; generates candidate texts according to the candidate paths, compares the candidate texts with the query text, and outputs matching candidate texts. The present application searches for candidate paths from subgraph relationships according to the business affiliations of entity nodes in the knowledge graph based on the entity information of the query text, generates candidate texts based on the candidate paths and matches them with the query text, increases the generalization performance of retrieval matching, can match more flexible user questions, and enhances user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] Figure 1 This is a schematic diagram of the architecture of a question-and-answer search system based on a knowledge graph in one embodiment of the present application.
[0041] Figure 2 This is a schematic diagram of the architecture of a question-and-answer search terminal based on a knowledge graph in one embodiment of the present application.
[0042] Figure 3 Schematic diagram of the flow of a question-and-answer search method based on a knowledge graph in one embodiment of the present application.
[0043] Figure 4 Schematic diagram of the structure of the matching model in one embodiment of the present application.
[0044] Figure 5 This is a flowchart of a question-and-answer search method based on a knowledge graph in another embodiment of the present application. DETAILED DESCRIPTION
[0045] The following describes the embodiments of the present application through specific examples, and those skilled in the art can easily understand other advantages and effects of the present application from the contents disclosed in this specification. The present application can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present application. It should be noted that the following embodiments and features in the embodiments can be combined with each other without conflict.
[0046] 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.
[0047] See also Figure 1 , Figure 1 It is an optional architectural diagram of a question-and-answer search system based on a knowledge graph provided in an embodiment of the present application. The terminal 400 is connected to the server 200 via a network 300. The network 300 may be a wide area network or a local area network, or a combination of the two.
[0048] Terminal 400 belongs to the visitor, and a client 410-1 for question-and-answer search based on the knowledge graph runs on the terminal 400, which is used to receive the query text input by the visitor or convert the query voice recorded by the visitor into text information, etc., upload the query text to the server 200 through the network 300, and receive the search results returned by the server 200.
[0049] Server 200 is used to construct a knowledge graph, classify entity nodes in the knowledge graph, and convert entity nodes into entity identifiers.
[0050] Terminal 400 is also used to send data requests to server 200, or upload business-related data. Server 200 extracts entities, relationships, attributes and other information in the business-related data, constructs a knowledge graph and saves it in database 500, and / or forwards it to terminal 400 for storage or display in client 410-1 of terminal 400.
[0051] In some embodiments, the server 200 may be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. The terminal 400 may be a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a smart watch, an intelligent voice interaction device, a smart home appliance, and a vehicle-mounted terminal, etc., but is not limited thereto. The terminal and the server may be directly or indirectly connected via wired or wireless communication, which is not limited in the embodiments of the present application.
[0052] In some embodiments, the administrator can also directly construct the knowledge graph on the terminal 400, so that the terminal 400 calls the constructed knowledge graph from the local database according to the visitor's query text, performs retrieval matching, obtains the entity node corresponding to the entity in the query text, traverses the knowledge graph based on the entity node to generate candidate paths of entities, attribute relationships, and attribute values, and performs similarity matching between the response text generated according to the candidate path and the query text, and combines the matching model of deep learning to increase the overall generalization ability, so that visitors can obtain accurate response output from the knowledge graph without having to ask questions in a fixed way. Or, in some embodiments, Figure 1 The terminal 400 in the embodiment can also be implemented as a server, that is, a knowledge graph is constructed based on a server-type device, and matching retrieval, candidate entity and candidate path screening are performed in response to visitor input, etc. The above implementation methods can be selected according to actual conditions, and the present application embodiment is not limited thereto.
[0053] See also Figure 2 , Figure 2 is a schematic diagram of the structure of the terminal 400 provided in an embodiment of the present application, Figure 2 The terminal 400 shown includes: at least one processor 410, a memory 450, at least one network interface 420 and a user interface 430. The various components in the terminal 400 are coupled together via a bus system 440. It is understood that the bus system 440 is used to achieve connection and communication between these components. In addition to the data bus, the bus system 440 also includes a power bus, a control bus and a status signal bus. However, for the sake of clarity, the bus system 440 is not shown in FIG. Figure 2 Various buses are labeled as bus system 440 .
[0054] Processor 410 can be an integrated circuit chip with signal processing capabilities, such as a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc., where the general-purpose processor can be a microprocessor or any conventional processor, etc.
[0055] The user interface 430 includes one or more output devices 431 that enable presentation of media content, including one or more speakers and / or one or more visual display screens. The user interface 430 also includes one or more input devices 432, including user interface components that facilitate user input, such as a keyboard, mouse, microphone, touch screen display, camera, other input buttons and controls.
[0056] The memory 450 may be removable, non-removable, or a combination thereof. Exemplary hardware devices include solid-state memory, hard drives, optical drives, etc. The memory 250 may optionally include one or more storage devices that are physically remote from the processor 410.
[0057] The memory 450 includes a volatile memory or a non-volatile memory, and may also include both volatile and non-volatile memories. The non-volatile memory may be a read-only memory (ROM), and the volatile memory may be a random access memory (RAM). The memory 450 described in the embodiments of the present application is intended to include any suitable type of memory.
[0058] In some embodiments, memory 450 can store data to support various operations, examples of which include programs, modules, and data structures, or a subset or superset thereof, as exemplarily described below.
[0059] Operating system 451, including system programs for processing various basic system services and performing hardware-related tasks, such as a framework layer, a core library layer, a driver layer, etc., for implementing various basic services and processing hardware-based tasks;
[0060] A network communication module 452, for reaching other computing devices via one or more (wired or wireless) network interfaces 420, exemplary network interfaces 420 include: Bluetooth, Wireless Compatibility Authentication (WiFi), and Universal Serial Bus (USB);
[0061] a presentation module 453 for enabling presentation of information via one or more output devices 431 (e.g., display screen, speaker, etc.) associated with the user interface 430 (e.g., a user interface for operating peripherals and displaying content and information);
[0062] The input processing module 454 is used to detect one or more user inputs or interactions from one of the one or more input devices 432 and translate the detected inputs or interactions.
[0063] In some embodiments, the device provided in the embodiments of the present application can be implemented in software. Figure 2 A knowledge graph-based question-answer search system 455 stored in a memory 450 is shown, which may be software in the form of programs and plug-ins, including the following software modules: an energy vehicle acquisition module 4551, an energy graph construction module 4552, an allocation strategy matching module 4553, and an energy sharing module 4554. These modules are logical, and therefore can be arbitrarily combined or further split according to the functions implemented.
[0064] The functions of each module will be described below.
[0065] In other embodiments, the system provided in the embodiments of the present application can be implemented in hardware. As an example, the system provided in the embodiments of the present application can be a processor in the form of a hardware decoding processor, which is programmed to execute the question-and-answer search method based on the knowledge graph provided in the embodiments of the present application. For example, the processor in the form of a hardware decoding processor can adopt one or more application-specific integrated circuits (ASICs), DSPs, programmable logic devices (PLDs), complex programmable logic devices (CPLDs), field programmable gate arrays (FPGAs) or other electronic components.
[0066] In some embodiments, the terminal or server can implement the question-and-answer search method based on the knowledge graph provided in the embodiment of the present application by running a computer program. For example, the computer program can be a native program or software module in the operating system; it can be a native application (APP, Application), that is, a program that needs to be installed in the operating system to run, such as a social application APP or a message sharing APP; it can also be a small program, that is, a program that can be run only by downloading it to a browser environment; it can also be a small program or a web client program that can be embedded in any APP. In short, the above-mentioned computer program can be any form of application, module or plug-in.
[0067] The following will illustrate the knowledge graph-based question-and-answer search method provided in the embodiment of the present application in combination with the exemplary application and implementation of the device provided in the embodiment of the present application.
[0068] See also Figure 3 , the present application provides a question-answering search method based on a knowledge graph, which includes the following steps.
[0069] Step S101, classify the entity nodes in the preset knowledge graph according to the preset business affiliation, obtain the entity identification and establish a mapping relationship between the entity node and the entity identification.
[0070] In one embodiment, various documents and materials of business scenarios can be input into the system in advance, and the system extracts entities, relationships between entities, attribute relationships, and attribute values in the documents to form triples. The triples can be expressed as: (entity, entity relationship, entity) or (entity, attribute relationship, attribute value). A knowledge graph is constructed based on the extracted triples, and the knowledge graph contains entity information of each business.
[0071] In one embodiment, in step S101, the entity nodes in the preset knowledge graph are classified according to the preset business attribution, the entity identifiers are obtained, and a mapping relationship between the entity nodes and the entity identifiers is established, including the following steps:
[0072] Step S1011, comparing the entity node in the knowledge graph with the business vocabulary in the preset business dictionary to obtain the business vocabulary matching the entity node;
[0073] Step S1012: determining the business attribution of the matching business vocabulary as the entity identifier of the entity node according to the preset index information of each business vocabulary in the business dictionary.
[0074] In one embodiment, it is envisioned that commonly used words or special words in various business scenarios are obtained, a business dictionary is constructed, and the business category is used as the index information of each special word in the business dictionary. The business-specific words or phrases in the business dictionary can be quickly queried based on the index information. Exemplarily, the index information can also be encoded according to a preset encoding rule based on the corresponding business category. When a business person performs a vocabulary search, the system will encode the search information entered by the business person according to the preset rules and compare it with the index information in the business dictionary to quickly locate the search content.
[0075] In one embodiment, the vocabulary and index information in the business dictionary can be used as structured sample data to train the classification model. After the model training is completed, the index information matching the input data can be obtained by simply inputting the data into the classification model. The specific classification model can be trained based on the network architecture obtained by combining the long short-term memory neural network with the conditional random field. The choice of the specific network architecture is not limited here. The essence of the classification model is to calculate the probability that the input data is similar to the business vocabulary in the business dictionary, and to classify it based on a preset similarity probability threshold.
[0076] In one embodiment, each entity node in the knowledge graph can be input into the aforementioned classification model. If the similarity between the entity node and the corresponding business vocabulary is higher than a set threshold, the entity node matches the business vocabulary, and the index information corresponding to the matching business vocabulary can be used as an entity identifier to mark the entity node, thereby establishing a mapping relationship between the entity node and the entity identifier. The business category of the corresponding entity node in the knowledge graph can be known through the entity identifier.
[0077] Step S102, obtaining a query entity in the query text, matching entity nodes in the knowledge graph according to the query entity, and obtaining matching nodes, wherein the matching nodes include one or more.
[0078] In one embodiment, after obtaining the query text input by the visitor, entity extraction is performed using entity extraction technology, and the extracted entity values are entity linked. The main methods used for entity linking are Chinese word segmentation, named entity recognition, candidate entity selection, and entity disambiguation.
[0079] In one embodiment, obtaining the query entity in the query text in step S102 includes the following steps:
[0080] Step S1021, segmenting the query text according to preset business scenario vocabulary to obtain multiple query words;
[0081] Step S1022: input the query word into a preset named entity recognition model to obtain the query entity.
[0082] In one embodiment, Chinese word segmentation can be performed using word segmentation tools such as jieba and hanlp. Some specific words or phrases in preset business scenarios are added to the word segmentation tools so that the word segmentation tools can completely and accurately segment the visitor's inquiry text to obtain the inquiry words in the inquiry text. After obtaining the inquiry words, named entity recognition needs to be performed. Named entity recognition can be performed by sequence annotation. The named entity recognition model is trained by BERT+CRF, that is, the conditional random field is trained by the BERT model. The inquiry words are input into the named entity recognition model in the form of a sequence, and the annotation information of the corresponding entity can be obtained, thereby determining the inquiry entity.
[0083] In one embodiment, in step S102, matching entity nodes in the knowledge graph according to the query entity to obtain matching nodes includes the following steps:
[0084] Step S1023, obtaining the historical access records of each user, and determining the words with a usage frequency higher than a set threshold as high-frequency words according to the historical access records;
[0085] Step S1024, filtering the knowledge graph according to the high-frequency words to determine the boundary of the knowledge graph, matching the query entity with the entity node in the filtered knowledge graph to obtain the matching node.
[0086] In one embodiment, after obtaining the query entity in the query text through named entity recognition, the query entity can be matched with the entity node in the knowledge graph, and multiple candidate entities can be determined based on similarity. Before determining the candidate entity, the user's historical behavior records and the high-frequency entity words used by the current user within a preset time period can be collected. The entity information in the user's historical behavior record is identified by the named entity recognition model, and the high-frequency entity words used in the current user's historical data are matched with the knowledge graph. The boundary of the knowledge graph used for question and answer search with the current user is determined according to the matching results, such as taking the center of the matched entity node as the base point to delineate a circular area, which contains all the matching entity nodes. The specific boundary division rules can be adjusted according to the actual application requirements, and are not limited here. Matching candidate entities based on the screened knowledge graph can avoid adding a large number of long-tail, less interactive information, and no practical entity nodes to the knowledge graph. Matching searches are performed according to user usage habits to enhance user orientation and improve the efficiency of matching searches.
[0087] In one embodiment, after obtaining candidate entities from the knowledge graph, entity selection and entity disambiguation are performed on the candidate entities to obtain matching nodes. Entity selection and entity disambiguation are mainly judged based on the user's intention. Entity selection is mainly performed by deep matching the candidate entities and the entities extracted from the user's query text or by a multilayer perceptron (MLP) to obtain a score, and the top 1 entities are sorted. If the top 1 score is greater than a threshold, the entity is judged, and if it is less than the threshold, it is empty. Entity disambiguation can also adopt the above method, and other auxiliary rules such as entity popularity and user popularity can be added to complete entity positioning.
[0088] In one embodiment, the depth matching can be implemented by using a preset matching model. The model architecture of the matching model is as follows: Figure 4 As shown, the matching model includes at least two input paths, an attention layer, a pooling layer, a fusion layer and a similarity calculation network; each of the input paths includes at least a recurrent network layer for obtaining the sequence information of the input text and a convolutional network layer for obtaining the keyword information in the input text, and the input text is encoded in series through the recurrent network layer and the convolutional network layer in sequence; the output sequence obtained after each input path encodes its own input text passes through the attention layer, the pooling layer, the fusion layer and the similarity calculation network in sequence to obtain the similarity of the input texts of the two input paths. Specifically, the input is encoded, and the encoding adopts CNN and RNN two-part serial encoding. RNN is mainly used to capture the sequence information of the text; CNN is mainly used to capture the keyword information of the text. Then the Attention mechanism is used to capture the direct interactive information of the two comparison texts, and Softattention Alignment is selected to obtain the interactive information of the two texts. Then the two interactive information are fused, and finally an MLP is used to calculate the probability of the two entities being similar.
[0089] Step S103, determining the service attribution of the matching node according to the mapping relationship between the entity node and the entity identifier, and determining the entity node and attribute node connected to the matching node according to the service attribution to obtain a candidate path.
[0090] In one embodiment, after obtaining a matching node from a knowledge graph based on a query entity in a query text, the entity identifier of the matching node can be obtained based on a mapping relationship between entity nodes and entity identifiers in the knowledge graph, thereby determining the business category of the matching node.
[0091] In one embodiment, determining the entity node and the attribute node connected to the matching node according to the service attribution in step S103 to obtain a candidate path includes the following steps:
[0092] Step S1031, when the matching node is a single node or corresponds to the same business, traverse the knowledge graph, obtain the attribute node having an attribute relationship with the matching node, obtain the subgraph relationship including the matching node, and use the nodes in the subgraph relationship and the attributes corresponding to the nodes as candidate paths;
[0093] Step S1032, when the matching node contains multiple different business attributes, the matching nodes are associated, the matching subgraph relationship in the knowledge graph is obtained based on the associated matching nodes, and a candidate path is generated according to the subgraph relationship.
[0094] In one embodiment, if the obtained matching node is a single category or a single node information, the candidate path of the graph is obtained by locating the subgraph relationship, traversing the nodes and the attributes corresponding to the nodes, and the candidate path is converted into standard text information and the user query text for text matching, and the top result is returned; if the multiple node information extracted by the entity extraction technology belongs to different categories, the entity subgraph relationship expanded by the multiple nodes is located by associating the entity nodes, and then the candidate path is generated by the entity nodes, relationships and attribute values, and the similarity between the candidate path and the user query text is matched by deep learning, and finally the top result is returned. The subgraph relationship can represent a set of matching nodes and corresponding attribute relationships and attribute values.
[0095] Step S104, generating candidate texts according to the candidate paths, comparing the candidate texts with the query texts, and outputting matching candidate texts.
[0096] In one embodiment, generating candidate texts according to the candidate paths in step S104, comparing the candidate texts with the query text, and outputting matching candidate texts includes the following steps:
[0097] Step S1041, converting the nodes and node attributes in the candidate path into standard text as the candidate text;
[0098] Step S1042, inputting the candidate text and the query text into a preset matching model to obtain the similarity between each candidate text and the query text;
[0099] Step S1043 , sorting the candidate texts from high to low according to the similarity, and outputting the plurality of candidate texts ranked first as matching candidate texts.
[0100] In one embodiment, when matching the candidate text with the query text, the following method may be used: Figure 4The matching model architecture shown encodes the user input, and the encoding adopts CNN and RNN two-part serial encoding. RNN is mainly used to capture the sequence information of the text; CNN is mainly used to capture the keyword information of the text. Then the Attention mechanism is used to capture the direct interactive information of the two compared texts, and Softattention Alignment is selected to obtain the interactive information of the two texts. The two interactive information are then fused, and finally an MLP is used to calculate the probability that the two texts are similar. In another embodiment, the matching of entity extracted nodes and candidate nodes and the matching between candidate paths and user query texts can use an enhanced RCNN algorithm. The RCNN algorithm architecture is as follows Figure 4 By calling the matching model, the candidate entity nodes can be generalized, and then the candidate paths can be generated by maximizing the generalization, and the candidate paths with the highest similarity can be matched.
[0101] See also Figure 5 , Figure 5 This is a flow chart of a question-and-answer search method based on a knowledge graph in another embodiment of the present application. After receiving the query input by the user, entity extraction is performed to obtain the entity information of the query text. The entity information in the knowledge graph is converted into an entity ID, and a mapping relationship between the entity node and the entity ID in the knowledge graph is established. Text matching and rule filtering are performed based on a preset matching model to obtain candidate entities, and candidate paths are obtained based on the attribute relationships and attribute values of the candidate entities. The candidate paths are converted into standard texts to match the query text query, and the TOPN standard texts ranked in the front by similarity are selected as output for visitors to select based on the matching results.
[0102] According to the description of the question-answering search method based on the knowledge graph, the embodiment of the present application provides a question-answering search system based on the knowledge graph, such as Figure 2 As shown. A question-answer search system based on a knowledge graph is run on the device, and the system includes: a graph mapping module 4551, which is used to classify entity nodes in a preset knowledge graph according to preset business affiliation, obtain entity identification and establish a mapping relationship between entity nodes and entity identification; a query matching module 4552, which is used to obtain the query entity in the query text, match the entity nodes in the knowledge graph according to the query entity, and obtain matching nodes, and the matching nodes include one or more; a candidate matching module 4553, which is used to determine the business affiliation of the matching node according to the mapping relationship between the entity node and the entity identification, and determine the entity node and attribute node connected to the matching node according to the business affiliation, and obtain a candidate path; a matching output module 4554, which is used to generate a candidate text according to the candidate path, compare the candidate text with the query text, and output the matching candidate text.
[0103] In one embodiment, the graph mapping module 4551 is also used to compare the entity node in the knowledge graph with the business vocabulary in the preset business dictionary to obtain the business vocabulary matching the entity node; and determine the business attribution of the matching business vocabulary as the entity identifier of the entity node based on the preset index information of each business vocabulary in the business dictionary.
[0104] In one embodiment, the query matching module 4552 is also used to obtain the query entity in the query text, including: segmenting the query text according to preset business scenario vocabulary to obtain multiple query words; inputting the query words into a preset named entity recognition model to obtain the query entity.
[0105] In one embodiment, the query matching module 4552 is also used to match entity nodes in the knowledge graph according to the query entity to obtain matching nodes, including: obtaining historical access records of each user, and determining words with a usage frequency higher than a set threshold as high-frequency words according to the historical access records; filtering the knowledge graph according to the high-frequency words to determine the boundary of the knowledge graph, and matching the query entity with the entity nodes in the filtered knowledge graph to obtain the matching nodes.
[0106] In one embodiment, the candidate matching module 4553 is also used to determine the entity nodes and attribute nodes connected to the matching node according to the business affiliation to obtain a candidate path, including: when the matching node is a single node or corresponds to the same business affiliation, traversing the knowledge graph, obtaining the attribute nodes having an attribute relationship with the matching node, obtaining the subgraph relationship containing the matching node, and taking the nodes in the subgraph relationship and the attributes corresponding to the nodes as candidate paths; when the matching node contains multiple different business affiliations, associating each of the matching nodes, obtaining the matching subgraph relationship in the knowledge graph based on the associated matching nodes, and generating a candidate path according to the subgraph relationship.
[0107] In one embodiment, the matching output module 4554 is also used to generate candidate texts based on the candidate path, compare the candidate texts with the query text, and output matching candidate texts, including: converting the nodes and node attributes in the candidate path into standard texts as the candidate texts; inputting the candidate texts and the query text into a preset matching model to obtain the similarity between each candidate text and the query text; sorting the candidate texts from high to low according to the similarity, and outputting the multiple candidate texts ranked first as matching candidate texts.
[0108] In one embodiment, the matching model includes at least two input paths, an attention layer, a pooling layer, a fusion layer and a similarity calculation network; each of the input paths includes at least a recurrent network layer for obtaining sequence information of the input text and a convolutional network layer for obtaining keyword information in the input text, and the input text is encoded serially through the recurrent network layer and the convolutional network layer in sequence; the output sequence obtained after each of the input paths encodes its own input text passes through the attention layer, the pooling layer, the fusion layer and the similarity calculation network in sequence to obtain the similarity of the input texts of the two input paths.
[0109] An embodiment of the present application provides a computer-readable storage medium storing executable instructions, wherein executable instructions are stored. When the executable instructions are executed by a processor, the processor will execute the question-and-answer search method based on the knowledge graph provided in the embodiment of the present application.
[0110] In some embodiments, the computer-readable storage medium may be a memory such as FRAM, ROM, PROM, EPROM, EEPROM, flash memory, magnetic surface storage, optical disk, or CD-ROM; or it may be various devices including one or any combination of the above memories.
[0111] In some embodiments, executable instructions may be in the form of a program, software, software module, script or code, written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and may be deployed in any form, including as a stand-alone program or as a module, component, subroutine or other unit suitable for use in a computing environment.
[0112] As an example, executable instructions may, but do not necessarily, correspond to a file in a file system, may be stored as part of a file that stores other programs or data, for example, in one or more scripts in a HyperText Markup Language (HTML) document, in a single file dedicated to the program in question, or in multiple coordinated files (e.g., files storing one or more modules, subroutines, or code portions).
[0113] By way of example, executable instructions may be deployed to be executed on one computing device, or on multiple computing devices located at one site, or on multiple computing devices distributed across multiple sites and interconnected by a communication network.
[0114] In summary, the present application provides a question-answer search method, system, device and medium based on a knowledge graph, which is based on subgraph search and relies on entity relationship paths. First, entity linking is performed on the input query text, and the entity is converted into an entity identifier. By matching the entity nodes and attribute relationships in the graph, candidate paths are screened out, and the top results are obtained by text matching and sorting the candidate paths. By calling the matching model, the generalization of the candidate entity nodes can be completed, and then the candidate paths can be generated by maximizing the generalization, and the candidate paths with the highest similarity can be matched. Therefore, the present application effectively overcomes the various shortcomings in the prior art and has a high industrial utilization value.
[0115] The above embodiments are merely illustrative of the principles and effects of the present application and are not intended to limit the present application. Anyone familiar with the technology may modify or change the above embodiments without violating the spirit and scope of the present application. Therefore, all equivalent modifications or changes made by a person of ordinary skill in the art without departing from the spirit and technical ideas disclosed in the present application shall still be covered by the claims of the present application.
Claims
1. A question-answering search method based on knowledge graph, characterized in that: include: Classify the entity nodes in the preset knowledge graph according to the preset business attribution, obtain the entity identifier and establish a mapping relationship between the entity node and the entity identifier; Obtaining a query entity in the query text, matching entity nodes in the knowledge graph according to the query entity to obtain matching nodes, wherein the matching nodes include one or more; Determine the business affiliation of the matching node according to the mapping relationship between the entity node and the entity identifier, and determine the entity node and attribute node connected to the matching node according to the business affiliation to obtain a candidate path, including: when the matching node is a single node or corresponds to the same business affiliation, traverse the knowledge graph, obtain the attribute node having an attribute relationship with the matching node, obtain the subgraph relationship containing the matching node, and use the nodes in the subgraph relationship and the attributes corresponding to the nodes as candidate paths; when the matching node contains multiple different business affiliations, associate each of the matching nodes, obtain the matching subgraph relationship in the knowledge graph based on the associated matching nodes, and generate a candidate path according to the subgraph relationship; Generate candidate texts according to the candidate paths, compare the candidate texts with the query texts, and output matching candidate texts.
2. The question-answer search method based on knowledge graph according to claim 1, characterized in that: Classify the entity nodes in the preset knowledge graph according to the preset business attribution, obtain the entity identifier and establish a mapping relationship between the entity node and the entity identifier, including: Compare the entity node in the knowledge graph with the business vocabulary in the preset business dictionary to obtain the business vocabulary matching the entity node; The business attribution of the matched business vocabulary is determined according to the preset index information of each business vocabulary in the business dictionary as the entity identifier of the entity node.
3. The question-answer search method based on knowledge graph according to claim 1, characterized in that: Get the query entities in the query text, including: Segmenting the query text according to preset business scenario vocabulary to obtain multiple query words; The query word is input into a preset named entity recognition model to obtain the query entity.
4. The question-answer search method based on knowledge graph according to claim 1, characterized in that: Matching entity nodes in the knowledge graph according to the query entity to obtain matching nodes includes: Acquire the historical access records of each user, and determine the words with a usage frequency higher than a set threshold as high-frequency words according to the historical access records; The knowledge graph is screened according to the high-frequency words to determine the boundary of the knowledge graph, and the query entity is matched with the entity node in the screened knowledge graph to obtain the matching node.
5. The question-answer search method based on knowledge graph according to claim 1, characterized in that: Generating candidate texts according to the candidate paths, comparing the candidate texts with the query texts, and outputting matching candidate texts, including: Converting the nodes and node attributes in the candidate path into standard text as the candidate text; Inputting the candidate text and the query text into a preset matching model to obtain the similarity between each candidate text and the query text; The candidate texts are sorted from high to low according to the similarity, and the candidate texts ranked first are output as matching candidate texts.
6. The question-answer search method based on knowledge graph according to claim 5, characterized in that: The matching model includes at least two input paths, an attention layer, a pooling layer, a fusion layer and a similarity calculation network; Each of the input paths includes at least one recurrent network layer for obtaining sequence information of the input text and one convolutional network layer for obtaining keyword information in the input text, and the input text is encoded serially through the recurrent network layer and the convolutional network layer in sequence; The output sequence obtained after each input path encodes its own input text is passed through the attention layer, pooling layer, fusion layer and similarity calculation network in sequence to obtain the similarity of the input texts of the two input paths.
7. A question-answering search system based on knowledge graph, characterized in that: include: A graph mapping module is used to classify entity nodes in a preset knowledge graph according to preset business attributes, obtain entity identifiers and establish a mapping relationship between entity nodes and entity identifiers; A query matching module, used to obtain a query entity in a query text, and match entity nodes in the knowledge graph according to the query entity to obtain a matching node, wherein the matching node includes one or more nodes; A candidate matching module is used to determine the business affiliation of the matching node according to the mapping relationship between the entity node and the entity identifier, and determine the entity node and attribute node connected to the matching node according to the business affiliation, and obtain the candidate path including: when the matching node is a single node or corresponds to the same business affiliation, traverse the knowledge graph, obtain the attribute node having an attribute relationship with the matching node, obtain the subgraph relationship containing the matching node, and use the nodes in the subgraph relationship and the attributes corresponding to the nodes as the candidate path; when the matching node contains multiple different business affiliations, associate each of the matching nodes, obtain the matching subgraph relationship in the knowledge graph based on the associated matching nodes, and generate a candidate path according to the subgraph relationship; A matching output module is used to generate candidate texts according to the candidate paths, compare the candidate texts with the query text, and output matching candidate texts.
8. A computer device comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the method according to any one of claims 1 to 6 when executing the computer program.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
Citation Information
Cited By
College intelligent reimbursement auditing method and system fused with knowledge graph
CN122596968A
