A question-answering method and system based on multi-granularity temporal knowledge graph

Through the multi-granularity temporal knowledge graph method, the embedded vector model and semantic model are used to extract question information, which solves the problem of inaccurate answers caused by time granularity differences in traditional temporal knowledge graphs and realizes accurate multi-granularity temporal question answering.

CN117312528BActive Publication Date: 2025-09-19CHENGDU UNION BIG DATA TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202311455305.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-11-03
Publication Date
2025-09-19
Estimated Expiration
2043-11-03

AI Technical Summary

Technical Problem

Traditional temporal knowledge graph question answering methods ignore the difference in temporal information granularity between questions and graphs, and have difficulty handling multi-granularity time problems. They are usually based on reasoning when the question entities are known or crudely utilize semantic representations, resulting in inaccurate answers.

Method used

A multi-granularity temporal knowledge graph method is adopted to obtain entity, time and relationship representation vectors through the embedding vector model, extract question information by combining named entity recognition and regular expressions, map the relationship using the semantic model, and perform answer prediction and time granularity refinement through a linear neural network.

Benefits of technology

It achieves accurate answer correction for questions of different time granularities, improves the accuracy and completeness of knowledge graph question and answer, and ensures the accuracy of information utilization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117312528B_ABST
    Figure CN117312528B_ABST
Patent Text Reader

Abstract

The present invention provides a question-answering method and system based on a multi-granularity temporal knowledge graph, relating to the field of natural language processing. The method comprises the following steps: obtaining an embedding vector model based on a temporal knowledge graph; obtaining an entity representation vector of a question based on a named entity recognition model, and obtaining a time representation vector of the question based on a regular expression; obtaining a relationship representation vector of the question based on a semantic model, and mapping the relationship representation to a temporal knowledge graph; predicting an answer score based on the embedding vector model, the entity representation vector of the question, the time representation vector of the question, and the relationship representation vector of the question; obtaining an answer to the question based on the answer score, and refining the time granularity of the answer to the question. The present invention unifies the fine-grained time information contained in the coarse-grained time onto a single time vector for prediction, and corrects the relevant answers for questions asking about different time granularities.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of natural language processing, and in particular to a question-answering method and system based on a multi-granularity temporal knowledge graph. Background Art

[0002] The temporal knowledge graph is an extension of the knowledge graph. It adds timestamps to the triples representing facts to form quadruples, assigning a specific time to each fact and thus more realistically depicting reality. Temporal knowledge graph question answering is currently one of the main applications of temporal knowledge graphs. It aims to answer questions by associating questions with known facts in the graph.

[0003] Traditional temporal knowledge graph question answering is often carried out under the premise of unified temporal granularity, ignoring the situation that the granularity of temporal information contained in the question may be different from that contained in the graph; most temporal knowledge graphs are often based on reasoning when the question entity is known, or crudely use the semantic representation of the question to represent the entity, which makes it difficult to solve complex multi-granularity temporal question answering. Summary of the Invention

[0004] The present invention provides a question-answering method and system based on a multi-granularity temporal knowledge graph to eliminate the defects of traditional temporal knowledge graph question-answering.

[0005] In a first aspect, an embodiment of the present invention provides a question-answering method based on a multi-granularity temporal knowledge graph, the method flow is as follows:

[0006] Obtain an embedded vector model based on the temporal knowledge graph;

[0007] Obtaining an entity representation vector of the question based on a named entity recognition model, and obtaining a time representation vector of the question based on a regular expression;

[0008] Obtain the relational representation vector of the question based on the semantic model and map the relational representation to the temporal knowledge graph;

[0009] Predict the answer score based on the embedding vector model, the question entity representation vector, the question time representation vector, and the question relationship representation vector;

[0010] The answer to the question is obtained based on the answer score, and the time granularity of the question answer is refined.

[0011] In the above embodiment, the fine-grained time information contained in the coarse-grained time is unified into a single time vector for prediction, and the relevant answers are corrected for questions asking about time of different granularities; and the entities in the question are extracted based on the named entity recognition model, and the time in the question is extracted based on the regular matching method, which makes the use of information more accurate and also constructs a more complete knowledge graph question-answering model.

[0012] As some optional implementations of the present application, the embedding vector model includes an entity embedding vector set, a relationship embedding vector set, and a time embedding vector set.

[0013] As some optional implementations of the present application, the process of obtaining the relation representation vector of the question based on the semantic model and mapping the relation representation to the temporal knowledge graph is as follows:

[0014] Replace the question's entities and time, and semantically represent the replaced question based on the semantic model to obtain a relational representation vector for the question.

[0015] A linear neural network layer is used to map the relational representation vector of the question to the same dimensional vector space represented by the temporal knowledge graph.

[0016] In the above embodiment, since the relationship in the question is usually difficult to extract directly, a semantic model is used to convert the question into a semantic representation to provide relationship information; and in order to reduce noise interference, the text of the extracted entities, time, etc. in the question is replaced with [MASK] to shield redundant information.

[0017] As some optional implementations of the present application, the questions are divided into questions about the question entity and questions about the question time according to the content of the answer.

[0018] In the above embodiment, by classifying the questions into different types, subsequent predictions can be performed based on the characteristics of the types.

[0019] As some optional implementations of the present application, the process of predicting the answer score based on the embedding vector model, the entity representation vector of the question, the time representation vector of the question, and the relationship representation vector of the question is as follows:

[0020] For question sentences asking questions about entities:

[0021] If there is time in the question, the score of the entity in the embedding vector model is predicted based on the question's entity representation vector, relationship representation vector, and time representation vector, and the score of time is set to 0;

[0022] If there is no time in the question, the time representation vector is obtained based on the start and end time of the event involved in the question, and the score of the entity in the embedding vector model is predicted based on the entity representation vector, relationship representation vector and time representation vector of the question, and the score of time is set to 0;

[0023] Concatenate the entity score and the time score to get the answer score;

[0024] Regarding question time:

[0025] Predict the time score in the embedding vector model based on the question’s entity representation vector, relationship representation vector, and time representation vector, and set the entity score to 0;

[0026] Concatenate the score for the entity and the score for the time to get the score for the answer.

[0027] In the above embodiment, for questions about question entities, the task is understood as a temporal knowledge graph completion task in which the head entity, relationship, and time are known and the tail entity is predicted; for questions about question time, the task is understood as a temporal knowledge graph completion task in which the head and tail entities and relationships are known and the time is predicted.

[0028] As some optional implementations of the present application, the calculation formula for predicting the score of an entity in the embedding vector model based on the entity representation vector, relationship representation vector, and time representation vector of the question is as follows:

[0029] Score e =Φ e (e v1 ,e r ,e tq )

[0030] Among them, e v1 is the entity representation vector of the question, e r is the relation representation vector of the question, e tq is the time representation vector of the question, Score e is the score of all entities in the temporal knowledge graph, Φ e Indicates that the entity representation of the question is e v1 and relational representation r and time representation vector e tq Complex multiplication is used to combine, and the combined vector is multiplied by the dot product of all entity representations in the embedded vector model to obtain the entity score.

[0031] As some optional implementations of the present application, the calculation formula for obtaining the time representation based on the start and end time of the event involved in the question is as follows:

[0032]

[0033] in, and is the time representation corresponding to the start and end time of the event, Represents the concatenation of time representation vectors.

[0034] As some optional implementations of the present application, the calculation formula for obtaining the time representation vector based on the start and end time of the event involved in the question is as follows:

[0035] Score t =Φ t (e v1 ,e r ,e v2 )

[0036] Among them, e v1 and e v2 is the entity representation vector of the question, e r is the relation representation vector of the question, Score t is the fraction of all times in the temporal knowledge graph, Φ t Indicates that the entity representation vector e v1 and the relationship representation vector e r and entity representation vector e v2 Complex multiplication is used to combine, and the combined vector is dot-producted with all time representation vectors in the embedded vector model to obtain the time score.

[0037] As some optional implementations of the present application, the process of obtaining the answer to the question based on the answer score and refining the time granularity of the question answer is as follows:

[0038] Sorting the scores of the answers, and selecting a number of question answers based on the ranking, wherein the question answers include entity answers and time answers;

[0039] For time answers, the time granularity of the time answer is refined according to the time granularity of the question.

[0040] In the above embodiment, according to the actual situation, multiple answers with higher scores can be returned. At the same time, for time answers, the answers are refined according to the time granularity of the question.

[0041] In a second aspect, the present invention provides a question-answering system based on a multi-granularity temporal knowledge graph, the system comprising:

[0042] A knowledge graph unit, wherein the knowledge graph unit obtains an embedding vector model based on a temporal knowledge graph;

[0043] A question representation unit, which obtains an entity representation vector of the question based on a named entity recognition model and a time representation vector of the question based on a regular expression; obtains a relationship representation vector of the question based on a semantic model, and maps the relationship representation to a temporal knowledge graph;

[0044] a score prediction unit, wherein the score prediction unit predicts the score of the answer based on the embedding vector model, the entity representation vector of the question, the time representation vector of the question, and the relationship representation vector of the question;

[0045] An answer prediction unit is configured to obtain an answer to the question based on the answer score and refine the time granularity of the answer to the question.

[0046] In a third aspect, the present invention provides a computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the question-answering method based on a multi-granularity temporal knowledge graph when executing the computer program.

[0047] In a fourth aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the question-answering method based on a multi-granularity temporal knowledge graph.

[0048] The beneficial effects of the present invention are as follows:

[0049] (1) The present invention unifies the fine-grained time information contained in the coarse-grained time onto a single time vector for prediction, and corrects the relevant answers to questions asking about different granularities of time.

[0050] (2) The present invention extracts entities in questions based on a named entity recognition model and extracts time in questions based on a regular matching method, which makes more accurate use of information and also constructs a more complete knowledge graph question-answering model. BRIEF DESCRIPTION OF THE DRAWINGS

[0051] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for use in the embodiments. It should be understood that the following drawings only illustrate certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other relevant drawings can be obtained based on these drawings without paying any creative work.

[0052] Figure 1 is a schematic diagram of the computer device structure of the hardware operating environment described in an embodiment of the present invention;

[0053] Figure 2This is a flowchart of the question-answering method based on a multi-granularity temporal knowledge graph according to an embodiment of the present invention;

[0054] Figure 3 This is an application framework diagram of the question-answering method based on the multi-granularity temporal knowledge graph according to an embodiment of the present invention;

[0055] Figure 4 This is a system block diagram of a question-answering system based on a multi-granularity temporal knowledge graph according to an embodiment of the present invention. DETAILED DESCRIPTION

[0056] It should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application.

[0057] In order to eliminate the defects of traditional time series knowledge graph question answering, this application provides a question answering method and system based on multi-granularity time series knowledge graph. Before introducing the specific technical solution of this application, the hardware operating environment involved in the embodiment of this application is first introduced.

[0058] See also Figure 1 , Figure 1 This is a schematic diagram of the computer device structure of the hardware operating environment involved in the embodiment of the present application.

[0059] like Figure 1 As shown, the computer device may include: a processor, such as a central processing unit (CPU), a communication bus, a user interface, a network interface, and a memory. The communication bus is used to realize the connection and communication between these components. The user interface may include a display screen (Display), an input unit such as a keyboard (Keyboard), and optionally, the user interface may also include a standard wired interface and a wireless interface. The network interface may optionally include a standard wired interface and a wireless interface (such as a wireless fidelity interface). The memory may be a high-speed random access memory (Random Access Memory, RAM) memory, or a stable non-volatile memory (Non-Volatile Memory, NVM), such as a disk memory. The memory may also be a storage device independent of the aforementioned processor.

[0060] Those skilled in the art will understand that Figure 1 The structure shown in the figure does not constitute a limitation on the computer device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.

[0061] like Figure 1As shown, the memory as a storage medium may include an operating system, a data storage module, a network communication module, a user interface module, and a storage module for software programs.

[0062] exist Figure 1 In the computer device shown, the network interface is mainly used for data communication with the network server; the user interface is mainly used for data interaction with the user; the processor and memory in the computer device of the present application can be set in the computer device, and the computer device calls the question and answer system based on the multi-granularity temporal knowledge graph stored in the memory through the processor, and executes the question and answer method based on the multi-granularity temporal knowledge graph provided in the embodiment of the present application.

[0063] Based on the hardware environment of the aforementioned embodiment, the embodiment of this application provides a question-answering method based on a multi-granularity time series knowledge graph. Figure 2 and Figure 3 , Figure 2 is a flow chart of the method, Figure 3 The application framework diagram of the method is as follows:

[0064] Step 1: Obtain an embedding vector model based on the pre-trained temporal knowledge graph.

[0065] In the embodiment of the present invention, the temporal knowledge graph can be represented as a set of four-tuples, namely in, Represents a temporal knowledge graph, s represents the head entity, r represents the relationship, o represents the tail entity, and t represents time; the time granularity of the temporal knowledge graph can be set to a date, such as 2018-08-01.

[0066] Specifically, the embedding vector model is expressed as:

[0067]

[0068] Among them, E e Represents the entity embedding vector set in the temporal knowledge graph, E r Represents the set of relation embedding vectors, E t Represents a set of time embedding vectors.

[0069] Step 2: Obtain the entity representation vector of the question based on the named entity recognition model (NER), and obtain the time representation vector of the question based on the regular expression.

[0070] In an embodiment of the present invention, the process of obtaining the entity representation vector of a question sentence based on the named entity recognition (NER) model is as follows:

[0071] First, for a question q, the NER model is used to extract the entity e in the question i :

[0072] e1,e2,…,e n =NER(q)

[0073] Among them, e i (i=1,2,…,n) represents the entity of the question. Usually, the maximum value of n is 2.

[0074] Then, through the entity e i Get the corresponding entity representation vector e vi .

[0075] In an embodiment of the present invention, the process of obtaining the time representation vector of a question based on a regular expression is as follows:

[0076] For a question q, the time expression pattern in the question is mostly fixed, such as 2018-08-01, 2018 / 8 / 1, 2018 / 08, etc., which has a fixed pattern. First, the time t of the question is extracted based on the regular expression. q , then based on time t q The time representation vector e can be obtained tq ; For a question q that does not contain time information, search for the question entity e in the temporal knowledge graph i All associated quadruples (i=1,2,…,n) and select the earliest time t q,start and the latest time t q,end Time t as a question q When t q When the granularity of t is inconsistent with the time granularity in the temporal knowledge graph, t q Convert to t q The earliest time t in the time range represented q,start and the latest time t q,end , for example, 2018 / 08 is converted to (2018 / 08 / 01, 2018 / 08 / 31).

[0077] Step 3: Obtain the relational representation vector e of the question based on the pre-trained semantic model r , and the relationship representation vector e r Mapping to the temporal knowledge graph.

[0078] In this embodiment of the present invention, since it is usually difficult to directly extract the relationship in the question, a pre-trained semantic model is used to convert the question into a semantic representation to provide relationship information. In addition, to reduce noise interference, the text of the entity, time, etc. extracted in step 2 in the question is replaced with [MASK] to block redundant information.

[0079] For example: Who visited USA on 5 April 2009?

[0080] Replace with: Who visited [MASK] on [MASK]?

[0081] After the question q is processed based on the above replacement, a pre-trained semantic model is used to obtain the semantic representation of the question. The semantic model includes but is not limited to the Bert model:

[0082] q CLS =Bert(q)

[0083] Among them, q CLS For the semantic representation of the question, in order to unify the semantic representation output by the pre-trained semantic model and the dimension of the graph representation vector space, a linear neural network layer is used to map the semantic representation of the question to the same dimensional vector space of the graph representation:

[0084] e r =Linear1(q CLS )

[0085] Among them, e r is the relation representation vector based on the semantic representation of the question.

[0086] Step 4: Entity representation vector e based on embedding vector model and question vi , the time representation vector e of the question tq And the relation representation vector e of the question r The score of the predicted answer.

[0087] In the embodiment of the present invention, for question q, based on question words such as "when", "which time", "which date", and "what month", questions can be divided into two types according to the answer content: questions about the entity and questions about the time.

[0088] For question sentences that inquire about entities, the task is understood as a temporal knowledge graph completion task with known head entities, relations, and time-predicted tail entities. The scores of all candidate entities are calculated using the entity score function of the embedding vector model in step 1:

[0089] Step 1.1: If there is time in the question, then the entity representation vector e based on the question vi , relation representation vector e r and the time representation vector Predict the score of the entity in the embedding vector model and convert the score of the time into Score t Set to 0;

[0090] Specifically, the formula for calculating the entity score is as follows:

[0091] Score e =Φ e (e v1 ,e r ,e tq )

[0092] Among them, e v1 is the entity representation vector of the question (head entity or tail entity), e v1 ∈E e , e r is the relation representation vector of the question, e r ∈E r , is the time representation vector of the question, e tq ∈E t , Score e is the score of all entities in the temporal knowledge graph, Φ e Represents the entity representation vector e of the question v1 and the relationship representation vector e r and time representation vector e tq The entity score is obtained by combining the combined vector with all entity representations in the embedding vector model using complex multiplication. e .

[0093] Step 1.2: If there is no time in the question, obtain the time representation vector e based on the start and end time of the event involved in the question tq , and based on the question entity representation vector e v1 , relation representation vector e r And the obtained time representation vector e tq Use the formula in step (1.1) to predict the score of the entity in the embedding vector model e , and the score of time Score t Set to 0;

[0094] Specifically, the time representation vector The calculation formula is as follows:

[0095]

[0096] in, and is the time representation corresponding to the start and end time of the event, Represents the concatenation of time representation vectors.

[0097] Step 1.3: Score the entity e Score of timet Splice together to get points for the answer;

[0098] Specifically, the scores of the answers are expressed as follows:

[0099]

[0100] For questions about time, the task is understood as a temporal knowledge graph completion task with known head and tail entities and relationship prediction times. The time score function of the embedding vector model in step 1 is used to calculate the scores for all candidate times:

[0101] Step 2.1: Predict the time score in the embedding vector model based on the question entity representation vector, relationship representation vector, and time representation vector t , and the entity's score Score e Set to 0;

[0102] Specifically, the score of time t The calculation formula is as follows:

[0103] Score t =Φ t (e v1 ,e r ,e v2 )

[0104] Among them, e1 and e2 are the entity representation vectors of the question, e r is the relation representation vector of the question, Score t is the fraction of all times in the temporal knowledge graph, Φ t Indicates that the entity representation vector e1 and the relationship representation vector e r The entity representation vector e2 is combined using complex multiplication, and the combined vector is dot-producted with all time representation vectors in the embedded vector model to obtain the time score.

[0105] Step 2.2: Score the entity e Score of time t Splicing to get the score of the answer, where the score of the answer is the same as step 1.3. For the question of the question entity, a zero vector is assigned as the score of the time t , similarly for the question about the question time, a zero vector is assigned as the score zero vector of the entity to ensure the uniformity of the output; the score Score of the entity of the question e Score of time t The concatenated scores are used as the answer scores for the question, and in order to further improve the accuracy, only the answers contained in the entity-related knowledge (quadruple) in the question are retained.

[0106] Step 5: Obtain the answer to the question based on the answer score and refine the time granularity of the answer to the question.

[0107] In the embodiment of the present invention, since the questions about time in the question sentences are not limited to dates, but may also refer to a certain year or month, the question sentences can easily distinguish the time granularity of their answers based on the interrogative words. For example, the answer to "when" must be a date, and the answer to "what / which year" must be a year.

[0108] The previous step can give scores for all candidate entities or time periods. Based on the actual situation, the top answers can be returned. For time answers, the answers are refined based on the time granularity of the question. For example, for the question "Which year did Tom visit Iran?", the answer given was 2013-01-01, which was revised to 2013.

[0109] At the same time, the entire question-answering task is regarded as a multi-classification task. Before the formal use in step 5, it is necessary to use cross entropy to calculate the loss function to realize the training of the entire large model. Specifically, the loss function is expressed as follows:

[0110] Loss=Cross(Score,Score True )

[0111] Score True is the true answer score of the labeled data, where only the answer (entity or time) has a score of 1 and the rest are 0. After calculating the loss, the gradient descent method is used to train the model.

[0112] In summary, traditional temporal knowledge graph question-answering ignores the fact that the granularity of the time information contained in the question may be different from that contained in the graph. The present invention unifies the fine-grained time information contained in the coarse-grained time onto a single time vector for prediction, and corrects the relevant answers for questions asking about different granularities of time. In addition, traditional temporal knowledge graph question-answering often relies on reasoning based on the known entities in the question, or crudely uses the semantic representation of the question to represent the entity. The present invention first extracts the entity in the question based on the NER method, and extracts the time in the question based on the regular matching method, making more accurate use of information and constructing a more complete knowledge graph question-answering model.

[0113] In addition, in one embodiment, based on the same inventive concept as the above embodiment, the embodiment of the present invention provides a question-answering system based on a multi-granularity temporal knowledge graph. The system corresponds one-to-one with the method of embodiment 1. Please refer to Figure 4 , Figure 4 This is a structural block diagram of the question-answering system based on the multi-granularity temporal knowledge graph, which includes:

[0114] A knowledge graph unit, wherein the knowledge graph unit obtains an embedding vector model based on a pre-trained temporal knowledge graph;

[0115] A question representation unit, which obtains an entity representation vector of the question based on a named entity recognition model and a time representation vector of the question based on a regular expression; obtains a relationship representation vector of the question based on a pre-trained semantic model, and maps the relationship representation to a temporal knowledge graph;

[0116] a score prediction unit, wherein the score prediction unit predicts the score of the answer based on the embedding vector model, the entity representation vector of the question, the time representation vector of the question, and the relationship representation vector of the question;

[0117] An answer prediction unit is configured to obtain an answer to the question based on the answer score and refine the time granularity of the answer to the question.

[0118] It should be noted that each unit in the question-answering system based on the multi-granularity temporal knowledge graph in this embodiment corresponds one-to-one to each step in the question-answering method based on the multi-granularity temporal knowledge graph in the aforementioned embodiment. Therefore, the specific implementation method and technical effects achieved by this embodiment can refer to the implementation method of the aforementioned question-answering method based on the multi-granularity temporal knowledge graph, and will not be repeated here.

[0119] In addition, in one embodiment, the present application also provides a computer device, which includes a processor, a memory, and a computer program stored in the memory, and the computer program implements the method in the aforementioned embodiment when executed by the processor.

[0120] In addition, in one embodiment, the present application further provides a computer storage medium, on which a computer program is stored. When the computer program is executed by a processor, the method in the aforementioned embodiment is implemented.

[0121] In some embodiments, the computer-readable storage medium may be a memory device such as FRAM, ROM, PROM, EPROM, EEPROM, flash memory, magnetic surface mount memory, optical disk, or CD-ROM; or various devices including any one or any combination of the above memories. The computer may be various computing devices including smart terminals and servers.

[0122] In some embodiments, executable instructions may be in the form of a program, software, software module, script, or code, written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and may be deployed in any form, including as a stand-alone program or as a module, component, subroutine, or other unit suitable for use in a computing environment.

[0123] As an example, executable instructions may, but need not, correspond to a file in a file system, may be stored as part of a file that stores other programs or data, such as in one or more scripts in a HyperText Markup Language (HTML) document, in a single file dedicated to the program in question, or in multiple coordinating files (e.g., files storing one or more modules, subroutines, or code portions).

[0124] By way of example, executable instructions may be deployed to be executed on one computing device, or on multiple computing devices at one site, or on multiple computing devices distributed across multiple sites and interconnected by a communication network.

[0125] It should be noted that, in this document, the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, article, or system comprising a series of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such process, method, article, or system. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or system comprising the element.

[0126] The serial numbers of the above embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.

[0127] Through the description of the above embodiments, those skilled in the art can clearly understand that the above embodiment methods can be implemented by means of software plus the necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better embodiment. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as a read-only memory / random access memory, a magnetic disk, or an optical disk), and includes a number of instructions for enabling a multimedia terminal device (which can be a mobile phone, a computer, a television receiver, or a network device, etc.) to execute the methods described in each embodiment of the present application.

[0128] The above are only preferred embodiments of the present application and do not limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.

Claims

1. A question-answering method based on a multi-granularity temporal knowledge graph, characterized in that: The method flow is as follows: Obtain an embedded vector model based on the temporal knowledge graph; Obtaining an entity representation vector of the question based on a named entity recognition model, and obtaining a time representation vector of the question based on a regular expression; Obtain the relational representation vector of the question based on the semantic model and map the relational representation to the temporal knowledge graph; Predict the answer score based on the embedding vector model, the question entity representation vector, the question time representation vector, and the question relationship representation vector; Obtain the answer to the question based on the answer score, and refine the time granularity of the answer to the question; The process of predicting the answer score based on the embedding vector model, the entity representation vector of the question, the time representation vector of the question, and the relationship representation vector of the question is as follows: For question sentences asking questions about entities: If there is time in the question, the score of the entity in the embedding vector model is predicted based on the question's entity representation vector, relationship representation vector, and time representation vector, and the score of time is set to 0; If there is no time in the question, the time representation vector is obtained based on the start and end time of the event involved in the question, and the score of the entity in the embedding vector model is predicted based on the entity representation vector, relationship representation vector and time representation vector of the question, and the score of time is set to 0; Concatenate the entity score and the time score to get the answer score; Regarding question time: Predict the time score in the embedding vector model based on the question’s entity representation vector, relationship representation vector, and time representation vector, and set the entity score to 0; Concatenate the score for the entity and the score for the time to get the score for the answer.

2. A question-answering method based on a multi-granularity temporal knowledge graph according to claim 1, characterized in that: The embedding vector model includes an entity embedding vector set, a relationship embedding vector set, and a time embedding vector set.

3. The question-answering method based on a multi-granularity temporal knowledge graph according to claim 1 is characterized in that: The process of obtaining the relational representation vector of the question based on the semantic model and mapping the relational representation to the temporal knowledge graph is as follows: Replace the question's entities and time, and semantically represent the replaced question based on the semantic model to obtain a relational representation vector for the question. A linear neural network layer is used to map the relational representation vector of the question to the same dimensional vector space represented by the temporal knowledge graph.

4. The question-answering method based on a multi-granularity temporal knowledge graph according to claim 1, characterized in that: The questions are divided into questions about the question entity and questions about the question time according to the content of the answer.

5. The question-answering method based on a multi-granularity temporal knowledge graph according to claim 1, characterized in that: The calculation formula for predicting the score of the entity in the embedding vector model based on the question entity representation vector, relationship representation vector, and time representation vector is as follows: ; in, is the entity representation vector of the question, is the relation representation vector of the question, is the time representation vector of the question, is the score of all entities in the temporal knowledge graph, Indicates the entity representation of the question and relational representation and time representation vector Complex multiplication is used to combine, and the combined vector is multiplied by the dot product of all entity representations in the embedded vector model to obtain the entity score.

6. The question-answering method based on a multi-granularity temporal knowledge graph according to claim 1, characterized in that: The calculation formula for obtaining the time representation based on the start and end time of the events involved in the question is as follows: ; in, and is the time representation corresponding to the start and end time of the event, Represents the concatenation of time representation vectors.

7. The question-answering method based on a multi-granularity temporal knowledge graph according to claim 1, characterized in that: The calculation formula for obtaining the time representation vector based on the start and end time of the events involved in the question is as follows: ; in, and is the entity representation vector of the question, is the relation representation vector of the question, is the fraction of all times in the temporal knowledge graph, Indicates that the entity representation vector and relation representation vector and entity representation vector Complex multiplication is used to combine, and the combined vector is dot-producted with all time representation vectors in the embedded vector model to obtain the time score.

8. The question-answering method based on a multi-granularity temporal knowledge graph according to claim 1, characterized in that: The process of obtaining the answer to the question based on the answer score and refining the time granularity of the question answer is as follows: Sorting the scores of the answers, and selecting a number of question answers based on the ranking, wherein the question answers include entity answers and time answers; For time answers, the time granularity of the time answer is refined according to the time granularity of the question.

9. A question-answering system based on a multi-granularity temporal knowledge graph, characterized in that: The system comprises: A knowledge graph unit, wherein the knowledge graph unit obtains an embedding vector model based on a temporal knowledge graph; A question representation unit, which obtains an entity representation vector of the question based on a named entity recognition model and a time representation vector of the question based on a regular expression; obtains a relationship representation vector of the question based on a semantic model, and maps the relationship representation to a temporal knowledge graph; a score prediction unit, wherein the score prediction unit predicts the score of the answer based on the embedding vector model, the entity representation vector of the question, the time representation vector of the question, and the relationship representation vector of the question; an answer prediction unit, which obtains an answer to the question based on the answer score and refines the time granularity of the answer to the question; The process of predicting the answer score based on the embedding vector model, the question entity representation vector, the question time representation vector, and the question relationship representation vector is as follows: For question sentences asking questions about entities: If there is time in the question, the score of the entity in the embedding vector model is predicted based on the question's entity representation vector, relationship representation vector, and time representation vector, and the score of time is set to 0; If there is no time in the question, the time representation vector is obtained based on the start and end time of the event involved in the question, and the score of the entity in the embedding vector model is predicted based on the entity representation vector, relationship representation vector and time representation vector of the question, and the score of time is set to 0; Concatenate the entity score and the time score to get the answer score; Regarding question time: Predict the time score in the embedding vector model based on the question’s entity representation vector, relationship representation vector, and time representation vector, and set the entity score to 0; Concatenate the score for the entity and the score for the time to get the score for the answer.

10. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, it implements the question-answering method based on a multi-granularity temporal knowledge graph as described in any one of claims 1-8.

11. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by the processor, it implements the question-answering method based on a multi-granularity temporal knowledge graph as described in any one of claims 1 to 8.

Citation Information

Patent Citations

  • Complex question and answer query method and device based on time sequence knowledge graph

    CN114637819A

  • Multi-granularity dynamic knowledge graph embedding model construction method based on federated learning

    CN115062159A

  • Method and device for realizing automatic question and answer based on knowledge graph

    CN116127032A