CN116204625A - Intelligent question-answering method and system based on knowledge graph - Google Patents

Intelligent question-answering method and system based on knowledge graph Download PDF

Info

Publication number
CN116204625A
CN116204625A CN202310336807.1A CN202310336807A CN116204625A CN 116204625 A CN116204625 A CN 116204625A CN 202310336807 A CN202310336807 A CN 202310336807A CN 116204625 A CN116204625 A CN 116204625A
Authority
CN
China
Prior art keywords
condition
rule
entity
attribute
relation
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
CN202310336807.1A
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.)
Hangzhou Half Cloud Technology Co ltd
Original Assignee
Hangzhou Half Cloud Technology 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 Hangzhou Half Cloud Technology Co ltd filed Critical Hangzhou Half Cloud Technology Co ltd
Priority to CN202310336807.1A priority Critical patent/CN116204625A/en
Publication of CN116204625A publication Critical patent/CN116204625A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/33Querying
    • G06F16/332Query formulation
    • G06F16/3329Natural language query formulation or dialogue systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/36Creation of semantic tools, e.g. ontology or thesauri
    • G06F16/367Ontology
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/279Recognition of textual entities
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N5/00Computing arrangements using knowledge-based models
    • G06N5/04Inference or reasoning models

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Computational Linguistics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Artificial Intelligence (AREA)
  • Mathematical Physics (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Animal Behavior & Ethology (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Human Computer Interaction (AREA)
  • Health & Medical Sciences (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • General Health & Medical Sciences (AREA)
  • Evolutionary Computation (AREA)
  • Computing Systems (AREA)
  • Software Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention relates to an intelligent question-answering method and system based on a knowledge graph, belongs to the technical field of knowledge graphs, and solves the problem that in the prior art, satisfaction of a user on a question answer is low due to lack of deeper information. The method comprises the steps of receiving a user problem and extracting keywords in the user problem; obtaining a search result according to the keyword search knowledge graph, sequencing the search result, and taking out the search result according to the preset quantity to serve as a question answer; acquiring the evaluation satisfaction degree of a user on the answer to the question, and generating an inference task according to the user question corresponding to the evaluation satisfaction degree lower than the threshold value; based on the knowledge graph, configuring a condition rule and a result rule for each reasoning task by using a condition rule template and a result rule template; and (3) running the reasoning task passing the verification, converting the condition rule and the result rule in the reasoning task into operation sentences of the graph database, executing the operation sentences, and updating the knowledge graph. And the improvement of the question answer accuracy and the user satisfaction is realized.

Description

Intelligent question-answering method and system based on knowledge graph
Technical Field
The invention relates to the technical field of knowledge graphs, in particular to an intelligent question-answering method and system based on knowledge graphs.
Background
With the rapid development of science and technology, various industries have generated enormous amounts of data, most of which are based on relational databases. However, a bottleneck occurs when complex relational query and relational analysis are performed, and table and multi-table association query of a large amount of data obviously reduces query efficiency, so that in order to better store and analyze such relational data and make full use of unstructured data, a graph database storage technology is generated, and meanwhile, various knowledge graphs based on a graph database are increasingly applied.
The intelligent question-answering of the knowledge graph aims at finding the answer of a given question expressed in natural language from the existing knowledge graph. The existing intelligent question and answer focuses on the retrieval of the answers to the questions in the knowledge graph and the semantic packaging of the answers, and whether the fed back answers meet the user requirements is only statistics of evaluation satisfaction. Moreover, the updating of the knowledge graph is only changed due to the fact that the business data is changed, and mining of information with deeper layers or more dimensions is lacking, so that satisfaction of users on answers to questions is low.
Therefore, the lack of further analysis on the satisfaction degree of the answer to the question evaluation in the prior art ignores the entity and relation information implicit in the question of the user, so that a large amount of valuable data is lacking, and the satisfaction degree of the user on the answer to the question cannot be improved even if the knowledge graph is updated.
Disclosure of Invention
In view of the above analysis, the embodiment of the invention aims to provide an intelligent question-answering method and system based on a knowledge graph, which are used for solving the problems that deep information cannot be accurately mined due to insufficient utilization and analysis of satisfaction of users on answers to questions, so that the accuracy of answers to questions and the satisfaction of users cannot be improved.
In one aspect, the embodiment of the invention provides an intelligent question-answering method based on a knowledge graph, which comprises the following steps:
receiving a user problem and extracting keywords in the user problem; obtaining a search result according to the keyword search knowledge graph, sequencing the search result, and taking out the search result according to the preset quantity to serve as a question answer;
acquiring the evaluation satisfaction degree of a user on the answer to the question, and generating an inference task according to the user question corresponding to the evaluation satisfaction degree lower than the threshold value; based on the knowledge graph, configuring a condition rule and a result rule for each reasoning task by using a condition rule template and a result rule template;
and (3) running the reasoning task passing the verification, converting the condition rule and the result rule in the reasoning task into operation sentences of the graph database, executing the operation sentences, and updating the knowledge graph.
Based on a further improvement of the above method, generating an inference task according to the user problem corresponding to the evaluation satisfaction below the threshold value, including:
taking the user problem corresponding to the evaluation satisfaction degree lower than the threshold value as task description; keywords in the user questions are used as task keywords; obtaining a task name according to the keywords and the current date; and creating an inference task according to the task name, the task description and the task keyword.
Based on a further improvement of the above method, the conditional rule template comprises: the entity A and the entity B have a relation C, the attribute B of the entity A meets the condition C, the attribute B of the relation A meets the condition C, the attribute of the entity A is defined as a variable B, the attribute of the relation A is defined as a variable B, and the variable A and the variable B meet the condition C; the result rule template includes: the entity A and the entity B add the relation C, the attribute B of the entity A is set as C, and the attribute B of the relation A is set as C.
Based on the further improvement of the method, based on the knowledge graph, the condition rule template and the result rule template are utilized to configure the condition rule and the result rule for each reasoning task, and the method comprises the following steps:
selecting an entity, a relation, an entity attribute and a relation attribute in the knowledge graph, and configuring 1 or more condition rules and 1 result rule;
The same entity, relationship, entity attribute and relationship attribute are respectively identified by unique variable names in the same reasoning task;
the conditions in the condition rule template include operators and condition values;
the plurality of condition rules are "and" relationships.
Based on the further improvement of the method, the verification passing reasoning task means that the condition rule and the variable name of the result rule in the reasoning task are valid, the condition value is matched with the attribute type, and the attribute value is valid.
Based on a further improvement of the above method, the variable names effectively include: each variable name does not include Chinese and symbols; each variable name only corresponds to the same entity or relationship or attribute; and, according to the condition rule configured by the rule template of defining the attribute of the entity A as the variable B and/or defining the attribute of the relation A as the variable B, the variable name exists in the condition rule configured by the rule template of defining the condition C by the variable A and the variable B;
matching the condition value with the attribute type includes: the condition value is not NULL or NULL string; and the condition value is matched with the type of the attribute of the corresponding entity or relation;
the attribute values effectively include: the attribute value is not null and the attribute value exists in the corresponding entity or relationship.
Based on the further improvement of the method, the condition rules in the reasoning task are converted into operation sentences of the graph database, and the method comprises the following steps:
converting the condition rules in the reasoning task into entity relation sentences and condition sentences according to the condition rule templates;
obtaining a corresponding operation object according to a result rule in the reasoning task;
and splicing the entity relation statement, the conditional statement and the operation object according to the grammar of the operation statement of the graph database to obtain the operation statement.
Based on the further improvement of the method, the condition rule in the reasoning task is converted into an entity relation statement and a condition statement according to the condition rule template, and the method comprises the following steps:
when the condition rules comprise the condition rules configured by the rule templates of the definition entity A attribute being the variable B and the definition relation A attribute being the variable B, the corresponding relation of the variable names is identified and stored;
when the condition rule comprises that the attribute B of the entity A meets the condition C, the attribute B of the relation A meets the condition C and the variable A and the variable B meet the condition C rule template configured condition rule, the corresponding relation of the variable names is combined to obtain a condition statement corresponding to the entity or the relation;
and according to the condition rule configured by the rule template of the entity A and the entity B with the relation C, the entities are connected in series through the relation to obtain an entity relation statement.
Based on the further improvement of the method, the result rule in the reasoning task is converted into an operation sentence of the graph database, which comprises the following steps:
when the result rule in the reasoning task corresponds to that the entity A and the entity B add the relation C, converting the result rule into an inserted relation statement;
when the result rule in the reasoning task corresponds to that 'the attribute B of the entity A is set as C', converting the result rule into an updated entity attribute statement;
when the result rule in the reasoning task corresponds to "the attribute B of the relation A is set as C", the result rule is converted into an updated relation attribute statement.
On the other hand, the embodiment of the invention provides an intelligent question-answering system based on a knowledge graph, which comprises the following steps:
the intelligent question-answering module is used for receiving user questions and extracting keywords in the user questions; searching the knowledge graph according to the keywords to obtain search results, sequencing the search results, and taking out the search results according to the preset quantity to serve as answers to the questions;
the reasoning task construction module is used for acquiring the evaluation satisfaction degree of the user on the answers of the questions and generating a reasoning task according to the user questions corresponding to the evaluation satisfaction degree lower than the threshold value; based on the knowledge graph, configuring a condition rule and a result rule for each reasoning task by using a condition rule template and a result rule template;
The knowledge graph updating module is used for running the reasoning task passing the verification, converting the condition rules and the result rules in the reasoning task into operation sentences of the graph database, executing the operation sentences and updating the knowledge graph.
Compared with the prior art, the invention has at least one of the following beneficial effects: starting from the evaluation satisfaction degree of the user on the answers to the questions, automatically generating an inference task according to the questions of the user, and supplementing and updating a knowledge graph by configuring and executing the inference task to mine the knowledge required by the user, thereby improving the evaluation satisfaction degree in a targeted manner; the method has the advantages that various condition rules and result rules are combined rapidly by combining the rule templates to configure the reasoning task, implicit entity attributes and association relations are mined, the method is convenient and quick, understanding is facilitated, an operation user only needs to have business knowledge, complex graph database sentences do not need to be written, and professional knowledge such as graph algorithms, machine learning and the like is not needed to be used for data analysis; through rule verification, rule conversion and rule execution, graph data are automatically added and changed, the richness and the comprehensiveness of knowledge are increased, and the accuracy of knowledge questions and answers and the satisfaction of users are improved.
In the invention, the technical schemes can be mutually combined to realize more preferable combination schemes. Additional features and advantages of the invention will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. The objectives and other advantages of the invention may be realized and attained by the structure particularly pointed out in the written description and drawings.
Drawings
The drawings are only for purposes of illustrating particular embodiments and are not to be construed as limiting the invention, like reference numerals being used to refer to like parts throughout the several views.
FIG. 1 is a flow chart of an intelligent question-answering method based on a knowledge graph in the embodiment 1 of the invention;
FIG. 2 is a diagram illustrating the conversion of conditional rules into operation sentences in embodiment 1 of the present invention;
fig. 3 is a flowchart of the operation of updating the knowledge graph according to the reasoning task in embodiment 2 of the present invention.
Detailed Description
Preferred embodiments of the present invention will now be described in detail with reference to the accompanying drawings, which form a part hereof, and together with the description serve to explain the principles of the invention, and are not intended to limit the scope of the invention.
Example 1
The invention discloses an intelligent question-answering method based on a knowledge graph, which is shown in fig. 1 and comprises the following steps:
s11: receiving a user problem and extracting keywords in the user problem; and obtaining a search result according to the keyword search knowledge graph, sequencing the search result, and taking out the search result according to the preset quantity to serve as a question answer.
It should be noted that, the knowledge graph is to map the collected structured and unstructured business data into a graph database by using a constructed entity model to form a set of points and edges, wherein the "points" are used to represent entities, the "edges" are used to represent relationships between the entities, and the entities and the relationships all include attributes. Further, knowledge maps of different teams or projects may be isolated through graph space. The embodiment does not limit the construction mode of the knowledge graph.
And (3) obtaining word segmentation results through jieba word segmentation of the received user problems, and comparing the word segmentation results with a keyword library in a knowledge graph to extract keywords in the user problems. The keyword library may be pre-constructed according to a word frequency statistics method.
According to the entity and relation in the keyword search knowledge graph, the weight of the keyword and the search frequency of the search result, the score of the search result is calculated, the search result is ordered from high to low, the search result is taken out according to the preset number, the search result is packaged according to the semantic template, and the obtained question answer is displayed at the front end. And the user carries out satisfaction evaluation on the displayed answers to the questions.
S12: acquiring the evaluation satisfaction degree of a user on the answer to the question, and generating an inference task according to the user question corresponding to the evaluation satisfaction degree lower than the threshold value; based on the knowledge graph, configuring a condition rule and a result rule for each reasoning task by using a condition rule template and a result rule template;
it should be noted that, the evaluation satisfaction degree of the embodiment may be obtained directly according to the obtained score of the answer to the question by the user, or may be obtained by classifying the question of the user according to the keywords in the question of the user, and then counting the average score of each type of question, which is not limited herein.
Further, generating an inference task according to the user problem corresponding to the evaluation satisfaction below the threshold value, including:
taking the user problem corresponding to the evaluation satisfaction degree lower than the threshold value as task description; keywords in the user questions are used as task keywords; obtaining a task name according to the keywords and the current date; and creating an inference task according to the task name, the task description and the task keyword.
Preferably, by monitoring tasks, timing statistics of evaluation satisfaction of answers to questions, inference tasks are timely created, and relevant business personnel are reminded. If the evaluation satisfaction is obtained by classifying and counting the average scores, in order to avoid too many user problems, the user problems with lower evaluation satisfaction can be selected as task descriptions.
The business personnel checks the detailed information of the reasoning task, and obtains the reasoning task with the same keyword from the historical reasoning task according to the task keyword, so that the business personnel can refer to the task conveniently.
Compared with the prior art, the method and the device for evaluating the satisfaction degree of the user on the answers of the questions, automatically generating an inference task according to the questions of the user, and establishing the association between the satisfaction degree of the user and the knowledge graph data, so that knowledge required by the user is mined, and accuracy of the answers of the questions and satisfaction degree of the user are improved.
When the reasoning task is configured, reading all entity and relation information in a graph space of a knowledge graph to which the reasoning task belongs, caching the entity and relation information to a front page, and selecting the entity, the relation, the entity attribute and the relation attribute in a drop-down frame mode when the rule configuration is performed. An inference task includes 1 or more condition rules, but only 1 result rule, meaning that an inference result rule can be mined based on configured condition rules.
Specifically, the conditional rule templates include: the entity A and the entity B have a relation C, the attribute B of the entity A meets the condition C, the attribute B of the relation A meets the condition C, the attribute of the entity A is defined as a variable B, the attribute of the relation A is defined as a variable B, and the variable A and the variable B meet the condition C; the result rule template includes: the entity A and the entity B add the relation C, the attribute B of the entity A is set as C, and the attribute B of the relation A is set as C.
It should be noted that A, B and C are only distinguished from the rule templates, and there is no correspondence between rule templates. When the condition rules are configured, 1 or more condition rule templates can be selected, 1 or more condition rules can be configured by 1 condition rule template, and the 'conditions' in the condition rule templates comprise operators and condition values; the plurality of condition rules are "and" relationships.
In order to correctly identify the entity, the relation and the attribute in knowledge mining, the problem of confusion of judgment of rules caused by the fact that the same rule template is introduced for many times is avoided, a variable name is introduced to replace the names of the original entity, the relation and the attribute, and the selected same entity, relation, entity attribute and relation attribute are respectively identified by unique variable names in the same reasoning task.
The following description is directed to 6 conditional rule templates.
1) Entity A has relationship C with entity B
The rule template is used for judging whether the entity A and the entity B in the graph database have a relation C or not, wherein the entity A and the entity B can be the same entity or different entities. For example: in the bus map, a station (entity A) and a station (entity B) have the next station relationship (relationship C), and a bus route (entity A) and a station (entity B) have the inclusion relationship (relationship C).
When a rule is configured, setting variable names for 2 entities and 1 relation respectively, wherein in an exemplary bus map, the entity name of a bus route is gongjiaoxian lu, and the variable name is gjxl; the entity name of the site is zhandian, and the variable name is zd; the relationship name of the containing relationship is baohan, and the set variable name is bh.
2) Attribute B of entity a satisfies condition C
The rule template is a rule that determines whether a certain attribute B of an entity a in the graph database satisfies a certain condition C, wherein the operators of the condition include, but are not limited to: greater than, equal to or less than, not equal to or equal to and inclusive. For example: in the bus map, the property (attribute name zhichan) of a bus company (entity name gongjiaognsi, variable name gjgs) is greater than 100 ten thousand (condition C), wherein the condition of "greater than 100 ten thousand" is set to be "greater than" by a drop-down box, and a condition value of "100" is filled in by an input box (back end processing is 100 ten thousand).
3) Attribute B of relationship a satisfies condition C
The rule template is a rule that determines whether a certain attribute B of a relationship a in the graph database satisfies a certain condition C, wherein the operators of the condition include, but are not limited to: greater than, equal to or less than, not equal to or equal to and inclusive. For example: in the bus map, the time (attribute name xltmae) of the bus company having the relationship of the lines (relationship name gjyongyouxl, variable name yy) is larger than 2022-01-01 (condition C), wherein the condition "larger than 2022-01-01" sets the operator to "larger than" through the drop-down box, and the condition value "2022-01-01" is filled in through the input box.
4) Defining the attribute of entity A as variable B
The rule template is to set a variable B to a certain attribute of an entity a in the graph database, where the variable B represents a value of the attribute, and the variable B is used to participate in a variable value comparison in that the variable a and the variable B satisfy a condition C. For example: in the bus map, the operation state (attribute name yunyinzhuangtai) of the station (entity name zhandian, variable name zd) is set as the variable name zdyyzt.
5) Defining the attributes of relationship A as variable B
The rule template is to set a variable B to a certain attribute of a relation a in the graph database, and the variable B is used to participate in the variable value comparison in the condition that the variable a and the variable B meet the condition C. For example: in the bus map, the operation state (attribute name yunyinzhuangtai) of the inclusion relationship (relationship name baohan, variable name bh) between the bus route and the station is set as the variable name bhyzt.
6) The variable A and the variable B meet the condition C
The rule template is to use the entity attribute variable names and the relationship attribute variable names defined in steps 4) and 5) above to make a conditional comparison between variable names, wherein the operators of the conditions include, but are not limited to: greater than, equal to or less than, not equal to or equal to and inclusive. For example: in the bus map, the operation state of the station is set as a variable name zdyyzt, the operation state of the inclusion relationship between the bus line and the station is set as a variable name bhyzt, and if the variable values of the two operation states are equal, the configuration of 'zdyyzt' = 'bhyzt'.
The following is a description of 3 result rule templates.
1) Entity A and entity B add relationship C
The rule template is to add a relation C to an entity A and an entity B in the graph database and update the graph database. For example: in the bus map, an overlay relationship (relationship name fggx) is added to a bus company (entity name, variable name, gjgs) and a station (entity name, zhandian, variable name, zd) in a data set satisfying a condition rule.
2) The attribute B of entity a is set to the value C
The rule template is to set the attribute B of the entity A in the graph database as a value C and update the graph database. For example: in the public transportation map, the enterprise scale (attribute name qygm) of a public transportation company (entity name gongjiaognsi, variable name gjgs) in the data set satisfying the condition rule is set to "medium scale".
3) Attribute B of relationship A is set to value C
The rule template is to set the attribute B of the relation A in the graph database as the value C and update the graph database. For example: in the bus map, a line type (attribute name xllx) having a line relationship (relationship name gjyongyouxl, variable name yy) for a bus company in a data set satisfying a condition rule is set as a "temporary line".
Compared with the prior art, the method and the device have the advantages that knowledge discovery and reasoning in the graph database are summarized into 6 condition rules, updating of the graph database is summarized into 3 result rules, data meeting the conditions are automatically mined according to the flexibly configured condition rules through a visual interface, implicit knowledge is added according to the result rules, knowledge maps are enriched, and accuracy of intelligent question-answering is improved.
S13: and (3) running the reasoning task passing the verification, converting the condition rule and the result rule in the reasoning task into operation sentences of the graph database, executing the operation sentences, and updating the knowledge graph.
Specifically, step S13 includes:
s131: and checking condition rules and result rules in the reasoning task.
It should be noted that, the condition rule and the result rule configured by the front end are transmitted to the back end, each condition rule is mapped into a condition rule object to form a condition rule list, 1 result rule is mapped into a result rule object, and after verification, information in the condition rule object and the result rule object is stored in a relational database, so that the information is conveniently displayed at the interface end.
The rule checking is to comprehensively check the configured condition rule and result rule, the reasoning task can be operated only after the checking passes, and the checking cannot be operated after the checking does not pass. Rule checking sequentially checks whether the variable name is valid, whether the condition value is matched with the attribute type, and whether the attribute value is valid, if one error exists, error reporting prompt is carried out, the task state is set to be failed in checking, and only the state is changed to be normal after all the task states pass. That is, the condition rule and the result rule check pass, including: the variable name is valid, the condition value matches the attribute type, and the attribute value is valid.
Specifically, when checking whether the variable name is valid, if the variable name contains symbols and Chinese, the variable name is invalid; an invalid variable if a variable name is repeatedly defined by a different entity, a different relationship, or a different attribute; if the attribute in the former rule defines a variable name, but the attribute variable name is not used in the latter rule, the variable name is an invalid variable name; if a variable name is used in the rule for performing the variable comparison, but the variable name is not defined in all rules, it is an invalid variable name; the occurrence of the above cases is regarded as verification failure. Thus, variable names effectively include: each variable name does not include Chinese and symbols; each variable name only corresponds to the same entity or relationship or attribute; and, the variable names in the rule templates configured according to the rule templates of the definition entity A as the variable B and/or the definition relation A as the variable B exist in the rule templates configured according to the rule templates of the definition relation A as the variable C.
When checking whether the condition value is matched with the attribute type, if the attribute type of the entity or the relation is a digital type, but the set condition value is Chinese-English characters or symbols, the condition value is an invalid rule; if the attribute value of the entity or relationship is set to null or empty string, the entity or relationship is regarded as an invalid rule, and the above situations are regarded as verification failure. Thus, matching the condition value with the attribute type includes: the condition value is not NULL or NULL string; and, the condition value matches the type of attribute of the corresponding entity or relationship.
When checking whether the attribute value is valid, if the attribute of the entity or the relation needs to be selected in configuration, but is not selected, or the attribute is manually modified after the selection, the attribute value is invalid, and the situation that the verification fails is considered. Thus, the attribute values effectively include: the attribute value is not null and the attribute value exists in the corresponding entity or relationship.
Preferably, if a plurality of condition rules configured by a rule template of 'entity A and entity B have a relation C' exist in the condition rules, whether the plurality of entities have tandem connection or not is further checked according to the connection direction of the entities and the relation in the knowledge graph.
Illustratively, if the rule configured for "entity a has a relationship C with entity B" is: the public transport company has possession relation with public transport line, and public transport line has the contained relation with the website, according to the entity and the direction of connection of relation, can establish ties to: (public transportation company) - [ possession ] - > (public transportation route) - [ including ] - > (station), then is the valid rule, check passes; if "entity A has a relationship C with entity B" the configuration rule is: the bus company and the bus line have a possession relation (bus company) - [ possession ] - > (bus line), the station and the station have a next-station relation (station) - [ next station ] - > (station), the same entity is not available, and the bus company and the bus line cannot be connected in series, so that the bus line is invalid in rule and the verification fails; if "entity A has a relationship C with entity B" the configuration rule is: the bus company and the bus line have an possession relationship (bus company) - [ possession ] - > (bus line), the bus company and the bus driver have an possession relationship (bus company) - [ possession ] - > (bus driver), and the connection direction of the relationship can not lead the entities to be connected in series, so that the rule is invalid and the verification fails.
Preferably, whether the entity or the relation corresponding to the task keyword of the reasoning task exists in the entity or the relation selected by the condition rule and the result rule or not is checked, if not, prompt information is displayed, whether the prompt information is ignored or not is confirmed by a user, if so, the verification is passed, otherwise, the verification is failed.
After the condition rules and the result rules pass verification, the operation sentences are respectively converted into operation sentences of the graph database, wherein the operation sentences corresponding to the condition rules are used for inquiring the data sets meeting the conditions, and the operation sentences corresponding to the result rules are used for inserting or updating the data sets meeting the conditions.
It should be noted that the operation sentence of the graph database is based on the query language specification of the graph database adopted in the knowledge graph. The mainstream graph database includes Neo4j, dgraph, janusGraph, hugeGraph, nebula, etc., and in this embodiment, a Nebula graph database is used to convert the map database into an operation sentence supported by the corresponding nGQL language.
Specifically, the method comprises the following steps:
(1) and converting the condition rules in the reasoning task into entity relation sentences and condition sentences according to the condition rule templates.
It should be noted that, the condition rule templates 1) are used for configuring entity relationships, and the condition rule templates 2), 3) and 6) are used for configuring conditions; conditional rule templates 4) and 5) are used to define variables for use in conditional rule template 6). In the embodiment, the rule of each reasoning task is analyzed and converted according to the sequence of the first variable, the second condition and the last entity relation.
Illustratively, as shown in fig. 2, the following three steps are performed on the conditional rule to obtain an entity relationship statement and a conditional statement:
a) Performing identification conversion of attribute variable names
Namely: when the condition rules comprise the condition rules configured by the rule templates of the definition entity A attribute being the variable B and the definition relation A attribute being the variable B, the corresponding relation of the variable names is identified and stored.
Specifically, the attribute of the definition entity A is a variable B, and the entity A and the entity variable name, the entity attribute and the entity attribute variable name B are configured; the attribute defining the relation A is a variable B, and the relation A and the relation variable name, the relation attribute and the relation attribute variable name B are configured; if the same entity, relationship and attribute are used in the subsequent rule, the corresponding variable name can be directly obtained.
b) Identification conversion for conditional comparison
Namely: when the condition rule comprises that the attribute B of the entity A meets the condition C, the attribute B of the relation A meets the condition C and the variable A and the variable B meet the condition C, and the condition rule is configured by the rule template, the corresponding relation of the variable names is combined, and the condition statement corresponding to the entity or the relation is obtained.
The term "attribute B of the entity a satisfies the condition C" and "attribute B of the relation a satisfies the condition C", and the conversion statement is obtained according to the term "variable name of the entity/relation. Illustratively, the assets (attribute names zhichan) of public transport companies (entity names gongjiaognsi, variable names gjgs) are greater than 100 ten thousand, and the converted conditional statement is: gjgs.zhichan >100.
The condition rule that the variable A and the variable B meet the condition C is that after the corresponding relation of the variable names obtained in the first step is needed to obtain the entity or the variable name of the relation corresponding to the variable names, the conversion statement is obtained according to the variable names of the entity/the relation.
The operation state of the station is set as a variable zdyyzt, the operation state of the inclusion relationship between the bus line and the station is set as a variable bhyzt, the variable values of the two operation states are equal, the condition rule is configured as "zdyyzt" = "bhyzt", when the condition statement is converted, the corresponding entity and relationship need to be found according to the corresponding relationship of the variable name, and the converted condition statement is: zdyzt= bh.
c) Performing recognition conversion of entity relationship
Namely: and according to the condition rule configured by the rule template of the entity A and the entity B with the relation C, the entities are connected in series through the relation to obtain an entity relation statement.
If there are a plurality of condition rules of "entity a and entity B have a relationship C", a linked list may be created first, the rules may be sorted and stored to the linked list according to the connection direction of the relationship, and then the entities may be connected in series according to "(entity variable name 1: entity name 1) - [ relationship variable name 1: relationship name 1] - > (entity variable name 2: entity name 2)", to obtain an entity relationship sentence.
Illustratively, a public transport company (entity name gongjiaognsi, variable name gjgs) has an possession relation (relation name yongyou, variable name yy) with a public transport line (entity name gongjiaoxynu, variable name gjxl) and a site (entity name zhandian, variable name zd) has an inclusion relation (relation name baohan, variable name bh), and the converted entity relation statement is: (gjgs: gongjiaognsi) - [ yy: yongyou ] - > (gjxl: gongjiaoxiaoxynlu) - [ bh: baohan ] - > (zd: zhandian).
(2) And obtaining a corresponding operation object according to the result rule in the reasoning task.
It should be noted that, when the result rule in the reasoning task corresponds to "entity a and entity B add relationship C", the operation object is entity a and entity B; when the result rule in the reasoning task corresponds to that 'the attribute B of the entity A is set as C', the operation object is the entity A; when the result rule in the reasoning task corresponds to "the attribute B of the relationship a is set to C", the operation object is the relationship a.
Illustratively, the result rule is configured with: the bus company (entity name gongjialongsi, variable name gjgs) and the station (entity name zhandian, variable name zd) add an overlay relationship (relationship name fggx), and the operation objects are the bus company gjgs and the station zd.
(3) And splicing the entity relation statement, the conditional statement and the operation object according to the grammar of the operation statement of the graph database to obtain the operation statement.
It should be noted that, the operation statement obtained according to the condition rule is a query operation statement, which is used for obtaining the data result meeting the condition. The format of the query operation statement is: the MATCH entity relationship statement WHERE 1= =1 and the conditional statement RETURN operand; when there are 2 operation objects, the operation objects are used and spliced.
Illustratively, the query operation statement that is spliced is: "MATCH (gjgs: gongjiaomongsi) - [ yy: yongyou ] - > (gjxl: gongjiaoxiaoxinlu) - [ bh: baohan ] - > (zd: zhandian) WHERE 1= 1and zd. Zdyzt= bh. Bhyzt RETURN gjs, zd).
S133: and converting the result rule in the reasoning task into an operation statement of the graph database.
Specifically, the method comprises the following steps:
when the result rule in the reasoning task corresponds to "the entity A and the entity B add the relation C", the result rule is converted into an insert relation statement, and the format of the insert relation statement is as follows: INSERT EDGE C () the primary key of value "a" - > "primary key of B": ().
When the result rule in the reasoning task corresponds to that "the attribute B of the entity A is set as C", the result rule is converted into an updated entity attribute statement, and the format of the updated entity attribute statement is as follows: UPDATE VERTEX ONA "main key of a" SET attribute b=c.
When the result rule in the reasoning task corresponds to that the attribute B of the relation A is set as C, converting the result rule into an updated relation attribute statement, wherein the format of the updated relation attribute statement is as follows: UPDATE EDGE a "a start point id" - > "a end point id" @0SET attribute b=c.
And the sentences obtained by the three result rule templates are used as result operation sentences.
S134: executing the operation sentence and updating the knowledge graph.
It should be noted that, executing the operation statement includes: firstly executing the query operation statement obtained by converting the condition rule, temporarily storing the data result meeting the condition in the memory, then taking out the temporarily stored data, executing the result operation statement obtained by converting the result rule by using the corresponding executor, and performing the inserting or updating operation on the temporarily stored data.
Preferably, all the inserted or updated records are stored in a result data buffer, after the task operation is finished, the data in the buffer is subjected to result data statistics, the result statistics data are stored in a task result table of a task database, and after the task operation is finished, the total number statistics and detailed detail records of each task operation are displayed on a front-end page.
Preferably, each reasoning task is executed regularly in the form of a timing task, and knowledge-graph data is supplemented timely.
Compared with the prior art, the intelligent question answering method based on the knowledge graph starts from the evaluation satisfaction degree of the user on the answers to the questions, automatically generates an inference task according to the questions of the user, and supplements and updates the knowledge graph by configuring and executing the inference task to mine out the knowledge required by the user, thereby pertinently improving the evaluation satisfaction degree; the method has the advantages that various condition rules and result rules are combined rapidly by combining the rule templates to configure the reasoning task, implicit entity attributes and association relations are mined, the method is convenient and quick, understanding is facilitated, an operation user only needs to have business knowledge, complex graph database sentences do not need to be written, and professional knowledge such as graph algorithms, machine learning and the like is not needed to be used for data analysis; through rule verification, rule conversion and rule execution, graph data are automatically added and changed, the richness and the comprehensiveness of knowledge are increased, and the accuracy of knowledge questions and answers and the satisfaction of users are improved.
Example 2
In another embodiment of the invention, an intelligent question-answering system based on a knowledge graph is disclosed, so that the intelligent question-answering method based on the knowledge graph in the embodiment 1 is realized. The specific implementation of each module is described with reference to the corresponding description in embodiment 1. The system comprises:
The intelligent question-answering module is used for receiving user questions and extracting keywords in the user questions; searching the knowledge graph according to the keywords to obtain search results, sequencing the search results, and taking out the search results according to the preset quantity to serve as answers to the questions;
the reasoning task construction module is used for acquiring the evaluation satisfaction degree of the user on the answers of the questions and generating a reasoning task according to the user questions corresponding to the evaluation satisfaction degree lower than the threshold value; based on the knowledge graph, configuring a condition rule and a result rule for each reasoning task by using a condition rule template and a result rule template;
the knowledge graph updating module is used for running the reasoning task passing the verification, converting the condition rules and the result rules in the reasoning task into operation sentences of the graph database, executing the operation sentences and updating the knowledge graph.
Taking the public transportation industry as an example, a public transportation knowledge graph is obtained through a knowledge construction module, and a user searches out problems related to travel and public transportation operation through an intelligent question-answering module. After statistics, the satisfaction degree of the station query covered by the public transport company is low, an inference task is automatically generated, and then the inference task is configured according to the flow shown in fig. 3, and the knowledge graph is updated. The steps in the flow are described as follows:
1) Selecting an reasoning task: and selecting an inference task of a public transport company and a station.
2) Adding a condition rule: and entering a task editing page, and adding a condition rule. The condition rules can be one or a plurality of according to the service requirement, and the plurality of rules are in a parallel relation and all the rules must be satisfied to process the result.
(1) The public transport company has a public transport line: adding a first rule, selecting an entity A and an entity B to have a relation C in a condition rule template, then selecting an entity object of "bus company" by entity pull-down, setting a variable name as "gjgs", selecting "possession" in a relation pull-down frame, setting a variable name as "yy", selecting a "bus route" by the entity pull-down frame, and setting a variable name as "gjxl".
(2) The bus route comprises a station: adding a second rule, selecting an entity A and an entity B from a condition rule template to have a relation C, then selecting an entity object public transportation line by entity pull-down, setting a variable name as gjxl, selecting a relation pull-down frame to contain, setting a variable name as bh, selecting a station by entity pull-down frame, and setting a variable name as zd.
3) And adding a result rule, namely selecting an entity A and an entity B to add a relation C template, then selecting an entity object public transportation company by entity drop-down, setting a variable name as gjgs, selecting an overlay in a relation drop-down frame, selecting a station by the entity drop-down frame, and setting a variable name as zd.
And storing the added condition rules and result rules, and storing the entities, the relations, the attributes and the variable names in the rules in an associated mode.
4) Rule checking: and through a 'rule check' button, checking whether the variable name is valid, whether the condition value is matched with the attribute type and whether the attribute value is valid in sequence. And after the verification is passed, the state is normal, and page prompt is carried out to indicate that the rule verification is successful. If an error exists, the error reporting prompt is carried out, the task state is set to be the verification failure, the rule configuration interface is returned, the rule is modified and then the rule is verified again until the state is changed to be normal after all the verification passes.
5) Running tasks:
and after the rule check is passed, the task can be operated. Clicking an operation button in a task interface, converting the condition rule and the result rule into a query operation statement and a result operation statement of a graph database respectively, executing the query operation statement in a graph statement executor of the graph database, and temporarily storing the bus company and the station meeting the condition. And then executing a result operation statement, and inserting an 'coverage' relationship between the temporarily stored public transportation company and the station. All updated detail records are stored in a result data buffer, after the task operation is finished, result data statistics is carried out on data in the buffer, result statistics data is stored in a task result table of a task database, the data can be checked in an operation result after the task operation is finished, and the data of 'public transportation company' -coverage '-station' is displayed in detail through a list.
Because the relevant parts of the knowledge-based intelligent question-answering system and the knowledge-based intelligent question-answering method in the embodiment can be referred to each other, the description is repeated here, and therefore, the description is not repeated here. The principle of the system embodiment is the same as that of the method embodiment, so the system embodiment also has the corresponding technical effects of the method embodiment.
Those skilled in the art will appreciate that all or part of the flow of the methods of the embodiments described above may be accomplished by way of a computer program to instruct associated hardware, where the program may be stored on a computer readable storage medium. Wherein the computer readable storage medium is a magnetic disk, an optical disk, a read-only memory or a random access memory, etc.
The present invention is not limited to the above-mentioned embodiments, and any changes or substitutions that can be easily understood by those skilled in the art within the technical scope of the present invention are intended to be included in the scope of the present invention.

Claims (10)

1. The intelligent question-answering method based on the knowledge graph is characterized by comprising the following steps of:
Receiving a user problem and extracting keywords in the user problem; obtaining a search result according to the keyword search knowledge graph, sequencing the search result, and taking out the search result according to the preset quantity to serve as a question answer;
acquiring the evaluation satisfaction degree of a user on the answer to the question, and generating an inference task according to the user question corresponding to the evaluation satisfaction degree lower than the threshold value; based on the knowledge graph, configuring a condition rule and a result rule for each reasoning task by using a condition rule template and a result rule template;
and (3) running the reasoning task passing the verification, converting the condition rule and the result rule in the reasoning task into operation sentences of the graph database, executing the operation sentences, and updating the knowledge graph.
2. The knowledge-based intelligent question-answering method according to claim 1, wherein the generating an inference task according to the user questions corresponding to the evaluation satisfaction below the threshold comprises:
taking the user problem corresponding to the evaluation satisfaction degree lower than the threshold value as task description; keywords in the user questions are used as task keywords; obtaining a task name according to the keywords and the current date; and creating an inference task according to the task name, the task description and the task keyword.
3. The knowledge-based intelligent question-answering method according to claim 1, wherein the condition rule template includes: the entity A and the entity B have a relation C, the attribute B of the entity A meets the condition C, the attribute B of the relation A meets the condition C, the attribute of the entity A is defined as a variable B, the attribute of the relation A is defined as a variable B, and the variable A and the variable B meet the condition C; the result rule template comprises: the entity A and the entity B add the relation C, the attribute B of the entity A is set as C, and the attribute B of the relation A is set as C.
4. The knowledge-based intelligent question-answering method according to claim 3, wherein the configuring of the condition rule and the result rule for each inference task based on the knowledge-based by using the condition rule template and the result rule template comprises:
selecting an entity, a relation, an entity attribute and a relation attribute in the knowledge graph, and configuring 1 or more condition rules and 1 result rule;
the same entity, relationship, entity attribute and relationship attribute are respectively identified by unique variable names in the same reasoning task;
the conditions in the condition rule template include operators and condition values;
the plurality of condition rules are "and" relationships.
5. The knowledge-graph-based intelligent question-answering method according to claim 4, wherein the inference task passed by the verification means that a condition rule and a variable name of a result rule in the inference task are valid, a condition value is matched with an attribute type, and an attribute value is valid.
6. The knowledge-based intelligent question-answering method according to claim 5, wherein the variable names effectively include: each variable name does not include Chinese and symbols; each variable name only corresponds to the same entity or relationship or attribute; and, according to the condition rule configured by the rule template of defining the attribute of the entity A as the variable B and/or defining the attribute of the relation A as the variable B, the variable name exists in the condition rule configured by the rule template of defining the condition C by the variable A and the variable B;
the matching of the condition value with the attribute type comprises: the condition value is not NULL or NULL string; and the condition value is matched with the type of the attribute of the corresponding entity or relation;
the attribute value effectively includes: the attribute value is not null and the attribute value exists in the corresponding entity or relationship.
7. The knowledge-based intelligent question-answering method according to claim 1, wherein the converting the condition rules in the reasoning task into the operation sentences of the graph database comprises:
Converting the condition rules in the reasoning task into entity relation sentences and condition sentences according to the condition rule templates;
obtaining a corresponding operation object according to a result rule in the reasoning task;
and splicing the entity relation statement, the conditional statement and the operation object according to the grammar of the operation statement of the graph database to obtain the operation statement.
8. The knowledge-based intelligent question-answering method according to claim 7, wherein the converting the condition rules in the reasoning task into entity relation sentences and condition sentences according to the condition rule templates comprises:
when the condition rules comprise the condition rules configured by the rule templates of the definition entity A attribute being the variable B and the definition relation A attribute being the variable B, the corresponding relation of the variable names is identified and stored;
when the condition rule comprises that the attribute B of the entity A meets the condition C, the attribute B of the relation A meets the condition C and the variable A and the variable B meet the condition C rule template configured condition rule, the corresponding relation of the variable names is combined to obtain a condition statement corresponding to the entity or the relation;
and according to the condition rule configured by the rule template of the entity A and the entity B with the relation C, the entities are connected in series through the relation to obtain an entity relation statement.
9. The knowledge-based intelligent question-answering method according to claim 1, wherein the converting the result rule in the reasoning task into the operation sentence of the graph database comprises:
when the result rule in the reasoning task corresponds to that the entity A and the entity B add the relation C, converting the result rule into an inserted relation statement;
when the result rule in the reasoning task corresponds to that 'the attribute B of the entity A is set as C', converting the result rule into an updated entity attribute statement;
when the result rule in the reasoning task corresponds to "the attribute B of the relation A is set as C", the result rule is converted into an updated relation attribute statement.
10. An intelligent question-answering system based on a knowledge graph is characterized by comprising:
the intelligent question-answering module is used for receiving user questions and extracting keywords in the user questions; searching the knowledge graph according to the keywords to obtain search results, sequencing the search results, and taking out the search results according to the preset quantity to serve as answers to the questions;
the reasoning task construction module is used for acquiring the evaluation satisfaction degree of the user on the answers of the questions and generating a reasoning task according to the user questions corresponding to the evaluation satisfaction degree lower than the threshold value; based on the knowledge graph, configuring a condition rule and a result rule for each reasoning task by using a condition rule template and a result rule template;
The knowledge graph updating module is used for running the reasoning task passing the verification, converting the condition rules and the result rules in the reasoning task into operation sentences of the graph database, executing the operation sentences and updating the knowledge graph.
CN202310336807.1A 2023-03-31 2023-03-31 Intelligent question-answering method and system based on knowledge graph Pending CN116204625A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310336807.1A CN116204625A (en) 2023-03-31 2023-03-31 Intelligent question-answering method and system based on knowledge graph

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310336807.1A CN116204625A (en) 2023-03-31 2023-03-31 Intelligent question-answering method and system based on knowledge graph

Publications (1)

Publication Number Publication Date
CN116204625A true CN116204625A (en) 2023-06-02

Family

ID=86513011

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310336807.1A Pending CN116204625A (en) 2023-03-31 2023-03-31 Intelligent question-answering method and system based on knowledge graph

Country Status (1)

Country Link
CN (1) CN116204625A (en)

Similar Documents

Publication Publication Date Title
US20210382878A1 (en) Systems and methods for generating a contextually and conversationally correct response to a query
CN108256074B (en) Verification processing method and device, electronic equipment and storage medium
US9390084B2 (en) Natural language parsers to normalize addresses for geocoding
US6965900B2 (en) Method and apparatus for electronically extracting application specific multidimensional information from documents selected from a set of documents electronically extracted from a library of electronically searchable documents
US7519607B2 (en) Computer-based system and method for generating, classifying, searching, and analyzing standardized text templates and deviations from standardized text templates
JP4997856B2 (en) Database analysis program, database analysis apparatus, and database analysis method
CN111597356B (en) Intelligent education knowledge map construction system and method
JP2005531068A (en) Automatic paper annotation system and method
CN103443787A (en) System for identifying textual relationships
CN109471889B (en) Report accelerating method, system, computer equipment and storage medium
CN113609838B (en) Document information extraction and mapping method and system
US20210397790A1 (en) Method of training a natural language search system, search system and corresponding use
CN112925563B (en) Code reuse-oriented source code recommendation method
KR100835290B1 (en) System and method for classifying document
US20130198201A1 (en) Specification Document Check Method, Program, and System
CN112036842A (en) Intelligent matching platform for scientific and technological services
CN111191429A (en) System and method for automatic filling of data table
CN115422371A (en) Software test knowledge graph-based retrieval method
CN112988982B (en) Autonomous learning method and system for computer comparison space
CN113988057A (en) Title generation method, device, equipment and medium based on concept extraction
CN111898371A (en) Ontology construction method and device for rational design knowledge and computer storage medium
CN101334793B (en) Method for automatic recognition for dependency relationship of demand
CN111309773A (en) Vehicle information query method, device and system and storage medium
Lecoeuche Finding comparatively important concepts between texts
CN116204625A (en) Intelligent question-answering method and system based on knowledge graph

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