Knowledge graph construction method and device, computer device, and storage medium
By acquiring the original text and preset word segmentation rules, preprocessing it using word segmentation algorithms, and receiving modification instructions to adjust the knowledge graph, the problem of low accuracy caused by a single algorithm is solved, and high accuracy and reliability of the knowledge graph are achieved.
Patent Information
- Application Number
- CN202011566137.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-12-25
- Publication Date
- 2026-01-09
- Estimated Expiration
- 2040-12-25
AI Technical Summary
Existing knowledge graph construction methods use a single text recognition algorithm, resulting in low accuracy of recognition results and an inability to obtain highly accurate knowledge graphs.
By acquiring the original text and preset word segmentation rules, preprocessing is performed using word segmentation algorithms, receiving modification instructions, and adjusting the first knowledge graph according to modification instructions from different sources. By combining modifications from multiple input sources, the accuracy of the knowledge graph is improved.
By combining subjective modifications with multiple input sources, the accuracy and reliability of the knowledge graph were improved, thus enhancing its overall accuracy.
Smart Images

Figure CN114691811B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present disclosure relates to the technical field of computer, and particularly relates to a knowledge graph construction method and device, computer equipment and a storage medium. BACKGROUND
[0002] The existing knowledge graph construction is usually implemented by using a single text recognition algorithm, but the recognition result accuracy of the single text recognition algorithm is low, and an accurate knowledge graph cannot be obtained. SUMMARY
[0003] In order to solve the above technical problems, the present disclosure provides a knowledge graph construction method and device, computer equipment and a storage medium.
[0004] In a first aspect, the present disclosure provides a knowledge graph construction method, comprising:
[0005] obtaining an original text and a preset segmentation rule;
[0006] preprocessing the original text according to a segmentation algorithm and the preset segmentation rule to obtain a first knowledge graph;
[0007] receiving a modification instruction;
[0008] modifying the first knowledge graph according to the modification instruction to obtain a target knowledge graph.
[0009] Optionally, the preprocessing the original text according to a segmentation algorithm and the preset segmentation rule to obtain a first knowledge graph comprises:
[0010] preprocessing the original text according to each segmentation algorithm and the preset segmentation rule to obtain a corresponding preprocessing knowledge graph, each segmentation in the preprocessing knowledge graph corresponding to a word index array;
[0011] merging each preprocessing knowledge graph to obtain the first knowledge graph.
[0012] Optionally, the knowledge graph comprises a plurality of nodes and relationships between the nodes, and the merging each preprocessing knowledge graph to obtain the first knowledge graph comprises:
[0013] in each preprocessing knowledge graph, the appearance probability of each node is counted to obtain a corresponding first node probability;
[0014] in each preprocessing knowledge graph, the appearance probability of each relationship is counted to obtain a corresponding first relationship probability;
[0015] According to the node corresponding to the first node probability satisfying the first preset condition and the relationship corresponding to the first relationship probability satisfying the second preset condition, the first knowledge graph is obtained.
[0016] Optionally, the modification instruction includes a first modification instruction and a second modification instruction, the first modification instruction and the second modification instruction correspond to different input sources, and the modification of the first knowledge graph according to the modification instruction to obtain a target knowledge graph includes:
[0017] When the first modification instruction is received, the first knowledge graph is modified according to the first modification instruction to obtain a second knowledge graph;
[0018] The second knowledge graph is modified according to the second modification instruction to obtain the target knowledge graph.
[0019] Optionally, when the first modification instruction is not received, the method further includes:
[0020] The first knowledge graph is modified according to the second modification instruction to obtain the target knowledge graph.
[0021] Optionally, the modification of the first knowledge graph according to the first modification instruction to obtain a second knowledge graph includes:
[0022] The first knowledge graph is modified according to a plurality of first modification instructions to obtain a corresponding modified knowledge graph;
[0023] The second knowledge graph is obtained by merging each modified knowledge graph.
[0024] Optionally, the knowledge graph includes a plurality of nodes and relationships between the nodes, and the merging of each modified knowledge graph to obtain the second knowledge graph includes:
[0025] In each modified knowledge graph, a second node probability corresponding to the appearance probability of each node is obtained.
[0026] In each modified knowledge graph, a second relationship probability corresponding to the appearance probability of each relationship is obtained.
[0027] According to the node corresponding to the second node probability satisfying the third preset condition and the relationship corresponding to the second relationship probability satisfying the fourth preset condition, the second knowledge graph is obtained.
[0028] In a second aspect, the present disclosure provides a knowledge graph construction device, comprising:
[0029] A text acquisition module is configured to acquire original text and a preset segmentation rule.
[0030] a preprocessing module configured to preprocess the original text according to a word segmentation algorithm and the preset word segmentation rule to obtain a first knowledge graph;
[0031] an instruction receiving module configured to receive a modification instruction;
[0032] a modification module configured to modify the first knowledge graph according to the modification instruction to obtain a target knowledge graph.
[0033] A computer device comprises a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the following steps when executing the computer program:
[0034] obtaining an original text and a preset word segmentation rule;
[0035] preprocessing the original text according to a word segmentation algorithm and the preset word segmentation rule to obtain a first knowledge graph;
[0036] receiving a modification instruction;
[0037] modifying the first knowledge graph according to the modification instruction to obtain a target knowledge graph.
[0038] A computer readable storage medium has a computer program stored thereon, and the computer program is executed by a processor to implement the following steps:
[0039] obtaining an original text and a preset word segmentation rule;
[0040] preprocessing the original text according to a word segmentation algorithm and the preset word segmentation rule to obtain a first knowledge graph;
[0041] receiving a modification instruction;
[0042] modifying the first knowledge graph according to the modification instruction to obtain a target knowledge graph.
[0043] The knowledge graph construction method, device, computer device, and storage medium, the method comprising: obtaining an original text and a preset word segmentation rule; preprocessing the original text according to a word segmentation algorithm and the preset word segmentation rule to obtain a first knowledge graph; receiving a modification instruction; and modifying the first knowledge graph according to the modification instruction to obtain a target knowledge graph. Based on the above method, the first knowledge graph preprocessed by the word segmentation algorithm is modified subjectively, and the modification of multiple input sources is combined to make up for the deficiencies of algorithm recognition, thereby improving the accuracy of the knowledge graph. BRIEF DESCRIPTION OF DRAWINGS
[0044] The accompanying drawings, which are incorporated into and constitute a part of this specification, illustrate embodiments consistent with the present application and serve to explain the principles of the present application together with the specification.
[0045] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the accompanying drawings required by the embodiments or the prior art description will be briefly introduced as follows. Obviously, for those of ordinary skill in the art, the other drawings can be obtained based on these drawings without any creative effort.
[0046] Figure 1 An application environment diagram of the knowledge graph construction method in an embodiment;
[0047] Figure 2 A flowchart of the knowledge graph construction method in an embodiment;
[0048] Figure 3 An interface display diagram of the knowledge graph construction in an embodiment;
[0049] Figure 4 An interface display diagram of the knowledge graph construction in an embodiment;
[0050] Figure 5 An interface display diagram of the knowledge graph construction in an embodiment;
[0051] Figure 6 An interface display diagram of the knowledge graph construction in an embodiment;
[0052] Figure 7 A structural block diagram of the knowledge graph construction device in an embodiment;
[0053] Figure 8 An internal structure diagram of the computer device in an embodiment. DETAILED DESCRIPTION
[0054] In order to make the objects, technical solutions and advantages of the embodiments of the present disclosure clearer, the technical solutions in the embodiments of the present disclosure will be described clearly and completely below with reference to the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only a part of the embodiments of the present disclosure, rather than all the embodiments of the present disclosure. Based on the embodiments in the present disclosure, all the other embodiments obtained by those of ordinary skill in the art without any creative effort fall within the protection scope of the present disclosure.
[0055] Figure 1 An application environment diagram of the knowledge graph construction method in an embodiment. Refer to Figure 1This knowledge graph construction method is applied to a knowledge graph construction system. The system includes a terminal 110 and a server 120. The terminal 110 and server 120 are connected via a network. The terminal 110 can be a desktop terminal or a mobile terminal; a mobile terminal can be at least one of a mobile phone, tablet, or laptop. The server 120 can be a standalone server or a server cluster consisting of multiple servers.
[0056] In one embodiment, Figure 2 This is a flowchart illustrating a knowledge graph construction method in one embodiment, with reference to... Figure 2 This provides a method for constructing knowledge graphs. This embodiment mainly applies this method to the above-mentioned... Figure 1 Taking terminal 110 as an example, the knowledge graph construction method specifically includes the following steps:
[0057] Step S210: Obtain the original text and preset word segmentation rules.
[0058] Specifically, the original text is text that has not undergone any recognition processing. The original text consists of multiple sentences, each composed of words. Preset word segmentation rules are used to determine the data structure for storing the segmentation results. These rules are generated through a configured open-defined template and include word tagging rules, tag types (Tag), applicable ranges (Range), and word extraction rules (RangeContent). Specific word tagging rules can include word-based tagging (WordIndex) and character-based tagging (CharIndexArray). Tag types can include dates, names of people, place names, nouns, verbs, etc. The applicable range determines the extraction scope of the segmented words; for example, ... Figure 3 As shown, the original text is of the legal type. If the applicable scope of word segmentation is law, then only the main sentence components related to law will be extracted during word segmentation. If the applicable scope of word segmentation is none, it means that the extraction scope of word segmentation is not limited, and open word segmentation is performed without domain restrictions. The word segmentation extraction rule is a rule for selecting word segments that match the preset word segments. The preset word segments are common phrases corresponding to the applicable scope of word segmentation. For example, when the applicable scope of word segmentation is law, the preset word segments corresponding to the word segmentation extraction rule include agreement, dispute, letter of understanding, defendant, defense lawyer, etc.
[0059] Step S220: Preprocess the original text according to the word segmentation algorithm and the preset word segmentation rules to obtain the first knowledge graph.
[0060] Specifically, sentence stems are extracted from the original text based on word segmentation algorithms and preset word segmentation rules. Each sentence stem includes a subject, predicate, and object. The extracted sentence stems form the first knowledge graph, which is then referenced. Figure 4, the first knowledge graph includes multiple phrases, and each phrase corresponds to a character index array or a word segmentation index number. If each phrase corresponds to a character index array, it means that during word segmentation, it is marked by characters, and the phrase corresponds to an array of the same number of digits. For example, as Figure 3 shown, the character index array corresponding to the first phrase "trial" in the first row is "12"; if each phrase corresponds to a word segmentation index number, it means that during word segmentation, it is marked by words, and the phrase corresponds to an index number, then the word segmentation index number corresponding to "trial" is "1". In this embodiment, the word segmentation annotation rule is selected to be marked by characters, which is convenient for subsequent splitting of the word segmentation by characters according to the modification instruction. And each phrase has a corresponding annotation type. For example, Figure 4 "Li Gu" in
[0061] Step S230, receive a modification instruction.
[0062] Specifically, the modification instruction corresponds to instructions from at least one input source, and each input source represents a user. The user can specifically be an ordinary user and / or an expert user. Since the ideas of each user are different, the corresponding modification instructions may be different. The modification instruction includes instructions corresponding to operations such as merging, deleting, modifying, commenting, backing, pasting, and splitting.
[0063] Step S240, modify the first knowledge graph according to the modification instruction to obtain a target knowledge graph.
[0064] Specifically, modify the first knowledge graph according to the modification instructions corresponding to each input source to obtain the final target knowledge graph. By modifying in multiple dimensions, the accuracy of the target knowledge graph is improved. For example, due to the low accuracy of the word segmentation algorithm, Figure 4 "Wu Tiesuo" in Figure 5 is defined as a personal name by the word segmentation algorithm and the preset word segmentation rules. According to the modification instruction, "Wu Tiesuo" is split and modified into
[0065] "Wu Tie" in
[0066] Specifically, word segmentation algorithms are divided into dictionary-based segmentation algorithms and statistical machine learning algorithms. These algorithms can include Ansj, LTP, and THULAC segmentation algorithms, among others. Each algorithm, combined with predefined segmentation rules, preprocesses the original text to obtain a corresponding preprocessed knowledge graph. This preprocessed knowledge graph includes multiple preprocessed word segments, each with a corresponding annotation type and character index array. The preprocessed knowledge graphs obtained by each segmentation algorithm may differ. By statistically combining the preprocessed knowledge graphs from various algorithms, a first knowledge graph is obtained. The accuracy of this first knowledge graph is higher than that of the preprocessed knowledge graph obtained using a single segmentation algorithm.
[0067] In one embodiment, the knowledge graph includes multiple nodes and the relationships between the nodes. In each preprocessed knowledge graph, the occurrence probability of each node is calculated to obtain the corresponding first node probability. In each preprocessed knowledge graph, the occurrence probability of each relationship is calculated to obtain the corresponding first relationship probability. The first knowledge graph is obtained based on the nodes corresponding to the first node probabilities that satisfy the first preset condition and the relationships corresponding to the first relationship probabilities that satisfy the second preset condition.
[0068] Specifically, a knowledge graph includes multiple phrases, with one node corresponding to one noun phrase and one relation corresponding to one verb phrase, for example... Figure 5 The term "reached" in this context refers to the relationship between "both parties" and "agreement." The probability of the first node corresponding to each node is calculated in each preprocessed knowledge graph. For example, if there are five word segmentation algorithms, there are five corresponding preprocessed knowledge graphs. If "defendant" appears in three preprocessed knowledge graphs and "defendant" appears in two preprocessed knowledge graphs, then the probability of the first node corresponding to the "defendant" node is 60%. If the relationship "reached" appears in five preprocessed knowledge graphs, then the probability of the first relationship corresponding to "reached" is 100%. The first preset condition is that the probability of the first node is greater than 50%, and the second preset condition is that the probability of the first relationship is greater than 50%. The first knowledge graph is formed based on the nodes and relationships that satisfy the first and second preset conditions; that is, nodes and relationships with high probabilities are selected to form the first knowledge graph.
[0069] In one embodiment, the modification instruction includes a first modification instruction and a second modification instruction, the first modification instruction and the second modification instruction correspond to different input sources. When the first modification instruction is received, the first knowledge graph is modified according to the first modification instruction to obtain a second knowledge graph; the second knowledge graph is modified according to the second modification instruction to obtain the target knowledge graph.
[0070] Specifically, the first modification instruction corresponds to a modification instruction of at least one ordinary user, and the second modification instruction corresponds to a modification instruction of at least one expert user; when the first modification instruction is received, the first knowledge graph is modified according to the first modification instruction to obtain a second knowledge graph, and the second knowledge graph is modified by the user on the basis of the first knowledge graph, thereby improving the accuracy of the first knowledge graph. Since the expert user is more professional than the ordinary user, the expert user modifies on the basis of the second knowledge graph, thereby obtaining a target knowledge graph with higher accuracy.
[0071] For example, Figure 6 The "push" in the sentence "Li stock pushes Wu Tie" is a relationship obtained by modification according to the modification instruction of the expert user, so as to obtain the sentence stem "Li stock-push-Wu Tie", thereby obtaining the updated target knowledge graph.
[0072] In one embodiment, the second knowledge graph is compared with the first knowledge graph, and the difference between the second knowledge graph and the first knowledge graph is used to correct the segmentation algorithm and the preset segmentation rule, thereby improving the accuracy of the segmentation algorithm and improving the accuracy of the knowledge graph in the next construction of the knowledge graph.
[0073] In one embodiment, the target knowledge graph is compared with the second knowledge graph, and the difference between the target knowledge graph and the second knowledge graph is displayed, which can provide a modification reference for the ordinary user, thereby improving the accuracy of the knowledge graph obtained by the ordinary user after modification. If the ordinary user has objections to the target knowledge graph, the expert user can be informed through email or other contact methods, and the expert user and the ordinary user form mutual feedback, thereby improving the accuracy and reliability of the final knowledge graph.
[0074] In one embodiment, when the first modification instruction is not received, the first knowledge graph is modified according to the second modification instruction to obtain the target knowledge graph.
[0075] Specifically, if there is no ordinary user to modify the first knowledge graph or the ordinary user does not modify the first knowledge graph, the first knowledge graph is modified according to the modification instruction of the expert user to obtain a target knowledge graph with higher accuracy.
[0076] In one embodiment, the first knowledge graph is modified according to a plurality of first modification instructions to obtain corresponding modified knowledge graphs; and the modified knowledge graphs are combined to obtain the second knowledge graph.
[0077] Specifically, when there are multiple modification instructions corresponding to ordinary users, the first knowledge graph is modified according to each modification instruction to obtain the modified knowledge graph corresponding to each modification instruction. There may be differences between the various modified knowledge graphs. The various modified knowledge graphs are statistically combined to obtain the second knowledge graph. The accuracy of the second knowledge graph is higher than that of the preprocessed knowledge graph obtained according to the modification instruction corresponding to a single ordinary user.
[0078] In one embodiment, the knowledge graph includes multiple nodes and the relationships between the nodes. In each modified knowledge graph, the occurrence probability of each node is calculated to obtain the corresponding second node probability. In each modified knowledge graph, the occurrence probability of each relationship is calculated to obtain the corresponding second relationship probability. The second knowledge graph is obtained based on the nodes corresponding to the second node probabilities that satisfy the third preset condition and the relationships corresponding to the second relationship probabilities that satisfy the fourth preset condition.
[0079] Specifically, the knowledge graph includes multiple phrases. One node corresponds to one noun phrase, and one relation corresponds to one verb phrase. For example, if there are modification instructions from five ordinary users that modify the first knowledge graph, resulting in a modified knowledge graph, and if "defendant" appears in four of the modified knowledge graphs and "defendant is" appears in one of them, then the probability of the second node corresponding to "defendant" is 80%. If "hit" appears in five of the modified knowledge graphs, then the probability of the second relation corresponding to "hit" is 100%. The third preset condition is that the probability of the second node is greater than 50%, and the fourth preset condition is that the probability of the second relation is greater than 50%. The second knowledge graph is formed based on the nodes and relations that satisfy the third and fourth preset conditions, that is, nodes and relations with high probabilities are selected to form the second knowledge graph.
[0080] Figure 2 This is a flowchart illustrating a knowledge graph construction method in one embodiment. It should be understood that, although... Figure 2 The steps in the flowchart are shown sequentially as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order in which these steps are executed, and they can be performed in other orders. Figure 2 At least some of the steps in the process may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least some of the sub-steps or stages of other steps.
[0081] In one embodiment, such as Figure 7As shown, a knowledge graph construction apparatus is provided, comprising:
[0082] a text acquisition module 310 configured to acquire original text and a preset segmentation rule;
[0083] a preprocessing module 320 configured to preprocess the original text according to a segmentation algorithm and the preset segmentation rule to obtain a first knowledge graph;
[0084] an instruction receiving module 330 configured to receive a modification instruction;
[0085] a modification module 340 configured to modify the first knowledge graph according to the modification instruction to obtain a target knowledge graph.
[0086] In an embodiment, the preprocessing module 320 comprises:
[0087] a preprocessing unit configured to preprocess the original text according to each segmentation algorithm and the preset segmentation rule to obtain a corresponding preprocessing knowledge graph, each segmentation in the preprocessing knowledge graph corresponding to a word index array;
[0088] a first merging unit configured to merge each preprocessing knowledge graph to obtain the first knowledge graph.
[0089] In an embodiment, a knowledge graph comprises a plurality of nodes and relationships between the nodes, and the first merging unit comprises:
[0090] a first node statistical unit configured to count the occurrence probability of each node in each preprocessing knowledge graph to obtain a corresponding first node probability;
[0091] a first relationship statistical unit configured to count the occurrence probability of each relationship in each preprocessing knowledge graph to obtain a corresponding first relationship probability;
[0092] a first graph generation unit configured to obtain the first knowledge graph according to the node corresponding to the first node probability satisfying a first preset condition and the relationship corresponding to the first relationship probability satisfying a second preset condition.
[0093] In an embodiment, the modification instruction comprises a first modification instruction and a second modification instruction, the first modification instruction and the second modification instruction corresponding to different input sources, and the modification module 340 comprises:
[0094] a first modification unit configured to modify the first knowledge graph according to the first modification instruction to obtain a second knowledge graph when the first modification instruction is received;
[0095] A second modification unit is configured to modify the second knowledge graph according to the second modification instruction to obtain the target knowledge graph.
[0096] In one embodiment, the modification module 340 further includes:
[0097] A third modification unit is configured to modify the first knowledge graph according to the second modification instruction to obtain the target knowledge graph when no first modification instruction is received.
[0098] In one embodiment, the first modification unit includes:
[0099] A modified graph generation unit is configured to modify the first knowledge graph according to a plurality of first modification instructions to obtain a corresponding modified knowledge graph.
[0100] A second merging unit is configured to merge each modified knowledge graph to obtain the second knowledge graph.
[0101] In one embodiment, the knowledge graph includes a plurality of nodes and relationships between the nodes, and the second merging unit includes:
[0102] A second node statistics unit is configured to count the occurrence probability of each node in each modified knowledge graph to obtain a corresponding second node probability.
[0103] A second relationship statistics unit is configured to count the occurrence probability of each relationship in each modified knowledge graph to obtain a corresponding second relationship probability.
[0104] A second graph generation unit is configured to obtain the second knowledge graph according to the node corresponding to the second node probability satisfying a third preset condition and the relationship corresponding to the second relationship probability satisfying a fourth preset condition.
[0105] Figure 8 An internal structure diagram of a computer device in one embodiment is shown. The computer device can specifically be a terminal 110 (or a server 120) in Figure 1 as shown in FIG. 1. Figure 8As shown in the figure, the computer device includes a processor, a memory, a network interface, an input device and a display screen connected through a system bus. The memory includes a non-volatile storage medium and an internal memory. The non-volatile storage medium of the computer device stores an operating system, and can also store a computer program which, when executed by the processor, can enable the processor to implement the knowledge graph construction method. The internal memory can also store a computer program which, when executed by the processor, can enable the processor to execute the knowledge graph construction method. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer overlaid on the display screen, or a key, trackball or touchpad arranged on the shell of the computer device, or an external keyboard, touchpad or mouse, etc.
[0106] Those skilled in the art can understand that, Figure 8 The structure shown in the figure is only a block diagram of part of the structure related to the present disclosure, and does not constitute a limitation on the computer device to which the present disclosure is applied. A specific computer device can include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0107] In one embodiment, the knowledge graph construction apparatus provided by the present disclosure can be implemented in the form of a computer program which can run on a computer device as shown in the figure. The memory of the computer device can store various program modules constituting the knowledge graph construction apparatus, such as the text acquisition module 310, the preprocessing module 320, the instruction receiving module 330 and the modification module 340 shown in the figure. The computer program constituted by the various program modules enables the processor to execute the steps in the knowledge graph construction method of each embodiment of the present disclosure described in the specification. Figure 8 Figure 7 The computer device can execute the steps in the knowledge graph construction method of each embodiment of the present disclosure described in the specification by executing the text acquisition module 310, the preprocessing module 320, the instruction receiving module 330 and the modification module 340 in the knowledge graph construction apparatus as shown in the figure.
[0108] Figure 8 The computer device can execute the steps in the knowledge graph construction method of each embodiment of the present disclosure described in the specification by executing the text acquisition module 310, the preprocessing module 320, the instruction receiving module 330 and the modification module 340 in the knowledge graph construction apparatus as shown in the figure. Figure 7 The computer device can execute the steps in the knowledge graph construction method of each embodiment of the present disclosure described in the specification by executing the text acquisition module 310, the preprocessing module 320, the instruction receiving module 330 and the modification module 340 in the knowledge graph construction apparatus as shown in the figure.
[0109] In one embodiment, a computer device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, when the processor executes the computer program, the following steps are implemented: obtaining original text and preset word segmentation rules; pre-processing the original text according to a word segmentation algorithm and the preset word segmentation rules to obtain a first knowledge graph; receiving a modification instruction; modifying the first knowledge graph according to the modification instruction to obtain a target knowledge graph.
[0110] The processor executing the program stored in the memory can also implement the method steps to be implemented by any one of the above embodiments.
[0111] In one embodiment, a computer readable storage medium is provided, having a computer program stored thereon, when the computer program is executed by a processor, the following steps are implemented: obtaining original text and preset word segmentation rules; pre-processing the original text according to a word segmentation algorithm and the preset word segmentation rules to obtain a first knowledge graph; receiving a modification instruction; modifying the first knowledge graph according to the modification instruction to obtain a target knowledge graph.
[0112] The computer program executed by the processor can also implement the method steps to be implemented by any one of the above embodiments.
[0113] A person of ordinary skill in the art can understand that all or part of the processes in the above embodiments can be completed by a computer program instructing related hardware, and the program can be stored in a non-volatile computer readable storage medium. When the program is executed, it can include the processes of the above embodiments. Any reference to memory, storage, database or other medium used in the embodiments provided by the present disclosure can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration but not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0114] It has to be noted that, in the present document, relational terms are intended only to convey a possible relationship between elements or
[0115] The foregoing is considered as illustrative only of the principles of the application. Numerous modifications and changes will readily occur to those skilled in the art, which modifications and changes are to be understood as intended to be encompassed by the general scope of the application. Accordingly, the application is not to be limited to the above described or illustrated embodiments, but is intended to encompass all embodiments consistent with the principles of the application.
Claims
1. A method for constructing a knowledge graph, characterized in that, The method comprises: obtaining original text and a preset word segmentation rule; preprocessing the original text according to a word segmentation algorithm and the preset word segmentation rule to obtain a first knowledge graph, comprising: preprocessing the original text according to each word segmentation algorithm and the preset word segmentation rule to obtain a corresponding preprocessing knowledge graph, each word segmentation in the preprocessing knowledge graph corresponding to a character index array; merging each preprocessing knowledge graph to obtain the first knowledge graph; wherein the knowledge graph comprises a plurality of nodes and relationships between the nodes, and the merging of each preprocessing knowledge graph to obtain the first knowledge graph comprises: in each preprocessing knowledge graph, the appearance probability of each node is counted to obtain a corresponding first node probability; in each preprocessing knowledge graph, the appearance probability of each relationship is counted to obtain a corresponding first relationship probability; the first knowledge graph is obtained according to the nodes corresponding to the first node probability satisfying a first preset condition and the relationships corresponding to the first relationship probability satisfying a second preset condition; receiving a modification instruction; modifying the first knowledge graph according to the modification instruction to obtain a target knowledge graph.
2. The method of claim 1, wherein, The modification instruction comprises a first modification instruction and a second modification instruction, the input sources corresponding to the first modification instruction and the second modification instruction are different, and the modification of the first knowledge graph according to the modification instruction to obtain a target knowledge graph comprises: when the first modification instruction is received, the first knowledge graph is modified according to the first modification instruction to obtain a second knowledge graph; the second knowledge graph is modified according to the second modification instruction to obtain the target knowledge graph.
3. The method of claim 2, wherein, When the first modification instruction is not received, the method further comprises: the first knowledge graph is modified according to the second modification instruction to obtain the target knowledge graph.
4. The method of claim 2, wherein, The modification of the first knowledge graph according to the first modification instruction to obtain a second knowledge graph comprises: the first knowledge graph is modified according to a plurality of first modification instructions to obtain a corresponding modified knowledge graph; each modified knowledge graph is merged to obtain the second knowledge graph.
5. The method of claim 4, wherein, The knowledge graph comprises a plurality of nodes and relationships between the nodes, and the merging of each modified knowledge graph to obtain the second knowledge graph comprises: in each modified knowledge graph, the appearance probability of each node is counted to obtain a corresponding second node probability; in each modified knowledge graph, the appearance probability of each relationship is counted to obtain a corresponding second relationship probability; the second knowledge graph is obtained according to the nodes corresponding to the second node probability satisfying a third preset condition and the relationships corresponding to the second relationship probability satisfying a fourth preset condition.
6. A knowledge graph construction apparatus, characterized by comprising: The device comprises: a text acquisition module for obtaining original text and a preset word segmentation rule; a preprocessing module for preprocessing the original text according to a word segmentation algorithm and the preset word segmentation rule to obtain a first knowledge graph; The first knowledge graph is obtained by preprocessing the original text according to a word segmentation algorithm and the preset word segmentation rule, and the preprocessing includes: The original text is preprocessed according to each word segmentation algorithm and the preset word segmentation rule to obtain a corresponding preprocessed knowledge graph, each word segmentation in the preprocessed knowledge graph corresponding to a word index array; The first knowledge graph is obtained by merging each preprocessed knowledge graph; The first knowledge graph is obtained by merging each preprocessed knowledge graph, wherein the knowledge graph includes multiple nodes and relationships between the nodes, and the merging includes: In each preprocessed knowledge graph, the occurrence probability of each node is counted to obtain a corresponding first node probability; In each preprocessed knowledge graph, the occurrence probability of each relationship is counted to obtain a corresponding first relationship probability; The first knowledge graph is obtained according to the nodes corresponding to the first node probability satisfying a first preset condition and the relationships corresponding to the first relationship probability satisfying a second preset condition. An instruction receiving module is configured to receive a modification instruction. A modification module is configured to modify the first knowledge graph according to the modification instruction to obtain a target knowledge graph.
7. A computer device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, The processor executes the computer program to implement the steps of the method in any one of claims 1 to 5.
8. A computer-readable storage medium having stored thereon a computer program, characterized in that, The computer program is executed by the processor to implement the steps of the method in any one of claims 1 to 5.
Citation Information
Patent Citations
Knowledge graph construction method, system and device and storage medium
CN111435367A
Word segmentation data set generation method, device and equipment and storage medium thereof
CN111597807A
Method and device for generating attribute information
CN111797622A