Knowledge graph construction method and device, equipment, storage medium and product

By combining entity relationship rules and a pre-defined bidirectional model with character label conflict correction technology, the problem of low quality of knowledge graphs in existing technologies has been solved, achieving higher quality entity recognition and graph construction.

CN121958561APending Publication Date: 2026-05-01CHINA MOBILE (JIANGXI) VIRTUAL REALITY TECH CO LTD +2
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411534692.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-30
Publication Date
2026-05-01

AI Technical Summary

Technical Problem

The quality of knowledge graphs constructed by existing technologies is relatively low, mainly because supervised learning algorithms have high requirements for the scale and quality of training data, which makes it difficult to meet the needs of practical applications.

Method used

Entities are identified using entity relationship rules and a pre-defined bidirectional model, and a knowledge graph is constructed by dynamically correcting character tag conflict features.

Benefits of technology

This improves the quality of knowledge graph construction, effectively avoids entity conflicts, and enhances the accuracy of entity recognition and the overall quality of the graph.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121958561A_ABST
    Figure CN121958561A_ABST
Patent Text Reader

Abstract

The invention discloses a knowledge graph construction method and device, equipment, a storage medium and a product, and relates to the technical field of artificial intelligence, and the method comprises the steps: determining a first entity according to a structured text block based on an entity relationship rule; determining a second entity according to the structured text block based on a preset bidirectional model; when it is determined that a conflict exists according to the character tag in the first entity and the character tag in the second entity, dynamic correction is conducted according to conflict features, and a target entity is obtained; constructing a knowledge graph according to the first entity and the target entity; according to the mode, the first entity and the second entity are respectively determined according to the structured text block based on the entity relationship rule and the preset bidirectional model, then the character tags of the two entities are determined to determine whether a conflict exists, if yes, the conflict feature is obtained according to the added preset tag, and then the conflict character is corrected according to the conflict feature, so that the conflict accuracy is improved. Therefore, entity conflicts can be effectively avoided, and the quality of the constructed knowledge graph is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of artificial intelligence technology, and in particular to methods, apparatus, devices, storage media and products for constructing knowledge graphs. Background Technology

[0002] Knowledge graph technology, as a core tool for information organization and retrieval, has enormous potential and value. Entities are the foundation for building knowledge graphs. Currently, the common method for identifying entities is based on single statistical machine learning, specifically using supervised learning algorithms in machine learning to extract entities. However, supervised learning algorithms have high requirements for the scale and quality of the original corpus, requiring a certain size of labeled training dataset. In practical applications, it is difficult to meet the above scale and quality requirements. Therefore, the quality of knowledge graphs built using the above methods is relatively low.

[0003] The above content is only used to help understand the technical solution of this application and does not represent an admission that the above content is prior art. Summary of the Invention

[0004] The main purpose of this application is to provide a method, apparatus, device, storage medium and product for constructing a knowledge graph, which aims to solve the technical problem of low quality of knowledge graph construction in the prior art.

[0005] To achieve the above objectives, this application proposes a knowledge graph construction method, the method comprising:

[0006] The first entity is determined based on the entity relationship rules and structured text blocks.

[0007] The second entity is determined based on a pre-defined bidirectional model using structured text blocks;

[0008] When a conflict is determined to exist based on the character tags in the first entity and the character tags in the second entity, dynamic correction is performed based on the conflict characteristics to obtain the target entity;

[0009] A knowledge graph is constructed based on the first entity and the target entity.

[0010] In one embodiment, the first entity is determined based on structured text blocks according to entity relationship rules;

[0011] The second entity is determined based on a pre-defined bidirectional model using structured text blocks;

[0012] When a conflict is determined to exist based on the character tags in the first entity and the character tags in the second entity, dynamic correction is performed based on the conflict characteristics to obtain the target entity;

[0013] A knowledge graph is constructed based on the first entity and the target entity.

[0014] In one embodiment, the step of determining the first entity based on entity relationship rules according to structured text blocks includes:

[0015] Obtain the attribute tendencies of the structured text block;

[0016] Based on the attribute tendency, set entity relationship rules for the structured text block on the rule device;

[0017] Entity matching is performed based on the structured text blocks according to the entity relationship rules.

[0018] The first triplet is generated based on the entity matching results and written to the graph database;

[0019] The data in the graph database is labeled according to the entity relationship rules, and a label vector is generated based on each labeled character;

[0020] The first entity is determined based on the label vector and the entity matching result.

[0021] In one embodiment, the step of determining the second entity based on a preset bidirectional model and structured text blocks includes:

[0022] The structured text block is encoded from multiple dimensions to obtain entity word vectors;

[0023] Based on a preset bidirectional model, a character tag probability vector is generated according to the entity word vector;

[0024] Based on a pre-defined bidirectional model, the constraint relationships between character annotations are determined according to Chinese grammar rules;

[0025] Construct a state transition matrix based on the aforementioned constraints;

[0026] Based on the sentence sequence, the probability of each character belonging to each label is calculated according to the state transition matrix and the character label probability vector;

[0027] The label for each character is determined based on the probability that each character belongs to each label.

[0028] A second entity is generated based on the character tags and the characters of the structured text block.

[0029] In one embodiment, the step of dynamically correcting based on conflict characteristics to obtain the target entity when a conflict is determined to exist based on the character tags in the first entity and the character tags in the second entity includes:

[0030] Determine whether a conflict exists based on the character tags in the first entity and the character tags in the second entity;

[0031] If so, then obtain the conflict features based on the added preset labels;

[0032] Based on the conflict characteristics, a specified proportion of conflicting characters are randomly selected, and the proportion of the conflicting characters in the original character set is determined.

[0033] When the ratio is greater than or equal to the preset conflict character correction threshold, the correction character is calculated based on the ratio and the correction ratio;

[0034] Dynamic correction is performed based on the correction characters to obtain the target conflict character set;

[0035] Modify the preprocessing conditions of the first task in the preset bidirectional model according to the target conflict character set;

[0036] A new round of model training will be conducted based on the modified preprocessing conditions and calibration rounds;

[0037] When the new proportion is less than the preset conflict character correction threshold, the target entity is determined based on the new preset bidirectional model.

[0038] In one embodiment, after the step of determining the second entity based on a preset bidirectional model and structured text blocks, the method further includes:

[0039] Retrieve the character tags from the second entity;

[0040] When both the character tags in the first entity and the character tags in the second entity point to a preset tag, compare the next character tag;

[0041] When the character label exists in the second entity and the character label does not exist in the first entity, a new entity is determined;

[0042] A second triplet is generated based on the new entity, and the second triplet is written to the graph database.

[0043] Furthermore, to achieve the above objectives, this application also proposes a knowledge graph construction apparatus, which includes:

[0044] The first determination module is used to determine the first entity based on the entity relationship rules and the structured text block.

[0045] The second determination module is used to determine the second entity based on a pre-set bidirectional model and structured text blocks;

[0046] The correction module is used to dynamically correct the target entity based on the conflict characteristics when a conflict is determined to exist based on the character labels in the first entity and the character labels in the second entity.

[0047] The construction module is used to construct a knowledge graph based on the first entity and the target entity.

[0048] In addition, to achieve the above objectives, this application also proposes a knowledge graph construction device, the device comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, the computer program being configured to implement the steps of the knowledge graph construction method as described above.

[0049] In addition, to achieve the above objectives, this application also proposes a storage medium, which is a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, it implements the steps of the knowledge graph construction method described above.

[0050] In addition, to achieve the above objectives, this application also provides a computer program product, which includes a computer program that, when executed by a processor, implements the steps of the knowledge graph construction method described above.

[0051] The one or more technical solutions proposed in this application have at least the following technical effects: determining a first entity based on structured text blocks according to entity relationship rules; determining a second entity based on structured text blocks according to a preset bidirectional model; when a conflict is determined based on the character tags in the first entity and the character tags in the second entity, dynamic correction is performed based on the conflict features to obtain the target entity; constructing a knowledge graph based on the first entity and the target entity; through the above method, the first entity and the second entity are determined based on structured text blocks according to entity relationship rules and a preset bidirectional model, and then the character tags of the two entities are determined to determine whether there is a conflict. If so, the conflict features are obtained based on the added preset tags, and then the conflicting characters are corrected based on the conflict features, thereby effectively avoiding entity conflicts and improving the quality of the constructed knowledge graph. Attached Figure Description

[0052] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.

[0053] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0054] Figure 1 This is a flowchart illustrating an embodiment of the knowledge graph construction method of this application.

[0055] Figure 2 This is a schematic diagram of the character tag comparison process for the knowledge graph construction method provided in Embodiment 1 of this application;

[0056] Figure 3 This is a flowchart illustrating Embodiment 2 of the knowledge graph construction method of this application.

[0057] Figure 4 A simplified flowchart illustrating the knowledge graph construction method provided in Embodiment 2 of this application;

[0058] Figure 5 This is a schematic diagram of the module structure of the knowledge graph construction device according to an embodiment of this application;

[0059] Figure 6 This is a schematic diagram of the device structure of the hardware operating environment involved in the knowledge graph construction method in the embodiments of this application.

[0060] The purpose, features, and advantages of this application will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation

[0061] It should be noted that the executing entity in this embodiment can be a computing service device with data processing, network communication, and program execution functions, such as a tablet computer, personal computer, or mobile phone, or an electronic device or knowledge graph construction device capable of performing the above functions. The following description uses knowledge graph construction as an example to illustrate this embodiment and the subsequent embodiments.

[0062] Based on this, embodiments of this application provide a knowledge graph construction method, referring to... Figure 1 , Figure 1 This is a flowchart illustrating the first embodiment of the knowledge graph construction method of this application.

[0063] In this embodiment, the knowledge graph construction method includes steps S10 to S40:

[0064] Step S10: Determine the first entity based on the structured text block according to the entity relationship rules.

[0065] It should be noted that entity relationship rules include, but are not limited to, entity relationship scope rules, entity matching rules, and entity reverse annotation rules. Entity relationships include, but are not limited to, subordinate relationships, inclusion relationships, and parallel relationships. Structured text blocks refer to text blocks that have undergone text structuring processing.

[0066] It should be understood that the first entity refers to the entity matched by entity relationship rules. For example, block A is organization-related content, the title is organizational structure, and the relationship is containment. There are two ways to match using entity relationship rules. The first is to select the organization-related modules in the corpus and directly perform fuzzy matching. The second is to use a custom rule template, such as fuzzy matching [First Bureau, Second Bureau, First Office, Second Office, ...].

[0067] Furthermore, to effectively improve the accuracy of determining the first entity, step S10 includes: obtaining the attribute tendency of the structured text block; setting entity relationship rules for the structured text block on the rule device according to the attribute tendency; performing entity matching based on the entity relationship rules and the structured text block; generating a first triplet based on the entity matching result and writing the first triplet to the graph database; labeling the data in the graph database according to the entity relationship rules and generating a label vector based on each labeled character; and determining the first entity based on the label vector and the entity matching result.

[0068] Understandably, based on the characteristics of the text's logic, each text block will have an attribute tendency. For example, text block A focuses on organizational hierarchy, while text block B focuses on response flow. The rule device for setting entity relationship rules can be a rule engine. After performing entity matching, the first triplet is generated based on the entity matching result. The format of the first triplet can be <block title, relation, matching entity>. Then, the first triplet is written to the graph database.

[0069] It should be noted that reverse annotation rules for entities are also used at the block level. For example, in block A, for all entities of the type "organization" that are matched, the first character of the entity is labeled as B-ORG, other characters are labeled as I-ORG, and unlabeled characters in the text block are labeled as O. At the same time, a label vector is generated based on each labeled character, denoted as T = (t1, t2, t3, ..., t n ), t i =1 indicates that the annotation type of the entity containing the character is i; otherwise, t i =0. In addition, after obtaining the labeled data, a certain proportion of the labeled data will be used to expand the training dataset required by the BERT-CRF model. This proportion can be adaptively set according to the quality of the labels, for example, 30%.

[0070] Step S20: Determine the second entity based on the structured text blocks according to the preset bidirectional model.

[0071] It should be understood that the preset bidirectional model can be the BERT-CRF model. The BERT model learns the relationships between words and the contextual semantic information between sentences to achieve bidirectional text feature extraction, while the CRF layer optimizes the extraction results based on the constraints and dependencies of the character structure. The second entity refers to the entity identified through the preset bidirectional model.

[0072] Furthermore, to effectively improve the accuracy of determining the second entity, step S20 includes: encoding the structured text block from multiple dimensions to obtain entity word vectors; generating character label probability vectors based on the entity word vectors using a preset bidirectional model; determining the constraint relationships between character labels based on the preset bidirectional model and Chinese grammar rules; constructing a state transition matrix based on the constraint relationships; calculating the probability of each character belonging to each label based on the sentence sequence, the state transition matrix, and the character label probability vectors; determining each character label based on the probability of each character belonging to each label; and generating the second entity based on the character labels and the characters of the structured text block.

[0073] Understandably, the multiple dimensions of encoding include, but are not limited to, symbols, fragments, and positions. Specifically, text blocks are segmented by recognizing punctuation marks through character encoding, with each text block fragment marked with [CLS] at the beginning and [SEP] at the end; fragment encoding identifies the sentence to which a character belongs; and positional encoding identifies the character's position within the sentence. The sum of these three encoding vectors is E. word =E tok +E seg +E pos This is used to obtain entity word vectors.

[0074] It should be understood that the first and second tasks in the pre-defined bidirectional model also need to be used for pre-training to learn the dependency between word vectors and contextual information. The first task can be Masked LM, and the second task can be NextSentence Prediction. Pre-training of Masked LM involves masking 15% of the serialized data, where 80% of the text is replaced with MASK symbols, 10% is replaced with other text symbols, and 10% remains unreplaced. The masked original text is then predicted based on the context of the unmasked text. Pre-training of Next Sentence Prediction involves randomly selecting 50% of the sentences and then selecting another 50% of the sentences from the original, unordered data. The contextual relationships between the randomly selected sentences and the sentences in the original, unordered data are then learned. The output character label probability vector can then be represented as Y = (y1, y2, y3, ..., y...). n ), where y i This represents the probability that a character belongs to label i. Construct matrix B = [Y1, Y2, Y3, ..., Y...].n ] T , which represents the label probability of each character in the entire sentence.

[0075] It should be noted that since the formation of words by characters is subject to grammatical constraints, a state transition matrix is ​​constructed based on the BERT model. The constraints between character labels are determined according to Chinese grammatical rules. Taking the entity label structure "label 1 - label 2" as an example, the constraints are as follows: the first word label should be "B-" or "O"; the label should begin with "B-", not "I-"; the characters after "B-" can be "I-" or "O", and label 2 must be the same; "I B-" or different labels 2 are not allowed; the characters after "I-" can be "I-" or "O", and label 2 must be the same; "O I-" or different labels 2 are not allowed, etc. This represents the probability that if the current character belongs to the i-th label class, the next character belongs to the (i+1)-th label class.

[0076] Understandably, after obtaining the state transition matrix, this matrix is ​​used as input to the CRF layer. Then, based on the sentence sequence, the probability of each character belonging to each label is calculated according to the character label probability vector, and the maximum probability is taken as the final label of that character, denoted as TAG. i Specifically:

[0077]

[0078] Where A represents the state transition matrix, B represents the probability matrix, and M represents the probability that each character belongs to each label.

[0079] It should also be noted that after determining each character, the characters are combined according to the annotation rules to form entity objects. The method for determining the second entity is to traverse the first character starting with B until the next character starting with B or O is encountered, and then extract the middle part as the second entity.

[0080] Furthermore, in order to process the different comparison results of character tags in a timely and accurate manner, after step S20, the method further includes: obtaining character tags in the second entity; comparing the next character tag when both the character tags in the first entity and the character tags in the second entity point to a preset tag; determining a new entity when the character tags in the second entity exist and the character tags in the first entity do not exist; generating a second triplet based on the new entity, and writing the second triplet to the graph database.

[0081] It should be noted that the character labels in the first entity can use T. ti=1 This indicates that character tags in the second entity can use TAG. iIndicates, for reference Figure 2 , Figure 2 The flowchart illustrates the character tag comparison process, which is as follows: After determining the first entity based on the structured text block according to entity relationship rules and the second entity based on the structured text block according to the preset bidirectional model, on the one hand, it is necessary to determine whether the character tags in the first entity and the character tags in the second entity both point to the preset tags. If so, it indicates that the character tag already exists, which belongs to case 1. At this time, the character is skipped and the comparison continues to the next character. On the other hand, it is also necessary to determine whether the character tag exists. If the character tag in the second entity exists and the character tag in the first entity does not exist, which belongs to case 2, a new entity is determined and a second triple <head entity, connection, tail entity> is generated. Here, the head entity is the title of the text block to which it belongs, the connection is the rule definition, and the tail entity is the entity extraction result. Then, the first triple is written to the graph database and a knowledge graph is constructed.

[0082] Step S30: When it is determined that there is a conflict based on the character labels in the first entity and the character labels in the second entity, dynamic correction is performed based on the conflict characteristics to obtain the target entity.

[0083] It should be understood that after identifying the first entity and the second entity, a conflict is determined based on the character labels in the first entity and the character labels in the second entity. Specifically, a conflict exists when a character label in the first entity exists but corresponds to a character label in the second entity, indicating that the conflict is considered a conflict. Figure 3 In scenario 3, to reduce the occurrence of conflicts, dynamic correction is performed based on conflict characteristics to obtain the target entity. Furthermore, this application can also formulate corresponding correction strategies for semantic conflicts, structural conflicts, and data conflicts.

[0084] Furthermore, to effectively improve the accuracy of identifying the target entity, step S30 includes: determining whether a conflict exists based on the character labels in the first entity and the character labels in the second entity; if so, obtaining conflict features based on added preset labels; randomly selecting a specified proportion of conflict characters based on the conflict features, and determining the proportion of the conflict characters in the original character set; when the proportion is greater than or equal to a preset conflict character correction threshold, calculating correction characters based on the proportion and correction proportion; performing dynamic correction based on the correction characters to obtain a target conflict character set; modifying the preprocessing conditions of the first task in the preset bidirectional model based on the target conflict character set; performing a new round of model training based on the modified preprocessing conditions and correction rounds; and determining the target entity based on the new preset bidirectional model when the new proportion is less than the preset conflict character correction threshold.

[0085] Understandably, after a conflict is identified, a preset label is added to the character to mark it. This preset label can be flag=1, and the character with the preset label is used as the conflict feature. The conflict character refers to the character that is dynamically corrected. The correction character can be calculated based on the proportion of the conflict character to the original character set and the correction ratio. Specifically, the correction character T = the proportion of the conflict character to the original character set N and the correction ratio P. Then, dynamic correction is performed based on the correction character.

[0086] It should be understood that after the target conflict character set is obtained through correction, it will be fed into the BERT model in the preset bidirectional model for a new round of training to enhance the accuracy of the BERT model in entity labeling and recognition. At this time, the preprocessing conditions of the first task (Masked LM) need to be modified to increase the masking ratio of conflict characters. If the masking ratio of conflict characters is M, then at least N×M in the conflict character set will be replaced with Mask. Then a new round of model training will be performed. If the proportion of conflict characters is still greater than or equal to the preset conflict character correction threshold after the correction rounds, the correction ratio will be increased and training will continue until the new ratio is less than the preset conflict character correction threshold. At this time, the step of determining the target entity will continue to be performed based on the new preset bidirectional model.

[0087] Step S40: Construct a knowledge graph based on the first entity and the target entity.

[0088] It should be understood that after obtaining the target entity, a triple is generated by combining it with the first entity, and then the triple is written to a graph database, which can be Neo4j, and then a knowledge graph is constructed.

[0089] This embodiment determines a first entity based on entity relationship rules and structured text blocks; it determines a second entity based on a preset bidirectional model and structured text blocks; when a conflict is found between the character tags in the first entity and the character tags in the second entity, dynamic correction is performed based on the conflict features to obtain the target entity; a knowledge graph is constructed based on the first entity and the target entity; through the above method, the first entity and the second entity are determined based on entity relationship rules and a preset bidirectional model and structured text blocks respectively, and then the character tags of the two entities are determined to determine whether there is a conflict. If so, the conflict features are obtained based on the added preset tags, and then the conflicting characters are corrected based on the conflict features, thereby effectively avoiding entity conflicts and improving the quality of the constructed knowledge graph.

[0090] Based on the first embodiment of this application, in the second embodiment of this application, the content that is the same as or similar to that in the first embodiment described above can be referred to the above description, and will not be repeated hereafter. Based on this, please refer to... Figure 3Before step S10, steps S001 to S004 are also included:

[0091] Step S001: Select the target entity annotation structure according to the information hierarchy and granularity requirements of the entity.

[0092] It should be noted that the target entity annotation structure refers to the structure used for entity annotation. Different entities require different hierarchical information and granularity requirements, necessitating different entity annotation structures. This target entity annotation structure includes, but is not limited to, "Label 1 - Label 2", "Label 1 - Label 2 - Label 3", etc. Here, Label 1 indicates the position of the character within the entity; Label 2 indicates the category of the entity to which the text belongs, such as Organization (ORG) or Rescue (RESCUE); Label 3 indicates a more granular level of classification. Taking a hazardous chemicals emergency response plan as an example, entity annotation can be performed from multiple dimensions, including scope of application, organizational structure, expert team, rescue forces, activation conditions, division of responsibilities, and response procedures. The labels used for annotation are shown in Table 1.

[0093] Table 1:

[0094] Entity Name Start tag Internal label Rescue forces - medical B-MEDICAL I-MEDICAL Rescue forces - firefighters B-FIRE I-FIRE Organization B-ORG I-ORG Job B-JOB I-JOB ...... ...... ......

[0095] Step S002: Obtain text data, and annotate the text data according to the target entity annotation structure based on the preset annotation strategy to obtain the target corpus.

[0096] It is understandable that the preset annotation strategy refers to the strategy for entity annotation. This preset annotation strategy can be the BIO annotation strategy, where B represents the beginning of the entity, I represents the interior of the entity, and O represents non-entities. Then, the text data is annotated according to the target entity annotation structure, and then the target corpus is constructed.

[0097] Step S003: Configure the full-text digitization template according to the table of contents and format features, and set the granularity parameters.

[0098] It should be understood that for objects with certain table of contents and formatting characteristics in their writing, a full-text digital template needs to be configured. Taking the emergency plan for hazardous chemicals as an example, for Label-1, the matching rule can be: starting with a table of contents character, fuzzy matching characters such as "organization", "organizational system", and "organizational structure", with a unified output of: "organizational system"; for Label-1.1, the matching rule can be: starting with a table of contents character, fuzzy matching characters such as "command center" and "responsibility", with a unified output of: "command responsibility". After configuring the full-text digital template, granularity parameters will also be set, for example, Label-X-{X...}.

[0099] Step S004: Based on the full-text digitization template, the target corpus is divided into blocks according to the granularity parameters to obtain structured text blocks.

[0100] Understandably, after configuring the full-text digitization template and setting the granularity parameters, the text in the target corpus is divided into blocks. Each block includes a block title and block content. The block title corresponds to the output of the Label, and the block content is the text between two sibling Labels. For example, if the block is set to be granularized by Label-X, then the title of the first block will be the output of Label-1, and the block content will be the content between Label-1 and Label-2, thus obtaining structured text blocks, such as block A, block B, and block C.

[0101] This embodiment selects the target entity annotation structure based on the entity's information hierarchy and granularity requirements; acquires text data, and annotates the text data according to the target entity annotation structure based on a preset annotation strategy to obtain a target corpus; configures a full-text digitization template according to the directory and format features, and sets granularity parameters; divides the target corpus into blocks based on the full-text digitization template and the granularity parameters to obtain structured text blocks. Through the above method, after selecting the target entity annotation structure, annotating the text data according to a preset annotation strategy, configuring a full-text digitization template according to the directory and format features, structuring the text after setting granularity parameters, and then dividing the structured text into blocks, the accuracy of obtaining structured text blocks can be effectively improved.

[0102] For example, to help understand the implementation process of the knowledge graph construction method obtained by combining this embodiment with the above embodiment one, please refer to... Figure 4 , Figure 4 A simplified flowchart of a knowledge graph construction method is provided, specifically:

[0103] After acquiring the text data, the text data is labeled according to the target entity labeling structure based on the preset labeling strategy to construct the target corpus. Then, the text in the target corpus is processed into a structured form, and the structured text is divided into blocks to obtain structured text blocks. A combination strategy is used to determine the entities, that is, the first entity and the second entity are determined by combining entity relationship rules and the preset bidirectional model, respectively. Then, the first entity and the second entity are combined to generate a triple. The triple is written into the graph database and a knowledge graph is constructed.

[0104] It should be noted that the above examples are only for understanding this application and do not constitute a limitation on the knowledge graph construction method of this application. Any simple transformations based on this technical concept are within the protection scope of this application.

[0105] This application also provides a knowledge graph construction apparatus; please refer to... Figure 5 The knowledge graph construction device includes:

[0106] The first determination module 10 is used to determine the first entity based on the entity relationship rules and the structured text block.

[0107] The second determining module 20 is used to determine the second entity based on a preset bidirectional model and structured text blocks.

[0108] The correction module 30 is used to perform dynamic correction based on the conflict characteristics when a conflict is determined to exist based on the character labels in the first entity and the character labels in the second entity, so as to obtain the target entity.

[0109] The construction module 40 is used to construct a knowledge graph based on the first entity and the target entity.

[0110] This embodiment determines a first entity based on entity relationship rules and structured text blocks; it determines a second entity based on a preset bidirectional model and structured text blocks; when a conflict is found between the character tags in the first entity and the character tags in the second entity, dynamic correction is performed based on the conflict features to obtain the target entity; a knowledge graph is constructed based on the first entity and the target entity; through the above method, the first entity and the second entity are determined based on entity relationship rules and a preset bidirectional model and structured text blocks respectively, and then the character tags of the two entities are determined to determine whether there is a conflict. If so, the conflict features are obtained based on the added preset tags, and then the conflicting characters are corrected based on the conflict features, thereby effectively avoiding entity conflicts and improving the quality of the constructed knowledge graph.

[0111] The knowledge graph construction apparatus provided in this application, employing the knowledge graph construction method described in the above embodiments, can solve the technical problem of low quality in existing knowledge graph construction. Compared with the prior art, the beneficial effects of the knowledge graph construction apparatus provided in this application are the same as those of the knowledge graph construction method described in the above embodiments, and other technical features in the knowledge graph construction apparatus are the same as those disclosed in the methods of the above embodiments, and will not be repeated here.

[0112] In one embodiment, the first determining module 10 is further configured to select a target entity annotation structure based on the information hierarchy and granularity requirements of the entity; acquire text data, annotate the text data according to the target entity annotation structure based on a preset annotation strategy to obtain a target corpus; configure a full-text digitization template according to the directory and format features, and set granularity parameters; and divide the target corpus into blocks based on the full-text digitization template and the granularity parameters to obtain structured text blocks.

[0113] In one embodiment, the first determining module 10 is further configured to: acquire the attribute tendency of the structured text block; set entity relationship rules for the structured text block on a rule device according to the attribute tendency; perform entity matching based on the entity relationship rules and the structured text block; generate a first triplet based on the entity matching result and write the first triplet to a graph database; label the data in the graph database according to the entity relationship rules and generate a tag vector based on each labeled character; and determine a first entity based on the tag vector and the entity matching result.

[0114] In one embodiment, the second determining module 20 is further configured to encode the structured text block from multiple dimensions to obtain entity word vectors; generate character label probability vectors based on the entity word vectors using a preset bidirectional model; determine the constraint relationships between character labels based on the preset bidirectional model and Chinese grammar rules; construct a state transition matrix based on the constraint relationships; calculate the probability of each character belonging to each label based on the sentence sequence, the state transition matrix, and the character label probability vectors; determine each character label based on the probability of each character belonging to each label; and generate a second entity based on each character label and the characters of the structured text block.

[0115] In one embodiment, the second determining module 20 is further configured to obtain character tags in the second entity; when both the character tags in the first entity and the character tags in the second entity point to a preset tag, compare the next character tag; when the character tags in the second entity exist and the character tags in the first entity do not exist, determine a new entity; generate a second triplet based on the new entity, and write the second triplet to the graph database.

[0116] In one embodiment, the correction module 30 is further configured to: determine whether a conflict exists based on the character labels in the first entity and the character labels in the second entity; if so, obtain conflict features based on added preset labels; randomly extract a specified proportion of conflict characters based on the conflict features and determine the proportion of the conflict characters in the original character set; when the proportion is greater than or equal to a preset conflict character correction threshold, calculate correction characters based on the proportion and correction proportion; perform dynamic correction based on the correction characters to obtain a target conflict character set; modify the preprocessing conditions of the first task in the preset bidirectional model based on the target conflict character set; perform a new round of model training based on the modified preprocessing conditions and correction rounds; and determine the target entity based on the new preset bidirectional model when the new proportion is less than the preset conflict character correction threshold.

[0117] This application provides a knowledge graph construction device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the knowledge graph construction method in Embodiment 1 above.

[0118] The following is for reference. Figure 6 The diagram illustrates a structural schematic suitable for implementing the knowledge graph construction device of the embodiments of this application. The knowledge graph construction device in the embodiments of this application may include, but is not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Description), PMPs (Portable Media Players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and fixed terminals such as digital TVs and desktop computers. Figure 6 The knowledge graph construction device shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of this application.

[0119] like Figure 6As shown, the knowledge graph construction device may include a processing unit 1001 (e.g., a central processing unit, a graphics processing unit, etc.) that can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1002 or a program loaded from a storage device 1003 into a random access memory (RAM) 1004. The RAM 1004 also stores various programs and data required for the operation of the knowledge graph construction device. The processing unit 1001, ROM 1002, and RAM 1004 are interconnected via a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Typically, the following systems can be connected to the I / O interface 1006: input devices 1007 including, for example, a touchscreen, touchpad, keyboard, mouse, image sensor, microphone, accelerometer, gyroscope, etc.; output devices 1008 including, for example, a liquid crystal display (LCD), speaker, vibrator, etc.; storage devices 1003 including, for example, magnetic tape, hard disk, etc.; and communication devices 1009. Communication device 1009 allows the knowledge graph building device to communicate wirelessly or wiredly with other devices to exchange data. While the figure shows knowledge graph building devices with various systems, it should be understood that implementing or having all of the systems shown is not required. More or fewer systems may be implemented alternatively.

[0120] Specifically, according to the embodiments disclosed in this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments disclosed in this application 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, or installed from storage device 1003, or installed from ROM 1002. When the computer program is executed by processing device 1001, it performs the functions defined in the methods of the embodiments disclosed in this application.

[0121] The knowledge graph construction device provided in this application, employing the knowledge graph construction method described in the above embodiments, can solve the technical problem of low quality in existing knowledge graph construction. Compared with the prior art, the beneficial effects of the knowledge graph construction device provided in this application are the same as those of the knowledge graph construction method described in the above embodiments, and other technical features in this knowledge graph construction device are the same as those disclosed in the previous embodiment method, and will not be repeated here.

[0122] It should be understood that the various parts disclosed in this application can be implemented using hardware, software, firmware, or a combination thereof. In the description of the above embodiments, specific features, structures, materials, or characteristics can be combined in any suitable manner in one or more embodiments or examples.

[0123] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

[0124] This application provides a computer-readable storage medium having computer-readable program instructions (i.e., a computer program) stored thereon, which are used to execute the knowledge graph construction method in the above embodiments.

[0125] The computer-readable storage medium provided in this application may be, for example, a USB flash drive, but is not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to: electrical connections with one or more wires, portable computer disks, hard disks, 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 devices, magnetic storage devices, or any suitable combination thereof. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, system, or device. The program code contained on the computer-readable storage medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination thereof.

[0126] The aforementioned computer-readable storage medium may be included in the knowledge graph construction device; or it may exist independently and not be assembled into the knowledge graph construction device.

[0127] Computer program code for performing the operations of this application 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 can be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0128] 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 application. 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.

[0129] The modules described in the embodiments of this application can be implemented in software or hardware. The names of the modules do not necessarily limit the functionality of the unit itself.

[0130] The readable storage medium provided in this application is a computer-readable storage medium that stores computer-readable program instructions (i.e., a computer program) for executing the above-described knowledge graph construction method, which can solve the technical problem of low quality in existing knowledge graph construction. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in this application are the same as the beneficial effects of the knowledge graph construction method provided in the above embodiments, and will not be repeated here.

[0131] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the knowledge graph construction method described above.

[0132] The computer program product provided in this application can solve the technical problem of low quality in the construction of knowledge graphs in the prior art. Compared with the prior art, the beneficial effects of the computer program product provided in this application are the same as the beneficial effects of the knowledge graph construction method provided in the above embodiments, and will not be repeated here.

[0133] The above description is only a part of the embodiments of this application and does not limit the patent scope of this application. All equivalent structural transformations made under the technical concept of this application and using the contents of the specification and drawings of this application, or direct / indirect applications in other related technical fields, are included in the patent protection scope of this application.

Claims

1. A method for constructing a knowledge graph, characterized in that, The method includes: The first entity is determined based on the entity relationship rules and structured text blocks. The second entity is determined based on a pre-defined bidirectional model using structured text blocks; When a conflict is determined to exist based on the character tags in the first entity and the character tags in the second entity, dynamic correction is performed based on the conflict characteristics to obtain the target entity; A knowledge graph is constructed based on the first entity and the target entity.

2. The method as described in claim 1, characterized in that, Before the step of determining the first entity based on structured text blocks according to entity relationship rules, the method further includes: Select the target entity annotation structure based on the information hierarchy and granularity requirements of the entity; Obtain text data, and annotate the text data according to the target entity annotation structure based on a preset annotation strategy to obtain a target corpus; Configure the full-text digitization template based on the table of contents and format features, and set the granularity parameters; Based on the full-text digitization template, the target corpus is divided into blocks according to the granularity parameters to obtain structured text blocks.

3. The method as described in claim 1, characterized in that, The step of determining the first entity based on entity relationship rules according to structured text blocks includes: Obtain the attribute tendencies of the structured text block; Based on the attribute tendency, set entity relationship rules for the structured text block on the rule device; Entity matching is performed based on the structured text blocks according to the entity relationship rules. The first triplet is generated based on the entity matching results and written to the graph database; The data in the graph database is labeled according to the entity relationship rules, and a label vector is generated based on each labeled character; The first entity is determined based on the label vector and the entity matching result.

4. The method as described in claim 1, characterized in that, The step of determining the second entity based on a preset bidirectional model and structured text blocks includes: The structured text block is encoded from multiple dimensions to obtain entity word vectors; Based on a preset bidirectional model, a character tag probability vector is generated according to the entity word vector; Based on a pre-defined bidirectional model, the constraint relationships between character annotations are determined according to Chinese grammar rules; Construct a state transition matrix based on the aforementioned constraints; Based on the sentence sequence, the probability of each character belonging to each label is calculated according to the state transition matrix and the character label probability vector; The label for each character is determined based on the probability that each character belongs to each label. A second entity is generated based on the character tags and the characters of the structured text block.

5. The method according to any one of claims 1 to 4, characterized in that, The step of dynamically correcting the conflict based on the conflict characteristics to obtain the target entity when a conflict is determined to exist based on the character tags in the first entity and the character tags in the second entity includes: Determine whether a conflict exists based on the character tags in the first entity and the character tags in the second entity; If so, then obtain the conflict features based on the added preset labels; Based on the conflict characteristics, a specified proportion of conflicting characters are randomly selected, and the proportion of the conflicting characters in the original character set is determined. When the ratio is greater than or equal to the preset conflict character correction threshold, the correction character is calculated based on the ratio and the correction ratio; Dynamic correction is performed based on the correction characters to obtain the target conflict character set; Modify the preprocessing conditions of the first task in the preset bidirectional model according to the target conflict character set; A new round of model training will be conducted based on the modified preprocessing conditions and calibration rounds; When the new proportion is less than the preset conflict character correction threshold, the target entity is determined based on the new preset bidirectional model.

6. The method according to any one of claims 1 to 4, characterized in that, Following the step of determining the second entity based on a pre-defined bidirectional model and structured text blocks, the method further includes: Retrieve the character tags from the second entity; When both the character tags in the first entity and the character tags in the second entity point to a preset tag, compare the next character tag; When the character label exists in the second entity and the character label does not exist in the first entity, a new entity is determined; A second triplet is generated based on the new entity, and the second triplet is written to the graph database.

7. A knowledge graph construction device, characterized in that, The device includes: The first determination module is used to determine the first entity based on the entity relationship rules and the structured text block. The second determination module is used to determine the second entity based on a pre-set bidirectional model and structured text blocks; The correction module is used to dynamically correct the target entity based on the conflict characteristics when a conflict is determined to exist based on the character labels in the first entity and the character labels in the second entity. The construction module is used to construct a knowledge graph based on the first entity and the target entity.

8. A knowledge graph construction device, characterized in that, The device includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, the computer program being configured to implement the steps of the knowledge graph construction method as described in any one of claims 1 to 6.

9. A storage medium, characterized in that, The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, it implements the steps of the knowledge graph construction method as described in any one of claims 1 to 6.

10. A computer program product, characterized in that, The computer program product includes a computer program that, when executed by a processor, implements the steps of the knowledge graph construction method as described in any one of claims 1 to 6.