CN113792132A - Target answer determination method, device, equipment and medium - Google Patents

Target answer determination method, device, equipment and medium Download PDF

Info

Publication number
CN113792132A
CN113792132A CN202111119969.7A CN202111119969A CN113792132A CN 113792132 A CN113792132 A CN 113792132A CN 202111119969 A CN202111119969 A CN 202111119969A CN 113792132 A CN113792132 A CN 113792132A
Authority
CN
China
Prior art keywords
graph
node
original
determining
sub
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.)
Granted
Application number
CN202111119969.7A
Other languages
Chinese (zh)
Other versions
CN113792132B (en
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.)
Taikang Insurance Group Co Ltd
Original Assignee
Taikang Insurance 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 Taikang Insurance Group Co Ltd filed Critical Taikang Insurance Group Co Ltd
Priority to CN202111119969.7A priority Critical patent/CN113792132B/en
Publication of CN113792132A publication Critical patent/CN113792132A/en
Application granted granted Critical
Publication of CN113792132B publication Critical patent/CN113792132B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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/33Querying
    • G06F16/3331Query processing
    • G06F16/334Query execution
    • G06F16/3344Query execution using natural language analysis
    • 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/30Semantic analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • G06N3/084Backpropagation, e.g. using gradient descent
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

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)
  • Data Mining & Analysis (AREA)
  • Mathematical Physics (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Health & Medical Sciences (AREA)
  • Databases & Information Systems (AREA)
  • General Health & Medical Sciences (AREA)
  • Biophysics (AREA)
  • Computing Systems (AREA)
  • Molecular Biology (AREA)
  • Software Systems (AREA)
  • Evolutionary Computation (AREA)
  • Biomedical Technology (AREA)
  • Animal Behavior & Ethology (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Human Computer Interaction (AREA)
  • Machine Translation (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application discloses a target answer determining method, device, equipment and medium, which are used for quickly and accurately determining a target answer. The method and the device can determine the first semantic feature vector of the question based on the semantic model, and obtain hidden information in the question of the user; the method comprises the steps of obtaining a knowledge graph, determining a first sub-graph according to each original node and each primary side in a set number of hops including nodes corresponding to entities in question sentences in the knowledge graph, obtaining relation sentences corresponding to the entities of the primary side and the corresponding original head node and the entities of the original tail node aiming at each primary side contained in the first sub-graph, determining a first association degree between a second semantic feature vector of each relation sentence and a first semantic feature vector of the question sentences, and determining target answers of the question sentences based on the entities of the original tail nodes of the relation sentences of which the first association degree is higher than a preset association degree threshold value, so that target answers can be determined quickly and accurately.

Description

Target answer determination method, device, equipment and medium
Technical Field
The present application relates to the field of question-answering system technologies, and in particular, to a method, an apparatus, a device, and a medium for determining a target answer.
Background
With the continuous development of internet technology, the question-and-answer system (QA system) has made great progress in the fields such as intelligent customer service, robot, etc.
Existing question-answering systems are typically based on two approaches. One way is that: the method comprises the steps of firstly analyzing a question of a user through a semantic model (obtaining the semantics of the question), matching the analyzed question with a sample question in a question-answer knowledge base, and taking a sample answer corresponding to the sample question with the highest matching degree in the question-answer knowledge base as a target answer of the question based on the corresponding relation (for convenience of description, called question-answer pair) between the sample question and the sample answer stored in the question-answer knowledge base. The advantages of this approach are: hidden information in the question of the user can be obtained through the semantic model, and the accuracy of the determined target answer is high. However, the disadvantages of this approach are: the question-answer pairs in the question-answer knowledge base need manual configuration, a large amount of manpower is consumed, the question-answer pairs need to strictly follow a form of 'question-answer', under the scene of massive knowledge, the data size in the question-answer knowledge base is exponentially multiplied, and the efficiency of determining the target answers is low.
The other mode is as follows: and determining an entity contained in the question input by the user, and matching the entity with the existing knowledge graph so as to determine a target answer. The advantages of this approach are: the data volume of the knowledge graph is relatively small compared with a question-answer knowledge base. However, the disadvantages of this approach are: the resolution of the question of the user is not comprehensive enough, hidden information in the question of the user cannot be obtained, and the accuracy of the determined target answer may not be too high.
Therefore, a technical solution for determining a target answer quickly and accurately is needed.
Disclosure of Invention
The application provides a target answer determining method, device, equipment and medium, which are used for quickly and accurately determining a target answer.
In a first aspect, the present application provides a method for determining a target answer, the method including:
determining an entity contained in a question input by a received user, and if the entity exists in a stored knowledge graph, determining a first sub-graph according to each original node and each primary side in a set number of hops including the node corresponding to the entity in the knowledge graph;
aiming at each primary side contained in the first sub-graph spectrum, acquiring a relation statement corresponding to the primary side and an entity of a corresponding original head node and an entity of an original tail node; inputting the question sentences and each relational sentence into a pre-trained semantic model respectively, and determining first semantic feature vectors of the question sentences and second semantic feature vectors of each relational sentence respectively according to output results of the semantic model;
determining a first association degree between a second semantic feature vector and the first semantic feature vector of each relation statement to which the primary side belongs according to the relation statement to which the primary side belongs;
and determining a target answer of the question sentence based on the entity of the original tail node of the relational sentence in the first sub-graph, wherein the first association degree is higher than a preset association degree threshold value.
In a second aspect, the present application provides a target answer determination apparatus, including:
the receiving module is used for receiving a question input by a user;
a sub-map determining module, configured to determine an entity included in the question input by the received user, and if the entity exists in a stored knowledge map, determine a first sub-map according to each original node and each primary side in a set number of hops in the knowledge map, including a node corresponding to the entity;
a semantic determining module, configured to obtain, for each primary side included in the first sub-graph, a relation statement corresponding to an entity of the primary side and a corresponding original head node and an entity of an original tail node; inputting the question sentences and each relational sentence into a pre-trained semantic model respectively, and determining first semantic feature vectors of the question sentences and second semantic feature vectors of each relational sentence respectively according to output results of the semantic model;
the sentence association degree determining module is used for determining a first association degree between a second semantic feature vector and the first semantic feature vector of the relation sentence to which the primary side belongs according to the relation sentence to which the primary side belongs;
and the target answer determining module is used for determining a target answer of the question based on an entity of an original tail node of the relational statement in the first sub-graph, wherein the first association degree is higher than a preset association degree threshold value.
In a third aspect, the present application provides an electronic device, which at least includes a processor and a memory, wherein the processor is configured to implement the steps of the target answer determination method according to any one of the above methods when executing a computer program stored in the memory.
In a fourth aspect, the present application provides a computer-readable storage medium storing a computer program, which when executed by a processor, implements the steps of a method for determining a target answer as described in any one of the above.
The method and the device can determine the first semantic feature vector of the question based on the semantic model, and obtain hidden information in the question of the user; the method comprises the steps of obtaining a knowledge graph, determining a first sub-graph according to each original node and each primary side in a set number of hops including nodes corresponding to entities in question sentences in the knowledge graph, obtaining relation sentences corresponding to the entities of the primary side and the corresponding original head node and the entities of the original tail node aiming at each primary side contained in the first sub-graph, determining a first association degree between a second semantic feature vector of each relation sentence and a first semantic feature vector of the question sentences, and determining target answers of the question sentences based on the entities of the original tail nodes of the relation sentences of which the first association degree is higher than a preset association degree threshold value, so that target answers can be determined quickly and accurately.
Drawings
In order to more clearly illustrate the embodiments of the present application or the implementation manner in the related art, a brief description will be given below of the drawings required for the description of the embodiments or the related art, and it is obvious that the drawings in the following description are some embodiments of the present application, and other drawings can be obtained by those skilled in the art according to the drawings.
FIG. 1 is a schematic diagram illustrating a first target answer determination process provided by some embodiments;
FIG. 2 is a diagram illustrating a second target answer determination process provided by some embodiments;
FIG. 3 illustrates a node diagram provided by some embodiments;
FIG. 4 illustrates a first sub-graph spectrum diagram provided by some embodiments;
fig. 5a illustrates a split sub-graph spectrum diagram of a first relevance interval provided by some embodiments;
fig. 5b illustrates a split sub-graph spectrum diagram of a second relevance interval provided by some embodiments;
fig. 5c illustrates a split sub-graph spectrum diagram of a third relevance interval provided by some embodiments;
fig. 6a illustrates a new split sub-graph spectrum diagram of a first relevance interval provided by some embodiments;
fig. 6b illustrates a new split sub-graph spectrum diagram for a second relevance interval provided by some embodiments;
fig. 6c illustrates a new split sub-graph spectrum diagram of a third relevance interval provided by some embodiments;
FIG. 7 is a diagram illustrating a third target answer determination process provided by some embodiments;
FIG. 8 is a diagram illustrating a fourth target answer determination process provided by some embodiments;
FIG. 9 is a schematic diagram of a target answer determining apparatus according to some embodiments;
fig. 10 is a schematic structural diagram of an electronic device according to some embodiments.
Detailed Description
In order to quickly and accurately determine a target answer, the application provides a method, a device, equipment and a medium for determining the target answer.
To make the purpose and embodiments of the present application clearer, the following will clearly and completely describe the exemplary embodiments of the present application with reference to the attached drawings in the exemplary embodiments of the present application, and it is obvious that the described exemplary embodiments are only a part of the embodiments of the present application, and not all of the embodiments.
The terms "first," "second," "third," and the like in the description and claims of this application and in the above-described drawings are used for distinguishing between similar or analogous objects or entities and not necessarily for describing a particular sequential or chronological order, unless otherwise indicated. It is to be understood that the terms so used are interchangeable under appropriate circumstances.
The term "module" refers to any known or later developed hardware, software, firmware, artificial intelligence, fuzzy logic, or combination of hardware and/or software code that is capable of performing the functionality associated with that element.
Finally, it should be noted that: the above embodiments are only used for illustrating the technical solutions of the present application, and not for limiting the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some or all of the technical features may be equivalently replaced; and the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present application.
Example 1:
fig. 1 is a schematic diagram illustrating a first target answer determination process provided by some embodiments, and as shown in fig. 1, the process includes the following steps:
s101: determining an entity contained in a question input by a received user, and if the entity exists in a stored knowledge graph, determining a first sub-graph according to each original node and each primary side in a set number of hops including the node corresponding to the entity in the knowledge graph.
The target answer determining method provided by the embodiment of the application is applied to electronic equipment, and the electronic equipment can be a PC, a mobile terminal and other equipment, and can also be a server.
In one possible implementation, a user may input a question to the electronic device, and the electronic device may receive the question input by the user. The electronic device may receive a question input by a user based on the prior art, which is not described herein again. After receiving a question input by a user, in order to determine an answer (called a target answer for convenience of description) of the received question, the electronic device may first determine an entity included in the received question. In one possible embodiment, the entity included in the question may be any thing in the real world, and may be any thing such as a name of a person, a place name, a company, a telephone, an animal, time, a medical insurance product, and the like.
After determining the entities contained in the question input by the user, it can be determined whether the entities contained in the question exist in the knowledge graph stored in the electronic device itself. In one possible embodiment, if each entity included in the question input by the user does not exist in the stored knowledge map, it may be considered that the target answer of the question input by the user cannot be determined at present, and in order to prompt the user, preset prompt information may be output. Illustratively, a prompt message that the question has not been answered may be output.
In one possible implementation, if any of the entities included in a question entered by a user is present in a stored knowledge-graph, it may be considered that a target answer for the question may be determined based on the knowledge-graph. In one possible embodiment, for fast determination of the target answer, the target answer may be determined based on a part of the knowledge graph (referred to as a first sub-graph for convenience of description). When determining the first sub-map, the electronic device may first determine the first sub-map according to each node (called an original node for convenience of description) and each edge (called a primary edge for convenience of description) in a set number of hops including a node corresponding to an entity included in the question in the knowledge-map. For example, a first sub-map may be determined based on nodes (called question nodes for convenience of description) corresponding to entities included in a question in a knowledge map, according to each original node and each primary side in a set number of hops including the question node in the knowledge map. The set number can be flexibly set according to requirements, and the method is not particularly limited in this application. Illustratively, the set number may be 3, 5, etc. If the set number is 5, the first sub-map can be determined according to each original node and each primary side in five hops including question nodes in the knowledge map.
S102: aiming at each primary side contained in the first sub-graph spectrum, acquiring a relation statement corresponding to the primary side and an entity of a corresponding original head node and an entity of an original tail node; and respectively inputting the question sentences and each relation sentence into a pre-trained semantic model, and respectively determining a first semantic feature vector of the question sentences and a second semantic feature vector of each relation sentence according to the output result of the semantic model.
After the first sub-graph is determined, for each primary side included in the first sub-graph, the electronic device may obtain a sentence (called a relational sentence for convenience of description) corresponding to the entity of a head node (called an original head node for convenience of description) corresponding to the primary side and an entity of a tail node (called an original tail node for convenience of description) corresponding to the primary side. For example, if the entity of the original head node is "coronary heart disease", the entity of the original tail node is "garlic", and the relationship represented by the primary side is "can not eat", the relationship statement corresponding to the entity of the primary side, the original head node, and the entity (triple) of the original tail node is "can not eat garlic for coronary heart disease". The relation statement that the primary side can not eat is that the coronary heart disease can not eat garlic.
In a possible implementation manner, in order to accurately determine the target answer, a question input by a user may be input into a pre-trained semantic model, and a semantic feature vector (referred to as a first semantic feature vector for convenience of description) of the question is determined according to an output result of the semantic model. In addition, the relational sentences to which the primary sides belong can be respectively input into the pre-trained semantic model, and the semantic feature vector (called as a second semantic feature vector for convenient description) of each relational sentence is respectively determined according to the output result of the semantic model.
In one possible embodiment, the process of training the semantic model includes:
obtaining any sample statement in a sample set, wherein the sample statement is a sample question statement or a sample relation statement; the sample statement corresponds to a sample semantic feature vector label, wherein the sample semantic feature vector label is used for identifying a sample semantic feature vector of the sample statement;
determining the identification semantic feature vector labels of the sample sentences through an original semantic model;
and training an original semantic model according to the sample semantic feature vector label and the recognition semantic feature vector label to obtain a trained semantic model.
In the embodiment of the application, the semantic feature vector of the question sentence or the relational sentence can be determined through the pre-trained semantic model. When training the semantic model, the sample set contains a plurality of sample sentences, wherein the sample sentences may be sample question sentences or sample relation sentences. Each sample statement in the sample set corresponds to a sample semantic feature vector label, and the sample semantic feature vector label is used for identifying a sample semantic feature vector of the sample statement. In one possible implementation, the sample semantic feature vector labels of the sample statements may be labeled on a manual basis.
When the original semantic model is trained, any sample statement in the sample set can be obtained, and the sample statement corresponds to a sample semantic feature vector label. And inputting any one of the obtained sample sentences into an original semantic model, and obtaining the identification semantic feature vector labels corresponding to the sample sentences through the original semantic model.
In specific implementation, after the identification semantic feature vector label of the input sample sentence is determined, because the sample semantic feature vector label of the sample sentence is stored in advance, whether the identification result of the semantic model is accurate can be determined according to whether the sample semantic feature vector label is consistent with the identification semantic feature vector label. In specific implementation, if the semantic model is inconsistent, which indicates that the recognition result of the semantic model is inaccurate, the parameters of the semantic model need to be adjusted, so as to train the semantic model.
In a specific implementation, when parameters in the semantic model are adjusted, a gradient descent algorithm may be used to perform back propagation on the gradient of the parameters of the semantic model, so as to train the semantic model.
In a possible implementation, the above operation may be performed on each sample statement in the sample set, and when a preset convergence condition is satisfied, it is determined that the semantic model training is completed.
The preset convergence condition can be satisfied by passing the sample sentences in the sample set through the original semantic model, wherein the number of the correctly recognized sample sentences is greater than the set number, or the iteration number for training the semantic model reaches the set maximum iteration number, and the like. The specific implementation can be flexibly set, and is not particularly limited herein.
In a possible implementation manner, when training the original semantic model, the sample sentences in the sample set may be divided into training sample sentences and testing sample sentences, the original semantic model is trained based on the training sample sentences, and then the reliability of the trained semantic model is verified based on the testing sample sentences.
S103: and determining a first association degree between a second semantic feature vector and the first semantic feature vector of each relation statement to which the primary side belongs according to the relation statement to which the primary side belongs.
After the first semantic feature vector of the question sentence and the second semantic feature vector of each relational sentence are determined, for each relational sentence, the association degree (referred to as a first association degree for convenience of description) between the second semantic feature vector of the relational sentence and the first semantic feature vector may be determined. For example, a first association degree between the second semantic feature vector and the first semantic feature vector of the relational statement may be calculated (determined) based on a cosine similarity determination formula. Or inputting the second semantic feature vector and the first semantic feature vector into a fully-connected neural network model which is trained in advance, and determining a first association degree between the second semantic feature vector and the first semantic feature vector according to an output result of the fully-connected neural network model.
In one possible embodiment, the process of training the fully-connected neural network model comprises:
acquiring any two sample semantic feature vectors in a sample set, wherein the any two sample semantic feature vectors correspond to a first sample association degree label, and the first sample association degree label is used for identifying the sample association degree between the any two sample semantic feature vectors;
determining a first identification relevance label between any two sample semantic feature vectors through an original fully-connected neural network model;
and training the original fully-connected neural network model according to the first sample association degree label and the first identification association degree label to obtain the trained fully-connected neural network model.
In the embodiment of the application, the association degree between the two semantic feature vectors can be determined through a fully connected neural network model which is trained in advance. When the fully-connected neural network model is trained, the sample set can contain a plurality of sample semantic feature vectors, and the sample semantic feature vectors can be semantic feature vectors of question sentences or semantic feature vectors of relational sentences. Any two sample semantic feature vectors in the sample set correspond to a first sample relevancy label, and the first sample relevancy label is used for identifying the sample relevancy between the two sample semantic feature vectors. In one possible implementation, the first sample relevancy label may be labeled manually.
When an original fully-connected neural network model is trained, any two sample semantic feature vectors in a sample set can be obtained, and the any two sample semantic feature vectors correspond to a first sample relevancy label. Inputting any two acquired sample semantic feature vectors into an original fully-connected neural network model, and acquiring first identification association degree labels corresponding to the any two sample semantic feature vectors through the original fully-connected neural network model.
In specific implementation, after the first identification relevancy labels of any two input sample semantic feature vectors are determined, because the first identification relevancy labels of any two sample semantic feature vectors are stored in advance, whether the identification result of the fully-connected neural network model is accurate can be determined according to whether the first identification relevancy label is consistent with the first identification relevancy label. In specific implementation, if the difference indicates that the recognition result of the fully-connected neural network model is inaccurate, parameters of the fully-connected neural network model need to be adjusted, so that the fully-connected neural network model is trained.
In specific implementation, when parameters in the fully-connected neural network model are adjusted, a gradient descent algorithm can be adopted to perform back propagation on the gradient of the parameters of the fully-connected neural network model, so that the fully-connected neural network model is trained.
In a possible implementation manner, the above operations may be performed on the sample semantic feature vectors in the sample set, and when a preset convergence condition is met, it is determined that the training of the fully-connected neural network model is completed.
The condition that the preset convergence condition is met can be that the sample semantic feature vectors in the sample set pass through the original fully-connected neural network model, the number of the correctly identified sample semantic feature vectors is larger than a set number, or the number of iterations for training the fully-connected neural network model reaches a set maximum number of iterations, and the like. The specific implementation can be flexibly set, and is not particularly limited herein.
In a possible implementation manner, when the original fully-connected neural network model is trained, the sample semantic feature vectors in the sample set can be divided into training sample semantic feature vectors and test sample semantic feature vectors, the original fully-connected neural network model is trained based on the training sample semantic feature vectors, and then the reliability of the trained fully-connected neural network model is verified based on the test sample semantic feature vectors.
S104: and determining a target answer of the question sentence based on the entity of the original tail node of the relational sentence in the first sub-graph, wherein the first association degree is higher than a preset association degree threshold value.
In a possible implementation manner, it is considered that, in a normal case, the higher the first relevance degree is, the higher the accuracy of the determined target answer is when the entity of the tail node of the relational sentence based on the first relevance degree determines the target answer of the question sentence. In order to accurately determine the target answer, for each relationship statement to which the primary side belongs, which is included in the first sub-graph spectrum, the target answer of the question sentence may be determined based on an entity of the original tail node of the relationship statement of which the first association degree is higher than a preset association degree threshold. The preset association threshold may be flexibly set according to requirements, which is not specifically limited in the present application.
In one possible implementation, when determining the target answer based on the entity of the original tail node, the target answer of the question sentence may be determined based on a preset answer template. Illustratively, if the question is "what cannot be eaten by coronary heart disease and gout", entities of the head node of the relational sentence having the first degree of association higher than a preset degree of association threshold are "garlic", "scallion", "peanut", and "red wine", respectively, the target answer of the determined question may be "you good", and if you have coronary heart disease and gout, it is not recommended to eat garlic, scallion, peanut, or the like, it is not recommended to drink red wine, or the like, based on a preset answer template. ".
The method and the device can determine the first semantic feature vector of the question based on the semantic model, and obtain hidden information in the question of the user; the method comprises the steps of obtaining a knowledge graph, determining a first sub-graph according to each original node and each primary side in a set number of hops including nodes corresponding to entities in question sentences in the knowledge graph, obtaining relation sentences corresponding to the entities of the primary side and the corresponding original head node and the entities of the original tail node aiming at each primary side contained in the first sub-graph, determining a first association degree between a second semantic feature vector of each relation sentence and a first semantic feature vector of the question sentences, and determining target answers of the question sentences based on the entities of the original tail nodes of the relation sentences of which the first association degree is higher than a preset association degree threshold value, so that target answers can be determined quickly and accurately.
Example 2:
in order to improve the accuracy of the determined target answer, on the basis of the above embodiment, in this embodiment of the application, after determining, for each relationship statement to which a primary side belongs, a first association degree between a second semantic feature vector of the relationship statement to which the primary side belongs and the first semantic feature vector, before determining the target answer of the question sentence based on an entity of an original tail node of the relationship statement in the first sub-graph whose first association degree is higher than a preset association degree threshold, the method further includes:
determining a sub-graph spectrum of the first association degree between a second semantic feature vector of the relation statement corresponding to each primary side and the first semantic feature vector as a second sub-graph spectrum, and inputting the second sub-graph spectrum into a pre-trained graph neural network model;
determining a second association degree corresponding to each primary side according to an output result of the graph neural network model; and updating the first relevance according to the second relevance, and performing subsequent steps based on the updated first relevance.
In a possible embodiment, after determining the first degree of association between the second semantic feature vector of the relational statement to which each primary side belongs and the first semantic feature vector of the question sentence included in the first sub-graph spectrum, it may be considered that the first degree of association corresponding to each primary side is determined. Considering that the determined first relevance corresponding to each primary side is performed based on each relational statement and question, and the relevance between the entity of the head node and the entity of the tail node corresponding to each primary side, and the like, and the question is not analyzed from the whole situation of the knowledge graph, in a possible embodiment, in order to accurately determine the relevance corresponding to each primary side included in the first sub-graph, the first relevance corresponding to each primary side may be corrected (determined) based on the graph neural network model.
In one possible embodiment, for convenience of description, each primary side may correspond to a sub-map with a first degree of correlation, referred to as (determined as) a second sub-map. Based on the graph neural network model, when the first relevance corresponding to each primary side is corrected, the second sub-graph spectrum can be input into the graph neural network model which is trained in advance, so that the graph neural network model corrects the first relevance corresponding to each primary side. Specifically, the second association degree corresponding to each primary side may be determined according to the output result of the graph neural network model, and then the first association degree is updated according to the second association degree, so that the correction of the first association degree corresponding to each primary side is completed.
In a possible implementation manner, after the first relevance is updated according to the second relevance, the entity of the original tail node corresponding to the edge (the relational statement to which the edge belongs) of which the updated first relevance is higher than the preset relevance threshold may be determined, and the target answer of the question is determined.
In one possible implementation, the graph neural network model may be a graph neural network model that incorporates a mechanism of attention. Illustratively, the graph neural network model may be a GAT network.
In one possible embodiment, the process of training the neural network model includes:
acquiring any sample knowledge graph in a sample set, wherein each edge of the sample knowledge graph corresponds to an initial association degree and a second sample association degree label, and the second sample association degree label is used for identifying the association degree of the corresponding edge;
determining a second identification association degree label corresponding to each edge of the sample knowledge graph through an original graph neural network model;
and training the original graph neural network model according to the second sample association degree label and the second identification association degree label to obtain a trained graph neural network model.
In the embodiment of the application, the first relevance corresponding to each primary side can be corrected through a pre-trained graph neural network model. When the neural network model of the graph is trained, the sample set may include a plurality of sample knowledge maps, each primary side of each sample knowledge map corresponds to an initial association degree and a second sample association degree label, where the second sample association degree label may be considered as an association degree for correcting the initial association degree. In one possible implementation, the labeling of the second sample relevancy labels may be based on manual work.
When the original map neural network model is trained, any sample knowledge map in a sample set can be obtained, the obtained sample knowledge map is input into the original map neural network model, and a second identification association degree label corresponding to each edge of the sample knowledge map is obtained through the original map neural network model.
In specific implementation, after the second identification association degree label corresponding to each edge of the input sample knowledge graph is determined, because the second sample association degree label corresponding to each edge of the sample knowledge graph is pre-stored, whether the identification result of the graph neural network model is accurate can be determined according to whether the second sample association degree label is consistent with the second identification association degree label. In specific implementation, if the recognition results of the neural network model are not consistent, which indicates that the recognition results of the neural network model are not accurate, parameters of the neural network model need to be adjusted, so that the neural network model is trained.
In specific implementation, when parameters in the graph neural network model are adjusted, a gradient descent algorithm can be adopted to perform back propagation on the gradient of the parameters of the graph neural network model, so that the graph neural network model is trained.
In one possible implementation, the above operation may be performed on each sample knowledge graph in the sample set, and when a preset convergence condition is met, it is determined that the training of the neural network model of the graph is completed.
The preset convergence condition can be satisfied, for example, that the sample knowledge graphs in the sample set pass through the original graph neural network model, the number of the correctly identified sample knowledge graphs is greater than a set number, or the number of iterations for training the graph neural network model reaches a set maximum number of iterations, and the like. The specific implementation can be flexibly set, and is not particularly limited herein.
In a possible implementation manner, when the original graph neural network model is trained, the sample knowledge maps in the sample set can be divided into training sample knowledge maps and testing sample knowledge maps, the original graph neural network model is trained based on the training sample knowledge maps, and then the reliability of the trained graph neural network model is verified based on the testing sample knowledge maps.
According to the method and the device, the second relevance corresponding to each primary side can be determined based on the graph neural network model, and the first relevance is updated (corrected) according to the second relevance, so that the accuracy of the determined target answer can be further improved.
Example 3:
in order to further improve the accuracy of the determined target answer, on the basis of the foregoing embodiments, in this embodiment of the present application, after determining, for each relationship statement to which a primary side belongs, a first degree of association between a second semantic feature vector of the relationship statement to which the primary side belongs and the first semantic feature vector, before inputting the second sub-graph spectrum into a pre-trained graph neural network model, the method further includes:
respectively determining a word meaning feature vector of an entity of an original head node and a word meaning feature vector of an entity of an original tail node corresponding to each primary side based on a second semantic feature vector of a relation statement to which each primary side belongs, and respectively determining a third degree of association between each word meaning feature vector and the first semantic feature vector;
determining a fourth degree of association of an original node of an entity contained in the question sentence in the first sub-graph based on at least one of the first degree of association of a relational sentence to which the original node belongs, the third degree of association of a term meaning feature vector of the entity of the original node and a preset degree of association; for each original node in the first sub-graph except for the original node of the entity contained in the question sentence, determining a fourth association degree of the original node based on at least one of the first association degree of the relation sentence to which the original node belongs and the third association degree of the word sense feature vector of the entity of the original node;
aiming at each original node, updating the entity in the original node according to the word sense characteristic vector of the entity in the original node; taking the first semantic feature vector of the question as a new node, and connecting the new node with the original node through a new edge to form a third sub-map; for each new edge, the relevance degree of the new edge is the fourth relevance degree of the original node corresponding to the new edge; and updating the second sub-graph spectrum according to the third sub-graph spectrum, and performing subsequent steps based on the updated second sub-graph spectrum.
In a possible implementation, it is considered that if the nodes of the sub-graph input into the graph neural network model do not contain question sentences, the graph neural network model may not be able to accurately determine the corresponding relevance of each edge contained in the sub-graph from the question sentences, which affects the accuracy of the relevance of the determined edges. In order to accurately determine the relevance of each edge, in one possible implementation, the question may also be used as a node in the sub-graph, and the question is merged into the sub-graph.
In a possible implementation, considering that each edge in the sub-graph of the input graph neural network model needs to carry (correspond to) a degree of association (initial degree of association), when a question is merged into the sub-graph as a node, the degree of association of the edge involved in the question needs to be determined. In one possible implementation, the relevance of the corresponding edge may be determined based on the relevance of the original node connected with the question.
In a possible implementation manner, in order to accurately determine the relevance of the original node, the term meaning feature vector of the entity of the original head node and the term meaning feature vector of the entity of the original tail node corresponding to each primary side may be determined based on the second semantic feature vector of the relational statement to which each primary side belongs. In a possible implementation manner, when determining the word sense feature vector of the entity of the original head node corresponding to any primary edge, the word sense feature vector of the entity of the original head node may be determined according to the word sense feature vector of each word related to the entity of the original head node in the second semantic feature vector of the relational statement to which the primary edge belongs. For example, the word sense feature vector of each word involved in the entity of the head node may be weighted and averaged to obtain the word sense feature vector of the entity of the head node.
In a possible implementation manner, when determining the word sense feature vector of the entity of the original tail node corresponding to any primary side, the word sense feature vector of the entity of the original tail node may be determined according to the word sense feature vector of each word related to the entity of the original tail node in the second semantic feature vector of the relational statement to which the primary side belongs. For example, the word sense feature vector of each word involved by the entity of the source tail node may be weighted and averaged to obtain the word sense feature vector of the entity of the source tail node.
In one possible implementation, after determining the term meaning feature vector of the entity of each node, the association degree (referred to as a third association degree for convenience of description) between each term meaning feature vector and the first semantic feature vector of the question sentence may be determined. In one possible implementation, similar to determining the first degree of association, a third degree of association between the second semantic feature vector and the first semantic feature vector of the relational statement may be calculated (determined) based on a cosine similarity determination formula. Or inputting the word meaning characteristic vector and the first semantic characteristic vector into a fully-connected neural network model which is trained in advance, and determining a third degree of association between the word meaning characteristic vector and the first semantic characteristic vector according to an output result of the fully-connected neural network model. And will not be described in detail herein.
In a possible implementation manner, when determining the relevance of the original node with respect to the original node (question node) of the entity included in the question in the first sub-graph, the relevance of the original node (for convenience of description, referred to as a fourth relevance) may be determined based on at least one of a first relevance between the relational statement to which the original node (question node) belongs and the first semantic feature vector, a third relevance between the term meaning feature vector of the entity of the original node (question node) and the first semantic feature vector, and a preset relevance. The preset association degree can be flexibly set according to requirements, and the method is not particularly limited in this application. For example, the preset association degree may be 1. In a possible implementation manner, the product of the first relevance degree and the second relevance degree may be determined as the fourth relevance degree of the original node. The first relevance degree, the second relevance degree or the preset relevance degree can also be determined as a fourth relevance degree of the original node. For example, for the question node of "coronary heart disease", if the first degree of association between the relational statement to which the question node belongs and the first semantic feature vector of the question is 0.9, and the third degree of association between the term semantic feature vector of the entity of the question node and the first semantic feature vector of the question is 0.8, 0.72 may be determined as the fourth degree of association of the question node. As another example, if the preset association degree is 1, 1 may also be directly determined as the fourth association degree of the question node, so as to simplify the process of calculating the fourth association degree.
In one possible implementation, when determining the association degree of each original node (referred to as another original node for convenience of description) in the first sub-graph, except for the question node, the association degree (referred to as a fourth association degree for convenience of description) of the original node (another original node) may be determined based on at least one of a first association degree between the relation sentence to which the original node (another original node) belongs and the first semantic feature vector, and a third association degree between the term meaning feature vector of the entity of the original node (another original node) and the first semantic feature vector.
In a possible implementation manner, as in the determination of the fourth relevance degree of the question node, the product of the first relevance degree and the second relevance degree may be determined as the fourth relevance degree of the other original nodes. The first relevance degree or the second relevance degree can also be determined as a fourth relevance degree of other original nodes. For example, for an original node of "garlic", if a first degree of association between a relational statement to which the original node belongs and a first semantic feature vector of a question is 0.9, and a third degree of association between a term semantic feature vector of an entity of the question node and the first semantic feature vector of the question is 0.9, 0.81 may be determined as a fourth degree of association of the original node. In addition, the fourth degree of association of the original node may also be 0.9, which is not described herein again.
After the fourth relevance of each original node is determined, the fourth relevance can be used as a bridge for integrating the semantic feature vector of the question into the knowledge graph (sub-graph), and the step of integrating the semantic feature vector of the question into the sub-graph (second sub-graph) as a node can be performed. In a possible implementation manner, considering that original nodes in the second sub-graph are all entities, in order to merge semantic feature vectors of question sentences into the second sub-graph as nodes, for each original node in the second sub-graph, the entities in the original nodes may be updated according to the word sense feature vectors of the entities in the original nodes, that is, each original node corresponds to a word sense feature vector of an entity, but not to an entity. Then, the first semantic feature vector of the question can be used as a new node, and the new node is connected with each original node through a new edge, so that the step of merging the question into the second sub-map is realized. For convenience of description, a sub-graph spectrum of the semantic feature vector fused into the question is called a third sub-graph spectrum, and each node in the third sub-graph spectrum is a semantic feature vector. And the new node is connected with any original node through a new edge, and the association degree of the new edge is the fourth association degree of the original node corresponding to the new edge. Illustratively, the fourth degree of association of the original node of "garlic" is 0.81, and the degree of association of the new edge between the new node and the original node of "garlic" is 0.81. It can be understood that each primary side in the third sub-map corresponds to the first degree of correlation. Thus, each edge in the third sub-map, whether it is a new edge or a primary edge, has a corresponding degree of association.
After the third sub-atlas is determined, the second sub-atlas can be updated according to the third sub-atlas, that is, the second sub-atlas is updated to the third sub-atlas, and then the updated second sub-atlas (namely, the third sub-atlas) is input into the pre-trained atlas neural network model; determining a second correlation degree corresponding to each primary side in the updated second sub-map according to an output result of the map neural network model; and then, updating the first relevance of each primary side according to the second relevance, thereby finishing the correction of the first relevance corresponding to each primary side. Then, a target answer of the question may be determined based on the updated entity of the original tail node corresponding to the primary side (the relation sentence to which the primary side belongs) whose first relevance is higher than the preset relevance threshold, which is not described herein again.
For convenience of understanding, the process of determining the target answer provided in the present application is described below by a specific embodiment. Fig. 2 is a schematic diagram illustrating a second target answer determination process provided by some embodiments, and as shown in fig. 2, the process includes the following steps:
s201: and determining an entity contained in the received question input by the user, and if the entity exists in the stored knowledge graph, determining a first sub-graph according to each original node and each primary side in a set number of hops including the node corresponding to the entity in the knowledge graph.
S202: aiming at each primary side contained in the first sub-graph spectrum, acquiring a relation statement corresponding to the primary side and an entity of a corresponding original head node and an entity of an original tail node; and respectively inputting the question sentences and each relational sentence into a pre-trained semantic model, and respectively determining a first semantic feature vector of the question sentences and a second semantic feature vector of each relational sentence according to the output result of the semantic model.
S203: and determining a first association degree between a second semantic feature vector and a first semantic feature vector of each relation statement to which the primary side belongs according to the relation statement to which the primary side belongs.
S204: determining a sub-map of a first association degree between a first semantic feature vector and a second semantic feature vector of a relational statement to which each primary side belongs as a second sub-map;
respectively determining a word meaning feature vector of an entity of an original head node and a word meaning feature vector of an entity of an original tail node corresponding to each primary side based on a second semantic feature vector of a relation statement to which each primary side belongs, and respectively determining a third degree of association between each word meaning feature vector and the first semantic feature vector;
aiming at an original node of an entity contained in a question in a first sub-graph, determining a fourth relevance of the original node based on at least one of a first relevance of a relation statement to which the original node belongs, a third relevance of a word sense feature vector of the entity of the original node and a preset relevance; determining a fourth degree of association of each original node except for the original node of the entity contained in the question sentence in the first sub-graph based on at least one of a first degree of association of a relation sentence to which the original node belongs and a third degree of association of a word sense feature vector of the entity of the original node;
aiming at each original node, updating the entity in the original node according to the word sense characteristic vector of the entity in the original node; taking the first semantic feature vector of the question as a new node, and connecting the new node and the original node through a new edge to form a third sub-map; for each new edge, the relevance degree of the new edge is the fourth relevance degree of the original node corresponding to the new edge; and updating the second sub-map according to the third sub-map.
S205: and inputting the updated second sub-graph spectrum into a pre-trained graph neural network model.
S206: determining a second association degree corresponding to each primary side according to an output result of the graph neural network model; and updating the first relevance according to the second relevance, and determining a target answer of the question based on the entity of the original tail node of the relational statement in the updated first sub-map, wherein the first relevance is higher than a preset relevance threshold.
Because the semantic feature vectors of the question sentences can be used as new nodes to be merged into the sub-maps, the sub-maps of the semantic feature vectors merged into the question sentences are input into the graph neural network model, the accuracy of the second relevance corresponding to each primary side is higher based on the graph neural network model, and the accuracy of the determined target answers can be further improved after the first relevance is updated (corrected) according to the second relevance.
Example 4:
for further and quickly determining a target answer, on the basis of the foregoing embodiments, in this application embodiment, after determining, for each relationship statement to which a primary side belongs, a first association degree between a second semantic feature vector of the relationship statement to which the primary side belongs and the first semantic feature vector, and based on an entity of a tail node of the relationship statement in the first sub-graph, where the first association degree is higher than a preset association degree threshold, before determining the target answer for the question, the method further includes:
respectively determining a word meaning feature vector of an entity of an original head node and a word meaning feature vector of an entity of an original tail node corresponding to each primary side based on a second semantic feature vector of a relation statement to which each primary side belongs, and respectively determining a third degree of association between each word meaning feature vector and the first semantic feature vector; determining a fourth degree of association of an original node of an entity contained in the question sentence in the first sub-graph based on at least one of the first degree of association of a relational sentence to which the original node belongs, the third degree of association of a term meaning feature vector of the entity of the original node and a preset degree of association; for each original node in the first sub-graph except for the original node of the entity contained in the question sentence, determining a fourth association degree of the original node based on at least one of the first association degree of the relation sentence to which the original node belongs and the third association degree of the word sense feature vector of the entity of the original node;
determining a number of segments based on a first number of entities contained in the question and a second number of all nodes contained in the first subgraph spectrum; uniformly dividing a preset relevance value range into a plurality of subsection relevance intervals;
for each relevance interval, determining each relevance original node of a fourth relevance in the relevance interval except for the original node of the entity contained in the question; determining a split sub-graph spectrum consisting of each associated original node in the association degree interval, the original node of the entity contained in the question and the original node between each associated original node and the original node of the entity contained in the question based on each original node and each original side contained in the first sub-graph spectrum; wherein each primary side in the molecular splitting map corresponds to a first degree of association;
aiming at each split molecular graph, updating the entity in each original node according to the word meaning characteristic vector of the entity of each original node in the split molecular graph; taking the first semantic feature vector of the question as a new node, and respectively connecting the new node with each original node in the split sub-graph through a new edge to form a new split sub-graph; for each new edge, the relevance degree of the new edge is a fourth relevance degree of the original node corresponding to the new edge;
inputting the new split sub-graph spectrum into a pre-trained graph neural network model aiming at each new split molecular graph, and determining a fifth association degree corresponding to each edge contained in the new split sub-graph spectrum according to an output result of the graph neural network model;
adding each original node and each original side in each newly-dismantled molecular map into an empty map respectively to obtain a recombinant sub-map, wherein each side in the recombinant sub-map carries the fifth relevance;
and updating the first sub-graph spectrum according to the recombinator graph, and performing subsequent steps based on the updated first sub-graph spectrum.
In a possible implementation, considering that a sub-graph spectrum with a large number of nodes and edges is input into the graph neural network model, it may take a long time to correct the first relevance of each primary edge based on the graph neural network. And when the sub-graph spectrum with fewer nodes and edges is input into the graph neural network model and the first relevance of each primary side is corrected based on the graph neural network, the consumed time is relatively less. In order to further and quickly determine the target answer and improve the efficiency of determining the target answer, the first sub-graph spectrum can be divided into a plurality of sub-graphs (called as split molecular graphs for convenient description), then the semantic feature vectors of the question are taken as new nodes to be merged into each split molecular graph, and the split molecular graph (called as split molecular graph for convenient description) of the semantic feature vectors of the question is input into the graph neural network model.
Specifically, in a possible implementation, the first sub-graph may be split into a plurality of split-molecule graphs based on the fourth degree of association of each primary node. The process of determining the fourth relevance degree of each original node is the same as the process of determining the fourth relevance degree in the above embodiment, and is not described herein again.
In one possible embodiment, when the first sub-spectrum is split into a plurality of split molecular maps, the total number of split molecular maps may be determined first. In determining the total number of the disjunctive molecular graphs, the total number of the disjunctive molecular graphs (referred to as the number of segments for convenience of description) may be determined based on the number of entities included in the question (referred to as the first number for convenience of description) and the number of all nodes included in the first sub-graph (referred to as the second number for convenience of description).
In one possible embodiment, when determining the number of segments based on the first number and the second number, the number of segments may be determined based on a ratio of the second number to the first number. In one possible implementation, the integer obtained by rounding up the ratio of the second number to the first number may be determined as the number of segments. Illustratively, if the first number is 2 and the second number is 5, the number of segments may be 3.
After the number of the segments is determined, the preset relevance value range can be uniformly divided into a plurality of relevance intervals of the segments. For example, if the preset association degree value range is [0, 1] and the number of segments is 3, the 3 divided association degree intervals may be: [0,0.333],(0.333,0.666],(0.666,1].
After each relevance degree interval is determined, for each relevance degree interval, each original node (called a relevance original node for convenience of description) of the fourth relevance degree located in the relevance degree interval except the original node (question node) of the entity contained in the question can be determined. For example, fig. 3 shows a node schematic diagram provided by some embodiments, as shown in fig. 3, if each original node included in the first sub-graph is "coronary heart disease", "gout", "garlic", "potato", or "apple", respectively. The original nodes (question nodes) of the entities contained in the question are coronary heart disease and gout, and the coronary heart disease and the gout are the original nodes of the entities contained in the question and can be used as common nodes.
Original nodes except question nodes in the original nodes included in the first sub-graph spectrum are apples, potatoes and garlic respectively. Wherein the fourth degree of association of the "apple" is 0.2593, the fourth degree of association of the "potato" is 0.5316, and the fourth degree of association of the "garlic" is 0.9132. Then "apple" is the associated node located in the region 1, [0, 0.333] of the association interval (for convenience of description, referred to as the first association interval), "potato" is the associated node located in the region 2 of fig. 3, (0.333, 0.666] of the association interval (for convenience of description, referred to as the second association interval), "garlic" is the associated node located in the region 3 of fig. 3, (0.666, 1] of the association interval (for convenience of description, referred to as the third association interval).
For each relevance interval, a split sub-graph spectrum composed of each relevant original node of the relevance interval, the original node of the entity included in the question, and the primary side between each relevant original node and the original node of the entity included in the question can be determined based on each original node and each primary side included in the first sub-graph spectrum.
For ease of understanding, the process of determining molecular profiling provided herein is illustrated below by a specific example. Fig. 4 is a schematic diagram of a first subgraph spectrum provided by some embodiments, where the first subgraph spectrum includes 5 original nodes and 5 primary sides, where the 5 original nodes include 2 question nodes: "coronary heart disease" and "gout" comprise 3 other primary nodes: apple, potato and garlic. The 5 primary sides are respectively the side between coronary heart disease and apple, the side between gout and potato, the side between coronary heart disease and garlic, and the side between gout and garlic.
If the apple is the associated original node in the first association degree interval, the potato is the associated original node in the second association degree interval, and the garlic is the associated original node in the third association degree interval.
Fig. 5a shows a schematic diagram of a split sub-graph spectrum of a first relevance interval provided in some embodiments, as shown in fig. 5a, the split sub-graph spectrum of the first relevance interval includes 3 original nodes and 2 primary sides, where 3 original nodes include 2 question nodes: coronary heart disease and gout comprise 1 other primary node apple. The 2 primary sides are respectively the side between coronary heart disease and apple and the side between gout and apple.
Fig. 5b shows a split sub-graph spectrum of a second relevance interval according to some embodiments, and as shown in fig. 5b, the split sub-graph spectrum of the second relevance interval includes 3 original nodes and 1 primary node, where 3 original nodes include 2 question nodes: coronary heart disease and gout comprise 1 other primary node potato. The 1 primary side is the side between "gout" and "potato".
Fig. 5c shows a split sub-graph spectrum of a third association interval according to some embodiments, and as shown in fig. 5c, the split sub-graph spectrum of the second association interval includes 3 original nodes and 2 primary nodes, where 3 original nodes include 2 question nodes: coronary heart disease and gout comprise 1 other primary node garlic. The 2 primary sides are the sides between coronary heart disease and garlic and the sides between gout and garlic.
Wherein, each primary side in each resolution molecular map corresponds to a first degree of association.
After the first sub-graph is split into a plurality of split molecular graphs, a step of merging semantic feature vectors of the question into each split molecular graph as new nodes can be performed. Specifically, in order to merge the semantic feature vector of the question as a new node into the split molecular graph, for each split molecular graph, the entity in the original node may be updated according to the term-sense feature vector of the entity of each original node in the split molecular graph. And then, taking the first semantic feature vector of the question as a new node, and respectively connecting the new node with each original node in the split sub-graph through a new edge to form a new split sub-graph. As in the previous embodiment, the relevance of each new edge in the newly-torn molecular graph is the fourth relevance of the original node corresponding to each new edge.
Fig. 6a shows a new split sub-graph spectrum of a first relevance interval according to some embodiments, as shown in fig. 6a, the new split sub-graph spectrum of the first relevance interval includes 3 original nodes, 1 new node, 2 primary sides, and 3 new sides, where 3 original nodes include 2 question nodes: the term meaning feature vector of coronary heart disease and the term meaning feature vector of gout comprise 1 term meaning feature vector of other original nodes apple. The 2 primary sides are respectively the sides between the term meaning characteristic vector of coronary heart disease and the term meaning characteristic vector of apple, the term meaning characteristic vector of gout and the term meaning characteristic vector of apple. The 1 new node is a first semantic feature vector of the question, and the 3 new edges are respectively an edge between the first semantic feature vector of the question and a term meaning feature vector of the coronary heart disease, an edge between the first semantic feature vector of the question and a term meaning feature vector of the gout, and an edge between the first semantic feature vector of the question and a term meaning feature vector of the apple.
Fig. 6b shows a new split sub-graph spectrum of a second relevance interval according to some embodiments, and as shown in fig. 6b, the new split sub-graph spectrum of the second relevance interval includes 3 original nodes, 1 new node, 1 primary side, and 3 new sides, where 3 original nodes include 2 question nodes: the term meaning feature vector of coronary heart disease and the term meaning feature vector of gout comprise the term meaning feature vectors of 1 other original node potato. The primary side of 1 is the side between the meaning feature vector of the words of "gout" and the meaning feature vector of the words of "potato". The 1 new node is a first semantic feature vector of the question, and the 3 new edges are respectively an edge between the first semantic feature vector of the question and a term meaning feature vector of the coronary heart disease, an edge between the first semantic feature vector of the question and a term meaning feature vector of the gout, and an edge between the first semantic feature vector of the question and a term meaning feature vector of the potato.
Fig. 6c shows a new split sub-graph spectrum of a third association interval provided in some embodiments, as shown in fig. 6c, the new split sub-graph spectrum of the third association interval includes 3 original nodes, 1 new node, 2 primary sides, and 3 new sides, where 3 original nodes include 2 question nodes: the term meaning characteristic vector of coronary heart disease and the term meaning characteristic vector of gout comprise the term meaning characteristic vectors of 1 other original node garlic. The 2 primary sides are the sides between the term meaning characteristic vector of coronary heart disease and the term meaning characteristic vector of garlic, and the sides between the term meaning characteristic vector of gout and the term meaning characteristic vector of garlic. The 1 new node is a first semantic feature vector of the question, and the 3 new edges are respectively an edge between the first semantic feature vector of the question and a term meaning feature vector of coronary heart disease, an edge between the first semantic feature vector of the question and a term meaning feature vector of gout, and an edge between the first semantic feature vector of the question and a term meaning feature vector of garlic.
After each new split sub-graph spectrum is determined (formed), each new split sub-graph spectrum can be respectively input into a graph neural network model which is trained in advance, and according to an output result of the graph neural network model, the association degree (for convenience of description, referred to as a fifth association degree) corresponding to each edge included in each new split sub-graph spectrum is determined.
In one possible embodiment, if the total number of the split molecular spectra is small, i.e. the number of segments is small, the new split sub-spectra is relatively complex, time consuming and inefficient; if the total number of the split molecular atlas is larger, namely the number of the segments is larger, the new split sub-atlas is relatively too simple, and the accuracy of the fifth relevancy determined by the neural network model of the atlas and the accuracy of the subsequently determined target answer are affected. Therefore, the number of the segments is reasonably determined based on the first number of the entities contained in the question and the second number of all the nodes contained in the first subgraph spectrum, so that the efficiency of determining the target answer can be improved, and the accuracy of the determined target answer can be ensured.
In one possible embodiment, after determining the degree of association corresponding to each edge (especially each primary edge) in each newly-split molecular graph, each primary edge and each primary edge in a plurality of newly-split molecular graphs can be recombined together to form a total subgraph (called a regrouping graph for convenience of description), so that the target answer can be determined based on the regrouping graph.
Specifically, when each original node and each primary side in a plurality of newly-torn molecular maps are recombined together to form a recombinant sub-map, a blank map can be created first, and then each original node and each primary side in each newly-torn molecular map are respectively added to the blank map in sequence, so that the recombinant sub-map is obtained. It can be understood that, since each primary side carries (corresponds to) the fifth degree of association, each side in the resulting recombinator map also carries the fifth degree of association.
For example, and still taking the above embodiment as an example, 3 original nodes ("the term meaning feature vectors of coronary heart disease", "apple" and "gout") and 2 original nodes ("the edge between the term meaning feature vector of coronary heart disease" and the term meaning feature vector of "apple"), the term meaning feature vector of "gout" and the term meaning feature vector of "apple") in the newly-torn molecular atlas of the first relevance interval of fig. 6a may be added to the empty atlas respectively. Then, 3 original nodes (meaning characteristic vectors of the words of coronary heart disease, potato and gout) in the newly-disassembled molecular map of the second relevance interval in the graph 6b are added, and when the original nodes are added, since the word sense feature vectors of "coronary heart disease" and "gout" already exist in the current empty atlas, the meaning feature vectors of the words "coronary heart disease" and "gout" may not be repeatedly added, only the word meaning characteristic vector of the node potato which does not exist in the current empty map is added, in addition, since there is also no edge between the term meaning feature vector of "potato" and the term meaning feature vector of "gout" in the current atlas, 1 primary edge in fig. 6b (the edge between the term meaning feature vector of "gout" and the term meaning feature vector of "potato") may also be added to the empty atlas. Finally, 3 original nodes ("meaning feature vectors of coronary heart disease", "garlic", and "gout") in the newly-torn molecular atlas in the third relevance interval of fig. 6c may be added, when adding, because the meaning feature vectors of "coronary heart disease" and "gout" already exist in the current empty atlas, the meaning feature vectors of "coronary heart disease" and "gout" may not be added repeatedly, but only the meaning feature vector of "garlic" that does not exist in the current empty atlas may be added, in addition, because the edges between the meaning feature vector of "garlic" and the meaning feature vector of "gout" and the edges between the meaning feature vector of "garlic" and the meaning feature vector of "coronary heart disease" do not exist in the current atlas, 2 primary edges between the meaning feature vector of "coronary heart disease" and the meaning feature vector of "garlic", and the meaning feature vector of "coronary heart disease" in fig. 6c may also be added, The edge between the term sense feature vector of "gout" and the term sense feature vector of "garlic") is added to the null map, thereby obtaining a recombinational sub-map. And the relevance degree corresponding to (carried by) each edge in the recombinator map is a fifth relevance degree.
In a possible implementation manner, after the recombinational sub-map is obtained, the first sub-map may be updated according to the recombinational sub-map, and the target answer of the question is determined based on an entity of the tail node of the relational statement in the updated first sub-map (i.e., the recombinational sub-map), where the first relevance (i.e., the fifth relevance corresponding to each edge in the recombinational sub-map) is higher than a preset relevance threshold.
According to the method, a first sub-graph spectrum can be firstly split into a plurality of split molecular graphs, semantic feature vectors of question sentences are taken as new nodes and are fused into each split molecular graph to form each new split molecular graph, each new split sub-graph spectrum is input into a graph neural network model which is trained in advance to obtain a fifth degree of association corresponding to each edge contained in each new split sub-graph spectrum, each original node and each original edge in the plurality of new split molecular graphs are recombined to obtain a recombined sub-graph, the first sub-graph spectrum is updated according to the recombined sub-graph, and a target answer is determined based on the updated first sub-graph spectrum, so that the aim of quickly and accurately determining the target answer can be achieved.
For convenience of understanding, the target answer determination process provided in the present application is exemplified by a specific embodiment. Fig. 7 is a schematic diagram illustrating a third target answer determination process provided by some embodiments, and as shown in fig. 7, the process includes the following steps:
s701: determining an entity contained in a question input by a received user, and if the entity exists in a stored knowledge graph, determining a first sub-graph according to each original node and each primary side in a set number of hops including the node corresponding to the entity in the knowledge graph.
S702: aiming at each primary side contained in the first sub-graph spectrum, acquiring a relation statement corresponding to the primary side and an entity of a corresponding original head node and an entity of an original tail node; and respectively inputting the question sentences and each relation sentence into a pre-trained semantic model, and respectively determining a first semantic feature vector of the question sentences and a second semantic feature vector of each relation sentence according to the output result of the semantic model.
S703: and determining a first association degree between a second semantic feature vector and the first semantic feature vector of each relation statement to which the primary side belongs according to the relation statement to which the primary side belongs.
S704: respectively determining a word meaning feature vector of an entity of an original head node and a word meaning feature vector of an entity of an original tail node corresponding to each primary side based on a second semantic feature vector of a relation statement to which each primary side belongs, and respectively determining a third degree of association between each word meaning feature vector and the first semantic feature vector; determining a fourth degree of association of an original node of an entity contained in the question sentence in the first sub-graph based on at least one of the first degree of association of a relational sentence to which the original node belongs, the third degree of association of a term meaning feature vector of the entity of the original node and a preset degree of association; and determining a fourth degree of association of each original node except for the original node of the entity contained in the question sentence in the first sub-graph based on at least one of the first degree of association of the relation sentence to which the original node belongs and the third degree of association of the term meaning feature vector of the entity of the original node.
S705: determining a number of segments based on a first number of entities contained in the question and a second number of all nodes contained in the first subgraph spectrum; and uniformly dividing a preset relevance value range into a plurality of subsection relevance intervals.
S706: for each relevance interval, determining each relevance original node of a fourth relevance in the relevance interval except for the original node of the entity contained in the question; determining a split sub-graph spectrum consisting of each associated original node in the association degree interval, the original node of the entity contained in the question and the original node between each associated original node and the original node of the entity contained in the question based on each original node and each original side contained in the first sub-graph spectrum; wherein each primary side in the molecular map corresponds to a first degree of correlation.
S707: aiming at each split molecular graph, updating the entity in each original node according to the word meaning characteristic vector of the entity of each original node in the split molecular graph; taking the first semantic feature vector of the question as a new node, and respectively connecting the new node with each original node in the split sub-graph through a new edge to form a new split sub-graph; and aiming at each new edge, the relevance degree of the new edge is the fourth relevance degree of the original node corresponding to the new edge.
S708: and inputting the new split sub-graph spectrum into a pre-trained graph neural network model aiming at each new split molecular graph, and determining a fifth association degree corresponding to each edge contained in the new split sub-graph spectrum according to an output result of the graph neural network model.
S709: and adding each original node and each original side in each newly-dismantled molecular map into an empty map respectively to obtain a recombinant sub-map, wherein each side in the recombinant sub-map carries the fifth relevance.
S710: and updating the first sub-graph spectrum according to the recombined sub-graph spectrum, and determining a target answer of the question based on an entity of an original tail node of the relational statement in the updated first sub-graph, wherein the first association degree (namely, the fifth association degree) is higher than a preset association degree threshold.
For convenience of understanding, the target answer determination process provided in the present application is illustrated by a specific embodiment. Fig. 8 is a schematic diagram illustrating a fourth target answer determination process provided by some embodiments, and as shown in fig. 8, the process includes the following steps:
s801: the user inputs a question Q through the front-end interface (Web page, application, APP, etc.) of the electronic device.
S802: the electronic equipment determines an entity contained in a question input by a user, and if the entity exists in a stored knowledge graph, determines a first sub-graph G according to each original node and each primary side in the knowledge graph within five hops including the node corresponding to the entity.
For convenience of understanding, the following description will take the example of the question input by the user as "what I can not eat because he suffers from coronary heart disease and gout". Wherein, the entities contained in the question input by the user can be coronary heart disease and gout.
S803: aiming at each primary side contained in the first sub-map G, acquiring a relation statement k corresponding to the primary side and the entity of the corresponding original head node and the entity of the original tail node;
inputting a question Q and each relational statement k into a pre-trained semantic model respectively, and determining a first semantic feature vector of the question and a second semantic feature vector of each relational statement respectively according to an output result of the semantic model;
determining a first association degree between a second semantic feature vector and the first semantic feature vector of each relation statement to which the primary side belongs according to the relation statement to which the primary side belongs;
respectively determining a word meaning feature vector of an entity of an original head node and a word meaning feature vector of an entity of an original tail node corresponding to each primary side based on a second semantic feature vector of a relation statement to which each primary side belongs, and respectively determining a third degree of association between each word meaning feature vector and the first semantic feature vector;
determining a fourth degree of association of an original node of an entity contained in a question Q in a first sub-graph based on at least one of the first degree of association of a relational statement to which the original node belongs, the third degree of association of a term meaning feature vector of the entity of the original node and a preset degree of association;
and for each original node except for the original node of the entity contained in the question Q in the first sub-graph, determining the fourth association degree of the original node based on at least one of the first association degree of the relation sentence to which the original node belongs and the third association degree of the word sense feature vector of the entity of the original node.
Illustratively, the first semantic feature vector of a user-entered question may be a 768-dimensional sentence vector VQ,VQ=[0.4929,0.3551,...,-0.4668]. The word sense feature vector of the "garlic" node contained in the first sub-graph spectrum is [0.3821,0.1253]Judging the word meaning characteristic vector and the first semantic characteristic vector V of the garlic calculated by the company according to the cosine similarityQA third degree of association between may be 0.624.
S804: determining the number of segments based on a first number of entities contained in the question Q and a second number of all nodes contained in the first sub-graph G; uniformly dividing a preset relevance value range into a plurality of subsection relevance intervals;
for each relevance interval, determining each relevance original node of a fourth relevance in the relevance interval except for the original node of the entity contained in the question; determining a split sub-graph spectrum G consisting of each associated original node in the association degree interval, the original node of the entity contained in the question and the primary side between each associated original node and the original node of the entity contained in the question based on each original node and each primary side contained in the first sub-graph spectrum1,G2,...,Gn(ii) a Wherein each primary side in the molecular map corresponds to a first degree of correlation.
Illustratively, if the number of segments is 33, 33 split sub-graph spectra G may be formed1,G2,...,G33
S805: aiming at each split molecular graph, updating the entity in each original node according to the word meaning characteristic vector of the entity of each original node in the split molecular graph; taking the first semantic feature vector of the question as a new node, and respectively connecting the new node with each original node in the split sub-graph spectrum through a new edge to form a new split sub-graph spectrum
Figure BDA0003276737730000151
And aiming at each new edge, the relevance degree of the new edge is the fourth relevance degree of the original node corresponding to the new edge.
Illustratively, if the number of segments is 33, 33 new split sub-graph spectra may be formed
Figure BDA0003276737730000152
S806: and inputting the new split sub-graph spectrum into a pre-trained graph neural network model aiming at each new split molecular graph, and determining a fifth association degree corresponding to each edge contained in the new split sub-graph spectrum according to an output result of the graph neural network model.
In a possible implementation manner, a plurality of new split sub-graph spectrums can be parallelly and respectively input into a plurality of graph neural network models with the same parameters, algorithm acceleration is completed through parallel computing, and computing efficiency is improved.
S807: adding each original node and each primary side in each newly-dismantled molecular map into an empty map respectively to obtain a recombined sub-map
Figure BDA0003276737730000153
Wherein the recombination profile
Figure BDA0003276737730000154
Each edge in (1) carries a fifth degree of association.
Wherein, new nodes and new edges in the newly-dismantled molecular graph can be removed, and only the original nodes and the original edges in the newly-dismantled molecular graph are added into the empty graph.
S808: and updating the first sub-graph spectrum according to the recombined sub-graph spectrum, and determining a target answer of the question based on the entity of the original tail node of the relational statement of which the first association degree is higher than a preset association degree threshold value in the updated first sub-graph spectrum.
For example, if the preset relevance threshold is 0.9, and the entities of the tail nodes of the relational sentences of which the first relevance is higher than the preset relevance threshold are "garlic" (where the first relevance of the relational sentence to which garlic belongs is 0.9132), "scallion" (where the first relevance of the relational sentence to which scallion belongs is 0.9567), "peanut" (where the first relevance of the relational sentence to which peanut belongs is 0.9421), and "red wine" (where the first relevance of the relational sentence to which red wine belongs is 0.9625), respectively, the target answers to the question sentences may be determined based on these entities. In one possible embodiment, the determined objective answer may be "you are good, if you have coronary heart disease and gout, do not recommend eating garlic, scallion, peanuts, etc., do not recommend drinking red wine, etc.
S809: and outputting the determined target answer.
The determined target answer may be output to a front-end interface of the electronic device or a corresponding API interface, and details are not described herein.
Example 5:
based on the same technical concept, the present application provides a target answer determining apparatus, and fig. 9 is a schematic structural diagram of a target answer determining apparatus according to some embodiments, and as shown in fig. 9, the apparatus includes:
a receiving module 91, configured to receive a question input by a user;
a sub-map determining module 92, configured to determine an entity included in the question input by the received user, and if the entity exists in the stored knowledge map, determine a first sub-map according to each original node and each primary side in a set number of hops in the knowledge map, including a node corresponding to the entity;
a semantic determining module 93, configured to obtain, for each primary side included in the first sub-graph spectrum, a relational statement corresponding to an entity of the primary side and the corresponding original head node and an entity of the original tail node; inputting the question sentences and each relational sentence into a pre-trained semantic model respectively, and determining first semantic feature vectors of the question sentences and second semantic feature vectors of each relational sentence respectively according to output results of the semantic model;
a statement association degree determining module 94, configured to determine, for each primary side belonging relation statement, a first association degree between a second semantic feature vector and the first semantic feature vector of the primary side belonging relation statement;
and a target answer determining module 95, configured to determine a target answer to the question based on an entity of an original tail node of the relational statement in the first sub-graph, where the first association degree is higher than a preset association degree threshold.
In a possible embodiment, the apparatus further comprises:
the first correction module is used for determining a sub-graph spectrum of the first relevance between a second semantic feature vector of the relation statement corresponding to each primary side and the first semantic feature vector as a second sub-graph spectrum, and inputting the second sub-graph spectrum into a pre-trained graph neural network model; determining a second association degree corresponding to each primary side according to an output result of the graph neural network model; and updating the first association degree according to the second association degree.
In a possible embodiment, the apparatus further comprises:
the node association degree determining module is used for respectively determining a word meaning feature vector of an entity of an original head node and a word meaning feature vector of an entity of an original tail node corresponding to each primary side based on a second semantic feature vector of a relation statement to which each primary side belongs, and respectively determining a third association degree between each word meaning feature vector and the first semantic feature vector; determining a fourth degree of association of an original node of an entity contained in the question sentence in the first sub-graph based on at least one of the first degree of association of a relational sentence to which the original node belongs, the third degree of association of a term meaning feature vector of the entity of the original node and a preset degree of association; for each original node in the first sub-graph except for the original node of the entity contained in the question sentence, determining a fourth association degree of the original node based on at least one of the first association degree of the relation sentence to which the original node belongs and the third association degree of the word sense feature vector of the entity of the original node;
the first correction module is further used for updating the entity in each original node according to the word sense feature vector of the entity in the original node; taking the first semantic feature vector of the question as a new node, and connecting the new node with the original node through a new edge to form a third sub-map; for each new edge, the relevance degree of the new edge is the fourth relevance degree of the original node corresponding to the new edge; updating the second sub-graph spectrum according to the third sub-graph spectrum, and inputting the updated second sub-graph spectrum into a graph neural network model which is trained in advance based on the updated second sub-graph spectrum; determining a second association degree corresponding to each primary side according to an output result of the graph neural network model; and updating the first association degree according to the second association degree.
In a possible embodiment, the apparatus further comprises:
the node association degree determining module is used for respectively determining a word meaning feature vector of an entity of an original head node and a word meaning feature vector of an entity of an original tail node corresponding to each primary side based on a second semantic feature vector of a relation statement to which each primary side belongs, and respectively determining a third association degree between each word meaning feature vector and the first semantic feature vector; determining a fourth degree of association of an original node of an entity contained in the question sentence in the first sub-graph based on at least one of the first degree of association of a relational sentence to which the original node belongs, the third degree of association of a term meaning feature vector of the entity of the original node and a preset degree of association; for each original node in the first sub-graph except for the original node of the entity contained in the question sentence, determining a fourth association degree of the original node based on at least one of the first association degree of the relation sentence to which the original node belongs and the third association degree of the word sense feature vector of the entity of the original node;
a partitioning module, configured to determine a number of segments based on a first number of entities included in the question and a second number of all nodes included in the first subgraph spectrum; uniformly dividing a preset relevance value range into a plurality of subsection relevance intervals;
the splitting module is used for determining each correlation original node, except for the original node of the entity contained in the question sentence, of which the fourth correlation degree is positioned in each correlation degree interval; determining a split sub-graph spectrum consisting of each associated original node in the association degree interval, the original node of the entity contained in the question and the original node between each associated original node and the original node of the entity contained in the question based on each original node and each original side contained in the first sub-graph spectrum; wherein each primary side in the molecular splitting map corresponds to a first degree of association;
the fusion module is used for updating the entities in the original nodes according to the word sense characteristic vector of the entity of each original node in each split molecular map; taking the first semantic feature vector of the question as a new node, and respectively connecting the new node with each original node in the split sub-graph through a new edge to form a new split sub-graph; for each new edge, the relevance degree of the new edge is a fourth relevance degree of the original node corresponding to the new edge;
the second correction module is used for inputting the new split sub-graph into a pre-trained graph neural network model aiming at each new split molecular graph, and determining a fifth association degree corresponding to each edge contained in the new split sub-graph according to an output result of the graph neural network model;
the recombination module is used for respectively adding each original node and each original side in each newly-disassembled molecular map into an empty map to obtain a recombined molecular map, wherein each side in the recombined molecular map carries the fifth relevance;
and the updating module is used for updating the first sub-graph spectrum according to the recombinator graph and performing subsequent steps based on the updated first sub-graph spectrum.
In a possible implementation, the dividing module is specifically configured to determine the number of segments based on a ratio of the second number to the first number.
In a possible implementation manner, the dividing module is specifically configured to determine, as the number of segments, an integer obtained by rounding up a ratio of the second number to the first number.
In a possible embodiment, the apparatus further comprises:
and the prompting module is used for outputting preset prompting information if the entity contained in the question input by the user does not exist in the knowledge graph.
Example 6:
on the basis of the foregoing embodiments, an embodiment of the present invention further provides an electronic device, and fig. 10 shows a schematic structural diagram of an electronic device provided in some embodiments, and as shown in fig. 10, the electronic device includes: the system comprises a processor 101, a communication interface 102, a memory 103 and a communication bus 104, wherein the processor 101, the communication interface 102 and the memory 103 are communicated with each other through the communication bus 104;
the memory 103 stores therein a computer program that, when executed by the processor 101, causes the processor 101 to perform the steps of the above-described target answer determination method.
Since the principle of the electronic device for solving the problem is similar to the target answer determining method, the implementation of the electronic device may refer to the implementation of the target answer determining method, and repeated details are not repeated.
The communication bus mentioned in the electronic device may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus.
The communication interface 102 is used for communication between the above-described electronic device and other devices.
The Memory may include a Random Access Memory (RAM) or a Non-Volatile Memory (NVM), such as at least one disk Memory. Alternatively, the memory may be at least one memory device located remotely from the processor.
The Processor may be a general-purpose Processor, including a central processing unit, a Network Processor (NP), and the like; but may also be a Digital instruction processor (DSP), an application specific integrated circuit, a field programmable gate array or other programmable logic device, discrete gate or transistor logic, discrete hardware components, or the like.
Example 7:
on the basis of the foregoing embodiments, the present application provides a computer-readable storage medium, in which a computer program executable by an electronic device is stored, and computer-executable instructions are used for causing a computer to execute the procedures performed by the foregoing method parts.
The computer readable storage medium may be any available medium or data storage device that can be accessed by a processor in an electronic device, including but not limited to magnetic memory such as floppy disks, hard disks, magnetic tape, magneto-optical disks (MOs), etc., optical memory such as CDs, DVDs, BDs, HVDs, etc., and semiconductor memory such as ROMs, EPROMs, EEPROMs, non-volatile memory (NAND FLASH), Solid State Disks (SSDs), etc.
As will be appreciated by one skilled in the art, 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 flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams 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 changes and modifications may be made in the present application without departing from the spirit and scope of the application. Thus, if such modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is intended to include such modifications and variations as well.

Claims (10)

1. A method for determining a target answer, the method comprising:
determining an entity contained in a question input by a received user, and if the entity exists in a stored knowledge graph, determining a first sub-graph according to each original node and each primary side in a set number of hops including the node corresponding to the entity in the knowledge graph;
aiming at each primary side contained in the first sub-graph spectrum, acquiring a relation statement corresponding to the primary side and an entity of a corresponding original head node and an entity of an original tail node; inputting the question sentences and each relational sentence into a pre-trained semantic model respectively, and determining first semantic feature vectors of the question sentences and second semantic feature vectors of each relational sentence respectively according to output results of the semantic model;
determining a first association degree between a second semantic feature vector and the first semantic feature vector of each relation statement to which the primary side belongs according to the relation statement to which the primary side belongs;
and determining a target answer of the question sentence based on the entity of the original tail node of the relational sentence in the first sub-graph, wherein the first association degree is higher than a preset association degree threshold value.
2. The method according to claim 1, wherein after determining, for each relational statement to which the primary side belongs, a first degree of association between a second semantic feature vector and the first semantic feature vector of the relational statement to which the primary side belongs, before determining a target answer of the question based on an entity of an origin node of the relational statement in the first sub-graph whose first degree of association is higher than a preset degree of association threshold, the method further comprises:
determining a sub-graph spectrum of the first association degree between a second semantic feature vector of the relation statement corresponding to each primary side and the first semantic feature vector as a second sub-graph spectrum, and inputting the second sub-graph spectrum into a pre-trained graph neural network model;
determining a second association degree corresponding to each primary side according to an output result of the graph neural network model; and updating the first relevance according to the second relevance, and performing subsequent steps based on the updated first relevance.
3. The method of claim 2, wherein after determining, for each relational statement to which the primary side belongs, a first degree of association between a second semantic feature vector and the first semantic feature vector of the relational statement to which the primary side belongs, and before inputting the second sub-graph spectrum into the pre-trained graph neural network model, the method further comprises:
respectively determining a word meaning feature vector of an entity of an original head node and a word meaning feature vector of an entity of an original tail node corresponding to each primary side based on a second semantic feature vector of a relation statement to which each primary side belongs, and respectively determining a third degree of association between each word meaning feature vector and the first semantic feature vector;
determining a fourth degree of association of an original node of an entity contained in the question sentence in the first sub-graph based on at least one of the first degree of association of a relational sentence to which the original node belongs, the third degree of association of a term meaning feature vector of the entity of the original node and a preset degree of association; for each original node in the first sub-graph except for the original node of the entity contained in the question sentence, determining a fourth association degree of the original node based on at least one of the first association degree of the relation sentence to which the original node belongs and the third association degree of the word sense feature vector of the entity of the original node;
aiming at each original node, updating the entity in the original node according to the word sense characteristic vector of the entity in the original node; taking the first semantic feature vector of the question as a new node, and connecting the new node with the original node through a new edge to form a third sub-map; for each new edge, the relevance degree of the new edge is the fourth relevance degree of the original node corresponding to the new edge; and updating the second sub-graph spectrum according to the third sub-graph spectrum, and performing subsequent steps based on the updated second sub-graph spectrum.
4. The method according to claim 1, wherein after determining, for each relational statement to which the primary side belongs, a first degree of association between a second semantic feature vector and the first semantic feature vector of the relational statement to which the primary side belongs, before determining a target answer of the question based on an entity of a tail node of the relational statement in the first sub-graph whose first degree of association is higher than a preset degree of association threshold, the method further comprises:
respectively determining a word meaning feature vector of an entity of an original head node and a word meaning feature vector of an entity of an original tail node corresponding to each primary side based on a second semantic feature vector of a relation statement to which each primary side belongs, and respectively determining a third degree of association between each word meaning feature vector and the first semantic feature vector; determining a fourth degree of association of an original node of an entity contained in the question sentence in the first sub-graph based on at least one of the first degree of association of a relational sentence to which the original node belongs, the third degree of association of a term meaning feature vector of the entity of the original node and a preset degree of association; for each original node in the first sub-graph except for the original node of the entity contained in the question sentence, determining a fourth association degree of the original node based on at least one of the first association degree of the relation sentence to which the original node belongs and the third association degree of the word sense feature vector of the entity of the original node;
determining a number of segments based on a first number of entities contained in the question and a second number of all nodes contained in the first subgraph spectrum; uniformly dividing a preset relevance value range into a plurality of subsection relevance intervals;
for each relevance interval, determining each relevance original node of a fourth relevance in the relevance interval except for the original node of the entity contained in the question; determining a split sub-graph spectrum consisting of each associated original node in the association degree interval, the original node of the entity contained in the question and the original node between each associated original node and the original node of the entity contained in the question based on each original node and each original side contained in the first sub-graph spectrum; wherein each primary side in the molecular splitting map corresponds to a first degree of association;
aiming at each split molecular graph, updating the entity in each original node according to the word meaning characteristic vector of the entity of each original node in the split molecular graph; taking the first semantic feature vector of the question as a new node, and respectively connecting the new node with each original node in the split sub-graph through a new edge to form a new split sub-graph; for each new edge, the relevance degree of the new edge is a fourth relevance degree of the original node corresponding to the new edge;
inputting the new split sub-graph spectrum into a pre-trained graph neural network model aiming at each new split molecular graph, and determining a fifth association degree corresponding to each edge contained in the new split sub-graph spectrum according to an output result of the graph neural network model;
adding each original node and each original side in each newly-dismantled molecular map into an empty map respectively to obtain a recombinant sub-map, wherein each side in the recombinant sub-map carries the fifth relevance;
and updating the first sub-graph spectrum according to the recombinator graph, and performing subsequent steps based on the updated first sub-graph spectrum.
5. The method of claim 4, wherein determining the number of segments based on the first number of entities contained in the question and the second number of all nodes contained in the first subgraph spectrum comprises:
determining the number of segments based on a ratio of the second number to the first number.
6. The method of claim 5, wherein the determining the number of segments based on a ratio of the second number to the first number comprises:
and determining an integer obtained by rounding up the ratio of the second number to the first number as the number of the segments.
7. The method of claim 1, further comprising:
and if the entity contained in the question input by the user does not exist in the knowledge graph, outputting preset prompt information.
8. An apparatus for determining a target answer, the apparatus comprising:
the receiving module is used for receiving a question input by a user;
a sub-map determining module, configured to determine an entity included in the question input by the received user, and if the entity exists in a stored knowledge map, determine a first sub-map according to each original node and each primary side in a set number of hops in the knowledge map, including a node corresponding to the entity;
a semantic determining module, configured to obtain, for each primary side included in the first sub-graph, a relation statement corresponding to an entity of the primary side and a corresponding original head node and an entity of an original tail node; inputting the question sentences and each relational sentence into a pre-trained semantic model respectively, and determining first semantic feature vectors of the question sentences and second semantic feature vectors of each relational sentence respectively according to output results of the semantic model;
the sentence association degree determining module is used for determining a first association degree between a second semantic feature vector and the first semantic feature vector of the relation sentence to which the primary side belongs according to the relation sentence to which the primary side belongs;
and the target answer determining module is used for determining a target answer of the question based on an entity of an original tail node of the relational statement in the first sub-graph, wherein the first association degree is higher than a preset association degree threshold value.
9. An electronic device, characterized in that the electronic device comprises at least a processor and a memory, the processor being configured to implement the steps of a method for determining a target answer as claimed in any one of claims 1 to 7 when executing a computer program stored in the memory.
10. A computer-readable storage medium, storing a computer program which, when executed by a processor, performs the steps of a method for determining a target answer according to any one of claims 1 to 7.
CN202111119969.7A 2021-09-24 2021-09-24 Target answer determining method, device, equipment and medium Active CN113792132B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111119969.7A CN113792132B (en) 2021-09-24 2021-09-24 Target answer determining method, device, equipment and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111119969.7A CN113792132B (en) 2021-09-24 2021-09-24 Target answer determining method, device, equipment and medium

Publications (2)

Publication Number Publication Date
CN113792132A true CN113792132A (en) 2021-12-14
CN113792132B CN113792132B (en) 2023-11-17

Family

ID=78879182

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111119969.7A Active CN113792132B (en) 2021-09-24 2021-09-24 Target answer determining method, device, equipment and medium

Country Status (1)

Country Link
CN (1) CN113792132B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115017276A (en) * 2022-03-28 2022-09-06 连芷萱 Multi-turn conversation method and system for government affair consultation by combining fuzzy logic and R-GCN

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108846104A (en) * 2018-06-20 2018-11-20 北京师范大学 A kind of question and answer analysis and processing method and system based on padagogical knowledge map
CN110781251A (en) * 2019-11-04 2020-02-11 泰康保险集团股份有限公司 Insurance knowledge map generation method, device, equipment and storage medium
CN111782769A (en) * 2020-07-01 2020-10-16 重庆邮电大学 Intelligent knowledge graph question-answering method based on relation prediction
US20200372019A1 (en) * 2019-05-21 2020-11-26 Sisense Ltd. System and method for automatic completion of queries using natural language processing and an organizational memory
CN112650840A (en) * 2020-12-04 2021-04-13 天津泰凡科技有限公司 Intelligent medical question-answering processing method and system based on knowledge graph reasoning

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108846104A (en) * 2018-06-20 2018-11-20 北京师范大学 A kind of question and answer analysis and processing method and system based on padagogical knowledge map
US20200372019A1 (en) * 2019-05-21 2020-11-26 Sisense Ltd. System and method for automatic completion of queries using natural language processing and an organizational memory
CN110781251A (en) * 2019-11-04 2020-02-11 泰康保险集团股份有限公司 Insurance knowledge map generation method, device, equipment and storage medium
CN111782769A (en) * 2020-07-01 2020-10-16 重庆邮电大学 Intelligent knowledge graph question-answering method based on relation prediction
CN112650840A (en) * 2020-12-04 2021-04-13 天津泰凡科技有限公司 Intelligent medical question-answering processing method and system based on knowledge graph reasoning

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
唐娇: "基于深度神经网络的知识库问答研究" *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115017276A (en) * 2022-03-28 2022-09-06 连芷萱 Multi-turn conversation method and system for government affair consultation by combining fuzzy logic and R-GCN

Also Published As

Publication number Publication date
CN113792132B (en) 2023-11-17

Similar Documents

Publication Publication Date Title
US11983269B2 (en) Deep neural network system for similarity-based graph representations
US11205271B2 (en) Method and device for semantic segmentation of image
CN110366734B (en) Optimizing neural network architecture
US20190197429A1 (en) Method and apparatus for training classification model, and method and apparatus for classifying data
US11488055B2 (en) Training corpus refinement and incremental updating
US10262272B2 (en) Active machine learning
US11061805B2 (en) Code dependency influenced bug localization
WO2021089013A1 (en) Spatial graph convolutional network training method, electronic device and storage medium
US20190042917A1 (en) Techniques for determining artificial neural network topologies
CN110598869B (en) Classification method and device based on sequence model and electronic equipment
US10372743B2 (en) Systems and methods for homogeneous entity grouping
CN110909868A (en) Node representation method and device based on graph neural network model
CN111611390B (en) Data processing method and device
CN115098556A (en) User demand matching method and device, electronic equipment and storage medium
CN112420125A (en) Molecular attribute prediction method and device, intelligent equipment and terminal
US11048852B1 (en) System, method and computer program product for automatic generation of sizing constraints by reusing existing electronic designs
CN113792132B (en) Target answer determining method, device, equipment and medium
CN112328881B (en) Article recommendation method, device, terminal equipment and storage medium
US20200250560A1 (en) Determining pattern similarities using a multi-level machine learning system
CN112560463B (en) Text multi-labeling method, device, equipment and storage medium
US20230075290A1 (en) Method for linking a cve with at least one synthetic cpe
CN114912623A (en) Method and device for model interpretation
US10546247B2 (en) Switching leader-endorser for classifier decision combination
Gladence et al. A novel technique for multi-class ordinal regression-APDC
KR101697992B1 (en) System and Method for Recommending Bug Fixing Developers based on Multi-Developer Network

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
GR01 Patent grant
GR01 Patent grant