Knowledge graph-based semantic discrimination method and device, equipment and storage medium

By acquiring triple information from the knowledge graph and constructing discriminative samples to train a semantic discriminative model, the problems of errors in automated named entity recognition and time-consuming and labor-intensive manual review are solved, achieving fast and accurate knowledge graph detection and updating.

CN116821369BActive Publication Date: 2026-01-30NEUSOFT CORP +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310786598.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-06-29
Publication Date
2026-01-30
Estimated Expiration
2043-06-29

AI Technical Summary

Technical Problem

In existing technologies, automated named entity recognition tools may introduce errors when constructing knowledge graphs, leading to inaccurate or inconsistent knowledge. Manual review is time-consuming, labor-intensive, and highly subjective, making it difficult to scale up and adapt to large-scale knowledge graph updates.

Method used

By acquiring triple information from the knowledge graph, we construct discriminative samples and train a semantic discriminative model. The model is then used to judge the target information and the knowledge graph, quickly and accurately determining the authenticity and accuracy of the knowledge.

Benefits of technology

It improves the efficiency of knowledge graph detection, quickly locates erroneous knowledge, reduces the time and cost of manual review, reduces subjective bias, and adapts to the updating of large-scale knowledge graphs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116821369B_ABST
    Figure CN116821369B_ABST
Patent Text Reader

Abstract

This application provides a semantic discrimination method, apparatus, device, and storage medium based on knowledge graphs. The method includes: obtaining triple information corresponding to the entity to be confirmed based on the knowledge graph; obtaining initial information corresponding to the knowledge graph, and constructing discrimination samples based on the initial information and triple information; training a semantic discrimination model based on the discrimination samples; using the trained semantic discrimination model to judge the target information and the target knowledge graph corresponding to the target information, and obtaining the judgment result. This method can quickly and accurately determine the authenticity and accuracy of knowledge in the knowledge graph, locate erroneous knowledge, and improve the detection efficiency of knowledge graphs.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data processing, and more specifically, to a semantic discrimination method, apparatus, device, and storage medium based on knowledge graphs. Background Technology

[0002] A knowledge graph is a graph-like collection of interconnected knowledge that can be used to better query complex, related information. Currently, one common method for constructing knowledge graphs is to utilize automation techniques to extract knowledge sets from unstructured data. Automation techniques can quickly process large amounts of text data, automatically identify key information, and transform it into a structured knowledge representation.

[0003] In the process of automating knowledge graph construction, especially in intermediate processes such as named entity recognition (NER), errors or inaccuracies may be introduced. NER is a crucial task used to identify and extract meaningful entities from text, such as people, places, organizations, drugs, and diseases. However, automated NER tools can make mistakes, such as incorrectly identifying entities, omitting entities, or incorrectly labeling entity types. When automated NER contains errors, it leads to inaccurate or inconsistent knowledge in the knowledge graph, thus affecting subsequent knowledge reasoning and applications.

[0004] Currently, the commonly used method for verifying knowledge graphs involves professional staff reviewing and verifying the knowledge in the knowledge graph, examining and confirming the entities and relationships within the knowledge graph. Professional staff can check for errors that may exist in the automation process and provide correct entity identification and relationship establishment, thereby ensuring the consistency between the knowledge in the knowledge graph and the original unstructured data. However, the method of professional staff reviewing and verifying also has the following problems: (1) Time-consuming, labor-intensive, and costly: Manual review and verification is a time-consuming and labor-intensive task, especially in large-scale knowledge graphs. It requires the participation of professional staff to review and confirm each entity and relationship, which may require a lot of time and human resources. In addition, the recruitment, training, and management of professional staff require high cost investment. (2) Strong subjectivity: Manual review and verification is easily affected by subjective factors. Different professional staff may have different understandings and judgments of the entities and relationships in the knowledge graph, thus introducing subjective bias. This may lead to inconsistent review results, or even ignore or misunderstand some potential knowledge. (3) Poor scalability and adaptability: Due to the large scale of knowledge graphs, it is difficult to manually check and confirm each entity and relationship. In addition, when the knowledge graph is updated or evolves, it needs to be continuously reviewed and verified manually.

[0005] Therefore, how to quickly and accurately determine the authenticity and accuracy of knowledge in a knowledge graph is an urgent problem to be solved. Summary of the Invention

[0006] Some embodiments of this application provide a knowledge graph-based semantic discrimination method, apparatus, device, and storage medium that can at least partially solve the above-mentioned problems existing in the prior art.

[0007] According to one aspect of this application, a semantic discrimination method based on a knowledge graph is provided. The method may include: obtaining triple information corresponding to a relation entity to be confirmed based on a knowledge graph; obtaining initial information corresponding to the knowledge graph, and constructing discrimination samples based on the initial information and the triple information; training a semantic discrimination model based on the discrimination samples; using the trained semantic discrimination model to determine target information and the target knowledge graph corresponding to the target information, and obtaining a determination result.

[0008] In one embodiment of this application, obtaining triple information corresponding to a relation entity to be confirmed based on a knowledge graph may include: searching the knowledge graph based on the relation entity to be confirmed to obtain a unit knowledge graph containing the relation entity to be confirmed; and determining the triple information based on the unit knowledge graph and the relation entity to be confirmed.

[0009] In one embodiment of this application, the entity to be confirmed includes a first entity and a second entity. Constructing a discriminant sample based on the triple information may include: obtaining a standard representation of the semantic discriminant model, and constructing a first discriminant sample based on the triple information and the standard representation; retrieving the initial information based on the first entity and the second entity to determine a second discriminant sample containing the first entity and the second entity; obtaining a first sample entity and a second sample entity, replacing the first entity with the first sample entity or replacing the second entity with the second sample entity to construct a third discriminant sample.

[0010] In one embodiment of this application, the first sample entity is of the same type as the first entity, and the first sample entity and the second entity do not have a direct or indirect relationship; the second sample entity is of the same type as the second entity.

[0011] This application also provides a semantic discrimination device based on a knowledge graph. The device may include: an information acquisition module, used to acquire triple information corresponding to the relation entity to be confirmed based on the knowledge graph; a sample construction module, used to acquire initial information corresponding to the knowledge graph and construct discrimination samples based on the initial information and the triple information; a model training module, used to train a semantic discrimination model based on the discrimination samples; and a knowledge graph judgment module, used to use the trained semantic discrimination model to judge the target information and the target knowledge graph corresponding to the target information, and obtain a judgment result.

[0012] In one embodiment of this application, the information acquisition module can be used to: search the knowledge graph based on the entity to be confirmed to obtain a unit knowledge graph containing the entity to be confirmed; and determine the triple information based on the unit knowledge graph and the entity to be confirmed.

[0013] In one embodiment of this application, the entity to be confirmed includes a first entity and a second entity. The sample construction module can be used to: obtain the standard representation of the semantic discrimination model, and construct a first discrimination sample based on the triple information and the standard representation; retrieve the initial information based on the first entity and the second entity to determine a second discrimination sample containing the first entity and the second entity; obtain the first sample entity and the second sample entity, replace the first entity with the first sample entity or replace the second entity with the second sample entity to construct a third discrimination sample.

[0014] In one embodiment of this application, the first sample entity is of the same type as the first entity, and the first sample entity and the second entity do not have a direct or indirect relationship; the second sample entity is of the same type as the second entity.

[0015] In another aspect, this application provides an electronic device, which may include: a processor adapted to execute a computer program; and a computer-readable storage medium storing a computer program, wherein when the computer program is executed by the processor, it implements the knowledge graph-based semantic discrimination method described above.

[0016] In another aspect, this application provides a computer-readable storage medium for storing a computer program that causes a computer to execute any of the above-described knowledge graph-based semantic discrimination methods.

[0017] According to the exemplary implementation of this application, the triple information corresponding to the relation entity to be confirmed is obtained based on the knowledge graph, and the discriminant sample is constructed to train the semantic discriminant model. The trained semantic discriminant model is used to judge the target information and the target knowledge graph, which can quickly and accurately determine the authenticity and accuracy of knowledge in the knowledge graph, locate erroneous knowledge, and improve the detection efficiency of the knowledge graph. Attached Figure Description

[0018] Other features, objects, and advantages of this application will become more apparent from the following detailed description of non-limiting embodiments with reference to the accompanying drawings. Wherein:

[0019] Figure 1 This is a flowchart of a knowledge graph-based semantic discrimination method 1000 according to an embodiment of this application;

[0020] Figure 2 This is a flowchart illustrating the process of obtaining triple information corresponding to a relation entity to be confirmed based on a knowledge graph according to an exemplary embodiment of this application.

[0021] Figure 3 This is a schematic diagram of a unit knowledge graph according to an exemplary embodiment of this application;

[0022] Figure 4 This is a flowchart illustrating the construction of a discrimination sample according to an exemplary embodiment of this application;

[0023] Figure 5 This is a schematic diagram illustrating the discrimination of a first discriminant sample and a second discriminant sample based on a semantic discriminant model according to an exemplary embodiment of this application;

[0024] Figure 6 This is a block diagram of a knowledge graph-based semantic discrimination device 2000 according to an exemplary embodiment of this application;

[0025] Figure 7 This is a schematic diagram of the structure of an electronic device 3000 adapted to implement embodiments of the present disclosure, according to an embodiment of the present disclosure. Detailed Implementation

[0026] To better understand this application, various aspects of this application will be described in more detail with reference to the accompanying drawings. It should be understood that these detailed descriptions are merely illustrative of exemplary embodiments of this application and are not intended to limit the scope of this application in any way. Throughout the specification, the same reference numerals refer to the same elements. The expression "and / or" includes any and all combinations of one or more of the associated listed items.

[0027] In the accompanying drawings, the size, dimensions, and shapes of the elements have been slightly adjusted for ease of illustration. The drawings are for illustrative purposes only and are not strictly to scale. As used herein, the terms “approximately,” “about,” and similar terms are used to indicate approximation, not degree, and are intended to illustrate inherent deviations in measured or calculated values ​​that will be recognized by one of ordinary skill in the art. Furthermore, the order in which the steps are described in this application does not necessarily indicate the order in which these steps occur in actual operation, unless otherwise expressly defined or deduced from the context.

[0028] It should also be understood that expressions such as "comprising," "including," "having," "containing," and / or "comprising" are open-ended rather than closed-ended expressions in this specification, indicating the presence of the stated features, elements, and / or components, but not excluding the presence of one or more other features, elements, components, and / or combinations thereof. Furthermore, when expressions such as "at least one of..." appear after a list of listed features, they modify the entire list of features, not just individual elements in the list. Additionally, when describing embodiments of this application, the word "may" is used to mean "one or more embodiments of this application." And the term "exemplary" is intended to refer to examples or illustrations.

[0029] Unless otherwise specified, all terms used herein (including engineering and technical terms) shall have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains. It should also be understood that, unless expressly stated herein, terms defined in common dictionaries shall be interpreted as having the meaning consistent with their meaning in the context of the relevant art, and not as having an idealized or overly formalized meaning.

[0030] It should be noted that, where there is no conflict, the embodiments and features described in this application can be combined with each other. This application will now be described in detail with reference to the accompanying drawings and embodiments.

[0031] Figure 1 This is a flowchart of a knowledge graph-based semantic discrimination method 1000 according to an embodiment of this application. Figure 1 As shown, the semantic discrimination method 1000 based on knowledge graphs may include:

[0032] Step S100: Obtain the triple information corresponding to the entity to be confirmed based on the knowledge graph;

[0033] Step S200: Obtain the initial information corresponding to the knowledge graph, and construct discriminative samples based on the initial information and triple information;

[0034] Step S300: Train the semantic discrimination model based on the discrimination samples;

[0035] Step S400: Use the trained semantic discrimination model to determine the target information and the target knowledge graph corresponding to the target information, and obtain the determination result.

[0036] The following will detail the specific steps of the aforementioned knowledge graph-based semantic discrimination method 1000.

[0037] Step S100

[0038] In an exemplary embodiment of this application, the triplet information corresponding to the relation entity to be confirmed is first obtained based on the knowledge graph. Figure 2 This is a flowchart illustrating a knowledge graph-based method for obtaining triple information corresponding to entities with relationships to be confirmed, according to an exemplary embodiment of this application. Figure 2 As shown, obtaining the triple information corresponding to the entity to be confirmed based on the knowledge graph may include the following steps:

[0039] Step S110: Search the knowledge graph based on the entities to be confirmed to obtain unit knowledge graphs containing the entities to be confirmed;

[0040] Step S120: Determine triple information based on the unit knowledge graph and the relation entities to be confirmed.

[0041] For example, a knowledge graph can contain multiple nodes, each representing an entity, and the nodes represent the relationships between the corresponding entities. Taking the entities whose relationship needs to be confirmed in the knowledge graph as 's' and 'o', where 's' represents the subject and 'o' represents the object, searching for all paths in the knowledge graph that begin with 's' and end with 'o' yields the unit knowledge graph. Figure 3 This is a schematic diagram of a unit knowledge graph according to an exemplary embodiment of this application. (In conjunction with...) Figure 3 The unit knowledge graph in the data can be used to obtain each connected entity and its corresponding relationship, which can be represented in the form of triples (head entity, relation, tail entity). Based on the unit knowledge graph, the corresponding triple information can be obtained as follows: (s, pa, a), (a, pd, d), (d, p, o), (s, p, o), (s, pc, c), (c, p, o).

[0042] According to the exemplary implementation of this application, the knowledge graph is initially screened by the relational entities to be confirmed, and the unit knowledge graph and the corresponding triple information are obtained. This can reduce the amount of data that needs to be processed in the subsequent process to a certain extent and improve the recognition efficiency of knowledge in the knowledge graph.

[0043] Step S200

[0044] In an exemplary embodiment of this application, after obtaining the triple information corresponding to the entity to be confirmed based on the knowledge graph, initial information corresponding to the knowledge graph can also be obtained, and a discriminant sample can be constructed based on the initial information and the triple information. The initial information is the text information corresponding to the knowledge graph; processing the text information yields the corresponding knowledge graph. The discriminant sample constructed based on the triple information may include a first discriminant sample, a second discriminant sample, and a third discriminant sample. Figure 4 This is a flowchart illustrating the construction of a discrimination sample according to an exemplary embodiment of this application. Figure 4 As shown, constructing discriminative samples may include the following steps:

[0045] Step S210: Obtain the standard representation of the semantic discrimination model, and construct the first discrimination sample based on the triple information and the standard representation;

[0046] Step S220: Based on the first entity and the second entity, retrieve the initial information to determine the second discrimination sample containing the first entity and the second entity;

[0047] Step S230: Obtain the first sample entity and the second sample entity, replace the first entity with the first sample entity or replace the second entity with the second sample entity, and construct the third discriminant sample.

[0048] For example, the standard representation of the semantic discriminant model is obtained. For instance, if the triple information is (s, o, p), the corresponding standard representation is "s's o is p". Then, the triple information obtained in step S100 can be converted into the standard representation to form the first discriminant sample, i.e., the first discriminant sample is: "s's pa is a", "a's pd is d", "d's p is o", "s's p is o", "s's pc is c", and "c's p is o". Since the first discriminant sample is based on the knowledge nodes between knowledge graphs and the relationships between knowledge nodes, it is considered that most of the first discriminant samples are correct factual expressions. Therefore, the first discriminant sample is a positive sample in the semantic discriminant model. The first entity (head entity) and the second entity (tail entity) in the triple information can be used as keywords for retrieval to obtain sentences containing the first and second entities in the initial information, which are then used as the second discriminant sample. Taking the triple information (s, pa, a) as an example, using s and a as keywords, all statements containing s and a are retrieved to obtain the second discriminant sample. For example, taking the entities whose relationship needs to be confirmed as early gastric cancer and endoscopic resection, the first discriminant sample is: the treatment method for early gastric cancer is endoscopic resection; by searching with "early gastric cancer" and "endoscopic resection" as keywords, the second discriminant sample can be obtained as: the recommended treatment for early gastric cancer is endoscopic resection. During the training of the semantic discriminant model, to better train the model's discriminative ability, negative samples, i.e., the third discriminant sample, can be further constructed. Obtain the first sample entity s and the second sample entity o, where the first sample entity s is of the same type as the first entity s, and the first sample entity s has no direct or indirect relationship with the second entity o; the second sample entity o is of the same type as the second entity o. Randomly replace the first entity s with the first sample entity s, or randomly replace the second entity o with the second sample entity o. For example, replace early gastric cancer with early myeloma, as both belong to early cancer types, and early myeloma is not related to endoscopic resection, i.e., the third discriminant sample is: the treatment method for early myeloma is endoscopic resection.

[0049] According to an exemplary implementation of this application, by constructing a first discriminant sample, a second discriminant sample, and a third discriminant sample, and then training the semantic discriminant model based on the first discriminant sample, the model's discriminant ability can be improved to a certain extent, and more accurate results can be obtained.

[0050] Steps S300 and S400

[0051] In an exemplary embodiment of this application, after constructing the discriminant samples, the semantic discrimination model can be trained based on the discriminant samples. For example, for the first and second discriminant samples being trained, the corresponding labels can be determined through manual annotation, enabling supervised training of the semantic discrimination model. For example, taking the first and second discriminant samples as examples, the semantic discrimination model can employ the BERT model, which can determine whether the two sentences in the first and second discriminant samples have the same semantics, and obtain suitable text character vector representations through the discrimination task. Figure 5 This is a schematic diagram illustrating the discrimination of a first discriminant sample and a second discriminant sample based on a semantic discriminant model according to an exemplary embodiment of this application. Figure 5 As shown, the first discriminant sample Tok1-TokN and the second discriminant sample Tok1-TokM are input into the BERT model. After processing by the BERT model, the corresponding output results are obtained. The output results include the label C and the character vector representation (T1-T2) corresponding to the first discriminant sample. N The character vector representation (T1'-T) corresponding to the second discriminant sample M The label C can be 0 or 1, where 0 indicates that the first and second discriminant samples have different semantics, and 1 indicates that the first and second discriminant samples have the same semantics. M and N represent the lengths of the first and second discriminant samples, respectively. Although this application uses the first and second discriminant samples to train the semantic model as an example, other discriminant samples can also be used to further train the model, and this application does not limit this.

[0052] In an exemplary embodiment of this application, after obtaining the trained semantic discriminant model, the trained semantic discriminant model can be used to judge the target information and the target knowledge graph corresponding to the target information, and obtain the discrimination result. For example, for the target information and the target knowledge graph, through steps S100 and S200, a first discrimination sample obtained based on the knowledge graph and a second discrimination sample retrieved based on the target information can be obtained. Inputting the first and second discrimination samples into the trained semantic discriminant model can obtain the corresponding discrimination result. If the discrimination result of the semantic discriminant model is 1, it proves that the knowledge in the knowledge graph is consistent with the content expressed by the target information, that is, the knowledge in the knowledge graph is correct; if the discrimination result of the semantic discriminant model is 0, it proves that the knowledge in the knowledge graph is inconsistent with the content expressed by the target information, and the accuracy of the corresponding part in the knowledge graph needs to be checked.

[0053] According to the exemplary implementation of this application, a semantic discrimination model is trained by discriminative samples, and the trained semantic discrimination model is used to judge target information and the target knowledge graph corresponding to the target information. This can quickly and accurately determine the authenticity and accuracy of knowledge in the knowledge graph, locate erroneous knowledge, and improve the detection efficiency of the knowledge graph.

[0054] This application also provides a semantic discrimination device 2000 based on a knowledge graph. Figure 6 This is a block diagram of a knowledge graph-based semantic discrimination device 2000 according to an exemplary embodiment of this application. Figure 6 As shown, the semantic discrimination device 2000 based on knowledge graph may include: an information acquisition module 2100, a sample construction module 2200, a model training module 2300, and a knowledge graph judgment module 2400.

[0055] In an exemplary embodiment of this application, the information acquisition module 2100 can be used to acquire triple information corresponding to the entity to be confirmed based on a knowledge graph. Acquiring triple information corresponding to the entity to be confirmed based on a knowledge graph may include: searching the knowledge graph based on the entity to be confirmed to obtain a unit knowledge graph containing the entity to be confirmed; and determining triple information based on the unit knowledge graph and the entity to be confirmed.

[0056] For example, a knowledge graph can contain multiple nodes, each representing an entity, and the nodes represent the relationships between the corresponding entities. Taking the entities whose relationship needs to be confirmed in the knowledge graph as 's' and 'o', where 's' represents the subject and 'o' represents the object, searching the knowledge graph for all paths starting with 's' and ending with 'o' yields the unit knowledge graph. Combined with... Figure 3 The unit knowledge graph in the data can be used to obtain each connected entity and its corresponding relationship, which can be represented in the form of triples (head entity, relation, tail entity). Based on the unit knowledge graph, the corresponding triple information can be obtained as follows: (s, pa, a), (a, pd, d), (d, p, o), (s, p, o), (s, pc, c), (c, p, o).

[0057] According to the exemplary implementation of this application, the knowledge graph is initially screened by the relational entities to be confirmed, and the unit knowledge graph and the corresponding triple information are obtained. This can reduce the amount of data that needs to be processed in the subsequent process to a certain extent and improve the recognition efficiency of knowledge in the knowledge graph.

[0058] In an exemplary embodiment of this application, the sample construction module 2200 can be used to obtain initial information corresponding to a knowledge graph and construct discriminative samples based on the initial information and triple information. The initial information is the text information corresponding to the knowledge graph; processing the text information yields the corresponding knowledge graph. The discriminative samples constructed based on the triple information may include a first discriminative sample, a second discriminative sample, and a third discriminative sample. Constructing the discriminative samples may include: obtaining a standard representation of a semantic discriminative model and constructing a first discriminative sample based on the triple information and the standard representation; retrieving the initial information based on a first entity and a second entity to determine a second discriminative sample containing both the first and second entities; obtaining a first sample entity and a second sample entity, replacing the first entity with the first sample entity or replacing the second entity with the second sample entity to construct a third discriminative sample.

[0059] For example, the standard representation of the semantic discriminant model is obtained. For instance, if the triple information is (s, o, p), the corresponding standard representation is "s's o is p". Then, the triple information obtained in step S100 can be converted into the standard representation to form the first discriminant sample, i.e., the first discriminant sample is: "s's pa is a", "a's pd is d", "d's p is o", "s's p is o", "s's pc is c", and "c's p is o". Since the first discriminant sample is based on the knowledge nodes between knowledge graphs and the relationships between knowledge nodes, it is considered that most of the first discriminant samples are correct factual expressions. Therefore, the first discriminant sample is a positive sample in the semantic discriminant model. The first entity (head entity) and the second entity (tail entity) in the triple information can be used as keywords for retrieval to obtain sentences containing the first and second entities in the initial information, which are then used as the second discriminant sample. Taking the triple information (s, pa, a) as an example, using s and a as keywords, all statements containing s and a are retrieved to obtain the second discriminant sample. For example, taking the entities whose relationship needs to be confirmed as early gastric cancer and endoscopic resection, the first discriminant sample is: the treatment method for early gastric cancer is endoscopic resection; by searching with "early gastric cancer" and "endoscopic resection" as keywords, the second discriminant sample can be obtained as: the recommended treatment for early gastric cancer is endoscopic resection. During the training of the semantic discriminant model, to better train the model's discriminative ability, negative samples, i.e., the third discriminant sample, can be further constructed. Obtain the first sample entity s and the second sample entity o, where the first sample entity s is of the same type as the first entity s, and the first sample entity s has no direct or indirect relationship with the second entity o; the second sample entity o is of the same type as the second entity o. Randomly replace the first entity s with the first sample entity s, or randomly replace the second entity o with the second sample entity o. For example, replace early gastric cancer with early myeloma, as both belong to early cancer types, and early myeloma is not related to endoscopic resection, i.e., the third discriminant sample is: the treatment method for early myeloma is endoscopic resection.

[0060] According to an exemplary implementation of this application, by constructing a first discriminant sample, a second discriminant sample, and a third discriminant sample, and then training the semantic discriminant model based on the first discriminant sample, the model's discriminant ability can be improved to a certain extent, and more accurate results can be obtained.

[0061] In an exemplary embodiment of this application, the model training module 2300 can be used to train a semantic discrimination model based on discriminative samples. For example, for the first and second discriminative samples being trained, labels corresponding to the first and second discriminative samples can be determined through manual annotation, enabling supervised training of the semantic discrimination model. For example, taking the first and second discriminative samples as examples, the semantic discrimination model can employ the BERT model, which can determine whether the two sentences (first and second discriminative samples) have the same semantics, and can obtain suitable text character vector representations through a discrimination task. Figure 5 As shown, the first discriminant sample Tok1-TokN and the second discriminant sample Tok1-TokM are input into the BERT model. After processing by the BERT model, the corresponding output results are obtained. The output results include the label C and the character vector representation (T1-T2) corresponding to the first discriminant sample. N The character vector representation (T1'-T) corresponding to the second discriminant sample M The label C can be 0 or 1, where 0 indicates that the first and second discriminant samples have different semantics, and 1 indicates that the first and second discriminant samples have the same semantics. M and N represent the lengths of the first and second discriminant samples, respectively. Although this application uses the first and second discriminant samples to train the semantic model as an example, other discriminant samples can also be used to further train the model, and this application does not limit this.

[0062] In an exemplary embodiment of this application, the knowledge graph determination module 2400 can be used to determine the target information and the target knowledge graph corresponding to the target information using a trained semantic discriminant model, and obtain a determination result. For example, the information acquisition module 2100 and the sample construction module 2200 can obtain a first discrimination sample based on the knowledge graph and a second discrimination sample retrieved based on the target information. The first and second discrimination samples are input into the trained semantic discriminant model to obtain the corresponding discrimination result. If the discrimination result of the semantic discriminant model is 1, it proves that the knowledge in the knowledge graph is consistent with the content expressed by the target information, i.e., the knowledge in the knowledge graph is correct. If the discrimination result of the semantic discriminant model is 0, it proves that the knowledge in the knowledge graph is inconsistent with the content expressed by the target information, and the accuracy of the corresponding part in the knowledge graph needs to be checked.

[0063] According to the exemplary implementation of this application, a semantic discrimination model is trained by discriminative samples, and the trained semantic discrimination model is used to judge target information and the target knowledge graph corresponding to the target information. This can quickly and accurately determine the authenticity and accuracy of knowledge in the knowledge graph, locate erroneous knowledge, and improve the detection efficiency of the knowledge graph.

[0064] This application also provides an electronic device and a computer-readable storage medium. Figure 7 This is a schematic diagram of the structure of an electronic device 3000 adapted to implement embodiments of the present disclosure, according to an embodiment of the present disclosure.

[0065] The following is for reference. Figure 7 The diagram illustrates a structural schematic of an electronic device 3000 suitable for implementing embodiments of the present disclosure. Terminal devices in embodiments of the present disclosure may include, but are not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and fixed terminals such as digital TVs and desktop computers. Figure 7 The terminal device / server shown is merely an example and should not be construed as limiting the functionality and scope of the embodiments of this disclosure.

[0066] like Figure 7 As shown, the electronic device 3000 may include a processing unit (e.g., a central processing unit, a graphics processor, etc.) 3100, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 3200 or a program loaded from a storage device 3800 into a random access memory (RAM) 3300. The RAM 3300 also stores various programs and data required for the operation of the electronic device 3000. The processing unit 3100, the ROM 3200, and the RAM 3300 are interconnected via a bus 3400. An input / output (I / O) interface 3500 is also connected to the bus 3400.

[0067] Typically, the following devices can be connected to the I / O interface 3500: input devices 3600 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 3700 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 3800 including, for example, magnetic tapes, hard disks, etc.; and communication devices 3900. The communication device 3900 allows the electronic device 3000 to communicate wirelessly or wiredly with other devices to exchange data. Although... Figure 7 An electronic device 3000 with various devices is shown; however, it should be understood that it is not required to implement or possess all of the devices shown. More or fewer devices may be implemented or possessed alternatively. Figure 7 Each box shown can represent a device or multiple devices as needed.

[0068] In particular, according to embodiments of this disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this disclosure include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device 3900, or installed from a storage device 3800, or installed from a ROM 3200. When the computer program is executed by a processing device 3100, it performs the functions defined in the methods of embodiments of this disclosure.

[0069] It should be noted that the computer-readable medium described in the embodiments of this disclosure can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In the embodiments of this disclosure, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In the embodiments of this disclosure, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium can be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wires, optical fibers, RF (radio frequency), etc., or any suitable combination thereof.

[0070] The aforementioned computer-readable medium may be included within the aforementioned electronic device or may exist independently without being assembled into the electronic device. The aforementioned computer-readable medium carries one or more programs that, when executed by the electronic device, enable the electronic device to: obtain triple information corresponding to the entity to be confirmed based on a knowledge graph; obtain initial information corresponding to the knowledge graph and construct discrimination samples based on the initial information and triple information; train a semantic discrimination model based on the discrimination samples; and use the trained semantic discrimination model to determine the target information and the target knowledge graph corresponding to the target information, and obtain the determination result.

[0071] Computer program code for performing the operations of embodiments of this disclosure can be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, and C++, and conventional procedural programming languages ​​such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0072] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0073] The specific embodiments described above further illustrate the purpose, technical solution, and beneficial effects of the present invention. It should be understood that the above descriptions are merely specific embodiments of the present invention and are not intended to limit the invention. Any modifications, equivalent substitutions, or improvements made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.

Claims

1. A semantic discrimination method based on a knowledge graph, characterized in that, The method comprises: acquiring, based on a knowledge graph, triple information corresponding to a relationship entity to be confirmed; acquiring initial information corresponding to the knowledge graph, and constructing a discrimination sample based on the initial information and the triple information, wherein the initial information is text information corresponding to the knowledge graph; training a semantic discrimination model based on the discrimination sample; using the trained semantic discrimination model to discriminate target information and a target knowledge graph corresponding to the target information, and obtaining a discrimination result; the relationship entity to be confirmed comprises a first entity and a second entity, and constructing a discrimination sample based on the triple information comprises: acquiring a standard expression form of the semantic discrimination model, and constructing a first discrimination sample based on the triple information and the standard expression form; searching the initial information based on the first entity and the second entity, and determining a second discrimination sample containing the first entity and the second entity; acquiring a first sample entity and a second sample entity, replacing the first entity with the first sample entity or replacing the second entity with the second sample entity, and constructing a third discrimination sample. 2.The knowledge graph based semantic discrimination method of claim 1, wherein, The method comprises: searching the knowledge graph based on the relationship entity to be confirmed, and obtaining a unit knowledge graph containing the relationship entity to be confirmed; determining the triple information based on the unit knowledge graph and the relationship entity to be confirmed. 3.The knowledge graph based semantic discrimination method of claim 1, wherein, The first sample entity is of the same type as the first entity, and the first sample entity has no direct or indirect relationship with the second entity; the second sample entity is of the same type as the second entity. 4.A semantic discrimination device based on a knowledge graph, characterized in that, The device comprises: an information acquisition module configured to acquire, based on a knowledge graph, triple information corresponding to a relationship entity to be confirmed; a sample construction module configured to acquire initial information corresponding to the knowledge graph, and construct a discrimination sample based on the initial information and the triple information, wherein the initial information is text information corresponding to the knowledge graph; a model training module configured to train a semantic discrimination model based on the discrimination sample; a knowledge graph discrimination module configured to use the trained semantic discrimination model to discriminate target information and a target knowledge graph corresponding to the target information, and obtain a discrimination result; the relationship entity to be confirmed comprises a first entity and a second entity, and the sample construction module is configured to: acquire a standard expression form of the semantic discrimination model, and construct a first discrimination sample based on the triple information and the standard expression form; search the initial information based on the first entity and the second entity, and determine a second discrimination sample containing the first entity and the second entity; acquire a first sample entity and a second sample entity, replace the first entity with the first sample entity or replace the second entity with the second sample entity, and construct a third discrimination sample. 5.The knowledge graph based semantic discrimination apparatus according to claim 4, characterized in that, The information acquisition module is configured to: search the knowledge graph based on the relationship entity to be confirmed, and obtain a unit knowledge graph containing the relationship entity to be confirmed; Determine the triple information based on the unit knowledge graph and the to-be-confirmed relationship entity. 6.The knowledge graph based semantic discrimination apparatus according to claim 4, characterized in that, The first sample entity is of the same type as the first entity, and the first sample entity has no direct or indirect relationship with the second entity; the second sample entity is of the same type as the second entity.

7. An electronic device, comprising: Comprise: A processor adapted to execute a computer program; And A computer readable storage medium having a computer program stored therein, wherein the computer program, when executed by the processor, implements the knowledge graph-based semantic discrimination method of any one of claims 1 to 3.

8. A computer-readable storage medium, characterized in that, A computer program for storing a computer program, which enables a computer to execute the knowledge graph-based semantic discrimination method of any one of claims 1 to 3.

Citation Information

Patent Citations

  • Knowledge graph detection method and related device, electronic equipment and storage medium

    CN113407736A

  • Text classification model training method and device and text classification processing method and device

    CN116150351A