CN117932022A - Intelligent question-answering method and device, electronic equipment and storage medium - Google Patents

Intelligent question-answering method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN117932022A
CN117932022A CN202311865633.4A CN202311865633A CN117932022A CN 117932022 A CN117932022 A CN 117932022A CN 202311865633 A CN202311865633 A CN 202311865633A CN 117932022 A CN117932022 A CN 117932022A
Authority
CN
China
Prior art keywords
triplet
question
answer
natural language
triplet set
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202311865633.4A
Other languages
Chinese (zh)
Inventor
顾杜娟
王星凯
杨鑫宜
袁军
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhou Lvmeng Chengdu Technology Co ltd
Nsfocus Technologies Inc
Nsfocus Technologies Group Co Ltd
Original Assignee
Shenzhou Lvmeng Chengdu Technology Co ltd
Nsfocus Technologies Inc
Nsfocus Technologies Group Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhou Lvmeng Chengdu Technology Co ltd, Nsfocus Technologies Inc, Nsfocus Technologies Group Co Ltd filed Critical Shenzhou Lvmeng Chengdu Technology Co ltd
Priority to CN202311865633.4A priority Critical patent/CN117932022A/en
Publication of CN117932022A publication Critical patent/CN117932022A/en
Pending legal-status Critical Current

Links

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application relates to the technical field of artificial intelligence, in particular to an intelligent question-answering method, an intelligent question-answering device, electronic equipment and a storage medium. The method comprises the following steps: acquiring a natural language problem input by an input object, extracting information of the natural language problem, and acquiring a problem triplet set corresponding to the natural language problem, wherein each problem triplet comprises: entity, relationship and answer to be queried; based on the question triplet set, inquiring a preset knowledge graph library to obtain an answer triplet set corresponding to the question triplet set, wherein each answer triplet at least comprises: entity, relationship, and target answer; and combining the data information of the answer triplet sets to generate and return natural language answers. Therefore, the method and the device can understand the various natural language questions of the input objects, answer the various questions, improve the answer accuracy and efficiency, generate natural language answers, facilitate the understanding of users, enrich the answer content and improve the user experience.

Description

Intelligent question-answering method and device, electronic equipment and storage medium
Technical Field
The application relates to the technical field of artificial intelligence, in particular to an intelligent question-answering method, an intelligent question-answering device, electronic equipment and a storage medium.
Background
Along with the rapid development of artificial intelligence technology, the application scene of intelligent question and answer is more and more extensive, for example, scenes such as intelligent customer service, search engines, intelligent home, etc., at present, a Knowledge Graph (KGs) is often adopted to realize intelligent question and answer, so that scattered Knowledge can be systemized and then transmitted to users.
Knowledge graph is a method of representing facts in a structured form. Knowledge graph aims at describing various entities or concepts and relations thereof existing in the real world, and forms a huge semantic network graph, wherein nodes represent the entities or concepts, and edges are formed by attributes or relations.
In the related art, a knowledge graph intelligent question and answer is usually performed by matching a question input by an input object with a template manually defined in advance, then converting the matched template into a graph query language, querying a knowledge graph, obtaining returned contents, and directly replying to the input object, wherein the manually defined template is manually defined according to the question intentions by a professional to analyze which question intentions the input object has in advance.
However, since templates are manually defined, the number and variety of templates are limited, and thus, templates matching with questions may not be found, complex and various questions are difficult to cover, so that correct answers cannot be found to answer, and the effect of intelligent questions and answers is poor. And the query content is directly answered, so that the answer is simple and the user experience is poor.
Therefore, in the related art, the stability of the effect of intelligent question and answer and the user experience feel are required to be further improved.
Disclosure of Invention
The embodiment of the application provides an intelligent question-answering method, an intelligent question-answering device, electronic equipment and a storage medium, so as to improve the stability of the effect of intelligent question-answering and the experience of a user.
The specific technical scheme provided by the embodiment of the application is as follows:
in a first aspect, an intelligent question-answering method is provided, including:
Acquiring a natural language problem input by an input object, extracting information of the natural language problem, and acquiring a problem triplet set corresponding to the natural language problem, wherein each problem triplet comprises: entity, relationship and answer to be queried;
based on the question triplet set, inquiring a preset knowledge graph library to obtain an answer triplet set corresponding to the question triplet set, wherein each answer triplet at least comprises: entity, relationship, and target answer;
and combining the data information of the answer triplet sets to generate and return natural language answers.
In a second aspect, an intelligent question answering apparatus is provided, including:
The system comprises an acquisition module, a processing module and a processing module, wherein the acquisition module is used for acquiring a natural language problem input by an input object, extracting information of the natural language problem and acquiring a problem triplet set corresponding to the natural language problem, and each problem triplet comprises: entity, relationship and answer to be queried;
the query module is used for querying a preset knowledge graph base based on the question triplet set to obtain an answer triplet set corresponding to the question triplet set, wherein each answer triplet at least comprises: entity, relationship, and target answer;
and the generation module is used for combining the data information of the answer triplet set to generate and return natural language answers.
Optionally, the information extraction is performed on the natural language problem, and when the problem triplet set corresponding to the natural language problem is obtained, the obtaining module is further configured to:
and obtaining a problem triplet set corresponding to the natural language problem according to the natural language problem through the trained language model.
Optionally, when obtaining, according to the natural language problem, a problem triplet set corresponding to the natural language problem through the trained language model, the obtaining module is further configured to:
performing word segmentation processing on the natural language problem to obtain each word segment, and extracting semantic information of each word segment;
Extracting each keyword from each word segmentation, wherein the association degree of each keyword and the natural language problem meets a preset association condition;
based on the semantic information of each keyword, at least one entity and at least one relation of the natural language problem are determined, and a problem triplet set is obtained.
Optionally, based on the question triplet set, querying a preset knowledge-graph library, and when obtaining an answer triplet set corresponding to the question triplet set, the query module is further configured to:
Screening target knowledge graphs associated with the problem fields and the problem demands from a knowledge graph base based on the problem fields and the problem demands of the problem triplet sets;
and carrying out graph association analysis on the question triplet set and the target knowledge graph to obtain an answer triplet set corresponding to the question triplet set.
Optionally, when the target knowledge graph associated with the problem domain and the problem requirement is screened from the knowledge graph base based on the problem domain and the problem requirement of the problem triplet set, the query module is further configured to:
For each problem triplet in the problem triplet set, the following operations are performed: and screening a target knowledge graph containing the entity type and the relation type from the knowledge graph base based on the entity type and the relation type in the problem triplet.
Optionally, each answer triplet further includes: attribute information, which is divided into entity attribute information and relationship attribute information;
The query module is further configured to perform graph association analysis on the question triplet set and the target knowledge graph to obtain an answer triplet set corresponding to the natural language question:
According to the query sequence of each question triplet in the question triplet set, the following operations are executed for each question triplet in turn:
based on the entity and the relation in the question triplet, inquiring the target knowledge graph, obtaining corresponding target answers and attribute information, taking the entity, the relation, the target answers and the attribute information as answer triples corresponding to the question triplet, and replacing the entity of the next question triplet with the target answer.
Optionally, when the data information of the answer triplet set is combined, and a natural language answer is generated and returned, the generating module is further configured to:
combining data information of the answer triplet set through the trained language model to generate a natural language answer;
and presenting the natural language answer as a return result to the input object.
In a third aspect, there is provided an electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the steps of the method of any of the first aspects when the program is executed.
In a fourth aspect, there is provided a computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of the method of any of the first aspects above.
In the embodiment of the application, an intelligent question-answering request triggered by an input object is responded, a natural language question input by the input object is acquired, information extraction is carried out on the natural language question, a question triplet set corresponding to the natural language question is acquired, then a preset knowledge graph base is queried based on the question triplet set, an answer triplet set corresponding to the question triplet set is acquired, finally data information of the answer triplet set is combined, and a natural language answer is generated and returned. Therefore, the method can understand the diversified natural language problem of the input object, brings convenience to the input object, and integrates the problem triplet set and the knowledge graph because the information is stored in the knowledge graph in the triplet mode, so that the method can answer complex and various problems, is convenient to inquire in the knowledge graph, and improves answer accuracy and efficiency. In addition, natural language answer generation is performed, so that the user can understand the answer conveniently, answer content is enriched, and user experience is improved.
Drawings
Fig. 1 is a schematic diagram of a possible application scenario in an embodiment of the present application;
FIG. 2 is a flowchart of an implementation of an intelligent question-answering method according to an embodiment of the present application;
FIG. 3 is a flow chart of obtaining a problem triplet set in an embodiment of the application;
FIG. 4 is a flowchart of obtaining target configuration information according to an embodiment of the present application;
FIG. 5 is a flowchart of a method for obtaining natural language answers according to an embodiment of the present application;
FIG. 6 is an exemplary diagram of a intelligent question and answer in an embodiment of the application;
FIG. 7 is a schematic diagram of the structure of the intelligent question answering device according to the embodiment of the application;
fig. 8 is a schematic structural diagram of an electronic device according to an embodiment of the application.
Detailed Description
The following description of the embodiments of the present application will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments, but not all embodiments of the present application. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
Some terms in the embodiments of the present application are explained below to facilitate understanding by those skilled in the art.
Intelligent question-answering: in a one-question-and-one-answer mode, answers are given according to user questions, and intelligent question-and-answer service is provided for the user through interaction with the user.
Knowledge graph: an attractive abstraction for organizing structured knowledge is also a way to integrate information extracted from multiple data sources, in essence, a knowledge graph is intended to describe various entities or concepts and their relationships that exist in the real world. The knowledge graph forms a huge semantic network graph, the nodes represent entities or concepts, and the edges are formed by attributes or relations. The present knowledge graph has been used to refer to various large-scale knowledge bases, and the knowledge graph has the advantages of clear and easily understood knowledge representation, and can be used for conveniently searching, reasoning and updating the knowledge.
Language model: is a model describing natural language probability distribution, and is a very basic and important natural language processing task. The probability of a word or sentence can be calculated using a language model, and the probability distribution of the words that may occur next can be estimated given the context. Large language models, such as the third generation generic pre-training transducer (GENERAL PRE-trained Transformer-3, gpt-3) of Open artificial intelligence (Open ARTIFICIAL INTELLIGENCE, OPENAI), are deep learning based natural language processing models. By pre-training on a large amount of text data, these models can learn rich linguistic knowledge and to some extent common sense knowledge.
The following briefly describes the design concept of the embodiment of the present application:
At present, along with the rapid development of artificial intelligence technology, the application scene of intelligent question and answer is more and more extensive, for example, scenes such as intelligent customer service, search engines, intelligent home and the like, and at present, knowledge maps are often adopted to realize intelligent question and answer, so that scattered knowledge can be systemized and then transmitted to users.
In the related art, a knowledge graph intelligent question and answer is usually performed by matching a question input by an input object with a template manually defined in advance, then converting the matched template into a graph query language, querying a knowledge graph, obtaining returned contents, and directly replying to the input object, wherein the manually defined template is manually defined according to the question intentions by a professional to analyze which question intentions the input object has in advance.
However, since the templates are manually defined, the number and the types of the templates are limited, the templates matched with the questions may not be found, complex and various questions are difficult to cover, so that correct answers cannot be found to answer, the intelligent question-answering effect is poor, for example, in the case of inquiring the loopholes, when the question-answering template is not included in the template library, if the questions are the repair suggestions of the loopholes, no matched templates exist, and thus the answers of the questions cannot be found.
In addition, the query content is directly answered, the answer is simple, and the user experience is poor.
In view of this, in the embodiment of the present application, an intelligent question-answering method, apparatus, electronic device and storage medium are provided, which firstly acquire a natural language question input by an input object, and extract information from the natural language question to obtain a question triplet set corresponding to the natural language question, then query a preset knowledge graph base based on the question triplet set to obtain an answer triplet set corresponding to the question triplet set, and finally combine data information of the answer triplet set to generate and return a natural language answer.
In this way, the information extraction is carried out on the natural language questions to obtain the question triplet sets corresponding to the natural language questions, so that the diversified natural language questions of the input objects can be understood, convenience is brought to the input objects, and the information is stored in the knowledge graph in the triplet mode, so that the question triplet sets and the knowledge graph are integrated, complex and various questions can be answered, the query in the knowledge graph is facilitated, and the answer accuracy and efficiency are improved. In addition, natural language answer generation is performed, so that the user can understand the answer conveniently, answer content is enriched, and user experience is improved.
The preferred embodiments of the present application will be described below with reference to the accompanying drawings of the specification, it being understood that the preferred embodiments described herein are for illustration and explanation only, and not for limitation of the present application, and that the embodiments of the present application and the features of the embodiments may be combined with each other without conflict.
Fig. 1 is a schematic diagram of a possible application scenario in an embodiment of the present application. The application scenario diagram includes a server 110 and a terminal device 120 (including a terminal device 1201 and a terminal device 1202 … and a terminal device 120 n).
The server 110 may be an independent physical server, a server cluster or a distributed system formed by a plurality of physical servers, or a cloud server providing cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, a content delivery network (Content Delivery Network, CDN), basic cloud computing services such as big data and an artificial intelligent platform. The terminal device 120 and the server 110 may be directly or indirectly connected through wired or wireless communication, and the present application is not limited herein.
Terminal devices 120 include, but are not limited to, cell phones, tablet computers, notebook computers, desktop computers, electronic book readers, intelligent voice interaction devices, intelligent home appliances, vehicle terminals, and the like; various software, such as applications and applets, can be installed on the terminal device.
It should be noted that, the number of the terminal devices 120 and the servers 110 shown in fig. 1 is merely illustrative, and the number is not limited in practice, and the embodiment of the present application is not limited in detail.
It should be noted that, the intelligent question-answering method in the embodiment of the present application may be deployed in a computing device, where the computing device may be a server or a terminal device, where the server may be the server 110 shown in fig. 1, or may be other servers than the server 110 shown in fig. 1; the terminal device may be the terminal device 120 shown in fig. 1, or may be other terminal devices than the terminal device 120 shown in fig. 1. That is, the method may be executed by the server or the terminal device alone or may be executed by both the server and the terminal device together.
The intelligent question answering method provided by the exemplary embodiments of the present application will be described below with reference to the accompanying drawings in conjunction with the application scenarios described above, and it should be noted that the application scenarios described above are only shown for the convenience of understanding the spirit and principle of the present application, and the embodiments of the present application are not limited in any way in this respect.
Referring to fig. 2, a flowchart of an implementation of an intelligent question-answering method according to an embodiment of the present application is described herein by taking a server as an execution body, where a specific implementation flow of the method is as follows:
Step 20: and acquiring the natural language problem input by the input object, extracting information of the natural language problem, and acquiring a problem triplet set corresponding to the natural language problem.
Wherein each problem triplet comprises: entity, relationship, and answer to be queried.
In the embodiment of the application, an input interface is displayed on a terminal device, when an input object is input in a question-answer area of the input interface, an intelligent question-answer request is triggered, a server responds to the intelligent question-answer request, natural language questions input by the input object are obtained, information extraction is carried out on the natural language questions, and a question triplet set corresponding to the natural language questions is obtained.
For example, when the input object wants to intelligently answer questions, the input box of the question-answer interface of the terminal device is required to input the text of the natural language questions, for example, the input object wants to ask "where person a is at birth", and then the input box is clicked to input: where person a is born. Then click the confirm key, trigger the intelligent question-answering request.
In addition, the input object can click a voice recognition button to input natural language question voice and convert the natural language question voice into natural language question text.
Therefore, the problem can be described by natural language by presenting the input interface for the input object to input the natural language problem, and the problem template according to the standard is not needed, so that convenience is provided for the input object, and the user experience is improved. And the voice input can be realized, so that the input time of an input object is saved, and the intelligent question-answering efficiency is improved.
The problem triplet set corresponding to the natural language problem can be obtained according to the natural language problem through the trained language model, and the trained language model can be deployed on a server.
In the embodiment of the application, based on a trained language model, natural language questions are taken as input parameters, information extraction is carried out on the natural language questions, and a question triplet set corresponding to the natural language questions is determined.
The trained language model can be a generated language model (GENERATIVE LANGUAGE MODEL, chatGLM) with high information extraction capability and a deep bi-directional pre-training model (Bidirectional Encoder Representations from Transformers, BERT) based on semantic understanding.
The problem triplet set may include only one problem triplet or may include a plurality of problem triples, which is not limited in the embodiment of the present application, and when the natural language problem is a one-hop problem, the problem triplet set includes only one problem triplet, and when the natural language problem is a multi-hop problem, the problem triplet set includes a plurality of problem triples.
For example, assume that the natural language question is: where person a is, then the question triplet set includes: < person a, place of birth? Where "character a" is an entity, "birth place" is a relationship, "? "is the answer to be queried.
For another example, assume that the natural language question is: where the character a parade is, then the question triplet set includes: < character a, father and daughter,? > and < daughter, place of birth? Where "character a" and "daughter" are entities, "father and daughter" and "place of birth" are relationships, "? "is the answer to be queried.
Therefore, the language model is not limited by the custom template and the graph query language, can understand various natural language problems, generates a problem triplet set, has high efficiency, and improves the efficiency of intelligent question-answering.
Specifically, when determining a problem triplet set corresponding to a natural language problem, the following operations are specifically performed. Referring to fig. 3, a flowchart of a process for obtaining a problem triplet set according to an embodiment of the present application is shown, and the following details of operations performed in conjunction with fig. 3 are described below:
Step 200: and performing word segmentation processing on the natural language problem to obtain each word segment, and extracting semantic information of each word segment.
Wherein, the semantic information includes: parts of speech, contextual information, etc., which is not limiting in the embodiments of the present application.
In the embodiment of the application, word segmentation processing is carried out on the obtained natural language problem, each word segment is obtained, and semantic information of each word segment is extracted.
The Word segmentation processing may adopt a byte pair coding (Byte Pair Encoding, BPE) algorithm, a Word segment (Word Piece) algorithm, a unified language model (Unified Language Model, ULM) algorithm, etc., the extracting of the parts of speech may adopt a part of speech labeling method based on rules, a part of speech labeling method based on statistical models, a part of speech labeling method based on a combination of the statistical methods and the rule methods, and a part of speech labeling method based on deep learning, and the statistical models include: hidden Markov models (Hidden Markov Model, HMM), conditional random fields (Conditional random fields, CRFs), and the like, without limitation in embodiments of the application.
For example, assume that the natural language question is: where the parade of character a is, each word includes: character a, daughter, place of birth, where.
Step 201: and extracting each keyword from each word segment.
The association degree of each keyword and the natural language question meets a preset association condition, and the preset association condition may be that the association degree is greater than a preset association threshold.
In the embodiment of the application, after each word is obtained, each word with the association degree meeting the preset association condition with the natural language problem is extracted from each word as each keyword.
The keyword extraction may be a method based on statistical features, a method based on word graph model, a method based on topic model, or the like, which is not limited in the embodiment of the present application, where the method based on statistical features is, for example: word frequency-inverse document frequency (TF-IDF), word graph model-based methods, such as: text ranking (TextRank), topic model based methods such as: implicit dirichlet Allocation (LDA).
For example, assume that each word segment includes: character a, daughter, birth place, where, each keyword includes character a, daughter, birth place.
Step 202: based on the semantic information of each keyword, at least one entity and at least one relation of the natural language problem are determined, and a problem triplet set is obtained.
In the embodiment of the application, the association relation between the keywords is obtained based on the semantic information of the keywords, and when the hidden keywords exist, the hidden keywords are obtained through the semantic information, the keywords with the parts of speech being nouns or pronouns are taken as entities, the keywords with the parts of speech being verbs are taken as relations, the relations directly associated with the entities are taken as the relations of the entities, and the problem triples corresponding to the entities are constructed.
For example, assuming that each keyword includes "person a" and "place of birth", the part of speech of "person a" is a noun, the part of speech of "person a" is a verb, the "place of birth" is a relationship directly associated with "person a", and the "place of birth" is a relationship of entity, and the construction of the question triplet is: < person a, place of birth? > is provided.
For another example, assuming that the implicit information of each keyword including "person a", "daughter", "birth place", "person a", and "daughter" is that the relationship between person a and daughter is father and daughter, obtaining the implicit keyword "father and daughter", "part of speech of person a" is a noun, the "person a" is a verb of entity 1, "father and daughter", the "father and daughter" is a relationship directly associated with "person a", and the "father and daughter" is a relationship of entity 1, and constructing a question triplet 1 corresponding to entity 1 is: < character a, father and daughter,? The parts of speech of "daughter" is the pronoun, the parts of speech of "daughter" is the entity 2, the part of speech of "place of birth" is the verb, the "place of birth" is the relation directly associated with "daughter", the "place of birth" is the relation of entity 2, and the construction of the problem triplet 2 corresponding to entity 2 is: < daughter, place of birth? > is provided.
In addition, it should be noted that, when the question triplet set includes a plurality of question triples, the query sequence of each question triplet is determined according to the semantic information of each keyword.
Step 21: based on the question triplet set, inquiring a preset knowledge graph base to obtain an answer triplet set corresponding to the question triplet set.
Wherein, each answer triplet at least comprises: entity, relationship, and target answer.
In the embodiment of the application, based on at least one entity in the question triplet set and the corresponding relation of the at least one entity, a preset knowledge graph base is queried to respectively obtain target answers of the at least one entity under the corresponding relation, and an answer triplet set corresponding to the question triplet set is obtained.
In addition, it is worth noting that the preset knowledge-graph library is one or more graphs generated based on various data of legal sources.
Specifically, in performing step 21, the server specifically performs the following operations. Referring to fig. 4, a flowchart of obtaining target configuration information according to an embodiment of the present application is shown, and the following details of the specific operations performed with reference to fig. 4 are described below:
step 210: and screening target knowledge maps related to the problem fields and the problem demands from the knowledge map base based on the problem fields and the problem demands of the problem triplet sets.
In the embodiment of the application, aiming at each problem triplet in the problem triplet set, the following operations are respectively executed: and screening a target knowledge graph containing the entity type and the relation type from the knowledge graph base based on the entity type and the relation type in the problem triplet.
In addition, it should be noted that, in the knowledge-graph library, there are cases where each problem triplet corresponds to the same target knowledge graph, there are cases where each problem triplet corresponds to a different target knowledge graph, and there are cases where each problem triplet corresponds to a plurality of different target knowledge graphs. Therefore, the number of the target knowledge patterns may be plural or one, which is not limited in the embodiment of the present application.
For example, assume that a problem triplet set includes: question triplet 1< person a, father and daughter,? > and question triplet 2< daughter, place of birth? The method comprises the steps of screening candidate knowledge maps containing the entity type as the name from a knowledge map base, screening target knowledge maps containing the relation type as the relative from the candidate knowledge maps to obtain target knowledge maps corresponding to a problem triplet 1, screening candidate knowledge maps containing the entity type as the name from the knowledge map base, and screening target knowledge maps containing the relation type as the place of birth from the candidate knowledge maps to obtain target knowledge maps corresponding to the problem triplet 2.
Therefore, the accurate target knowledge patterns are screened out based on the entity type and the relation type, the graph association analysis with each knowledge pattern in the knowledge pattern library can be avoided, the query efficiency is improved while the answer can be found, and the accuracy and the efficiency of intelligent question-answering are improved.
Step 211: and carrying out graph association analysis on the question triplet set and the target knowledge graph to obtain an answer triplet set corresponding to the question triplet set.
In the embodiment of the application, according to the query sequence of each question triplet in the question triplet set, the following operations are executed for each question triplet in turn: based on the entity and the relation in the question triplet, inquiring the target knowledge graph to obtain a corresponding target answer, taking the entity, the relation and the target answer as an answer triplet corresponding to the question triplet, and replacing the entity of the next question triplet with the target answer.
For example, the query order for a problem triplet set is: question triplet 1, question triplet 2, question triplet 1< person a, father and daughter? The entity of > is 'person A', the relation is 'father and daughter', the target knowledge graph is queried, the target answer corresponding to the question triplet 1 is 'person B', the 'person A', 'father and daughter', 'person B' is used as the answer triplet 1 corresponding to the question triplet 1, the question triplet 2 is < daughter, birth place,? The entity 'parapet' of > is replaced by 'person B', and based on the fact that the entity is 'person B' and the relationship is 'place of birth', a target knowledge graph is queried, a target answer corresponding to the question triplet 2 is obtained as 'place B', and the person B ',' place of birth 'and the place B' are taken as answer triples 2 corresponding to the question triplet 2.
In addition, it should be noted that the answer triples may further include: attribute information, which is divided into entity attribute information and relationship attribute information. In the embodiment of the application, when the answer triplet set is obtained, the following operations are specifically executed: according to the query sequence of each question triplet in the question triplet set, the following operations are executed for each question triplet in turn: based on the entity and the relation in the question triplet, inquiring the target knowledge graph, obtaining corresponding target answers and attribute information, taking the entity, the relation, the target answers and the attribute information as answer triples corresponding to the question triplet, and replacing the entity of the next question triplet with the target answer.
For example, question triplet 1< person a, father and daughter,? The entity of > is 'person A', the relation is 'father and daughter', the target knowledge graph is queried, the obtained target answer is 'person B', and the attribute information of the person B is: english name B, character A, father and daughter and character B (attribute information: english name B) are taken as answer triples 1 corresponding to the question triples 1.
Therefore, the attribute information in the query process is used as the joining answer triples, so that the answer content is enriched, and the user experience is improved.
Step 22: and combining the data information of the answer triplet sets to generate and return natural language answers.
Specifically, in performing step 21, the server specifically performs the following operations. Referring to fig. 5, a flowchart of a natural language answer obtaining process according to an embodiment of the present application is shown, and the following details of the specific operations performed with reference to fig. 5 are described below:
step 220: and combining the data information of the answer triplet set through the trained language model to generate a natural language answer.
In the embodiment of the application, based on a trained language model, the data information of the answer triplet set is combined by taking the answer triplet set as an input parameter, so as to generate a natural language answer corresponding to the natural language question.
For example, assume that the answer triplet set includes: < character a, father and daughter, character B (attribute information: english name B) > and < character B, place of birth, place B >, then the natural language answer generated by the combination is: a daughter of character a, character B, english name B, is born at location B.
Step 221: and presenting the natural language answer as a return result to the input object.
In the embodiment of the application, after the natural language answer is obtained, the natural language answer is taken as a return result and returned to the terminal equipment, and is presented to the input object through the terminal equipment.
The input object may be presented in text form or in voice form, which is not limited in the embodiment of the present application.
In this way, through the language model, an understandable natural language answer is generated and returned to the input object in various forms, so that the input object is convenient to understand, and the user experience is improved.
Based on the foregoing embodiments, a specific example is adopted to describe the intelligent question-answering method in the embodiment of the present application in detail, and referring to fig. 6, an exemplary diagram of intelligent question-answering in the embodiment of the present application specifically includes:
Firstly, a natural language question input by an object on a terminal device is 'where a parapet of a character A is born', an intelligent question-answering request is triggered, a server responds to the intelligent question-answering request, the natural language question input by the input object is acquired, a trained language model is called, the natural language question is taken as an input parameter, information extraction is carried out on the natural language question, and a question triplet set corresponding to the natural language question is determined, wherein the question triplet set comprises: question triplet 1< person a, father and daughter,? > and question triplet 2< daughter, place of birth? > is provided.
Then, based on the entity type and the relation type of the problem triplet 1, screening out a target knowledge spectrum corresponding to the problem triplet 1 from a preset knowledge spectrum base, and based on the entity type and the relation type of the problem triplet 2, screening out a target knowledge spectrum corresponding to the problem triplet 2 from a preset knowledge spectrum base, and based on the problem triplet 1< character A, father and daughter,? The entity "person A", relation "father and daughter" of > inquires about a target knowledge graph, obtains a target answer corresponding to the question triplet 1 as "person B", and attribute information of the person B is: english name B, wherein 'person A', 'father and daughter', 'person B (attribute information: english name B)' is taken as answer triplet 1 corresponding to question triplet 1, and question triplet 2< daughter, place of birth? The entity ' parapet ' of > is replaced by ' person B ', and based on the entity ' person B ' and the relation ' place of birth ', a target knowledge graph is queried to obtain a target answer corresponding to the question triplet 2 as ' place B ', the person B ', ' place of birth ' and ' place B ' are taken as answer triples 2 corresponding to the question triplet 2, and the answer triples are obtained as follows: < character a, father and daughter, character B (attribute information: english name B) > and < character B, place of birth, place B >.
And finally, invoking a trained language model, combining the data information of the answer triplet set by taking the answer triplet set as an input parameter, and generating a natural language answer as follows: and the parapet character B of the character A, the English name B and the natural language answer are returned to the terminal equipment after being born at the position B.
Based on the same inventive concept, the embodiment of the present application further provides an intelligent question-answering device, referring to fig. 7, which is a schematic structural diagram of the intelligent question-answering device in the embodiment of the present application, and specifically includes:
The obtaining module 701 is configured to obtain a natural language question input by an input object, and extract information from the natural language question, to obtain a question triplet set corresponding to the natural language question, where each question triplet includes: entity, relationship and answer to be queried;
The query module 702 is configured to query a preset knowledge graph base based on the question triplet set to obtain an answer triplet set corresponding to the question triplet set, where each answer triplet at least includes: entity, relationship, and target answer;
the generating module 703 is configured to combine the data information of the answer triplet set, and generate and return a natural language answer.
Optionally, when extracting information from the natural language problem and obtaining a problem triplet set corresponding to the natural language problem, the obtaining module 701 is further configured to:
and obtaining a problem triplet set corresponding to the natural language problem according to the natural language problem through the trained language model.
Optionally, when obtaining, according to the natural language problem, a problem triplet set corresponding to the natural language problem through the trained language model, the obtaining module 701 is further configured to:
performing word segmentation processing on the natural language problem to obtain each word segment, and extracting semantic information of each word segment;
Extracting each keyword from each word segmentation, wherein the association degree of each keyword and the natural language problem meets a preset association condition;
based on the semantic information of each keyword, at least one entity and at least one relation of the natural language problem are determined, and a problem triplet set is obtained.
Optionally, based on the question triplet set, query a preset knowledge graph base, and when obtaining an answer triplet set corresponding to the question triplet set, the query module 702 is further configured to:
Screening target knowledge graphs associated with the problem fields and the problem demands from a knowledge graph base based on the problem fields and the problem demands of the problem triplet sets;
and carrying out graph association analysis on the question triplet set and the target knowledge graph to obtain an answer triplet set corresponding to the question triplet set.
Optionally, when the target knowledge graph associated with the problem domain and the problem requirement is screened from the knowledge graph base based on the problem domain and the problem requirement of the problem triplet set, the query module 702 is further configured to:
For each problem triplet in the problem triplet set, the following operations are performed: and screening a target knowledge graph containing the entity type and the relation type from the knowledge graph base based on the entity type and the relation type in the problem triplet.
Optionally, each answer triplet further includes: attribute information, which is divided into entity attribute information and relationship attribute information;
The query module 702 is further configured to perform graph association analysis on the question triplet set and the target knowledge graph to obtain an answer triplet set corresponding to the natural language question:
According to the query sequence of each question triplet in the question triplet set, the following operations are executed for each question triplet in turn:
based on the entity and the relation in the question triplet, inquiring the target knowledge graph, obtaining corresponding target answers and attribute information, taking the entity, the relation, the target answers and the attribute information as answer triples corresponding to the question triplet, and replacing the entity of the next question triplet with the target answer.
Optionally, when the data information of the answer triplet set is combined and a natural language answer is generated and returned, the generating module 703 is further configured to:
combining data information of the answer triplet set through the trained language model to generate a natural language answer;
and presenting the natural language answer as a return result to the input object.
Based on the above embodiments, referring to fig. 8, a schematic structural diagram of an electronic device according to an embodiment of the present application is shown.
Embodiments of the present application provide an electronic device that may include a processor 810 (Center Processing Unit, a CPU), a memory 820, an input device 830, an output device 840, and the like, where the input device 830 may include a keyboard, a mouse, a touch screen, and the like, and the output device 840 may include a display device, such as a Liquid crystal display (Liquid CRYSTAL DISPLAY, LCD), a Cathode Ray Tube (CRT), and the like.
Memory 820 may include Read Only Memory (ROM) and Random Access Memory (RAM) and provides processor 810 with program instructions and data stored in memory 820. In an embodiment of the present application, the memory 820 may be used to store a program of any of the intelligent question-answering methods in the embodiment of the present application.
Processor 810 is operative to execute any one of the intelligent question-answering methods of the embodiments of the present application in accordance with the obtained program instructions by invoking the program instructions stored in memory 820.
Based on the above embodiments, in the embodiments of the present application, there is provided a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements the intelligent question-answering method in any of the above method embodiments.
It will be appreciated by those skilled in the art that embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to the application. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
It will be apparent to those skilled in the art that various modifications and variations can be made to the present application without departing from the spirit or scope of the application. Thus, it is intended that the present application also include such modifications and alterations insofar as they come within the scope of the appended claims or the equivalents thereof.

Claims (10)

1. An intelligent question-answering method is characterized by comprising the following steps:
Acquiring a natural language problem input by an input object, extracting information of the natural language problem, and acquiring a problem triplet set corresponding to the natural language problem, wherein each problem triplet comprises: entity, relationship and answer to be queried;
Based on the question triplet set, inquiring a preset knowledge graph library to obtain answer triplet sets corresponding to the question triplet sets, wherein each answer triplet at least comprises: the entity, the relationship, and the target answer;
and combining the data information of the answer triplet set to generate and return natural language answers.
2. The method of claim 1, wherein the extracting information of the natural language question to obtain a question triplet set corresponding to the natural language question includes:
And obtaining a problem triplet set corresponding to the natural language problem according to the natural language problem through the trained language model.
3. The method of claim 2, wherein the obtaining, by the trained language model, a question triplet set corresponding to the natural language question from the natural language question, comprises:
Performing word segmentation processing on the natural language problem to obtain each word segment, and extracting semantic information of each word segment;
Extracting each keyword from each word segment, wherein the association degree of each keyword and the natural language question meets a preset association condition;
and determining at least one entity and at least one relation of the natural language problem based on the semantic information of each keyword, and obtaining the problem triplet set.
4. The method of claim 1, wherein the querying a preset knowledge-graph base based on the question triplet set to obtain an answer triplet set corresponding to the question triplet set includes:
screening target knowledge maps associated with the problem domain and the problem requirement from the knowledge map base based on the problem domain and the problem requirement of the problem triplet set;
and carrying out graph association analysis on the question triplet set and the target knowledge graph to obtain an answer triplet set corresponding to the question triplet set.
5. The method of claim 4, wherein the screening the knowledge-graph library for a target knowledge-graph associated with the problem domain and the problem requirement based on the problem domain and the problem requirement of the problem triplet set comprises:
For each problem triplet in the problem triplet set, the following operations are performed respectively: and screening a target knowledge graph containing the entity type and the relation type from the knowledge graph base based on the entity type and the relation type in the problem triplet.
6. The method of claim 4, wherein each answer triplet further comprises: attribute information, wherein the attribute information is divided into entity attribute information and relationship attribute information;
Performing graph association analysis on the question triplet set and the target knowledge graph to obtain an answer triplet set corresponding to the natural language question, including:
According to the query sequence of each question triplet in the question triplet set, the following operations are executed for each question triplet in turn:
And inquiring the target knowledge graph based on the entity and the relation in the question triplet, obtaining corresponding target answers and attribute information, taking the entity, the relation, the target answers and the attribute information as answer triples corresponding to the question triplet, and replacing the entity of the next question triplet with the target answers.
7. The method of claim 1, wherein combining the data information of the answer triplet set to generate and return a natural language answer comprises:
Combining the data information of the answer triplet set through the trained language model to generate a natural language answer;
And taking the natural language answer as a return result and presenting the return result to the input object.
8. An intelligent question-answering device, comprising:
The system comprises an acquisition module, a processing module and a processing module, wherein the acquisition module is used for acquiring a natural language problem input by an input object, extracting information of the natural language problem and acquiring a problem triplet set corresponding to the natural language problem, and each problem triplet comprises: entity, relationship and answer to be queried;
The query module is configured to query a preset knowledge graph library based on the question triplet set to obtain an answer triplet set corresponding to the question triplet set, where each answer triplet at least includes: the entity, the relationship, and the target answer;
and the generation module is used for combining the data information of the answer triplet set to generate and return natural language answers.
9. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the steps of the method of any of claims 1-7 when the program is executed by the processor.
10. A computer-readable storage medium having stored thereon a computer program, characterized by: the computer program implementing the steps of the method of any of claims 1-7 when executed by a processor.
CN202311865633.4A 2023-12-29 2023-12-29 Intelligent question-answering method and device, electronic equipment and storage medium Pending CN117932022A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311865633.4A CN117932022A (en) 2023-12-29 2023-12-29 Intelligent question-answering method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311865633.4A CN117932022A (en) 2023-12-29 2023-12-29 Intelligent question-answering method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN117932022A true CN117932022A (en) 2024-04-26

Family

ID=90767668

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311865633.4A Pending CN117932022A (en) 2023-12-29 2023-12-29 Intelligent question-answering method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN117932022A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN118116620A (en) * 2024-04-28 2024-05-31 支付宝(杭州)信息技术有限公司 Medical question answering method and device and electronic equipment

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN118116620A (en) * 2024-04-28 2024-05-31 支付宝(杭州)信息技术有限公司 Medical question answering method and device and electronic equipment

Similar Documents

Publication Publication Date Title
US10496749B2 (en) Unified semantics-focused language processing and zero base knowledge building system
US20170337261A1 (en) Decision Making and Planning/Prediction System for Human Intention Resolution
KR102491172B1 (en) Natural language question-answering system and learning method
CN111708869B (en) Processing method and device for man-machine conversation
CN109325040B (en) FAQ question-answer library generalization method, device and equipment
US20150286943A1 (en) Decision Making and Planning/Prediction System for Human Intention Resolution
US20220405484A1 (en) Methods for Reinforcement Document Transformer for Multimodal Conversations and Devices Thereof
CN110297893B (en) Natural language question-answering method, device, computer device and storage medium
CN107807968B (en) Question answering device and method based on Bayesian network and storage medium
CN112417102A (en) Voice query method, device, server and readable storage medium
CN110019712A (en) More intent query method and apparatus, computer equipment and computer readable storage medium
CN117077792B (en) Knowledge graph-based method and device for generating prompt data
CN117932022A (en) Intelligent question-answering method and device, electronic equipment and storage medium
CN112579733A (en) Rule matching method, rule matching device, storage medium and electronic equipment
CN116541493A (en) Interactive response method, device, equipment and storage medium based on intention recognition
Steinmetz et al. From natural language questions to SPARQL queries: a pattern-based approach
CN112507089A (en) Intelligent question-answering engine based on knowledge graph and implementation method thereof
CN115497477A (en) Voice interaction method, voice interaction device, electronic equipment and storage medium
CN115455169A (en) Knowledge graph question-answering method and system based on vocabulary knowledge and semantic dependence
CN114911915A (en) Knowledge graph-based question and answer searching method, system, equipment and medium
CN114722174A (en) Word extraction method and device, electronic equipment and storage medium
CN112417174A (en) Data processing method and device
CN110019714A (en) More intent query method, apparatus, equipment and storage medium based on historical results
CN115757720A (en) Project information searching method, device, equipment and medium based on knowledge graph
CN114942981A (en) Question-answer query method and device, electronic equipment and computer readable storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination