Relationship triple generation method and apparatus, electronic device, and storage medium
By acquiring the combined elements of the information to be retrieved, and using the schema information of the knowledge graph and deep learning technology to generate candidate triples, the applicability of existing triple generation methods in complex retrieval scenarios is solved, achieving higher scalability and flexibility.
Patent Information
- Application Number
- CN202111661032.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-30
- Publication Date
- 2025-11-28
- Estimated Expiration
- 2041-12-30
AI Technical Summary
Existing triple generation methods have low applicability in complex retrieval scenarios and are difficult to meet the scalability and flexibility requirements of different retrieval scenarios.
By acquiring the combined elements of the information to be retrieved, combining them using the schema information of the knowledge graph, generating candidate triples, classifying them using a pre-defined triple classification model, and combining deep learning technology to generate target relation triples.
The triple generation method has improved its scalability and flexibility in different complex retrieval scenarios, and enhanced its applicability to complex retrieval scenarios.
Smart Images

Figure CN114461810B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of information processing, and in particular to a relationship triple generation method and device, an electronic device, and a storage medium. BACKGROUND
[0002] In the process of information retrieval based on a knowledge graph, a triple can be generated from a retrieval sentence, and a graph data query sentence can be generated from the triple to achieve information retrieval. Therefore, the generation of the triple has an important influence on the accuracy of the retrieval result. At present, for complex retrieval scenarios, a template designed in advance for the retrieval scenario is often used to generate a triple. This method has poor scalability for different retrieval scenarios, and the rule method is too simple, so it has low applicability to complex retrieval scenarios.
[0003] The current triple generation method has low applicability to complex retrieval scenarios in the related art, and there is currently no effective solution to this problem. SUMMARY
[0004] A relationship triple generation method, device, electronic device, and storage medium are provided in the present embodiment to solve the problem of low applicability of the triple generation method in the related art to complex retrieval scenarios.
[0005] In a first aspect, a relationship triple generation method is provided in the present embodiment, comprising:
[0006] obtaining combined elements of to-be-retrieved information;
[0007] combining the combined elements based on schema information of a knowledge graph to generate candidate triples;
[0008] classifying the candidate triples using a preset triple classification model to obtain classification results of the candidate triples;
[0009] aggregating the candidate triples using a preset aggregation method based on the classification results to generate target relationship triples.
[0010] In some embodiments, the combined elements include entity information and relationship information in the to-be-retrieved information, and the obtaining of the combined elements of the to-be-retrieved information comprises:
[0011] obtaining the to-be-retrieved information;
[0012] performing information extraction processing on the to-be-retrieved information to extract entity information and relationship information included in the to-be-retrieved information to obtain the combined elements.
[0013] In some embodiments, the triple classification model comprises a semantic model, and the classifying the candidate triple by using the preset triple classification model to obtain a classification result of the candidate triple comprises:
[0014] fusing the candidate triple and the information to be searched to obtain data to be classified;
[0015] inputting the data to be classified into a preset semantic model to obtain semantic feature information of the data to be classified;
[0016] linearly mapping and performing binary classification processing on the semantic feature information to obtain the classification result of the candidate triple.
[0017] In some embodiments, the semantic model comprises a word vector model and a natural language deep learning model, and the inputting the data to be classified into a preset semantic model to obtain semantic feature information of the data to be classified comprises:
[0018] encoding the data to be classified by using a preset word vector model to obtain an embedding representation of the data to be classified;
[0019] inputting the embedding representation into a preset natural language deep learning model to obtain the semantic feature information of the data to be classified.
[0020] In some embodiments, the generating a target relationship triple by using a preset aggregation method based on the classification result to aggregate the candidate triples comprises:
[0021] selecting, based on the classification result, candidate triples with correct classification results, grouping the candidate triples according to a preset grouping rule to obtain a grouping result of the candidate triples;
[0022] merging the grouping result according to a preset merging rule to generate the target relationship triple.
[0023] In some embodiments, before the grouping result is processed according to the preset merging rule to generate the target relationship triple, the method further comprises:
[0024] verifying the grouping result based on the classification result, and updating the grouping result according to a verification result.
[0025] In a second aspect, a relationship triple generation apparatus is provided in the embodiments, comprising an acquisition module, a first generation module, a classification module, and a second generation module, wherein:
[0026] the acquisition module is configured to acquire a combination element of information to be searched.
[0027] The first generation module is configured to combine the combination elements based on schema information of the knowledge graph to generate candidate triples;
[0028] The classification module is configured to classify the candidate triples by using a preset triple classification model to obtain a classification result of the candidate triples.
[0029] The second generation module is configured to aggregate the candidate triples by using a preset aggregation method based on the classification result to generate target relationship triples.
[0030] In a third aspect, an electronic device is provided in the embodiment, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the relationship triple generation method of the first aspect when executing the computer program.
[0031] In a fourth aspect, a computer device is provided in the embodiment, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the steps of the relationship triple generation method of the first aspect when executing the computer program.
[0032] In a fifth aspect, a storage medium is provided in the embodiment, which stores a computer program executable by a processor to implement the relationship triple generation method of the first aspect.
[0033] Compared with the related art, the relationship triple generation method, device, electronic device, and storage medium provided in the embodiment generate candidate triples by obtaining combination elements of to-be-retrieved information, combining the combination elements based on schema information of a knowledge graph, classifying the candidate triples by using a preset triple classification model to obtain a classification result of the candidate triples, aggregating the candidate triples by using a preset aggregation method based on the classification result to generate target relationship triples. The method generates candidate triples based on schema information of a knowledge graph, and further classifies the candidate triples based on a general classification algorithm framework, thereby improving the expansibility and flexibility of the triple generation method in different complex retrieval scenarios, and improving the applicability to complex retrieval scenarios.
[0034] Details of one or more embodiments of the present application are presented in the following drawings and description to make other features, objects, and advantages of the present application more apparent. BRIEF DESCRIPTION OF DRAWINGS
[0035] The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this application, illustrate embodiments of the present application and together with the description serve to explain the present application. In the drawings:
[0036] Figure 1 is a hardware structure block diagram of a terminal of a related technology relationship triple generation method;
[0037] Figure 2 is a flow chart of the relationship triple generation method of the present embodiment;
[0038] Figure 3 is a flow chart of the knowledge graph-based relationship triple classification method of the present preferred embodiment;
[0039] Figure 4 is a flow chart of the knowledge graph-based relationship triple aggregation method of the present preferred embodiment;
[0040] Figure 5 is a structure block diagram of the relationship triple generation device of the present embodiment;
[0041] Figure 6 is a structure schematic diagram of the computer device of the present embodiment. DETAILED DESCRIPTION
[0042] In order to more clearly understand the purpose, technical scheme and advantages of the present application, the present application is described and explained below in combination with the drawings and embodiments.
[0043] Unless otherwise defined, technical terms or scientific terms used in the present application shall have the same meaning as those commonly understood by a person of ordinary skill in the art to which the present application belongs. The terms "one", "a", "an", "the", "these", and similar terms in the present application do not indicate quantity of limitation, and they can be singular or plural. The terms "include", "contain", "have", and any variant thereof in the present application are intended to cover non-exclusive inclusion; for example, a process, method, and system, product or device containing a series of steps or modules (units) are not limited to the listed steps or modules (units), but can include steps or modules (units) not listed, or can include other steps or modules (units) inherent to the process, method, product or device. The terms "connect", "connect", "couple" and the like in the present application are not limited to physical or mechanical connection, but can include electrical connection, whether direct or indirect. The term "multiple" in the present application refers to two or more. The term "and / or" describes the association between the associated objects, which means that there can be three relationships, for example, "A and / or B" can mean that A exists alone, A and B exist together, and B exists alone. Generally, the character " / " represents the relationship between the objects before and after it is "or". The terms "first", "second", "third" and the like in the present application are only used to distinguish similar objects, and do not represent a specific order of the objects.
[0044] The method embodiments provided in the present embodiment can be executed in a terminal, a computer or a similar computing device. For example, the method embodiments are executed on a terminal, Figure 1 is a hardware structure block diagram of the terminal of the relationship triple generation method of the present embodiment. As shown in Figure 1 , the terminal can include one or more (only one in Figure 1 ) processor 102 and memory 104 for storing data, wherein the processor 102 can include but not limited to processing device such as microprocessor MCU or programmable logic device FPGA. The above terminal can also include transmission device 106 for communication function and input / output device 108. Those skilled in the art can understand that Figure 1 The structure shown is only schematic, which does not limit the structure of the above terminal. For example, the terminal can include more or less components than those shown in Figure 1 , or have a different configuration from that shown in Figure 1 .
[0045] The memory 104 can be used to store computer programs, such as software programs of application software and modules, such as a computer program corresponding to the relationship triple generation method in the embodiment. The processor 102 can execute various functional applications and data processing, i.e., implement the method described above, by running the computer program stored in the memory 104. The memory 104 can include a high-speed random access memory, and can further include a non-volatile memory, such as one or more magnetic storage devices, flash memories, or other non-volatile solid-state memories. In some examples, the memory 104 can further include memories remotely arranged with respect to the processor 102, which can be connected to the terminal through a network. Examples of the network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof.
[0046] The transmission device 106 is used to receive or send data via a network. The network described above includes a wireless network provided by a communication provider of the terminal. In one example, the transmission device 106 includes a network adapter (NIC) which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module which is used to communicate with the Internet in a wireless manner.
[0047] In the embodiment, a relationship triple generation method is provided, Figure 2 A flowchart of the relationship triple generation method of the embodiment is shown in FIG. 2, which includes the following steps: Figure 2
[0048] In step S210, a combination element of to-be-retrieved information is obtained.
[0049] Specifically, the to-be-retrieved information can be text information input by a user for retrieval in a retrieval scenario. The to-be-retrieved information can include phrases, sentences, and paragraphs. The combination element of the to-be-retrieved information can be an element that constitutes the retrieval sentence and contains key information for retrieval, such as entities and relationships in the to-be-retrieved information. The combination element is a prerequisite for generating relationship triples. For example, if the to-be-retrieved information is “a 20-year-old woman who travels with Li Si”, the entities can be “person: Li Si”, “person: 20 years old”, and “person: woman”, and the relationship can be “traveling together”.
[0050] In step S220, the combination element is combined based on schema information of a knowledge graph to generate a candidate triple.
[0051] The knowledge graph is essentially a semantic network, the nodes of which represent entities or concepts, and the edges represent various semantic relationships between entities / concepts, and the knowledge graph can describe cognitive knowledge at various levels of concepts, facts, rules, etc. The schema information of the knowledge graph defines the format of the data to be added to the knowledge graph, and is used to standardize the expression of structured data.
[0052] The schema of the knowledge graph is combined with the combination elements to combine the entities and relationships therein, and candidate triples are generated, so as to improve the accuracy of triple generation, and further improve the generation efficiency of the target relationship triple. Here, the above example retrieval statement is used for illustration. In the information to be retrieved "a 20-year-old woman with Li Si on the train", the entities contained therein are "person: Li Si", "person: 20 years old", and "person: woman", and the relationship is "traveling together". According to the schema of the knowledge graph, the entities are combined according to the relationship, and the following three groups of candidate triples can be obtained, specifically including: <person: Li Si, traveling together, person: 20 years old>, <person: Li Si, traveling together, person: woman>, and <person: 20 years old, traveling together, person: woman>.
[0053] In step S230, the candidate triples are classified using a preset triple classification model to obtain the classification results of the candidate triples.
[0054] The preset triple classification model can include a semantic model and a classification model, which are used to perform binary classification on the candidate triples to determine whether the candidate triples are correct relationship triples under the semantics of the information to be retrieved. Specifically, the candidate triples and the information to be retrieved can be fused to obtain the input data of the triple classification model, i.e., the data to be classified. After the data to be classified is processed using the preset semantic model, the semantic feature information of the data to be classified is obtained, and the semantic feature information is processed using the preset classification model, so that the classification result of the candidate triple can be obtained. For example, the above candidate triples, <person: Li Si, traveling together, person: 20 years old>, <person: Li Si, traveling together, person: woman>, and <person: 20 years old, traveling together, person: woman>, are processed, and the classification result of the candidate triple is obtained, i.e., [<person: Li Si, traveling together, person: 20 years old>, correct], [<person: Li Si, traveling together, person: woman>, correct], and [<person: 20 years old, traveling together, person: woman>, incorrect].
[0055] Further, the semantic model can also be divided into a word vector model and a natural language deep learning model. Specifically, the above-mentioned to-be-classified data can be encoded by the word vector model to obtain an embedding representation, and the embedding representation is processed by the natural language deep learning model to obtain semantic feature information. The classification model can be a linear layer in a neural network. After the semantic feature information is linearly mapped through the linear layer, the Sigmoid function can be used for binary classification processing to obtain a score value of the candidate triple classification, and the score value is normalized. Based on a preset score threshold, if the normalized score value is greater than the score threshold, the candidate triple is a correct triple, otherwise it is an incorrect triple.
[0056] Compared with the way of generating triples by using the template designed in advance for the retrieval scene in the current complex retrieval scene, the embodiment combines the deep learning technology, determines whether the candidate triple is a correct triple by using the triple classification model, avoids the dependence on rules and templates, and therefore improves the flexibility of the triple generation process, enhances the scalability, and expands the applicable scenarios.
[0057] In step S240, the candidate triples are aggregated based on the classification results by using a preset aggregation method to generate target relationship triples.
[0058] Specifically, based on the transitive aggregation method, the classification results of the candidate triples obtained in step S230 are combined, and the candidate triples with correct classification results are sequentially grouped and merged to obtain the target relationship triples. For example, the to-be-retrieved information is "a 180 cm tall person and Li Si with a 20-year-old woman on a train", and the classification results of the candidate triples are: [<person: height 180 cm, same train, person: Li Si>, correct], [<person: height 180 cm, same train, person: 20 years old>, incorrect], [<person: height 180 cm, same train, person: female>, incorrect], [<person: Li Si, same train, person: 20 years old>, correct]. Based on the classification results, the candidate triples with correct classification results are selected, and grouping is performed according to the head and tail entities of the relationship to obtain the grouping results: [<person: height 180 cm, same train, person: Li Si>, correct], [<person: Li Si, same train, person: 20 years old>, correct], [<person: Li Si, same train, person: female>, correct]. Then, the above grouping results are grouped according to the relationship type to obtain: [<person: height 180 cm, same train, person: Li Si>, correct], [<person: Li Si, same train, person: 20 years old>, correct], [<person: Li Si, same train, person: female>, correct].
[0059] Additionally, in order to improve the accuracy of the generated result, the grouping result can also be verified based on the candidate triplets that are classified as errors, and then the grouping result is merged according to a preset merging rule, so as to obtain the target relationship triplet. The preset merging rule can be specifically that the head node is taken as the key value, that is, key, and the corresponding tail node is merged, so as to generate the target relationship triplet. For example, the target relationship triplet of the above example is [<person: [name: Li Si]>, same row, <person: [height: 180 cm, age: 20 years old, gender: female]>].
[0060] Through the above steps, the combination elements of the information to be searched are obtained, the combination elements are combined based on the schema information of the knowledge graph, the candidate triplets are generated, the candidate triplets are classified by using the preset triplet classification model, the classification results of the candidate triplets are obtained, and the candidate triplets are aggregated based on the classification results by using the preset aggregation method, so as to generate the target relationship triplet. Through the schema information of the knowledge graph, the candidate triplets are generated, and based on the general classification algorithm framework, the classification of the candidate triplets is further realized, thereby improving the expansibility and flexibility in different complex search scenarios, and improving the applicability to complex search scenarios.
[0061] In one embodiment, based on the above step S210, the combination elements contain entity information and relationship information in the information to be searched, and the combination elements of the information to be searched are obtained, specifically including the following steps:
[0062] Step S211, obtaining the information to be searched.
[0063] Step S212, performing information extraction processing on the information to be searched, extracting the entity information and relationship information contained in the information to be searched, and obtaining the combination elements.
[0064] Additionally, in one embodiment, based on the above step S230, the triplet classification model includes a semantic model, and the candidate triplets are classified by using the preset triplet classification model to obtain the classification results of the candidate triplets, specifically including the following steps:
[0065] Step S231, fusing the candidate triplets and the information to be searched to obtain the data to be classified.
[0066] Specifically, based on the extracted combination elements, the corresponding data in the information to be searched can be marked. For example, the entity type mark can be added to the entity information in the information to be searched. For example, the entity type mark " " can be added before and after the entity of the entity type of person. <per>" and< / per>For the relationship type of "same train", a mark representing the relationship type of "same train" can be added to the corresponding position of the information to be searched, for example, <sametrain>" and< / sametrain> ". For example, based on the candidate triple generation result of the information to be searched as "180 cm tall 20-year-old woman with Li Si on the same train", the fusion result of the candidate triple and the information to be searched can be obtained as follows:
[0067] <per>Height 180 cm< / per> with the 20-year-old woman; <per>Li Si< / per> <sametrain>Same train< / sametrain> with the 20-year-old woman;
[0068] <per>Height 180 cm< / per> with Li Si <sametrain>Same train< / sametrain> 's <per>20 years old< / per> woman;
[0069] <per>Height 180 cm< / per> with Li Si <sametrain>Same train< / sametrain> 's 20-year-old <per>Female< / per> ;
[0070] 180 cm tall <per>Li Si< / per> <sametrain>Same train< / sametrain> 's <per>20 years old< / per> woman;
[0071] 180 cm tall <per>Li Si< / per> <sametrain>Same train< / sametrain> 's 20-year-old <per>Female< / per> ;
[0072] 180 cm tall with Li Si <sametrain>Same train< / sametrain> 's <per>20 years old< / per> <per>Female< / per> .
[0073] By fusing the candidate triple and the information to be searched, the specific situation of the triple that needs to be judged in the subsequent processing process can be determined.
[0074] In step S232, the data to be classified is input into a preset semantic model for processing to obtain semantic feature information of the data to be classified.
[0075] In step S233, the semantic feature information is linearly mapped and binary classified to obtain a classification result of the candidate triple.
[0076] Further, in an embodiment, based on the above step S232, the semantic model includes a word vector model and a natural language deep learning model, the data to be classified is input into the preset semantic model for processing to obtain semantic feature information of the data to be classified, and the specific steps include the following steps:
[0077] In step S2321, the data to be classified is encoded by using a preset word vector model to obtain an embedded representation of the data to be classified.
[0078] The word vector model can be a CBOW (Continuous Bag-of-Word) model, which can be trained to predict a target word using context to obtain a word vector. Alternatively, other word vector models can be used to process the data to be classified according to the requirements of the actual application scenario, such as a Skip-gram model that predicts surrounding words from a target word to train a word vector, without being specifically limited herein.
[0079] At step S2322, the embedding representation is input into a preset natural language deep learning model to obtain semantic feature information of the data to be classified.
[0080] Specifically, the natural language deep learning model can be a Bilstm-Attention (Bi-directional Long Short-Term Memory-Attention) model or a BERT (Bidirectional Encoder Representation from Transformers) model. The BERT model can be used to process the embedding representation to obtain context semantic feature information between each word in the data to be classified. The preset natural language deep learning model can be used to obtain semantic feature information of the data to be classified.
[0081] In one embodiment, based on the above step S240, the candidate triplets are aggregated based on the classification results using a preset aggregation method to generate target relationship triplets, specifically including the following steps:
[0082] At step S241, based on the classification results, the candidate triplets with correct classification results are selected and grouped according to a preset grouping rule to obtain grouping results of the candidate triplets.
[0083] At step S243, the grouping results are merged according to a preset merging rule to generate target relationship triplets.
[0084] Further, in one embodiment, before the grouping results are processed according to the preset merging rule to generate the target relationship triplets, the following steps can also be included:
[0085] At step S242, based on the classification results, the grouping results are verified and updated according to the verification results.
[0086] Specifically, the grouping result can be verified according to the candidate triplets classified as wrong, and the wrong triplets are proposed, so as to update the grouping result and improve the accuracy of the target triplets generated subsequently.
[0087] The embodiment will be described and illustrated below by preferred embodiments.
[0088] Figure 3 is a flowchart of the knowledge graph-based relation triplet classification method of the preferred embodiment. As shown in Figure 3 , the knowledge graph-based relation triplet classification method comprises the following steps:
[0089] Step S310, preprocessing the original search text, extracting entities and relations in the original search text;
[0090] Step S320, generating candidate triplets in combination with the schema of the knowledge graph for the extracted entities and relations;
[0091] Step S330, fusing the candidate triplets with the original search text to obtain the original input of the model;
[0092] Step S340, encoding the original input using a word vector model to obtain the embedding representation of the original input;
[0093] Step S350, inputting the embedding representation of the original input into a natural language deep learning model to obtain deep semantic information of the original input;
[0094] Step S360, mapping the output result of the model through a linear layer to obtain the classification result of the candidate triplets.
[0095] Figure 4 is a flowchart of the knowledge graph-based relation triplet aggregation method of the preferred embodiment. As shown in Figure 4 , the knowledge graph-based relation triplet aggregation method comprises the following steps:
[0096] Step S410, selecting the candidate triplets classified correctly, and grouping according to the head and tail entities of the relation;
[0097] Step S420, grouping according to the relation type of the relation;
[0098] Step S430, selecting the candidate triplets classified as wrong, and verifying the result;
[0099] Step S440, merging the triplets with the same head node and tail node to obtain the target relation triplet.
[0100] In the embodiment, a relationship triple generation apparatus is also provided, which is used to implement the above-mentioned embodiments and preferred embodiments, and will not be described again. The terms "module", "unit", "sub-unit" and the like used below can be a combination of software and / or hardware that implements a predetermined function. Although the apparatus described in the following embodiments is preferably implemented in software, hardware or a combination of software and hardware is also possible and is contemplated.
[0101] Figure 5 is a structural block diagram of the relationship triple generation apparatus 50 of the embodiment, as shown in Figure 5 The relationship triple generation apparatus 50 comprises an acquisition module 52, a first generation module 54, a classification module 56, and a second generation module 58, wherein:
[0102] The acquisition module 52 is configured to acquire a combination element of to-be-retrieved information.
[0103] The first generation module 54 is configured to combine the combination element based on schema information of a knowledge graph to generate a candidate triple.
[0104] The classification module 56 is configured to classify the candidate triple by using a preset triple classification model to obtain a classification result of the candidate triple.
[0105] The second generation module 58 is configured to aggregate the candidate triple by using a preset aggregation method based on the classification result to generate a target relationship triple.
[0106] The relationship triple generation apparatus 50 described above acquires a combination element of to-be-retrieved information, combines the combination element based on schema information of a knowledge graph to generate a candidate triple, classifies the candidate triple by using a preset triple classification model to obtain a classification result of the candidate triple, and aggregates the candidate triple by using a preset aggregation method based on the classification result to generate a target relationship triple. The candidate triple is generated by using the schema information of the knowledge graph, and the classification of the candidate triple is further implemented based on a general classification algorithm framework, thereby improving the expansibility and flexibility of the triple generation method in different complex retrieval scenarios, and improving the applicability to complex retrieval scenarios.
[0107] It should be noted that each of the above modules can be a functional module or a program module, and can be implemented by software or hardware. For the modules implemented by hardware, each of the above modules can be located in the same processor; or each of the above modules can also be located in different processors in any combination.
[0108] An electronic device is also provided in the embodiment, comprising a memory and a processor, the memory storing a computer program, and the processor is configured to execute the computer program to perform the steps in any of the above method embodiments.
[0109] Optionally, the electronic device can further comprise a transmission device and an input / output device, wherein the transmission device is connected with the processor, and the input / output device is connected with the processor.
[0110] Optionally, in the embodiment, the processor can be configured to perform the following steps by the computer program:
[0111] obtain a combination element of the information to be retrieved;
[0112] combine the combination element based on schema information of the knowledge graph to generate a candidate triple;
[0113] classify the candidate triple by using a preset triple classification model to obtain a classification result of the candidate triple;
[0114] aggregate the candidate triple based on the classification result by using a preset aggregation method to generate a target relationship triple.
[0115] It should be noted that the specific examples in the embodiment can refer to the examples described in the above embodiments and optional implementation manners, which will not be described herein again.
[0116] In one embodiment, a computer device is provided, which can be a server, and an internal structure diagram of the computer device can be as shown in Figure 6 The computer device comprises a processor, a memory, a network interface and a database connected through a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device comprises a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store a preset configuration information set. The network interface of the computer device is used to communicate with an external terminal through a network connection. The computer program is executed by the processor to implement the above relationship triple generation method.
[0117] In one embodiment, a computer device is provided, which can be a terminal. The computer device comprises a processor, a memory, a network interface, a display screen and an input device connected through a system bus. The processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for running the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is configured to communicate with external terminals through a network connection. The computer program, when executed by the processor, implements a relationship triple generation method. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen. The input device of the computer device can be a touch layer overlaid on the display screen, or a key, trackball or touchpad arranged on the housing of the computer device, or an external keyboard, touchpad or mouse, etc.
[0118] Those skilled in the art can understand that, Figure 6 The structure shown in the above-mentioned embodiments is only a block diagram of part of the structure related to the scheme of the present application, and does not constitute a limitation on the computer device to which the scheme of the present application is applied. The specific computer device can include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0119] In addition, in combination with the relationship triple generation method provided in the above-mentioned embodiments, a storage medium can also be provided to implement the scheme in the present embodiment. The storage medium stores a computer program; and the computer program, when executed by a processor, implements any one of the relationship triple generation methods in the above-mentioned embodiments.
[0120] It should be understood that the specific embodiments described herein are only used to explain the application, but not to limit it. According to the embodiments provided in the present application, all other embodiments obtained by those of ordinary skill in the art without creative labor are within the scope of protection of the present application.
[0121] Obviously, the drawings are only some examples or embodiments of the present application, and can be applied to other similar situations without creative labor for those of ordinary skill in the art. In addition, it can be understood that, although the work done in the development process can be complex and long, certain design, manufacture or production changes made by those of ordinary skill in the art according to the technical content disclosed in the present application are only routine technical means, and should not be regarded as insufficient disclosure of the present application.
[0122] The word "implementation" in this application refers to the specific features, structures, or characteristics described in connection with an implementation can be included in at least one implementation of the present application. The phrase appears in various places throughout the specification is not necessarily meant to refer to the same implementation, nor is it meant to imply that the features, structures, or characteristics so described can not be implemented in other implementations. It will be apparent to those having ordinary skill in the art that the implementations described herein can be combined with other implementations without losing the intended effect.
[0123] The above-described implementations only express several implementation manners of the present application, which are described in detail and specifically, but cannot be understood as the limitation of the patent protection scope. It should be pointed out that for ordinary skilled in the art, several modifications and improvements can be made without departing from the concept of the present application, which all belong to the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the appended claims.
Claims
1. A method for generating relation triples, characterized in that, The method comprises the following steps: obtaining a combination element of information to be searched; the combination element comprises entity information and relationship information in the information to be searched; combining the entity information according to the relationship information based on schema information of a knowledge graph to generate a candidate triple; classifying the candidate triple by using a preset triple classification model to obtain a classification result of the candidate triple; based on the classification result, aggregating the candidate triple by using a preset aggregation method to generate a target relationship triple; wherein: the triple classification model comprises a semantic model, and the classification of the candidate triple by using the preset triple classification model to obtain the classification result of the candidate triple comprises: based on the extracted combination element, marking corresponding data in the information to be searched to fuse the candidate triple and the information to be searched to obtain data to be classified; inputting the data to be classified into a preset semantic model for processing to obtain semantic feature information of the data to be classified; performing linear mapping and binary classification processing on the semantic feature information to obtain the classification result of the candidate triple. 2.The relationship triple generation method of claim 1, wherein, The method comprises the following steps: obtaining the information to be searched; performing information extraction processing on the information to be searched to extract entity information and relationship information contained in the information to be searched to obtain the combination element. 3.The relationship triple generation method of claim 1, wherein, The semantic model comprises a word vector model and a natural language deep learning model, and the processing of the data to be classified by inputting the data to be classified into a preset semantic model comprises: encoding the data to be classified by using a preset word vector model to obtain an embedding representation of the data to be classified; inputting the embedding representation into a preset natural language deep learning model for processing to obtain semantic feature information of the data to be classified.
4. The method of claim 1, wherein, The method comprises the following steps: based on the classification result, selecting the candidate triple with a correct classification result, grouping the candidate triple according to a preset grouping rule to obtain a grouping result of the candidate triple; merging the grouping result according to a preset merging rule to generate a target relationship triple.
5. The method of claim 4, wherein, Before the merging of the grouping result according to the preset merging rule to generate the target relationship triple, the method further comprises the following steps: based on the classification result, verifying the grouping result and updating the grouping result according to a verification result.
6. A relationship triple generation apparatus characterized by comprising: The method comprises the following steps: an obtaining module, a first generating module, a classifying module, and a second generating module; wherein: the obtaining module is configured to obtain a combination element of information to be searched; the combination element comprises entity information and relationship information in the information to be searched; the first generating module is configured to combine the entity information according to the relationship information based on schema information of a knowledge graph to generate a candidate triple; the classifying module is configured to classify the candidate triple by using a preset triple classification model to obtain a classification result of the candidate triple; the second generating module is configured to aggregate the candidate triple by using a preset aggregation method based on the classification result to generate a target relationship triple. The second generation module is configured to generate a target relation triple by using a preset aggregation method to aggregate the candidate triples based on the classification result. The triple classification model comprises a semantic model, and the classification of the candidate triples by using the preset triple classification model to obtain the classification result of the candidate triples comprises: Based on the extracted combination elements, corresponding data in the information to be searched is marked to fuse the candidate triples and the information to be searched to obtain data to be classified; the data to be classified is input into a preset semantic model for processing to obtain semantic feature information of the data to be classified; the semantic feature information is linearly mapped and processed by binary classification to obtain the classification result of the candidate triples. 7.An electronic device comprising a memory and a processor, the electronic device characterized by, The memory stores a computer program, and the processor is configured to run the computer program to execute the relation triple generation method in any one of claims 1 to 5.
8. A computer device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, The processor executes the computer program to implement the steps of the relation triple generation method in any one of claims 1 to 5.
9. A computer readable storage medium having stored thereon a computer program, characterized in that, The computer program is executed by the processor to implement the steps of the relation triple generation method in any one of claims 1 to 5.
Citation Information
Patent Citations
Multi-granularity semantic chunk based entity attribute and attribute value extracting method
CN106777275A