Knowledge graph question and answer method and device

By recalling the graph data related to the target entity from the knowledge graph and using the problem statement to determine the target map data, the problem of outputting answers across the domain question statements is solved, and efficient and accurate knowledge graph questions and answers are achieved.

CN119537515APending Publication Date: 2025-02-28BEIJING GRIDSUM TECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202311061875.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-08-22
Publication Date
2025-02-28

AI Technical Summary

Technical Problem

It is difficult for the prior art to output accurate answers to cross-domain problem statements, because each model can only output accurate answers to the problem statements in their respective fields.

Method used

By extracting key elements in the question statement, including the target entity and the operation element, recalling the graph data related to the target entity from the knowledge graph, forming a graph data set, and using the problem statement to determine the target map data, and finally outputting the answer based on the target map data and the operation element.

Benefits of technology

It realizes the output of accurate answers to cross-domain question statements, eliminates the problem that the problem of unable to output accurate answers because the question statement contains vocabulary of different fields, and improves the speed and accuracy of knowledge graph questions and answers.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119537515A_ABST
    Figure CN119537515A_ABST
Patent Text Reader

Abstract

The invention discloses a knowledge graph question answering method and device, relates to the technical field of question answering, and mainly aims to output accurate answers for cross-domain question statements. According to the main technical scheme, key elements in question statements are extracted, wherein the key elements comprise target entities and operation elements; using the target entity to recall graph data related to the target entity from the knowledge graph to obtain a graph data set; determining target map data from the map data set by using the question statement; and outputting an answer to the question statement based on the target map data and the operation element.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of intelligent question answering technology, and in particular to a knowledge graph question answering method and device. Background Art

[0002] The knowledge graph is a large-scale semantic network system whose main purpose is to describe the attributes of entities in the real world and the relationships between entities. Knowledge graph question-answering is a question-answering scenario that uses the knowledge graph as a data source. Users ask questions in natural language, and the answer is found in the knowledge graph through semantic understanding of the user's question and output in natural language. For example, if a user asks "What is Zhang San's math score", the answer "Zhang San's math score is 95 points" is output through semantic understanding and data query.

[0003] In the prior art, knowledge graph question answering is implemented through an end-to-end model, that is, the user's question statement is input into a trained model, the model is used to find the corresponding graph data from the knowledge graph, and the graph data is used as the answer. When training the model, the knowledge graph is divided into several fields, and the model of the field is trained using the data of the same field. Therefore, in the process of knowledge graph question answering, it is essentially to first determine which field the question statement belongs to, and after determining the field to which it belongs, the question statement is input into the model of the corresponding field to output the answer.

[0004] Since each model in the prior art can only output accurate answers to question sentences in their respective fields, it is difficult to output accurate answers when words from different fields appear in the question sentences. Therefore, how to output accurate answers to cross-field question sentences is a problem that needs to be solved in this field. Summary of the invention

[0005] In view of the above problems, this application proposes a knowledge graph question answering method and device, the main purpose of which is to output accurate answers to cross-domain question statements.

[0006] In order to achieve the above objectives, this application mainly provides the following technical solutions:

[0007] In a first aspect, the present application provides a knowledge graph question answering method, comprising:

[0008] Extracting key elements in the question statement, wherein the key elements include a target entity and an operation element;

[0009] Using the target entity, recalling graph data related to the target entity from the knowledge graph to obtain a graph data set;

[0010] Determining target atlas data from the atlas data set using the question statement;

[0011] Based on the target graph data and the operation elements, an answer to the question statement is output.

[0012] In a second aspect, the present application provides a knowledge graph question-answering device, the device comprising:

[0013] An extraction unit, used to extract key elements in the question statement, wherein the key elements include a target entity and an operation element;

[0014] A recall unit, used to use the target entity to recall graph data related to the target entity from the knowledge graph to obtain a graph data set;

[0015] A determination unit, configured to determine target graph data from the graph data set using the question statement;

[0016] An output unit is used to output an answer to the question statement based on the target graph data and the operation element.

[0017] On the other hand, the present application also provides a storage medium, which is used to store a computer program, wherein when the computer program is running, it controls the device where the storage medium is located to execute the knowledge graph question and answer method of the first aspect mentioned above.

[0018] On the other hand, the present application also provides an electronic device, comprising at least one processor, and at least one memory and a bus connected to the processor; wherein the processor and the memory communicate with each other through the bus; and the processor is used to call program instructions in the memory to execute the knowledge graph question and answer method of the first aspect as described above.

[0019] By means of the above technical scheme, a knowledge graph question-answering method and device provided by the present application can output accurate answers to cross-domain question statements. The present application extracts key elements such as target entities and operation elements in question statements, and uses the target entity to recall all graph data related to the target entity from the knowledge graph to obtain a graph data set. Since the present application recalls the relevant graph data in the entire knowledge graph, the graph data set can contain graph data from various fields. Then the present application uses the question statement to determine the target graph data from the graph data set. The present application identifies whether the user wants to query entity relationships or entity attributes through the question statement, and finally outputs the answer to the question statement based on the target graph data and the operation elements. The present application obtains the operation information in the question statement through the operation element, and accurately obtains the answer to the question statement through both the target graph data and the operation information. The present application realizes cross-domain graph data query, and well responds to cross-domain question statements, and can output accurate answers to cross-domain question statements.

[0020] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the preferred embodiments below. The accompanying drawings are only for the purpose of illustrating the preferred embodiments and are not to be considered as limiting the present application. Also, the same reference symbols are used throughout the accompanying drawings to represent the same components. In the accompanying drawings:

[0022] Figure 1 A flow chart of a knowledge graph question answering method proposed in an embodiment of the present application is shown;

[0023] Figure 2 A flowchart of another knowledge graph question answering method proposed in an embodiment of the present application is shown;

[0024] Figure 3 A schematic diagram of the structure of a knowledge graph question-answering device proposed in an embodiment of the present application is shown;

[0025] Figure 4 A schematic diagram of the structure of another knowledge graph question-answering device proposed in an embodiment of the present application is shown;

[0026] Figure 5 A schematic diagram of the structure of an electronic device proposed in an embodiment of the present application. DETAILED DESCRIPTION

[0027] The exemplary embodiments of the present application will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present application are shown in the accompanying drawings, it should be understood that the present application can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided in order to enable a more thorough understanding of the present application and to fully convey the scope of the present application to those skilled in the art.

[0028] At present, knowledge graph question answering achieves answer output through an end-to-end model. Since the model is trained only with graph data in a certain field in the knowledge graph, the model in the prior art can only respond to question sentences in a certain field. If the question sentence contains vocabulary from different fields, it cannot output an accurate answer. Therefore, the applicant believes that it is possible to break the boundaries of fields in the knowledge graph, treat all graph data in the knowledge graph as a whole, and obtain it from the entire knowledge graph when searching for answers. In this way, whether the user's question sentence belongs to a certain field or crosses fields, the answer can be accurately output.

[0029] To this end, the embodiment of the present application provides a knowledge graph question-answering method that can output accurate answers to cross-domain question statements. After receiving the user's question statement, the present application extracts the key elements in the question statement, uses the key elements to filter out the graph data required by the user from the knowledge graph, and outputs it as the answer. The present application solves the problem of being unable to output the correct answer to cross-domain question statements. The specific implementation steps of the embodiment of the present application are as follows: Figure 1 As shown, including:

[0030] 101. Extract the key elements from the question statement.

[0031] Among them, the key elements include target entities and operation elements. The knowledge graph contains several major types of data, including ontology, entity, entity relationship, and entity attribute. Multiple entities correspond to one ontology. For example: "Student" is an ontology, "Zhang San" is an entity, the entity relationship between entity "Zhang San" and entity "Zhang Yi" is "father-child relationship", and the entity attribute of entity "Zhang San" is "math score". The target entity in this application is an entity related to the question statement, and the target entity can be one entity or multiple entities. Operation elements are elements related to mathematical operations in the question statement, for example: the question statement "Which students have math scores greater than 86 points", in which the operator "greater than" and the numeric value "86 points" can be operation elements.

[0032] In this step, after receiving the user's question statement, the key elements in the question statement are extracted so that the key elements can be used to recall the answer required by the user from the knowledge graph.

[0033] Exemplarily, a user's question statement is received, and the question statement is first preprocessed to remove punctuation marks, spaces, and stop words, and then the question statement is segmented to obtain segmented words, and the segmented words are classified according to preset rules to obtain entity segmentation and operator segmentation, and entities related to entity segmentation are recalled in the knowledge graph, and the question statement is used to filter the target entity from the partial entities. The operator segmentation is converted into an operation element according to the preset operation rules.

[0034] Exemplarily, determine whether there is ontology information in the question statement. If so, extract the target ontology and target entity from the question statement. If not, extract the target entity from the question statement. Also determine whether there are numbers in the question statement. If so, extract numerical quantities and operators from the question statement and use the numerical quantities and operators as operation elements. If not, extract operators from the question statement and use the operators as operation elements.

[0035] 102. Using the target entity, recall the graph data related to the target entity from the knowledge graph to obtain a graph data set.

[0036] Among them, the graph data set is the set of all graph data related to the target entity in the knowledge graph. That is, the graph data set contains not only the target entity, but also all entity relationships and entity attributes of the target entity.

[0037] In this step, graph data related to the target entity is recalled in the knowledge graph, and the collection of this part of graph data is the graph data set.

[0038] It should be noted that the graph data in this step can be parameters in the knowledge graph, or parameters and parameter values ​​in the knowledge graph data. If the graph data is only parameters, the graph data set is, for example: (Zhang San-math score), (Zhang San-height); if the graph data is parameters and parameter values, the graph data set is, for example: (Zhang San-math score-80 points), (Zhang San-height-176cm). In order to reduce the amount of data recall and save server computing resources, this application can only recall the parameters in the knowledge graph.

[0039] 103. Use the question statement to determine the target graph data from the graph data set.

[0040] The target graph data is the entities and entity relationships, or entities and entity attributes to be queried in the question statement. For example, if the question statement is "What is Zhang San's math score?", and the graph data set is (Zhang San-math score), (Zhang San-height), then the target graph data is (Zhang San-math score).

[0041] In this step, after obtaining the graph data set, the question statement is compared with each graph data in the graph data set to identify the graph data that the user needs to query, and the graph data is determined as the target graph data.

[0042] Exemplarily, each graph data and question sentence in the graph data set is used as input data, and input into a sentence similarity model. After calculation by the sentence similarity model, each similarity value is output, and the graph data with the highest similarity is used as the target graph data.

[0043] Exemplarily, the question sentence is segmented to obtain multiple segmented words, and it is determined whether the graph data set contains one or several segmented words. If so, the segmented words are determined to be the target graph data. If not, the similarity between the question sentence and each graph data in the graph data set is calculated, and the graph data with the highest similarity is used as the target graph data.

[0044] 104. Based on the target graph data and operation elements, output the answer to the question statement.

[0045] In this step, after the target graph data corresponding to the question statement is determined, the answer corresponding to the question statement is determined based on the target graph data and the operation elements.

[0046] Exemplarily, based on entity relationships or entity attributes in the target graph data, as well as operators and numeric quantities, a query statement of the knowledge graph is determined, and based on the query statement, various graph data in the knowledge graph are recalled, and based on the operator and preset question type rules, the question type of the question statement is determined, and the various graph data are assembled based on the question type to obtain an answer to the question statement presented in natural language.

[0047] Exemplarily, based on preset question type rules, the question type of the question statement is determined according to the target graph data and operation elements, and the question type is used to determine whether the parameter value in the target graph data is the graph data that the user wants to query. If so, the answer is output based on the parameter value in the target graph data. If not, the query statement of the knowledge graph is determined based on the entity relationship or entity attribute in the target graph data, and the operation elements. Based on the query statement, the graph data in the knowledge graph are recalled, and the graph data are assembled using the question type to obtain the answer to the question statement presented in natural language.

[0048] The embodiment of the present application extracts key elements such as target entities and operation elements in the question statement, and uses the target entity to recall the graph data related to the target entity from the entire knowledge graph, eliminating the problem that cross-domain question statements in the prior art cannot output accurate answers. Next, the present application uses the question statement to determine the target graph data from the recalled graph data, identifies the entity and entity attributes or entity relationships that the user needs to query in the question statement, and finally uses the target graph data and operation elements to output the answer in a natural language. In the process of extracting key elements, the present application performs word segmentation on the question statement, divides the word segmentation words into entity word segmentation and operator word segmentation, and only recalls entities related to entity word segmentation from the knowledge graph. Compared with recalling all entities related to word segmentation words from the knowledge graph, the present application reduces the amount of graph data recall and saves data query resources. In addition, in the process of outputting answers based on the target graph data and operation elements, the present application will first use the question type check of the question statement to check whether the user needs to query the parameter value in the target graph data. If so, there is no need to use the target graph data and operation elements to determine the query statement, and use the query statement to find the graph data required by the user from the knowledge graph, but directly output the corresponding answer based on the parameter value. The present application directly outputs the corresponding answer based on the parameter value, which improves the speed of knowledge graph question answering. In addition, the real knowledge graph will add new graph data and delete graph data from time to time. The graph data in the knowledge graph is in a dynamically changing state. The prior art uses a trained end-to-end model to output answers, which is equivalent to the end-to-end model being trained by the historical graph data in the knowledge graph. Therefore, sending dynamically changing graph data will affect the model outputting accurate answers, and the present application uses all graph data in the knowledge graph to obtain answers, which is equivalent to using the current latest knowledge graph every time the answer is queried. Therefore, the influence of dynamically changing graph data on the accuracy of the answer is eliminated.

[0049] In order to explain in more detail a knowledge graph question-answering method proposed in this application, this application proposes another embodiment of a knowledge graph question-answering method. The specific implementation steps of the embodiment of this application are as follows: Figure 2 As shown, including:

[0050] 201. Receive a question statement from a user and pre-process the question statement.

[0051] In this step, before extracting the key elements of the question sentence, it is necessary to pre-process the question sentence to process the question sentence into a question sentence from which the key elements can be extracted. The specific implementation steps include steps 1 to 3:

[0052] Step 1: Remove special characters such as spaces and line breaks in the question statement to convert the question statement into a question statement from which key elements can be extracted.

[0053] Step 2: Remove stop words from the question sentence.

[0054] Among them, stop words such as "Excuse me", "Do you know" and other common communication auxiliary words do not affect the key semantics of the question but may interfere with the extraction of key elements.

[0055] Step 3: Replace the synonyms in the question sentence.

[0056] Specifically, some common spoken words are converted into standard words in order to improve the accuracy of key element extraction.

[0057] 202. Extract the target entity, target ontology, numeric quantity, and operator from the question statement.

[0058] In this step, the target entity, target ontology, digital quantity, and operator are extracted from the question statement respectively. The specific implementation steps include step 1 to step 4:

[0059] Step 1: Extract target entities.

[0060] First, the question sentence is segmented to obtain the segmentation results. Then, the segmentation results are traversed, and entities related to the segmentation results are recalled in the knowledge graph through fuzzy query to obtain candidate entities. Then, the matching degree between each candidate entity and the question sentence is calculated, and the candidate entities are sorted according to the matching degree. Finally, the candidate entities before the preset order are taken as the target entities.

[0061] The word segmentation results are the word segmentation sentences obtained after the question sentence is segmented. Traversing the word segmentation results, that is, using each word segmentation term, recalling all entities related to each word segmentation term from the knowledge graph, and taking these entities as candidate entities. It should be noted that when sorting the candidate entities, the one with a greater matching degree ranks higher.

[0062] This application recalls all entities related to the word segmentation results in the graph data, spanning graph data from different fields, and avoids the problem of being unable to output accurate answers due to the question sentence containing vocabulary from different fields.

[0063] Step 2: Extract the target entity.

[0064] First, the question sentence is segmented to obtain the segmentation results. Then, the segmentation results are traversed, and the ontologies related to the segmentation results are recalled in the knowledge graph through the inverted index and BM25 algorithm (Okapi BM25) to obtain candidate ontologies; then, the matching degree between each candidate ontology and the question sentence is calculated respectively, and each candidate ontology is sorted according to the matching degree; finally, the candidate ontology with the highest ranking is used as the target ontology.

[0065] Step 3: Extract digital quantity.

[0066] First, the question statement is converted into a sentence to be recognized, and then the numerical quantity in the sentence to be recognized is extracted using a regular expression to obtain the target numerical quantity.

[0067] The digital quantities in the sentence to be recognized are presented according to preset digital quantity rules.

[0068] For example, the model is first used to convert numerical quantities described in natural language into Arabic numerals, such as "Which students have a math score greater than 95 points" is converted to "Which students have a math score greater than 95 points". Then, regular expressions are used to extract the numbers and units of measurement contained in the question sentence, that is, to extract the numerical quantity "95 points".

[0069] Step 4: Extract operators.

[0070] In this step, regular expressions are used to extract operators in the question statement to obtain the target operator.

[0071] Specifically, the operator extracted in this step can be the size comparison, statistics, and maximum value calculation of entity attributes. For example, if the question statement is "Who is the student with the best math score?", the "best" in the question statement is the operator, and the "best" is extracted from the question statement through a regular expression. When the embodiment of the present application generates a query statement using the "best" operator, the query statement will be determined to be within the category of the max query statement.

[0072] It should be noted that there is no logical order for steps 1 to 4. The order in which steps 1 to 4 are performed in the embodiment of the present application is only one specific implementation method. Therefore, when executing the method described in the embodiment of the present invention, the order of steps 1, 2, 3, and 4 can be selected as needed, and the order is not limited here.

[0073] 203. Utilize the target entity and the target ontology to recall the graph data related to the target entity from the knowledge graph to obtain a graph data set.

[0074] In this step, the target entity is used to recall the graph data related to the target entity from the knowledge graph; the target ontology is used to recall the graph data related to the target ontology from the knowledge graph; the graph data related to the target entity and the graph data related to the target ontology are determined as a graph data set.

[0075] The graph data set in the embodiment of the present application includes not only the graph data related to the target entity, but also the graph data related to the target ontology. When the ontology-related words appear in the question sentence, compared with obtaining the graph data set using only the target entity, the present application can obtain a more accurate graph data set.

[0076] 204. Determine the target graph data from the graph data set using the question statement.

[0077] In this step, the sentence similarity model is used to calculate the similarity between each graph data and the question sentence, and the graph data with the highest similarity is obtained. The graph data with the highest similarity and its entity are determined as the target graph data.

[0078] Among them, the graph data with the highest similarity is the entity relationship and / or entity attribute in the graph data set that is most relevant to the question statement.

[0079] In this step, the graph data with the highest similarity is obtained, that is, it is determined whether the user wants to query a certain entity attribute or entity relationship of the entity, or whether the user needs to query a certain entity attribute and a certain entity relationship of the entity. In order to use the target graph data to confirm the slot information required by the query statement, such as the question statement "What is Zhang San's math score", the confirmed slot information is the entity "Zhang San" and the entity attribute "math score".

[0080] It should be noted that the graph data with the highest similarity can be one entity relationship or multiple entity relationships, and can also be one entity attribute or multiple entity attributes. The specific number of entity relationships and entity attributes needs to be identified based on the question sentence. For example: for the question sentence "What are the math scores of Zhang San and Li Si respectively?", the target graph data is (Zhang San-math score)(Li Si-math score).

[0081] 205. Determine operation information based on numerical quantities and operators.

[0082] The operation information is used to assist in generating logical operations of query statements, such as maximum value, aggregation, filtering, statistics, etc.

[0083] 206. Determine the question type and query statement of the question statement according to the target graph data and the operation information.

[0084] The question type is the question type of the question statement. For example, the question type and the corresponding instance are shown in the following table 1:

[0085] Question Type Example Single Entity Zhang San Ontology student Entity attributes Zhang San's math scores Entity Relationship Zhang San's major courses Explicit attribute filtering Who are the students with math scores greater than 86? Implicit attribute filtering Which students have better math scores than Zhang San? Property comparison How much better is Zhang San's math score than Li Si's? statistics How many students judge Is Zhang San's math score 86? Best value The student with the highest math scores

[0086] Table 1

[0087] In this step, based on preset question type rules, the question type of the question statement can be determined according to the target graph data and operation information, and the query statement can be automatically generated using the slot information and operation information obtained from the target graph data.

[0088] In one achievable manner, the question type of the question statement is determined, and the specific implementation is as follows:

[0089] Create a question type classification table; find the question type corresponding to the question statement in the question type classification table according to the target map data and the operation elements; determine the question type as the question type of the question statement.

[0090] This application reasonably classifies question statements by creating a question type classification table. Based on the creation of the question type classification table, the question statement can be matched to the accurate question type, and then the accurate answer can be output.

[0091] 207. Use the query statement to recall the graph data corresponding to the query statement in the knowledge graph.

[0092] It should be noted that this query statement retrieves independent graph data from the knowledge graph, that is, multiple parameters and their corresponding parameter values.

[0093] 208. Assemble the graph data into sentences based on the question type to get the answer to the question sentence.

[0094] This application uses question types to assemble sentences for each graph data. Since this application recognizes the user's question intention through question types, this application can assemble each graph data into the answer the user wants to know, and this application accurately outputs the answer the user needs.

[0095] Furthermore, as a response to the above Figure 1-2 The implementation of the method embodiment shown in the figure, the embodiment of the present application provides a knowledge graph question-answering device, which can output accurate answers to cross-domain question statements. The embodiment of the device corresponds to the aforementioned method embodiment. For ease of reading, this embodiment will no longer repeat the details of the aforementioned method embodiment one by one, but it should be clear that the device in this embodiment can correspond to all the contents of the aforementioned method embodiment. Specifically, Figure 3 As shown, the device comprises:

[0096] An extraction unit 31, used to extract key elements in the question statement, wherein the key elements include a target entity and an operation element;

[0097] The recall unit 32 is used to use the target entity extracted by the extraction unit 31 to recall graph data related to the target entity from the knowledge graph to obtain a graph data set;

[0098] A determination unit 33, configured to determine target graph data from the graph data set obtained by the recall unit 32 using the question statement;

[0099] The output unit 34 is used to output the answer to the question statement based on the target atlas data determined by the determination unit 33 and the operation elements extracted by the extraction unit 31.

[0100] Further, such as Figure 4 As shown, the extraction unit 31 includes:

[0101] Segmenting the question sentence to obtain a segmentation result;

[0102] A recall module 311 is used to traverse the word segmentation results and recall entities related to the word segmentation results in the knowledge graph through fuzzy query to obtain candidate entities;

[0103] A calculation module 312 is used to calculate the matching degree between each candidate entity recalled by the first recall module 311 and the question sentence, and sort the candidate entities according to the matching degree;

[0104] The determination module 313 is used to take the candidate entities sorted by the calculation module 312 before the preset order as the target entity.

[0105] Further, such as Figure 4 As shown, the operation element includes a target digital quantity and a target operator, and the extraction unit 31 also includes:

[0106] A conversion module 314, used for the user to convert the question sentence into a sentence to be recognized, and the digital quantity in the sentence to be recognized is presented according to a preset digital quantity rule;

[0107] A first extraction module 315 is used to extract the numerical quantity in the sentence to be recognized obtained by the conversion module 314 using a regular expression to obtain the target numerical quantity;

[0108] The second extraction module 316 is used to extract the operator in the question statement using a regular expression to obtain the target operator.

[0109] Further, such as Figure 4 As shown, the key element also includes a target ontology, which is obtained by screening the ontology related to the word segmentation result, and the recall unit 32 includes:

[0110] A first recall module 321, used to use the target entity to recall graph data related to the target entity from the knowledge graph;

[0111] A second recall module 322 is used to recall graph data related to the target ontology from the knowledge graph using the target ontology;

[0112] The determination module 323 is used to determine the graph data related to the target entity recalled by the first recall module 321 and the graph data related to the target entity recalled by the second recall module 322 as the graph data set.

[0113] Further, such as Figure 4 As shown, the determining unit 33 includes:

[0114] A calculation module 331 is used to calculate the similarity between each graph data and the question statement, and obtain the graph data with the highest similarity, wherein the graph data with the highest similarity is the entity relationship and / or entity attribute in the graph data set that is most relevant to the question statement;

[0115] The determination module 332 is used to determine the entity relationship and its entities and / or the entity attributes and its entities determined by the calculation module 331 as target graph data.

[0116] Further, such as Figure 4 As shown, the output unit 34 includes:

[0117] A first determination module 341 is used to determine the question type and query statement of the question statement according to the target graph data and the operation element;

[0118] A recall module 342, configured to recall graph data corresponding to the query statement in the knowledge graph using the query statement determined by the first determination module 341;

[0119] The assembling module 343 is used to assemble sentences of the graph data recalled by the recall module 342 based on the question type determined by the first determining module 341, obtain the answer to the question sentence, and output the answer.

[0120] Further, such as Figure 4 As shown, the output unit 34 also includes:

[0121] A creation module 344 is used to create a problem type classification table;

[0122] A search module 345 is used to search for a question type corresponding to the question statement in the question type classification table created by the creation module 344 according to the target graph data and the operation element;

[0123] The second determination module 346 is used to determine the question type obtained by the search module 345 as the question type of the question statement.

[0124] Furthermore, the embodiment of the present application also provides a processor, the processor is used to run a program, wherein the program executes the above Figure 1-2 The knowledge graph question answering method described in .

[0125] Furthermore, an embodiment of the present application further provides a storage medium, wherein the storage medium is used to store a computer program, wherein when the computer program is running, the device where the storage medium is located is controlled to execute the above Figure 1-2 The knowledge graph question answering method described in .

[0126] Furthermore, an embodiment of the present application provides an electronic device 4, such as Figure 5 As shown, the device includes at least one processor 41, at least one memory 42 and a bus 43 connected to the processor 41; the processor 41 and the memory 42 communicate with each other through the bus 43; the processor 41 is used to call the program instructions in the memory 42 to execute the above-mentioned knowledge graph question-answering method. The device in this article can be a server, PC, PAD, mobile phone, etc.

[0127] Furthermore, the present application also provides a computer program product, which, when executed on a data processing device, is suitable for executing a program that initializes the steps of the knowledge graph question and answer method as described above.

[0128] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0129] It is understandable that the related features in the above methods and devices can be referenced to each other. In addition, the "first", "second" and the like in the above embodiments are used to distinguish the embodiments, but do not represent the advantages and disadvantages of the embodiments.

[0130] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0131] The algorithm and display provided herein are not inherently related to any particular computer, virtual system or other device. Various general purpose systems can also be used together with the teachings based on this. According to the above description, it is obvious that the structure required for constructing such systems. In addition, the application is not directed to any specific programming language either. It should be understood that various programming languages ​​can be utilized to realize the content of the application described herein, and the description of the specific language above is for the purpose of disclosing the best mode of implementation of the application.

[0132] In addition, the memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.

[0133] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.

[0134] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0135] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0136] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process in the computer or other programmable device. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0137] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0138] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.

[0139] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.

[0140] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.

[0141] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.

[0142] The above are only embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included within the scope of the claims of the present application.

Claims

1. A knowledge graph question answering method, characterized in that: The method comprises: Extracting key elements in the question statement, wherein the key elements include a target entity and an operation element; Using the target entity, recalling graph data related to the target entity from the knowledge graph to obtain a graph data set; Determining target atlas data from the atlas data set using the question statement; Based on the target graph data and the operation elements, an answer to the question statement is output.

2. The method according to claim 1, characterized in that The target entity extraction implementation method includes: Segmenting the question sentence to obtain a segmentation result; Traversing the word segmentation results, recalling entities related to the word segmentation results in the knowledge graph through fuzzy query, and obtaining candidate entities; Calculate the matching degree between each candidate entity and the question sentence respectively, and sort the candidate entities according to the matching degree; The candidate entity before the preset order is taken as the target entity.

3. The method according to claim 2, characterized in that The key element also includes a target ontology, which is obtained by screening the ontology related to the word segmentation result. Then, the target entity is used to recall the graph data related to the target entity from the knowledge graph to obtain a graph data set, including: Recalling graph data related to the target entity from the knowledge graph using the target entity; Recalling graph data related to the target ontology from the knowledge graph using the target ontology; The graph data related to the target entity and the graph data related to the target ontology are determined as the graph data set.

4. The method according to claim 1, characterized in that: The operation element includes a target digital quantity and a target operator, and the extraction implementation method of the operation element includes: Converting the question sentence into a sentence to be recognized, wherein the numerical quantity in the sentence to be recognized is presented according to a preset numerical quantity rule; Extracting the numerical quantity in the sentence to be recognized by using a regular expression to obtain the target numerical quantity; and / or, The operator in the question statement is extracted using a regular expression to obtain the target operator.

5. The method according to any one of claims 1 to 4, characterized in that: Determining target atlas data from the atlas data set using the question statement includes: Calculate the similarity between each graph data and the question statement respectively, and obtain the graph data with the highest similarity, wherein the graph data with the highest similarity is the entity relationship and / or entity attribute in the graph data set that is most relevant to the question statement; The entity relationship and its entities and / or the entity attributes and its entities are determined as target graph data.

6. The method according to claim 1, characterized in that Outputting an answer to the question statement based on the target graph data and the operation element includes: Determining the question type and query statement of the question statement according to the target graph data and the operation element; Recalling graph data corresponding to the query statement in the knowledge graph using the query statement; The graph data is sentence assembled based on the question type to obtain an answer to the question sentence, and the answer is output.

7. The method according to claim 6, characterized in that The step of determining the question type of the question statement includes: Create a taxonomy of question types; According to the target graph data and the operation element, find the question type corresponding to the question statement in the question type classification table; The question type is determined as the question type of the question sentence.

8. A knowledge graph question-answering device, characterized in that: The device comprises: An extraction unit, used to extract key elements in the question statement, wherein the key elements include a target entity and an operation element; A recall unit, used to use the target entity to recall graph data related to the target entity from the knowledge graph to obtain a graph data set; A determination unit, configured to determine target graph data from the graph data set using the question statement; An output unit is used to output an answer to the question statement based on the target graph data and the operation element.

9. A storage medium, characterized in that: The storage medium is used to store a computer program, wherein when the computer program is running, it controls the device where the storage medium is located to execute the knowledge graph question and answer method described in any one of claims 1 to 7.

10. An electronic device, characterized in that: The device includes at least one processor, and at least one memory and a bus connected to the processor; wherein the processor and the memory communicate with each other through the bus; the processor is used to call program instructions in the memory to execute the knowledge graph question and answer method as described in any one of claims 1-7.

Citation Information

Cited By

  • Domain knowledge supplement and SQL generation optimization method and device based on large model

    CN119938891A