Automatic question answering method and device, electronic equipment and storage medium
By identifying and extracting entity and entity association information from the question to be answered, the problem of the inability to parse multi-entity questions in the existing technology is solved, and accurate answers and rapid responses to complex questions are achieved.
Patent Information
- Application Number
- CN202211371930.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-03
- Publication Date
- 2026-08-25
- Estimated Expiration
- 2042-11-03
AI Technical Summary
Existing automated question answering methods cannot accurately parse user questions that contain multiple entities, attributes, or relationships, resulting in the inability to provide accurate answers.
By identifying entities, entity attributes, entity relationships, and entity constraints in the question to be answered, matching information is extracted, and the answer is determined from a pre-defined knowledge graph.
It enables accurate answers to complex questions involving multiple entities, improves semantic understanding and parsing capabilities, and enhances the response speed and accuracy of the question-answering system.
Smart Images

Figure CN116127026B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of artificial intelligence technology, and in particular to an automatic question-answering method, apparatus and question-answering robot. Background Technology
[0002] With the development of artificial intelligence technology, intelligent question-answering systems are widely used in daily life. Among them, knowledge graph-based question-answering methods work by parsing user questions to obtain a query graph of the user's question in the knowledge graph, and then constructing the corresponding answer to the user's question by querying the knowledge graph.
[0003] Currently, although automatic question answering methods have matured, they typically do not consider entity constraints in questions and struggle to parse questions containing multiple entities, attributes, or relationships, thus failing to provide accurate answers to user-submitted questions. Summary of the Invention
[0004] In view of the above, this disclosure provides an automatic question-answering method, apparatus, electronic device, and storage medium.
[0005] In a first aspect, an automatic question-answering method is provided, comprising: identifying at least one entity and at least one entity association information contained in a question to be answered, wherein each entity association information contains one of entity attributes, entity relationships, and entity constraints; extracting information from the question to be answered based on the first information to obtain second information; wherein the first information includes at least one of the following: a first number of entities in the question to be answered and a second number of entity association information, and a third number of entity association information containing entity constraints in the question to be answered; the second information includes at least one of the following: first matching information contained in at least one entity and at least one entity association information, and second matching information contained in at least one entity constraint; and determining the answer statement corresponding to the question to be answered from a preset knowledge graph based on at least one entity, at least one entity association information, and the second information.
[0006] Secondly, an automatic question-answering device is provided, comprising: an identification module for identifying at least one entity and at least one entity association information contained in a question to be answered, wherein each entity association information contains one of entity attributes, entity relationships, and entity constraints; an extraction module for extracting information from the question to be answered based on first information to obtain second information; wherein the first information includes at least one of the following: a first number of entities in the question to be answered and a second number of entity association information, and a third number of entity association information containing entity constraints in the question to be answered; the second information includes at least one of the following: first matching information contained in at least one entity and at least one entity association information, and second matching information contained in at least one entity constraint; and a determination module for determining the answer statement corresponding to the question to be answered from a preset knowledge graph based on at least one entity, at least one entity association information, and the second information.
[0007] Thirdly, an electronic device is provided, comprising: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to perform the method of the first aspect by executing the executable instructions.
[0008] Fourthly, a computer-readable storage medium is provided having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the method of the first aspect described above.
[0009] The automatic question-answering method provided in this disclosure, after identifying the entities and entity association information contained in the question to be answered, can extract matching information related to the entities and entity association information. Thus, given the clear matching information, it determines the answer statement corresponding to the question to be answered from a preset knowledge graph, thereby achieving accurate answers to complex questions containing multiple entities. Furthermore, since the entity association information in this disclosure includes entity constraints, the method can also accurately parse complex questions containing single or multiple entity constraints. In addition, by extracting matching information related to entities and entity association information, the ability to parse complex questions is improved, making the semantic understanding of user questions more accurate, and thus enabling fast and efficient accurate answers to user questions. Attached Figure Description
[0010] Figure 1 A schematic diagram of the system architecture of an automatic question-answering method according to an embodiment of this disclosure is shown.
[0011] Figure 2 A flowchart illustrating an automatic question-answering method according to an embodiment of this disclosure is shown.
[0012] Figure 3 A flowchart illustrating the method for extracting first matching information in an embodiment of this disclosure is shown.
[0013] Figure 4 A flowchart illustrating the method for extracting second matching information in an embodiment of this disclosure is shown.
[0014] Figure 5 A schematic diagram of an automatic question-and-answer device according to an embodiment of the present disclosure is shown.
[0015] Figure 6 A schematic diagram of the structure of an electronic device according to an embodiment of the present disclosure is shown. Detailed Implementation
[0016] Exemplary embodiments will now be described more fully with reference to the accompanying drawings. However, these exemplary embodiments can be implemented in many forms and should not be construed as limited to the examples set forth herein; rather, they are provided so that this disclosure will be more comprehensive and complete, and will fully convey the concept of the exemplary embodiments to those skilled in the art. The described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.
[0017] Furthermore, the accompanying drawings are merely illustrative of this disclosure and are not necessarily drawn to scale. The same reference numerals in the drawings denote the same or similar parts, and therefore repeated descriptions of them will be omitted. Some block diagrams shown in the drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities may be implemented in software, in one or more hardware modules or integrated circuits, or in different network and / or processor devices and / or microcontroller devices.
[0018] Knowledge graph-based question answering technology answers user questions based on the structured knowledge already present in the knowledge graph. Structured knowledge in a knowledge graph is typically represented as triples, where a triple is (subject, relation, object), and each triple is also called a fact. Knowledge graph-based question answering technology can transform natural language questions into machine-executable logical expressions through a certain semantic understanding architecture.
[0019] Although knowledge graph-based question answering technology has matured, most automatic question answering methods in this field focus on solving conventional questions based on entities, entity attributes, and entity relationships, without considering entity constraints within the question. In real-world business scenarios, user questions are often complex and varied, involving not only entity constraints but also questions with multiple entities or constraints, or even questions containing both. However, current knowledge graph-based question answering technologies cannot identify matching relationships arising from multiple entities or constraints. For example, when a question contains two entities, current automatic question answering methods can only identify the two entities and all their corresponding entity attributes and relationships, but cannot determine which specific entity each attribute or relationship corresponds to. For these reasons, current automatic question answering methods cannot accurately parse the semantics of user questions and therefore cannot provide accurate answers.
[0020] In view of this, the solution provided in this disclosure achieves an accurate understanding of the user's complex questions by identifying the entities, entity attributes, entity relationships and entity constraints contained in the question to be answered, and extracting the matching information therein, and then determining the corresponding answer from the preset knowledge graph.
[0021] Figure 1 An exemplary system architecture diagram is shown that can be applied to the automatic question answering method or automatic question answering device in the embodiments of this disclosure.
[0022] like Figure 1 As shown, the system architecture 100 may include a terminal device 101, a question-and-answer device 102, and a question-and-answer database 103.
[0023] Terminal device 101 can be various electronic devices, such as smartphones, tablets, laptops, desktop computers, wearable devices, augmented reality devices, virtual reality devices, etc., but is not limited to these.
[0024] For example, a client capable of initiating the automatic question-answering method provided in this disclosure is deployed on the terminal device 101. This client can be an application, a web client, a mini-program client, etc., but is not limited to these. Furthermore, depending on the terminal platform, the specific form of the client can also be different; for example, the client can be a mobile client, a PC client, etc.
[0025] The question-answering device 102 may be an electronic device capable of executing the automatic question-answering method provided in this disclosure, such as a smart speaker, a question-answering robot, a server, a cloud platform, etc., but is not limited thereto. The question-answering device 102 may be directly or indirectly connected to the terminal device 101 via wired or wireless communication, and this disclosure does not impose any restrictions on this.
[0026] The question-and-answer database 103 can be a server with a database deployed on it, storing a knowledge graph. It is worth noting that the question-and-answer database 103 can also be a different virtual module configured on the same server as the question-and-answer device 102, and this disclosure does not impose any restrictions on this.
[0027] In some embodiments, a user can input a question to be answered into the question-and-answer device 102 via the terminal device 101. The input can be in the form of voice or text. After receiving the question, the question-and-answer device 102 will parse the question, retrieve relevant answers from the question-and-answer database 103, and finally form an answer statement in natural language and feed it back to the terminal device 101 so that the answer statement can be displayed to the user.
[0028] For example, in Figure 1 In the process, a user inputs an unanswered question through terminal device 101: "How long is the recovery period for radiofrequency facial slimming, and what is the price of radiofrequency waist slimming?" After obtaining the unanswered question, question-answering device 102 can analyze the unanswered question and query it in question-answering database 103, and finally output the answer: "The recovery period for radiofrequency facial slimming is 1 month, and the price of radiofrequency waist slimming is 2000 yuan."
[0029] In some application scenarios, users can also directly input questions to the question-answering device 102. For example, when the question-answering device 102 is a smart speaker, the user can directly input questions to the smart speaker via voice. After receiving the question, the smart speaker can parse the question based on the automatic question-answering method provided in this disclosure, obtain the corresponding answer from the knowledge graph stored in the question-answering database 103, and finally form an answer statement in natural language, which is then directly fed back to the user in the form of voice.
[0030] Those skilled in the art will know that Figure 1 The number of terminal devices, question-and-answer devices, and question-and-answer databases shown are merely illustrative. Depending on actual needs, there may be any number of terminal devices, question-and-answer devices, and question-and-answer databases, and this disclosure does not impose any restrictions on this.
[0031] The following will describe the exemplary implementation method in detail with reference to the accompanying drawings and embodiments.
[0032] First, this disclosure provides an automatic question-answering method, which can be executed by any electronic device with computing power.
[0033] Figure 2 This diagram illustrates a flowchart of an automatic question-answering method according to an embodiment of the present disclosure, such as... Figure 2As shown in the embodiments of this disclosure, the automatic question-answering method includes the following steps.
[0034] S201, Identify at least one entity and at least one entity association information contained in the question to be answered.
[0035] It should be noted that the question to be answered can be a text-based question collected by a terminal device or a voice-based question received by a microphone; this disclosure does not limit the scope of the question.
[0036] It's important to note that an entity is an abstract object of a person, event, or thing, generally a noun. Examples include "student," "Chinese class," and "astronaut." Entity association information further illustrates the characteristics of an entity, such as entity attributes, entity relationships, and entity constraints. An entity attribute is a characteristic description of an entity. For example, if A's birth date is July 4, 2000, then "A" is an entity, and "July 4, 2000" is an attribute of "A," which is "birth date." An entity relationship refers to the relationship between two entities. For example, if B is an astronaut, then "B" and "astronaut" are two entities, and the relationship between them is "occupation," meaning B's occupation is astronaut. Entity constraints include constraint conditions and constraint attributes. Constraint conditions are restrictive conditions imposed on an entity, while constraint attributes are characteristic descriptions of the constraint conditions. For example, engine oil priced below 200 yuan, where "engine oil" is an entity, and "below 200 yuan" is a constraint condition for "engine oil", the constraint property of which is "price", that is, below 200 yuan is a constraint on the price of engine oil.
[0037] In some embodiments, the question to be answered can be a complex question involving multiple entities and their associated information. For example, the question to be answered can be a complex question involving multiple entities, an entity attribute, and an entity relationship; it can also be a complex question involving multiple entities and multiple entity attributes; or it can be a complex question involving multiple entities, an entity attribute, and an entity constraint. This disclosure does not limit the scope of the examples. Furthermore, the question to be answered can also be a complex question involving multiple entity constraints. In this case, the number of entities in the question to be answered is not limited. Because related technologies do not consider the matching relationships between multiple objects when processing the aforementioned complex questions, the question-answering system's understanding of the semantics of the question to be answered can become confused.
[0038] It should be noted that the entity recognition in this embodiment can be achieved using sequence labeling. Sequence labeling is a fundamental task in natural language processing. As those skilled in the art will understand, sequence labeling based on models such as BiLSTM-CRF and BertCRF can identify the entities contained in the question to be answered. This disclosure will not elaborate further on this aspect.
[0039] It should be noted that the identification method for constraints in this embodiment is the same as the identification method for entities, and both can be identified by sequence labeling. This disclosure will not elaborate further on this.
[0040] It should be noted that the identification of entity attributes and entity relationships in this embodiment can be performed using conventional classification models, such as BERT-based models, TextCNN-based models, LSTM-based models, etc., which will not be elaborated upon further in this disclosure. For example, by using a classification model to identify the question "How long is the recovery period for radiofrequency liposuction?", it can be identified that the user expects the "recovery period" attribute of radiofrequency liposuction. Similarly, by identifying the question "Who is A's daughter?", it can be identified that the user expects the relationship "A's daughter".
[0041] It should be noted that the identification method for constraint attributes in this embodiment is the same as the identification method for entity attributes and entity relationships, and both can be identified using a classification model. This disclosure will not elaborate further on this.
[0042] In some embodiments, after identifying entities contained in the question to be answered, the identified entities can be mapped to standard entities in the knowledge graph to construct a query graph applicable to the knowledge graph. Specifically, multiple candidate entities corresponding to the identified entities can be obtained from the knowledge graph, and then the similarity between each candidate entity and the identified entity can be calculated. The candidate entity with the highest similarity is then used as the standard entity of the entity contained in the question to be answered, for constructing the query graph of the knowledge graph.
[0043] For example, regarding the question "How long is the recovery period for radiofrequency facial slimming?", the entity "radiofrequency facial slimming" can be identified using the sequence annotation method described above. First, multiple candidate entities related to "radiofrequency facial slimming" are obtained from the knowledge graph, such as "radiofrequency liposuction for facial slimming" and "radiofrequency liposuction for waist reduction." Next, the similarity between each candidate entity and the identified entity can be calculated. Specifically, the question and each candidate entity can be concatenated separately, and then fed into a binary classification model for scoring. The specific concatenation method is as follows: <s project>Radiofrequency face slimming <e project>How long is the recovery period? [sep] <s project>Radiofrequency fat reduction for facial slimming <e project>".in, <s project>、[sep] and <e project>All three are special identifiers. <s project>The entity type for a segment of radiofrequency facial slimming is "project," and it is used to indicate the start position of that entity segment. Similarly, <e project>Used to indicate the end position of an entity fragment. [sep] is the separator between the question to be solved and the candidate entities. The concatenated sequence is sequentially fed into a preset binary classification model (e.g., a BERT-based binary classification model) to obtain a similarity score for each candidate entity. Finally, the candidate entity with the highest similarity score is selected as the standard entity included in the question to be solved.
[0044] In some embodiments, the constraints included in entity constraints can be expressed in the form of logical expressions. For example, constraints can be expressed by pre-setting logical expression templates corresponding to some fields. Specifically, for the constraint "below 200 yuan", it can be converted into "X<200" by applying the pre-set logical expression template, where "X" represents the price. For constraints not in the pre-set fields, a classification model can be used to determine them, and finally, a logical expression applicable to the constraint can be obtained.
[0045] In some embodiments, the question to be answered can be preprocessed before identifying the entities and entity association information contained in it. For example, stop words, special symbols, and sensitive information can be removed from the question. By preprocessing the question, interference from useless information can be avoided during the parsing process, thus improving the accuracy of the parsing.
[0046] S202, based on the first information, extract information from the question to be answered to obtain the second information.
[0047] It should be noted that the first information includes at least one of the following: a first number of entities in the question to be solved and a second number of entity association information; a third number of entity association information containing entity constraints in the question to be solved. The second information includes at least one of the following: at least one entity and at least one entity association information containing first matching information; at least one entity constraint containing second matching information.
[0048] In some embodiments, if the first number of entities contained in the question to be answered is multiple, and the second number of entity association information contained in the question to be answered is multiple, then the multiple entities and multiple entity association information contained in the question to be answered are matched respectively to obtain multiple first matching information.
[0049] This embodiment of the disclosure triggers the extraction of first matching information based on a first quantity and a second quantity, which avoids the possibility of missing the first matching information in specific situations. At the same time, it also avoids the extraction of unnecessary first matching information, thus balancing the accuracy of the extraction of the first matching information and the running efficiency of the question-and-answer method.
[0050] For example, Figure 3 A flowchart illustrating a method for extracting first matching information according to an embodiment of this disclosure is shown. Specifically, the method for extracting first matching information includes the following steps.
[0051] S301, each entity in the multiple entities contained in the question to be answered is concatenated with the association information of each entity in the multiple entity association information contained in the question to be answered, to obtain multiple first entity matching texts.
[0052] S302, match the multiple first entity matching texts with the question to be answered, and obtain multiple second entity matching texts that match the question to be answered.
[0053] S303, based on multiple second entity matching texts, obtain multiple first matching information.
[0054] For example, consider the question: "What is the recovery period for radiofrequency facial slimming, and what is the price of radiofrequency waist slimming?" This involves two entities: "radiofrequency facial slimming" and "radiofrequency waist slimming," and two entity attributes: "recovery period" and "price." Related technologies do not provide the correspondence between these two entities and attributes. However, according to the method provided in this disclosure, firstly, four first entity matching texts are constructed: "radiofrequency facial slimming recovery period," "radiofrequency facial slimming price," "radiofrequency waist slimming recovery period," and "radiofrequency waist slimming price." Next, these four first entity matching texts are fed into a text matching model along with the question to obtain second entity matching texts that match the question. For example, feeding "What is the recovery period for radiofrequency facial slimming, and what is the price of radiofrequency waist slimming?" and "radiofrequency facial slimming recovery period" into the text matching model shows that they match. However, feeding "What is the recovery period for radiofrequency facial slimming, and what is the price of radiofrequency waist slimming?" and "radiofrequency waist slimming recovery period" into the text matching model shows that they do not match. Therefore, it can be determined that the second entity matching text matching the question to be answered is "RF facial slimming recovery period" and "RF facial slimming price". Furthermore, based on the second entity matching text, it can be seen that the entity "RF facial slimming" corresponds to the entity attribute "recovery period", and the entity "RF facial slimming" corresponds to the entity attribute "price". It should be noted that the above text matching model can choose the dual-tower model or the interaction model in related technologies, which will not be elaborated further in this embodiment.
[0055] It should be noted that the above example only illustrates the method of extracting the first matching information by matching multiple entities and multiple entity attributes. Those skilled in the art will understand that, based on the same inventive concept, when there are multiple entities and any number of entity attributes, entity relationships, and entity constraints in the problem to be solved, the method of extracting the first matching information is similar to the above, and this disclosure will not elaborate further on this.
[0056] This disclosure solves the matching problem between multiple entities and their associated information by applying a text matching model to the matching of entities and entity association information. It is easy to operate, has a low learning cost for users, and can guarantee the accuracy of matching, thereby ensuring the ability of the question-answering method provided by this disclosure to parse complex user questions.
[0057] The above describes the methods for extracting matching information when the unsolved question contains multiple entities. The following section will further describe the methods for extracting matching information when the unsolved question contains multiple entity association information with entity constraints.
[0058] In some embodiments, if there are multiple third entities with entity constraints in the question to be answered, then multiple entity constraint conditions and multiple entity constraint attributes in the multiple entity association information containing entity constraints are matched respectively to obtain multiple second matching information.
[0059] This embodiment of the disclosure triggers the extraction of second matching information based on a third quantity, which avoids the possibility of missing second matching information in specific situations. At the same time, it also avoids the extraction of unnecessary second matching information, thus balancing the accuracy of second matching information extraction and the operating efficiency of the question-and-answer method.
[0060] For example, Figure 4 A flowchart illustrating the method for extracting second matching information according to an embodiment of this disclosure is shown. Specifically, the method for extracting second matching information includes the following steps.
[0061] S401, each entity constraint condition in multiple entity association information containing entity constraints is concatenated with each entity constraint attribute in multiple entity association information containing entity constraints to obtain multiple first constraint matching texts.
[0062] S402, match the multiple first constraint matching texts with the question to be answered, and obtain multiple second constraint matching texts that match the question to be answered.
[0063] S403, based on multiple second constraint matching texts, obtain multiple second matching information.
[0064] For example, regarding the question "What white cars are available for under 200,000 yuan?", this involves two entity constraints: "under 200,000 yuan" and "white," as well as two entity constraint attributes: "price" and "color." According to the method provided in this embodiment, firstly, four first constraint matching texts are constructed: "price under 200,000 yuan," "color under 200,000 yuan," "white price," and "white color." Next, one can refer to... Figure 3 In the same manner as the illustrated embodiment, the four first constraint matching texts are respectively fed into the text matching model along with the question to be answered, resulting in second constraint matching texts that match the question to be answered, namely "price below 200,000" and "white color". Furthermore, based on the second constraint matching texts, it can be determined that the entity constraint condition "below 200,000" corresponds to the entity constraint attribute "price", and the entity constraint condition "white" corresponds to the entity constraint attribute "color". It should be noted that the above text matching model can be either the dual-tower model or the interaction model from related technologies; this embodiment will not elaborate further on this.
[0065] This embodiment of the disclosure solves the matching problem between multiple entity constraints and multiple entity constraint attributes by applying a text matching model to the matching of entity constraints and entity constraint attributes. It is simple to operate, has a low user learning cost, and can guarantee the accuracy of matching, thereby ensuring the ability of the question answering method provided by this disclosure to parse complex user questions.
[0066] It should be noted that, due to the complexity and diversity of user questions, the unanswered questions in this embodiment of the disclosure may simultaneously satisfy all of the above conditions, and may also be based on... Figure 3 and Figure 4 The method shown obtains first matching information and second matching information respectively. In this case, since the first matching information and the second matching information are complementary, the first matching information and the second matching information can be used simultaneously as matching information in the embodiments of this disclosure.
[0067] S203, based on at least one entity, at least one entity association information, and second information, determine the answer statement corresponding to the question to be answered from the preset knowledge graph.
[0068] For example, a query graph for the question to be answered can be constructed first based on the entity, entity association information, and secondary information. Then, based on the query graph, the answer statement corresponding to the question to be answered can be determined from a pre-defined knowledge graph.
[0069] It's important to note that a query graph is a subgraph structure similar to a knowledge graph. A query graph can be directly mapped to a logical semantic expression, such as the query language SPARQL. Therefore, in knowledge graph-based question answering, the parsing of the question to be answered is simplified into the process of generating the query graph, transforming the question into a phased search problem. This significantly improves the search speed for answer-related information within the knowledge graph, thereby enhancing the response speed of the knowledge graph-based question answering system.
[0070] For example, the method for constructing a query graph for a question to be answered in this embodiment of the present disclosure is as follows: at least one query node is generated based on at least one entity, and the edge relationships of at least one query node are determined based on at least one entity association information and second information; at least one query node is used to indicate at least one preset entity in a preset knowledge graph corresponding to at least one entity, and the edge relationships of at least one query node are used to indicate the query relationships of at least one query node in the preset knowledge graph. A query graph for the question to be answered is constructed based on at least one query node and at least one edge relationship of the query node.
[0071] For example, for the question "What white cars are priced under 200,000?", "cars" can be treated as a node in the query graph. Based on the matching relationship between entity constraints and entity constraint attributes given in the second information, the edge relationship of this query node is obtained as "price: under 200,000; color: white". Then, based on this query node and its edge relationship, the answer corresponding to the question can be retrieved from a pre-defined knowledge graph.
[0072] Since the query method based on the query graph is well known to those skilled in the art, it will not be described in detail here.
[0073] The automatic question-answering method provided in this disclosure, after identifying the entities and entity association information contained in the question to be answered, can extract matching information related to the entities and entity association information. Thus, given the clear matching information, it determines the answer statement corresponding to the question to be answered from a preset knowledge graph, thereby achieving accurate answers to complex questions containing multiple entities. Furthermore, since the entity association information in this disclosure includes entity constraints, the method can also accurately parse complex questions containing single or multiple entity constraints. In addition, by extracting matching information related to entities and entity association information, the ability to parse complex questions is improved, making the semantic understanding of user questions more accurate. This allows for faster and more efficient accurate answers to user questions, improving the user experience.
[0074] Figure 5 This diagram illustrates the structure of an automatic question-and-answer device according to an embodiment of the present disclosure, as shown below. Figure 5 As shown, the automatic question-and-answer device 500 includes: an identification module 501, an extraction module 502, and a determination module 503.
[0075] Specifically, the identification module 501 is used to identify at least one entity and at least one entity association information contained in the question to be answered, wherein each entity association information contains one of entity attributes, entity relationships, and entity constraints. The extraction module 502 is used to extract information from the question to be answered based on the first information to obtain second information; wherein the first information includes at least one of the following: a first number of entities in the question to be answered and a second number of entity association information, and a third number of entity association information containing entity constraints in the question to be answered; the second information includes at least one of the following: first matching information contained in at least one entity and at least one entity association information, and second matching information contained in at least one entity constraint. The determination module 503 is used to determine the answer statement corresponding to the question to be answered from a preset knowledge graph based on at least one entity, at least one entity association information, and the second information.
[0076] In some embodiments, the extraction module 502 is further configured to, if both the first quantity and the second quantity are multiple, match the multiple entities and multiple entity association information contained in the question to be answered respectively to obtain multiple first matching information.
[0077] In some embodiments, the extraction module 502 is further configured to: concatenate each entity in the plurality of entities contained in the question to be answered with each entity association information in the plurality of entity association information contained in the question to be answered, to obtain a plurality of first entity matching texts; match the plurality of first entity matching texts with the question to be answered, to obtain a plurality of second entity matching texts that match the question to be answered; and obtain a plurality of first matching information based on the plurality of second entity matching texts.
[0078] In some embodiments, entity constraints include entity constraint conditions and entity constraint attributes. The extraction module 502 is further configured to, if there are multiple third quantities, match the multiple entity constraint conditions and multiple entity constraint attributes in the multiple entity association information containing entity constraints respectively to obtain multiple second matching information.
[0079] In some embodiments, the extraction module 502 is further configured to: concatenate each entity constraint condition in the plurality of entity association information containing entity constraints with each entity constraint attribute in the plurality of entity association information containing entity constraints to obtain a plurality of first constraint matching texts; match the plurality of first constraint matching texts with the question to be answered to obtain a plurality of second constraint matching texts that match the question to be answered; and obtain a plurality of second matching information based on the plurality of second constraint matching texts.
[0080] In some embodiments, the determining module 503 is further configured to construct a query graph of the question to be answered based on at least one entity, at least one entity association information, and second information; and determine the answer statement corresponding to the question to be answered from a preset knowledge graph based on the query graph of the question to be answered.
[0081] In some embodiments, the determining module 503 is further configured to generate at least one query node based on at least one entity, and determine the edge relationship of at least one query node based on at least one entity association information and second information; at least one query node is used to indicate at least one preset entity in the preset knowledge graph corresponding to at least one entity, and the edge relationship of at least one query node is used to indicate the query relationship of at least one query node in the preset knowledge graph; and a query graph of the question to be answered is constructed based on at least one query node and the edge relationship of at least one query node.
[0082] It should be noted that the automatic question-answering device provided in the above embodiments is only illustrated by the division of the above functional modules when used for graph question answering. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the automatic question-answering device and the automatic question-answering method embodiments provided in the above embodiments belong to the same concept, and the specific implementation process can be found in the method embodiments, which will not be repeated here.
[0083] Those skilled in the art will understand that various aspects of this disclosure can be implemented as a system, method, or program product. Therefore, various aspects of this disclosure can be specifically implemented in the following forms: a completely hardware implementation, a completely software implementation (including firmware, microcode, etc.), or a combination of hardware and software aspects, collectively referred to herein as a "circuit," "module," or "system."
[0084] The following reference Figure 6 To describe an electronic device 600 according to such an embodiment of the present disclosure. Figure 6 The electronic device 600 shown is merely an example and should not be construed as limiting the functionality and scope of the embodiments disclosed herein.
[0085] like Figure 6 As shown, the electronic device 600 is manifested in the form of a general-purpose computing device. The components of the electronic device 600 may include, but are not limited to: at least one processing unit 610, at least one storage unit 620, and a bus 630 connecting different system components (including storage unit 620 and processing unit 610).
[0086] The storage unit stores program code, which can be executed by the processing unit 610, causing the processing unit 610 to perform the steps described in the "Exemplary Methods" section above according to various exemplary embodiments of this disclosure.
[0087] In some embodiments, the processing unit 610 may perform the following steps of the above method embodiments: identifying at least one entity and at least one entity association information contained in the question to be answered, wherein each entity association information contains one of entity attributes, entity relationships, and entity constraints; extracting information from the question to be answered based on the first information to obtain second information; wherein the first information includes at least one of the following: a first number of entities in the question to be answered and a second number of entity association information, and a third number of entity association information containing entity constraints in the question to be answered; the second information includes at least one of the following: first matching information contained in at least one entity and at least one entity association information, and second matching information contained in at least one entity constraint; determining the answer statement corresponding to the question to be answered from a preset knowledge graph based on at least one entity, at least one entity association information, and the second information.
[0088] Storage unit 620 may include a readable medium in the form of a volatile storage unit, such as random access memory (RAM) 6201 and / or cache memory 6202, and may further include a read-only memory (ROM) 6203.
[0089] Storage unit 620 may also include a program / utility 6204 having a set (at least one) program module 6205, such program module 6205 including but not limited to: operating system, one or more application programs, other program modules and program data, each or some combination of these examples may include an implementation of a network environment.
[0090] Bus 630 can represent one or more of several types of bus structures, including a memory cell bus or memory cell controller, a peripheral bus, a graphics acceleration port, a processing unit, or a local bus using any of the various bus structures.
[0091] Electronic device 600 can also communicate with one or more external devices 640 (e.g., keyboard, pointing device, Bluetooth device, etc.), and with one or more devices that enable a user to interact with electronic device 600, and / or with any device that enables electronic device 600 to communicate with one or more other computing devices (e.g., router, modem, etc.). This communication can be performed via input / output (I / O) interface 650. Furthermore, electronic device 600 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public networks, such as the Internet) via network adapter 660. As shown, network adapter 660 communicates with other modules of electronic device 600 via bus 630. It should be understood that, although not shown in the figures, other hardware and / or software modules can be used in conjunction with electronic device 600, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0092] From the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solutions according to the embodiments of this disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) or on a network, including several instructions to cause a computing device (such as a personal computer, server, terminal device, or network device, etc.) to execute the methods according to the embodiments of this disclosure.
[0093] In exemplary embodiments of this disclosure, a computer-readable storage medium is also provided, which may be a readable signal medium or a readable storage medium. A program product capable of implementing the methods described above is stored thereon. In some possible implementations, various aspects of this disclosure may also be implemented as a program product including program code, which, when run on a terminal device, causes the terminal device to perform the steps described in the "Exemplary Methods" section of this specification according to various exemplary embodiments of this disclosure.
[0094] More specific examples of computer-readable storage media in this disclosure may include, but are not limited to: electrical connections having one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0095] In this disclosure, a computer-readable storage medium may include a data signal propagated in baseband or as part of a carrier wave, carrying readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A readable signal medium may also be any readable medium other than a readable storage medium, capable of transmitting, propagating, or transmitting a program for use by or in connection with an instruction execution system, apparatus, or device.
[0096] Optionally, the program code contained on the computer-readable storage medium may be transmitted using any suitable medium, including but not limited to wireless, wired, optical fiber, RF, etc., or any suitable combination thereof.
[0097] In practical implementation, program code for performing the operations of this disclosure can be written in any combination of one or more programming languages, including object-oriented programming languages such as Java and C++, and conventional procedural programming languages such as C or similar languages. The program code can execute entirely on the user's computing device, partially on the user's computing device, as a standalone software package, partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing device can be connected to the user's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computing device (e.g., via the Internet using an Internet service provider).
[0098] It should be noted that although several modules or units for the device used to perform actions have been mentioned in the detailed description above, this division is not mandatory. In fact, according to embodiments of this disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided and embodied by multiple modules or units.
[0099] Furthermore, although the steps of the method in this disclosure are described in a specific order in the accompanying drawings, this does not require or imply that the steps must be performed in that specific order, or that all the steps shown must be performed to achieve the desired result. Additional or alternative steps may be omitted, multiple steps may be combined into one step, and / or a step may be broken down into multiple steps.
[0100] From the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solutions according to the embodiments of this disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) or on a network, including several instructions to cause a computing device (such as a personal computer, server, mobile terminal, or network device, etc.) to execute the methods according to the embodiments of this disclosure.
[0101] Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This disclosure is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this disclosure are indicated by the appended claims.< / e> < / s> < / e> < / s> < / e> < / s> < / e> < / s>
Claims
1. An automatic question-answering method, characterized in that, include: Identify at least one entity and at least one entity association information contained in the question to be solved, wherein each entity association information contains one of the following: entity attributes, entity relationships, and entity constraints; If both the first number of entities and the second number of entity association information in the question to be answered are multiple, then each entity in the multiple entities and each entity association information in the multiple entity association information are concatenated to obtain multiple first entity matching texts; the multiple first entity matching texts are matched with the input text matching model of the question to be answered to obtain multiple second entity matching texts that match the question to be answered; based on the multiple second entity matching texts, multiple first matching information is obtained. If the number of third entity association information containing entity constraints in the question to be solved is multiple, then multiple entity constraint conditions and multiple entity constraint attributes in the multiple entity association information containing entity constraints will be matched to obtain multiple second matching information. Based on the at least one entity, the at least one entity association information, the plurality of first matching information and the plurality of second matching information, the answer statement corresponding to the question to be answered is determined from a preset knowledge graph.
2. The method according to claim 1, characterized in that, The process involves matching multiple entity constraint conditions and multiple entity constraint attributes from multiple entity association information containing entity constraints to obtain multiple second matching information, including: Each entity constraint condition in multiple entity association information containing entity constraints is concatenated with each entity constraint attribute in the multiple entity association information containing entity constraints to obtain multiple first constraint matching texts; Multiple first constraint matching texts are matched with the question to be answered to obtain multiple second constraint matching texts that match the question to be answered. Based on the multiple second constraint matching texts, multiple second matching information is obtained.
3. The method according to claim 1 or 2, characterized in that, The step of determining the answer statement corresponding to the question to be answered from a preset knowledge graph based on the at least one entity, the at least one entity association information, the plurality of first matching information, and the plurality of second matching information includes: Based on the at least one entity, the at least one entity association information, the plurality of first matching information, and the plurality of second matching information, a query graph for the question to be answered is constructed. Based on the query graph of the question to be answered, the answer statement corresponding to the question to be answered is determined from the preset knowledge graph.
4. The method according to claim 3, characterized in that, The step of constructing a query graph for the unanswered question based on the at least one entity, the at least one entity association information, the plurality of first matching information, and the plurality of second matching information includes: At least one query node is generated based on the at least one entity, and the edge relationship of the at least one query node is determined based on the at least one entity association information, the plurality of first matching information, and the plurality of second matching information; the at least one query node is used to show at least one preset entity in the preset knowledge graph corresponding to the at least one entity, and the edge relationship of the at least one query node is used to show the query relationship of the at least one query node in the preset knowledge graph; Based on the at least one query node and the edge relationships between the at least one query node, construct the query graph of the problem to be solved.
5. An automatic question-and-answer device, characterized in that, include: The identification module is used to identify at least one entity and at least one entity association information contained in the question to be answered. Each entity association information includes one of the following: entity attributes, entity relationships, and entity constraints. The extraction module is configured to: if both the first number of entities and the second number of entity association information in the unsolved question are multiple, then concatenate each entity and each entity association information in the multiple entities to obtain multiple first entity matching texts; match each of the multiple first entity matching texts with the input text matching model of the unsolved question to obtain multiple second entity matching texts that match the unsolved question; and obtain multiple first matching information based on the multiple second entity matching texts; if the third number of entity association information containing entity constraints in the unsolved question is multiple, then match multiple entity constraint conditions and multiple entity constraint attributes in the multiple entity association information containing entity constraints to obtain multiple second matching information. The determination module is used to determine the answer statement corresponding to the question to be answered from a preset knowledge graph based on the at least one entity, the at least one entity association information, the plurality of first matching information and the plurality of second matching information.
6. An electronic device, characterized in that, include: processor; as well as Memory for storing the executable instructions of the processor; The processor is configured to execute the method of any one of claims 1 to 4 by executing the executable instructions.
7. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the method described in any one of claims 1 to 4.
Citation Information
Patent Citations
Intelligent question and answer method and device, electronic equipment and storage medium
CN113609274A
Question answering method and device based on knowledge graph, storage medium and question answering robot
CN114357137A