Data processing method and apparatus

By obtaining SPO triples from the knowledge graph, constructing search instructions, and training sentence capture, and using encoding and knowledge question answering models for training, the high cost problem of updating knowledge graphs and adding new domains is solved, and the efficiency and accuracy of the question answering system are improved.

CN115221297BActive Publication Date: 2026-01-23ALIBABA (CHINA) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210640242.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-08
Publication Date
2026-01-23
Estimated Expiration
2042-06-08

AI Technical Summary

Technical Problem

In existing knowledge-based question-answering systems, updating the knowledge graph or adding new domains requires rebuilding and annotating the training corpus, resulting in high costs and low efficiency, which affects the accuracy of question answering.

Method used

The system obtains SPO triples from the knowledge graph, extracts training statements by constructing search instructions, and trains the system using an encoding model and a knowledge question answering model to generate the trained knowledge question answering model.

Benefits of technology

It improves the data processing speed and prediction accuracy of knowledge question answering models, and reduces the cost of knowledge question answering.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115221297B_ABST
    Figure CN115221297B_ABST
Patent Text Reader

Abstract

Embodiments of the present specification provide a data processing method and device, wherein the data processing method comprises: obtaining an SPO triple from a knowledge graph; constructing a search instruction using the SPO triple, and grabbing a corresponding training sentence based on the search instruction; inputting an input sequence into an encoding model for encoding to obtain respective encodings of each entity in the input sequence, wherein the input sequence comprises the SPO triple and the corresponding training sentence; inputting the input sequence comprising the respective encodings of each entity as a sample into a knowledge question and answer model for training to obtain a trained knowledge question and answer model, wherein the label of the sample is determined according to the SPO triple. The data processing method provided by the embodiments of the present application improves the speed of data processing and improves the accuracy of model prediction.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments in this specification relate to the field of computer technology, and in particular to a data processing method. Background Technology

[0002] In knowledge-based question answering scenarios, it is usually necessary to first construct a knowledge graph and annotate the training corpus, and then perform knowledge-based question answering based on the knowledge graph. However, when the knowledge graph is updated, in order to achieve the accuracy of knowledge-based question answering, it is necessary to re-annotate the training corpus and retrain the model. When a new domain of knowledge-based question answering is added, it is necessary to reconstruct the knowledge graph, annotate the training corpus, and then train the model to achieve knowledge-based question answering.

[0003] However, the above model training methods consume a lot of time and increase the cost of knowledge question answering. Therefore, there is an urgent need for a data processing method that can reduce the cost of knowledge question answering while improving its accuracy. Summary of the Invention

[0004] In view of the above, embodiments of this specification provide a data processing method. One or more embodiments of this specification also relate to a data processing apparatus, another data processing method, another data processing apparatus, a computing device, a computer-readable storage medium, and a computer program, to address the technical deficiencies existing in the prior art.

[0005] According to a first aspect of the embodiments of this specification, a data processing method is provided, comprising:

[0006] Retrieve SPO triples from the knowledge graph;

[0007] The search instructions are constructed using the SPO triples, and the corresponding training statements are extracted based on the search instructions.

[0008] The input sequence is input into the encoding model for encoding to obtain the encoding corresponding to each entity in the input sequence, wherein the input sequence contains the SPO triples and the corresponding training statements;

[0009] The input sequence containing the corresponding codes of each entity is used as a sample and input into the knowledge question answering model for training to obtain the trained knowledge question answering model. The labels of the samples are determined according to the SPO triples.

[0010] According to a second aspect of the embodiments of this specification, a data processing apparatus is provided, comprising:

[0011] The acquisition module is configured to retrieve SPO triples from a knowledge graph.

[0012] The construction module is configured to construct search instructions using the SPO triples and extract corresponding training statements based on the search instructions;

[0013] The encoding module is configured to input the input sequence into the encoding model for encoding, and obtain the encoding corresponding to each entity in the input sequence, wherein the input sequence contains the SPO triples and the corresponding training statements;

[0014] The input module is configured to take an input sequence containing the codes corresponding to each entity as samples and input it into the knowledge question answering model for training to obtain the trained knowledge question answering model, wherein the labels of the samples are determined according to the SPO triples.

[0015] According to a third aspect of the embodiments of this specification, another data processing method is provided, including:

[0016] Obtain the problem data;

[0017] The question data is input into the knowledge question answering model trained by the data processing method described in any embodiment of this specification for prediction processing;

[0018] Obtain the answer data corresponding to the question data.

[0019] According to a fourth aspect of the embodiments of this specification, another data processing apparatus is provided, comprising:

[0020] The second acquisition module is configured to acquire problem data;

[0021] The processing module is configured to input the question data into a knowledge question-answering model trained by the data processing method described in any embodiment of this specification for prediction processing;

[0022] The output module is configured to obtain answer data corresponding to the question data.

[0023] According to a fifth aspect of the embodiments of this specification, a computing device is provided, comprising:

[0024] Memory and processor;

[0025] The memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions, which, when executed by the processor, implement the steps of the above-described data processing method.

[0026] According to a sixth aspect of the embodiments of this specification, a computer-readable storage medium is provided that stores computer-executable instructions, which, when executed by a processor, implement the steps of the data processing method described above.

[0027] According to a seventh aspect of the embodiments of this specification, a computer program is provided, wherein when the computer program is executed in a computer, it causes the computer to perform the steps of the above-described data processing method.

[0028] This specification provides a data processing method that involves obtaining SPO triples from a knowledge graph; constructing search instructions using the SPO triples and extracting corresponding training statements based on the search instructions; encoding the input sequence into an encoding model to obtain the codes corresponding to each entity in the input sequence, wherein the input sequence contains the SPO triples and the corresponding training statements; and using the input sequence containing the codes corresponding to each entity as samples to train a knowledge question answering model to obtain the trained knowledge question answering model. This method improves data processing speed and enhances the accuracy of model prediction. Attached Figure Description

[0029] Figure 1 This is a schematic diagram of a data processing method provided in one embodiment of this specification;

[0030] Figure 2 This is a flowchart illustrating a data processing method provided in one embodiment of this specification;

[0031] Figure 3 This is a schematic diagram illustrating one application scenario of the data processing method provided in one embodiment of this specification;

[0032] Figure 4 This is a schematic diagram illustrating a second application scenario of the data processing method provided in one embodiment of this specification;

[0033] Figure 5 This is a schematic diagram illustrating a third application scenario of the data processing method provided in one embodiment of this specification;

[0034] Figure 6 This is a schematic diagram illustrating a fourth application scenario of the data processing method provided in one embodiment of this specification;

[0035] Figure 7 This is a flowchart illustrating the processing procedure of a data processing method provided in one embodiment of this specification.

[0036] Figure 8 This is a schematic diagram of the structure of a data processing apparatus provided in one embodiment of this specification;

[0037] Figure 9 This is a flowchart of another data processing method provided in one embodiment of this specification;

[0038] Figure 10 This is a schematic diagram of the structure of another data processing device provided in one embodiment of this specification;

[0039] Figure 11 This is a structural block diagram of a computing device provided in one embodiment of this specification. Detailed Implementation

[0040] Many specific details are set forth in the following description to provide a full understanding of this specification. However, this specification can be implemented in many other ways than those described herein, and those skilled in the art can make similar extensions without departing from the spirit of this specification. Therefore, this specification is not limited to the specific implementations disclosed below.

[0041] The terminology used in one or more embodiments of this specification is for the purpose of describing particular embodiments only and is not intended to be limiting of the one or more embodiments of this specification. The singular forms “a,” “described,” and “the” as used in one or more embodiments of this specification and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used in one or more embodiments of this specification refers to and includes any or all possible combinations of one or more associated listed items.

[0042] It should be understood that although the terms first, second, etc., may be used to describe various information in one or more embodiments of this specification, such information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another. For example, first may also be referred to as second without departing from the scope of one or more embodiments of this specification, and similarly, second may also be referred to as first. Depending on the context, the word "if" as used herein may be interpreted as "when," "when," or "in response to a determination."

[0043] First, the terms and concepts used in one or more embodiments of this specification will be explained.

[0044] Knowledge graph: also known as knowledge domain visualization or knowledge domain mapping map, is a series of different graphics that show the development process and structural relationships of knowledge. It uses visualization technology to describe knowledge resources and their carriers, and to mine, analyze, construct, draw and display knowledge and the interrelationships between them.

[0045] KBQA: Question answering based on knowledge graphs or knowledge bases.

[0046] The SPO triple: SPO(subject, predicate, object) contains a head entity, a relation, and a tail entity.

[0047] Graph Convolutional Networks (GCNs) are neural network architectures that operate on graph data to generate feature representations of nodes in a graph network.

[0048] This specification provides a data processing method, and also relates to a data processing apparatus, another data processing method, another data processing apparatus, a computing device, a computer-readable storage medium, and a computer program, which will be described in detail in the following embodiments.

[0049] The following is in conjunction with the appendix Figure 1 The data processing method is illustrated using a knowledge-based question-answering scenario as an example. In a knowledge graph-based question-answering scenario, the project scenario includes multiple project domains, each with its corresponding knowledge graph. Each project domain also includes at least one sub-project domain. When a new sub-project domain is added or an attribute feature is added to the knowledge graph, SPO triples are obtained from a knowledge graph containing multiple knowledge graphs. Search instructions are constructed using the obtained SPO triples, and the SPO triples are searched based on these instructions to extract the corresponding training statements; for example... Figure 1 As shown, the training statement "Can I repay my credit card using an app?" is processed to obtain the positive SPO triple "credit card repayment method app" and the negative SPO triple "SP-O". "Credit card rental method app" is composed of the training statement, the positive SPO triple, and the negative SPO triple, forming the input sequence. The input sequence is input into the Transformer model for encoding to obtain the corresponding codes k1-k40. The codes corresponding to each entity in the input sequence, as well as the subgraph information corresponding to the entity, are input into the gating unit for filtering and fusion using a gating mechanism to obtain the fused codes gs and go. Then, the input sequence h1-h40, which contains the fused codes corresponding to each entity, is used as a sample and input into the knowledge question answering model for training to obtain the trained knowledge question answering model.

[0050] like Figure 1As shown, the knowledge question answering model includes three sub-training tasks: Mention Detection (using a cue prediction model) and SPO Mask (using a traditional NER (Named Entity Recognition) model to enhance the model's understanding of entities). The model also includes SPO Mask (using a triplet mask to mask the relationship between the head and tail entities within a triplet, thus improving its semantic understanding. Additionally, it includes SPO Margin Magnify (SPOMM), which uses a Bernoulli distribution to generate random probabilities, ensuring that the order of training statements, positive SPO triples, and negative SPO triples in an input sequence is not fixed, thereby enabling the model to distinguish semantics. In the gating mechanism, the input is subgraph information obtained from the knowledge base.

[0051] See Figure 2 , Figure 2 A flowchart of a data processing method according to an embodiment of this specification is shown, specifically including the following steps:

[0052] Step 202: Obtain the SPO triples from the knowledge graph.

[0053] Specifically, the knowledge base consists of multiple different knowledge graphs, including but not limited to OpenKG (Open Knowledge Graph), zhishi.me (Chinese Encyclopedia Knowledge Graph), and Own Think (Chinese Open Knowledge Graph). The SPO triple consists of a head entity, a relation, and a tail entity. The relation represents the relationship between the head entity and the tail entity. For example, Zhang A, the university he graduated from, and school B constitute an SPO triple. Zhang A's university is school B, that is, the university he graduated from is the relationship between Zhang A and school B.

[0054] Based on this, in knowledge graph-based question answering scenarios, project scenarios include, but are not limited to, finance, healthcare, and insurance, each of which can be further subdivided into multiple sub-scenarios. For knowledge question answering after updating or adding new project scenarios to the knowledge graph, SPO triples can be obtained from public knowledge bases. Multiple SPO triples can be extracted from existing public knowledge graphs, encompassing knowledge content from multiple domains. After obtaining multiple SPO triples, a search can be performed based on each SPO triple to obtain the corresponding training statement.

[0055] For example, Figure 3The diagram illustrates an application scenario of a data processing method provided in one embodiment of this specification. The knowledge base is composed of knowledge graphs such as OpenKG (Open Knowledge Graph), Xlore (Knowledge Graph Integrating Chinese and English Knowledge), zhishi.me (Chinese Encyclopedia Knowledge Graph), OwnThink (Chinese Open Knowledge Graph), ConceptNet (Common Sense Knowledge Base), and Dbpedia (Knowledge Base Ontology Analysis). The knowledge base is subjected to SPO acquisition operations to obtain multiple SPO triples from the knowledge graph.

[0056] Step 204: Construct search instructions using the SPO triples, and extract the corresponding training statements based on the search instructions.

[0057] Specifically, after obtaining the SPO triples as described above, search instructions can be constructed based on the SPO triples to retrieve training statements. A search instruction refers to a computer instruction that uses a search statement constructed based on SPO triples for retrieval. In this embodiment, the head and tail entities in the SPO triples can be extracted and concatenated to obtain the search statement, which is then used to construct the search instruction. A training statement refers to at least one statement obtained after searching using the search instruction constructed based on the triples; the training statement is used to construct the input sequence.

[0058] Based on this, after obtaining the SPO triples, search instructions are constructed according to the head and tail entities contained in the SPO triples. That is, the head and tail entities contained in the SPO triples are extracted, the head and tail entities are concatenated to obtain the search statement, and then search instructions are constructed based on the search statement. The search statement is then searched based on the search instructions to obtain the training statement corresponding to the SPO triples.

[0059] Furthermore, considering the large number of SPO triples obtained from the knowledge graph, their wide range of sources, and the diverse nature of the knowledge, coupled with the non-standard format of the SPO triples, resulting in poor data quality, it is necessary to perform preliminary filtering, i.e., data cleaning, on the obtained SPO triples. The specific implementation is as follows:

[0060] The SPO triples are filtered to obtain filtered SPO triples; a search instruction is constructed using the filtered SPO triples.

[0061] Specifically, filtering refers to the data screening operation performed on SPO triples. By setting preset filtering rules, SPO triples that do not meet the rules are deleted to obtain filtered SPO triples.

[0062] Based on this, after obtaining SPO triples from the knowledge graph, the SPO triples are initially filtered, including but not limited to limiting the number of characters in entities and / or relations, setting a preset character threshold, and deleting all SPO triples whose entity and / or relation character counts exceed the threshold, thus obtaining filtered SPO triples. The head and tail entities contained in the filtered SPO triples are extracted, and the head and tail entities are concatenated to obtain the search statement. Based on the search statement, a search instruction is constructed; that is, for a given SPO triple, a search is performed using the search statement composed of its corresponding head and tail entities to obtain the training statement.

[0063] In summary, by filtering SPO triples, the SPO triples are standardized, and the SPO triples with poor data quality are deleted from the multiple obtained SPO triples, thereby improving the data quality of SPO triples.

[0064] Furthermore, when filtering SPO triples, in order to achieve standardized filtering of SPO triples, SPO triple filtering rules can be preset, and the obtained SPO triples can be filtered according to the filtering rules. The specific implementation is as follows:

[0065] The SPO triples are filtered according to filtering rules, which include entity length filtering rules, relation length filtering rules, entity occurrence count filtering rules, and / or entity type filtering rules.

[0066] Based on this, the entity length filtering rule refers to filtering SPO triples according to their entity length. A preset entity length threshold can be used to filter SPO triples. For example, setting the entity length threshold to 10 will delete SPO triples whose header and / or tail entities have a character length exceeding 10. Relations, also known as attributes in triples, can be filtered according to relation length rules. A preset relation length threshold can be used to filter SPO triples. For example, relations... If the length threshold is set to 6, then when filtering SPO triples, SPO triples with a header relation and / or attribute character length exceeding 6 will be deleted. SPO triples can also be filtered based on entity occurrence count rules and / or entity type rules. Entity occurrence count refers to the number of times the header and / or tail entities in an SPO triple appear in all obtained SPO triples. A preset occurrence count threshold is used to delete SPO triples whose entity occurrence count exceeds the threshold. Entity types include numeric, text, etc. The entity type filtering rule filters out SPO triples corresponding to numeric entities. Based on the above filtering rules, SPO triples are filtered to obtain the filtered SPO triples.

[0067] Continuing with the previous example, such as Figure 3 As shown, after obtaining multiple SPO triples, SPO noise reduction processing is performed on the obtained SPO triples. Due to the diverse sources, varied knowledge, and inconsistent standards of the obtained SPO triples, the data quality of the SPO triples is poor. To address the problem of poor SPO triple quality, multiple filtering rules are used to filter the SPO triples. These include entity length filtering rules, relation length filtering rules, entity occurrence count filtering rules, and / or entity type filtering rules. Accordingly, SPO triples with entity word lengths exceeding a word count threshold (e.g., 10, 5, etc.) are filtered; SPO triples with relation word lengths exceeding a word count threshold (e.g., 4, 6, etc.) are also filtered. Filtering rules may also include that the entities contained in the SPO triples cannot be numeric, and that the number of occurrences of the head or tail entity in all SPO triples is not less than a occurrence count threshold. It should be noted that the word count thresholds for entities and relations can be set according to actual needs; this embodiment does not impose any limitations on this.

[0068] In summary, filtering of SPO triples according to multiple filtering rules achieves standardization and unification of SPO triples, thereby improving the data quality of SPO triples.

[0069] Further, when constructing a search instruction using SPO triples, considering that the SPO triples contain a head entity, a tail entity, and the relationship between the head entity and the tail entity, when constructing the search instruction, the head entity and the tail entity contained in each SPO triple can be concatenated respectively to obtain a search statement corresponding to each SPO triple, and then a search instruction is constructed based on the search statement. The specific implementation is as follows:

[0070] Select entities from the SPO triples for concatenation to obtain a search statement; construct a search instruction based on the search statement.

[0071] Specifically, a search statement refers to a statement formed by concatenating the head entity and the tail entity in the SPO triple for retrieving training statements. By retrieving the search statement, at least one training statement corresponding to the search statement can be obtained.

[0072] Based on this, after filtering the obtained SPO triples to obtain the filtered SPO triples, the head entity and the tail entity in the SPO triples are concatenated in the entity order to obtain a search statement, and a search instruction is constructed based on the search statement. That is, the method of distant supervision recall is used to search for the search statement, so as to obtain the training statement corresponding to the search statement.

[0073] Continuing with the above example, after denoising the SPO triples, the search statement "Wang A a university" is obtained by concatenating the entities in the SPO triple "Wang A - graduation institution - a university". As Figure 1 shown, the method of distant supervision recall is used to search and recall the search statement "Wang A a university" corresponding to the SPO triple. When searching and recalling the SPO triple "Wang A a university", it can be searched and recalled according to the log, or it can be searched and recalled according to the search engine. Taking the search and recall according to the search engine as an example, the SPO triple "Wang A a university" is searched and recalled to obtain the recall result as Figure 4 shown.

[0074] To sum up, by constructing a search statement by concatenating the head entity and the tail entity in the SPO triple, accurate search based on the entities in the SPO triple is achieved, improving the accuracy of the search results and the relevance between the search results and the SPO triples.

[0075] Further, the statement obtained after searching based on the search instruction can be regarded as an initial training statement. Since the amount of data of the initial training statement is large and there may be problems such as ambiguity and grammar errors in the statement, it is necessary to filter the obtained initial training statement to obtain a training statement. The specific implementation is as follows:

[0076] The initial training statement is obtained by searching based on the search instructions; the initial training statement is then filtered based on the semantic matching model to obtain the training statement.

[0077] Specifically, the initial training statement refers to the statement obtained by searching based on the search command. Corresponding to the training statement, the initial training statement is filtered using a semantic matching model to obtain the training statement. The semantic matching model is used to match the semantic features between the SPO triple and its corresponding initial training statement. The semantic features of at least two initial training statements corresponding to the SPO triple are matched with the semantic features of the corresponding SPO triple to filter out the initial training statements with low matching degree with the SPO triple, thereby obtaining the filtered initial training statement, which is the training statement.

[0078] Based on this, a search is performed using search instructions to obtain at least two initial training statements. These initial training statements include those with grammatical errors, incoherent sentences, or semantic mismatches with the SPO triples. Therefore, after obtaining the initial training statements, a semantic matching model is trained based on a publicly available semantic matching dataset. The initial training statements are used as input to the semantic matching model for filtering. The statements output by the semantic matching model are the training statements.

[0079] Continuing with the previous example, such as Figure 3 As shown, the SPO triples obtained after noise reduction are denoised using a text similarity algorithm. That is, after obtaining the... Figure 4 After the recall results are shown, since the statement "Wang A Zhang C's sons all favor a university, why" in the recall results does not match the search statement "Wang Aa university", it is necessary to filter the recall results based on the text similarity algorithm to obtain the selected statement, which is the training statement.

[0080] In summary, by filtering the initial training statements obtained from the search, we can remove those with grammatical errors or ambiguities, thereby quickly obtaining the training statements.

[0081] Step 206: Input the input sequence into the encoding model for encoding to obtain the encoding corresponding to each entity in the input sequence, wherein the input sequence contains the SPO triples and the corresponding training statements.

[0082] Specifically, the input sequence consists of SPO triples and corresponding training statements, which are input to the encoding model for encoding processing. Correspondingly, the encoding model is used to encode the input sequence and convert it into a vector representation. In this embodiment, the encoding model includes, but is not limited to, Transformer models and other models that can be used to implement encoding operations.

[0083] Based on this, the input sequence contains SPO triples and corresponding training statements. The input sequence is then fed into the encoding model for encoding processing. The encoding model encodes the SPO triples and corresponding training statements in the input sequence to obtain the encodings of each entity in the SPO triples and the encodings of the training statements.

[0084] Furthermore, after encoding the input sequence, entities in the input sequence are aggregated based on the knowledge base to obtain subgraphs corresponding to the entities. A gating mechanism is then used to fuse the information in the subgraphs into the encoding corresponding to the entities, resulting in the fused encoding. The specific implementation is as follows:

[0085] From the knowledge graph, obtain the subgraphs corresponding to each entity; input the subgraphs and their corresponding codes to the gating units of each entity respectively, and use the gating units to select information from the subgraphs and integrate it into the codes to obtain the fused codes.

[0086] Specifically, a subgraph refers to a directed acyclic graph consisting of an entity and at least two entities that are related to it. It is drawn based on subgraph information obtained by aggregating entities contained in an input sequence using a knowledge graph database. The gating unit is used to filter and fuse subgraph information, integrating it into the encoding corresponding to the entity to obtain the fused encoding. For example, ... Figure 5 As shown, in response to the question "Q: What is the sum insured of the Guoshoufu Whole Life Insurance?", "sum insured" is the entity. Based on the knowledge graph, GCN (Graph Convolutional Neural Network) is used for aggregation to generate subgraph information, namely, the entire process corresponding to the sum insured: insured amount, insured party: insurer, discipline: insurance, determination method: insured value, and loss rate: unit sum insured compensation rate. The inflow of subgraph information is controlled through a gating mechanism and integrated into the encoding corresponding to "sum insured" to obtain the fused encoding.

[0087] Based on this, after obtaining the encoding corresponding to the input sequence, a knowledge graph is searched based on the entities contained in the input sequence. Relationships with the entities in the input sequence are identified in the knowledge graph. Subgraphs corresponding to the entities in the input sequence are constructed based on the subgraph information, including the entities in the input sequence and their related entities. The subgraphs corresponding to each entity in the input sequence, along with their corresponding encodings, are input to the gating unit corresponding to the entity. The gating unit then fuses the information in the subgraphs, that is, it fuses the subgraph information into the entity's encoding to obtain the fused encoding.

[0088] Continuing with the previous example, the input sequence containing the SPO triple "Wang A - Graduated Institution - University a" is fed into the Transformer model for encoding, obtaining the codes corresponding to the entities "Wang A" and "University a" in the SPO triple. A gating mechanism—the gated mechanism—is used to filter and fuse the entities "Wang A" and "University a" respectively. Specifically, a GCN (Graph Convolutional Neural Network) is used to aggregate the subgraph information corresponding to the entities "Wang A" and "University a", the gating mechanism controls the inflow of subgraph information, and then the inflowing subgraph information is fused with the corresponding entity codes to obtain the fused codes for "Wang A" and "University a".

[0089] In summary, by performing subgraph aggregation based on entities in the input sequence and using gating units to fuse the codes corresponding to entities in the input sequence, the fusion of information unrelated to entities in the knowledge graph is reduced, thus reducing the introduction of irrelevant knowledge.

[0090] Furthermore, before inputting the input sequence into the encoding model for encoding, considering that the input sequence consists of training statements, positive SpO triples, and negative SpO triples, it is necessary to encode the training statements, positive SpO triples, and negative SpO triples separately. The specific implementation is as follows:

[0091] The positive and negative SPO triples of the training statement are determined using the SPO triples; based on the training statement, the positive and negative SPO triples are used to generate an input sequence and input into the encoding model for encoding.

[0092] Specifically, a positive SPO triple refers to an SPO triple in which the relationship between the head entity and the tail entity is correct. Correspondingly, one negative SPO triple corresponds to one positive SPO triple. The relationship contained in the negative SPO triple is incorrect. Positive SPO triples and negative SPO triples constitute relative sample SPO triples. For example, in the training statement "Is Li B's alma mater C University?", Li B, alma mater, and C University are positive SPO triples. Correspondingly, Li B, company, and C University are negative SPO triples. It should be noted that the relationship contained in the negative SPO triple can be arbitrarily set, as long as it is different from the relationship contained in the positive SPO triple. This embodiment does not impose any restrictions on this.

[0093] Based on this, positive SPO triples are determined according to the SPO triples, and negative SPO triples corresponding to the positive SPO triples are determined based on the positive SPO triples. The relations contained in the negative SPO triples correspond to the relations contained in the positive SPO triples. The input sequence is composed of the training statement, positive SPO triples, and negative SPO triples. The input sequence is then fed into the encoding model for encoding to obtain the encoding of the corresponding input sequence.

[0094] In summary, by generating input sequences based on training statements, positive and negative SpO triples, and then inputting them into the encoding model for encoding, the model can be trained using the corresponding encodings of the input sequences, thereby improving the model's recognition ability.

[0095] Furthermore, before inputting the input sequence consisting of positive SPO triples, negative SPO triples, and training statements into the encoding model for encoding, considering the order of the training statements, positive SPO triples, and negative SPO triples in the input sequence, to avoid the model learning the correct prediction result when learning positive SPO triples close to the training statements during model training based on the input sequence, it is necessary to randomly sort the positive SPO triples, negative SPO triples, and training statements in the input sequence. The specific implementation is as follows:

[0096] The input order of several input sequences is randomly arranged to generate the input order of several input sequences.

[0097] Based on this, the input sequence consists of positive SpO triples, negative SpO triples, and training statements. For each input sequence, a Bernoulli distribution is used to generate random probabilities, and the order of positive SpO triples, negative SpO triples, and training statements in each input sequence is randomly arranged to generate input sequences with different input orders.

[0098] In summary, by randomly arranging the positive and negative SpO triples in the input sequence and the order of the training statements, the question-answering ability of the knowledge question-answering model can be improved.

[0099] Step 208: Take the input sequence containing the corresponding codes of each entity as samples and input it into the knowledge question answering model for training to obtain the trained knowledge question answering model, wherein the labels of the samples are determined according to the SPO triples.

[0100] Specifically, a knowledge question answering model refers to a model with knowledge question answering capabilities. It is trained by using input sequences as samples until a knowledge question answering model that meets the training stopping condition is obtained, thereby enabling the knowledge question answering model to have good knowledge question answering capabilities.

[0101] Based on this, the input sequence is used as a sample, containing the encoding of each entity in the SPO triple. The sample label is the relationship between entities determined by the SPO triple. Multiple input sequences are used as samples to train the knowledge question answering model. The training continues until the training stopping condition is met, thus completing the training of the knowledge question answering model and obtaining the trained knowledge question answering model.

[0102] Furthermore, after obtaining the input sequence containing the codes corresponding to each entity, in order to improve the semantic understanding ability of the knowledge question answering model and enhance the attribute / relation recognition ability, the relations contained in the input sequence can be masked before being input into the knowledge question answering model for training. The specific implementation is as follows:

[0103] Obtain an input sequence containing the codes corresponding to each entity; perform a masking operation on the input sequence to obtain samples and input them into the knowledge question answering model for training.

[0104] Specifically, the masking operation refers to the occlusion operation on the relations in the SPO triples in the input sequence. Based on the head and tail entities contained in the SPO triples, the relationship between the head and tail entities is predicted. The input sequence that has undergone the masking operation is used as a sample and input into the knowledge question answering model for training.

[0105] Based on this, before inputting the input sequence containing the corresponding codes of each entity into the knowledge question answering model as training samples, a masking operation is performed on the input sequence. The relations in the SPO triples in the input sequence are masked to obtain the samples corresponding to the input sequence, which are then used as training samples for the knowledge question answering model for model training.

[0106] Continuing with the previous example, such as Figure 6 As shown, before inputting the SPO triple "Wang A-Graduation Institution-a University" into the knowledge question answering model, a masking operation is performed on the relation "graduation institution" contained in the SPO triple "Wang A-Graduation Institution-a University". A self-attention mechanism is then used to predict the attribute of the SPO triple "Wang A-Graduation Institution-a University": graduation institution.

[0107] In summary, the embodiments of this specification provide a data processing method that obtains SPO triples from a knowledge graph; constructs search instructions using the SPO triples and extracts corresponding training statements based on the search instructions; encodes the input sequence into an encoding model to obtain the codes corresponding to each entity in the input sequence, wherein the input sequence contains the SPO triples and the corresponding training statements; and uses the input sequence containing the codes corresponding to each entity as samples to train a knowledge question answering model to obtain a trained knowledge question answering model, wherein the labels of the samples are determined according to the SPO triples. The data processing method provided by the embodiments of this application improves the speed of data processing and the accuracy of model prediction.

[0108] The following is in conjunction with the appendix Figure 7 Taking the application of the data processing method provided in this specification in insurance knowledge Q&A as an example, the data processing method will be further explained. Figure 7 A flowchart illustrating the processing steps of a data processing method according to an embodiment of this specification is shown, specifically including the following steps.

[0109] Step 702: Obtain SPO triples from a knowledge base composed of multiple knowledge graphs.

[0110] Step 704: Filter the SPO triples based on entity length filtering rules, attribute length filtering rules, entity occurrence count filtering rules and / or entity type filtering rules to obtain the filtered SPO triples.

[0111] Step 706: Select entities from the filtered SPO triples and concatenate them to obtain the search statement corresponding to the SPO triples, and construct search instructions based on the search statement.

[0112] Step 708: Use the remote supervision recall method to perform search and recall based on the search instructions to obtain the initial training statements.

[0113] Step 710: Based on the semantic matching model, filter the initial training statements to obtain the training statements.

[0114] Step 712: Use SPO triples to determine the positive and negative SPO triples of the training statements.

[0115] Step 714: Based on the training statement, positive SpO triples and negative SpO triples generate input sequences and input them into the encoding model for encoding.

[0116] Step 716: Randomly arrange the input order of several input sequences to generate the input order of several input sequences.

[0117] Step 718: Obtain the input sequence containing the codes corresponding to each entity.

[0118] Step 720: Mask the input sequence to obtain samples and input them into the knowledge question answering model for training.

[0119] In summary, by obtaining SPO triples from a knowledge graph; constructing search instructions using the SPO triples and extracting corresponding training statements based on the search instructions; encoding the input sequence into an encoding model to obtain the codes corresponding to each entity in the input sequence, wherein the input sequence contains the SPO triples and the corresponding training statements; and using the input sequence containing the codes corresponding to each entity as samples to train a knowledge question answering model, a trained knowledge question answering model is obtained, wherein the labels of the samples are determined according to the SPO triples. The data processing method provided in this application improves the speed of data processing and the accuracy of knowledge question answering model prediction.

[0120] Corresponding to the above method embodiments, this specification also provides data processing apparatus embodiments. Figure 8 A schematic diagram of the structure of a data processing apparatus according to one embodiment of this specification is shown. Figure 8 As shown, the device includes:

[0121] The first acquisition module 802 is configured to acquire SPO triples from a knowledge graph.

[0122] The construction module 804 is configured to construct search instructions using the SPO triples and extract corresponding training statements based on the search instructions;

[0123] The encoding module 806 is configured to input the input sequence into the encoding model for encoding to obtain the encoding corresponding to each entity in the input sequence, wherein the input sequence includes the SPO triples and the corresponding training statements;

[0124] The input module 808 is configured to take an input sequence containing the codes corresponding to each entity as samples and input it into the knowledge question answering model for training to obtain the trained knowledge question answering model, wherein the labels of the samples are determined according to the SPO triples.

[0125] In an optional embodiment, the encoding module 806 is further configured to:

[0126] From the knowledge graph, obtain the subgraphs corresponding to each entity; input the subgraphs and their corresponding codes to the gating units of each entity respectively, and use the gating units to select information from the subgraphs and integrate it into the codes to obtain the fused codes.

[0127] In an optional embodiment, the building module 804 is further configured to:

[0128] The SPO triplet is filtered to obtain the filtered SPO triplet.

[0129] The filtered SPO triples are used to construct search instructions.

[0130] In an optional embodiment, the building module 804 is further configured to:

[0131] The SPO triples are filtered according to filtering rules, which include entity length filtering rules, relation length filtering rules, entity occurrence count filtering rules, and / or entity type filtering rules.

[0132] In an optional embodiment, the building module 804 is further configured to:

[0133] Entities are selected from the SPO triples and concatenated to obtain a search statement; a search instruction is constructed based on the search statement.

[0134] In an optional embodiment, the building module 804 is further configured to:

[0135] The initial training statement is obtained by searching based on the search instructions; the initial training statement is then filtered based on the semantic matching model to obtain the training statement.

[0136] In an optional embodiment, the encoding module 806 is further configured to:

[0137] The positive and negative SPO triples of the training statement are determined using the SPO triples; based on the training statement, the positive and negative SPO triples are used to generate an input sequence and input into the encoding model for encoding.

[0138] In an optional embodiment, the encoding module 806 is further configured to:

[0139] The input order of several input sequences is randomly arranged to generate the input order of several input sequences.

[0140] In an optional embodiment, the input module 808 is further configured to:

[0141] Obtain an input sequence containing the codes corresponding to each entity; perform a masking operation on the input sequence to obtain samples and input them into the knowledge question answering model for training.

[0142] In summary, the embodiments of this specification provide a data processing apparatus that obtains SPO triples from a knowledge graph; constructs search instructions using the SPO triples and extracts corresponding training statements based on the search instructions; encodes the input sequence into an encoding model to obtain the codes corresponding to each entity in the input sequence, wherein the input sequence contains the SPO triples and the corresponding training statements; and uses the input sequence containing the codes corresponding to each entity as samples to train a knowledge question answering model to obtain a trained knowledge question answering model, wherein the labels of the samples are determined according to the SPO triples, thereby improving the speed of data processing and the accuracy of model prediction.

[0143] The above is an illustrative scheme of a data processing apparatus according to this embodiment. It should be noted that the technical solution of this data processing apparatus and the technical solution of the data processing method described above belong to the same concept. For details not described in detail in the technical solution of the data processing apparatus, please refer to the description of the technical solution of the data processing method described above.

[0144] See Figure 9 , Figure 9 A flowchart of another data processing method according to an embodiment of this specification is shown, which specifically includes the following steps:

[0145] Step 902: Obtain problem data;

[0146] Step 904: Input the question data into the knowledge question answering model trained by the data processing method described in any embodiment of this specification for prediction processing;

[0147] Step 906: Obtain the answer data corresponding to the question data.

[0148] Specifically, question data refers to the question text corresponding to the question raised by the user in a knowledge-based question-and-answer scenario. The fields covered by question data are quite broad, including but not limited to finance, healthcare, insurance, and education. The knowledge-based question-and-answer model is a model that processes the question data input by the user and outputs the answer data corresponding to the question data. That is, it answers the question input by the user and provides the result data corresponding to the question data, thereby answering the question raised by the user.

[0149] Based on this, in a knowledge-based question-answering scenario, the user inputs question data, and the knowledge-based question-answering model directly predicts and processes the question data, outputting the answer data corresponding to the question data.

[0150] For example, when a user inputs the question "What diseases are covered by insurance?", the knowledge-based question-answering model performs predictive processing on the question data "What diseases are covered by disease insurance?" to determine the entities "insurance" and "disease" and the relationship "coverage" in the question data. Based on the knowledge base, the knowledge-based question-answering model then predicts the "disease" corresponding to "insurance" to obtain the answer data corresponding to the question data, i.e., disease A, disease B, disease C, etc., thereby answering the user's question.

[0151] In summary, by using a knowledge base and a knowledge-based question-answering model to predict the answer data corresponding to the question data, the speed of obtaining answer data in knowledge-based question-answering scenarios is improved.

[0152] Corresponding to the above method embodiments, this specification also provides data processing apparatus embodiments. Figure 10 A schematic diagram of another data processing apparatus provided in one embodiment of this specification is shown. Figure 10 As shown, the device includes:

[0153] The second acquisition module 1002 is configured to acquire problem data;

[0154] Processing module 1004 is configured to input the question data into a knowledge question-answering model trained by the data processing method described in any embodiment of this specification for prediction processing;

[0155] Output module 1006 is configured to obtain answer data corresponding to the question data.

[0156] In summary, the embodiments of this specification provide a data processing device that predicts the answer data corresponding to the question data through a knowledge question-answering model, thereby improving the speed of obtaining answer data in knowledge question-answering scenarios.

[0157] The above is an illustrative scheme of a data processing apparatus according to this embodiment. It should be noted that the technical solution of this data processing apparatus and the technical solution of the data processing method described above belong to the same concept. For details not described in detail in the technical solution of the data processing apparatus, please refer to the description of the technical solution of the data processing method described above.

[0158] Figure 11 A structural block diagram of a computing device 1100 according to one embodiment of this specification is shown. The components of the computing device 1100 include, but are not limited to, a memory 1110 and a processor 1120. The processor 1120 is connected to the memory 1110 via a bus 1130, and a database 1150 is used to store data.

[0159] The computing device 1100 also includes an access device 1140, which enables the computing device 1100 to communicate via one or more networks 1160. Examples of these networks include a Public Switched Telephone Network (PSTN), a Local Area Network (LAN), a Wide Area Network (WAN), a Personal Area Network (PAN), or a combination of communication networks such as the Internet. The access device 1140 may include one or more of any type of wired or wireless network interface (e.g., a Network Interface Card (NIC)), such as an IEEE 802.11 Wireless Local Area Network (WLAN) interface, a Wi-MAX interface, an Ethernet interface, a Universal Serial Bus (USB) interface, a cellular network interface, a Bluetooth interface, a Near Field Communication (NFC) interface, and so on.

[0160] In one embodiment of this specification, the aforementioned components of the computing device 1100 and Figure 11 Other components, not shown, can also be connected to each other, for example, via a bus. It should be understood that... Figure 11 The block diagram of the computing device shown is for illustrative purposes only and is not intended to limit the scope of this specification. Those skilled in the art can add or replace other components as needed.

[0161] The computing device 1100 can be any type of stationary or mobile computing device, including mobile computers or mobile computing devices (e.g., tablet computers, personal digital assistants, laptop computers, notebook computers, netbooks, etc.), mobile phones (e.g., smartphones), wearable computing devices (e.g., smartwatches, smart glasses, etc.) or other types of mobile devices, or stationary computing devices such as desktop computers or PCs. The computing device 1100 can also be a mobile or stationary server.

[0162] The processor 1120 is configured to execute the following computer-executable instructions, which, when executed by the processor, implement the steps of the above-described data processing method.

[0163] The above is an illustrative scheme of a computing device according to this embodiment. It should be noted that the technical solution of this computing device and the technical solution of the data processing method described above belong to the same concept. For details not described in detail in the technical solution of the computing device, please refer to the description of the technical solution of the data processing method described above.

[0164] An embodiment of this specification also provides a computer-readable storage medium storing computer-executable instructions that, when executed by a processor, implement the steps of the above-described data processing method.

[0165] The above is an illustrative scheme of a computer-readable storage medium according to this embodiment. It should be noted that the technical solution of this storage medium and the technical solution of the data processing method described above belong to the same concept. For details not described in detail in the technical solution of the storage medium, please refer to the description of the technical solution of the data processing method described above.

[0166] An embodiment of this specification also provides a computer program, wherein when the computer program is executed in a computer, it causes the computer to perform the steps of the above-described data processing method.

[0167] The above is an illustrative example of a computer program according to this embodiment. It should be noted that the technical solution of this computer program and the technical solution of the data processing method described above belong to the same concept. Details not described in detail in the technical solution of the computer program can be found in the description of the technical solution of the data processing method described above.

[0168] The foregoing has described specific embodiments of this specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in a different order than that shown in the embodiments and may still achieve the desired result. Furthermore, the processes depicted in the drawings do not necessarily require the specific or sequential order shown to achieve the desired result. In some embodiments, multitasking and parallel processing are possible or may be advantageous.

[0169] The computer instructions include computer program code, which may be in the form of source code, object code, executable file, or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording media, USB flash drive, portable hard drive, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc. It should be noted that the content included in the computer-readable medium may be appropriately added to or subtracted according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media may not include electrical carrier signals and telecommunication signals.

[0170] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that the embodiments in this specification are not limited to the described order of actions, because according to the embodiments in this specification, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in this specification are all preferred embodiments, and the actions and modules involved are not necessarily essential to the embodiments in this specification.

[0171] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0172] The preferred embodiments disclosed above are merely illustrative of this specification. The optional embodiments do not exhaustively describe all details, nor do they limit the invention to the specific implementations described. Clearly, many modifications and variations can be made based on the embodiments described herein. These embodiments are selected and specifically described in this specification to better explain the principles and practical applications of the embodiments, thereby enabling those skilled in the art to better understand and utilize this specification. This specification is limited only by the claims and their full scope and equivalents.

Claims

1. A data processing method, comprising: Retrieve SPO triples from the knowledge graph; The search instructions are constructed using the SPO triples, and the corresponding training statements are extracted based on the search instructions. The input sequence is input into the encoding model for encoding to obtain the encoding corresponding to each entity in the input sequence. After encoding the input sequence, the method further includes: fusing the information in the subgraph corresponding to each entity into the encoding corresponding to the entity through a gating unit to obtain the fused encoding. The subgraph refers to a directed acyclic graph composed of an entity and at least two entities that are related to the entity. The input sequence contains the SPO triple and the corresponding training statement. The input sequence containing the corresponding codes of each entity is used as a sample and input into the knowledge question answering model for training to obtain the trained knowledge question answering model. The labels of the samples are determined according to the SPO triples.

2. The method according to claim 1, further comprising, after obtaining the encoding corresponding to each entity in the input sequence: Obtain the subgraphs corresponding to each entity from the knowledge graph; The subgraphs and codes corresponding to each entity are input into the gating units of each entity respectively. The gating units select information from the subgraphs and integrate it into the codes to obtain the fused codes.

3. The method according to claim 1, wherein constructing search instructions using the SPO triples comprises: The SPO triplet is filtered to obtain the filtered SPO triplet. The filtered SPO triples are used to construct search instructions.

4. The method according to claim 3, wherein filtering the SpO triplet comprises: The SPO triples are filtered according to filtering rules, which include entity length filtering rules, relation length filtering rules, entity occurrence count filtering rules, and / or entity type filtering rules.

5. The method according to claim 1, wherein constructing search instructions using the SPO triples comprises: Select entities from the SPO triples and concatenate them to obtain the search query; A search instruction is constructed based on the search statement.

6. The method according to claim 1, wherein retrieving the corresponding training statement based on the search instruction includes: The initial training statement is obtained by performing a search based on the search instructions. Based on the semantic matching model, the initial training statements are filtered to obtain training statements.

7. The method according to claim 1, wherein encoding the input sequence into the encoding model comprises: The positive and negative SPO triples of the training statement are determined using the SPO triples. Based on the training statement, the positive SpO triples and the negative SpO triples generate an input sequence and input it into the encoding model for encoding.

8. The method according to claim 1, further comprising, before encoding the input sequence into the encoding model: The input order of several input sequences is randomly arranged to generate the input order of several input sequences.

9. The method according to claim 1, wherein the step of using the input sequence containing the codes corresponding to each entity as samples and inputting it into the knowledge question answering model for training includes: Obtain the input sequence containing the codes corresponding to each entity; The input sequence is masked to obtain samples, which are then input into the knowledge question answering model for training.

10. A data processing apparatus, comprising: The first acquisition module is configured to retrieve SPO triples from the knowledge graph. The construction module is configured to construct search instructions using the SPO triples and extract corresponding training statements based on the search instructions; The encoding module is configured to input the input sequence into the encoding model for encoding to obtain the encoding corresponding to each entity in the input sequence. After encoding the input sequence, the module further includes: fusing the information in the subgraphs corresponding to each entity into the encoding corresponding to the entity through a gating unit to obtain the fused encoding. The subgraph refers to a directed acyclic graph composed of an entity and at least two entities that are related to the entity. The input sequence contains the SPO triples and the corresponding training statements. The input module is configured to take an input sequence containing the codes corresponding to each entity as samples and input it into the knowledge question answering model for training to obtain the trained knowledge question answering model, wherein the labels of the samples are determined according to the SPO triples.

11. A data processing method, comprising: Obtain the problem data; The question data is input into the knowledge question answering model trained by the data processing method described in claim 1 for prediction processing; Obtain the answer data corresponding to the question data.

12. A data processing apparatus, comprising: The second acquisition module is configured to acquire problem data; The processing module is configured to input the question data into the knowledge question answering model trained by the data processing method as described in claim 1 for prediction processing; The output module is configured to obtain answer data corresponding to the question data.

13. A computing device, comprising: Memory and processor; The memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions, which, when executed by the processor, implement the steps of the data processing method according to any one of claims 1 to 9 or 11.

14. A computer-readable storage medium storing computer-executable instructions that, when executed by a processor, implement the steps of the data processing method according to any one of claims 1 to 9 or 11.

Citation Information

Patent Citations

  • Knowledge sample data set determination method and apparatus, and electronic device

    CN109582799A

  • Conversation information generation method and device and electronic equipment

    CN112650768A