A knowledge graph generation method and device
By analyzing user text data and building a personalized knowledge graph, ChatGPT answers lack of personalization, and the effect of a large language model to better understand user habits and thinking modes and output personalized content.
Patent Information
- Application Number
- CN202411026442.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-30
- Publication Date
- 2024-11-26
- Estimated Expiration
- 2044-07-30
AI Technical Summary
In the future of ChatGPT's popularity, answers based on the same big data lack personalization and are difficult to meet users' unique language habits and thinking needs.
By analyzing the user's target text data, identifying entities and event center words, building triplets, paragraphs, and question-answer knowledge graphs, and fusing these graphs to generate a personalized knowledge graph that conforms to the user's language habits.
This enables the large language model to better analyze the scene and context, output content that better matches the user's language habits and thinking habits, and provides personalized answers.
Smart Images

Figure CN118551770B_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present invention relate to the field of knowledge graph technology, and in particular, to a knowledge graph generation method and device. Background Art
[0002] ChatGPT may be as popular as search engines today in the future, and it will become a tool for most people. This will raise the question of uniqueness, because ChatGPT will only give almost the same answers based on the same big data.
[0003] Knowledge management software is often called the "second brain" or "digital brain". It is a tool that exists between individuals and the Internet. It is also a method of information integration for brain-computer collaboration. In an era when everyone can hand in ChatGPT answers, this tool can enable ChatGPT to hand in a unique answer that belongs to the user. For example, digitize what you think, feel, and read, record, save, and classify them into a knowledge management software, such as Evernote, Onenote, Notion, Logseq, Obsidian, Mem, etc. Since the human brain's memory capacity is very limited, if all information and matters are classified and organized into knowledge management software, the burden on the human brain will be greatly reduced. At the same time, the system can retrieve the information needed by the human brain at any time, and it can be used with a little adjustment, which can increase work efficiency several times. Summary of the invention
[0004] The present invention provides a knowledge graph generation method and device capable of generating a personalized knowledge graph.
[0005] In order to solve the above technical problems, an embodiment of the present invention provides a knowledge graph generation method, including:
[0006] Obtaining target text data, wherein the target text data includes a plurality of text paragraphs;
[0007] Analyzing and identifying the target text data to obtain analysis and identification results, wherein the analysis and identification results include entities and event core words contained in the target text data;
[0008] Constructing a triple knowledge graph based on the analysis and recognition results;
[0009] Determine the event center words contained in each of the text paragraphs based on the analysis and recognition results, and construct a paragraph knowledge graph based on the event center words contained in the text paragraphs;
[0010] Performing content recognition on the plurality of text paragraphs, and generating corresponding question-and-answer data based on the content recognition results;
[0011] Constructing a question-and-answer knowledge graph based on the question-and-answer data;
[0012] Determine, based on the triple knowledge graph, the paragraph knowledge graph, and the question-answer knowledge graph, a first relationship between entities and event central words involved in each graph, and a second relationship between the entity and the text paragraph;
[0013] Based on the first relationship and the second relationship, the triple knowledge graph, the paragraph knowledge graph, and the question-answer knowledge graph are fused to obtain a fused knowledge graph.
[0014] In some embodiments, obtaining the target text data includes:
[0015] Obtain target text data containing user language habits and thinking patterns.
[0016] In some embodiments, obtaining target text data including user language habits and thinking patterns includes:
[0017] Collect one or more data from the user's chat records, text data published on the first platform, comment data in the second platform, and recorded logs to obtain target text data containing the user's language habits and thinking patterns.
[0018] In some embodiments, analyzing and identifying the target text data to obtain an analysis and identification result includes:
[0019] Matching and identifying the target text data based on entities in a preset entity library to determine all entities contained in the target text data;
[0020] The target text data is matched and identified based on the event center words in a preset event center word library to determine all the event center words included in the target text data.
[0021] In some embodiments, the method further comprises:
[0022] Analyze and identify the acquired learning text data to determine all entities and event center words used for learning;
[0023] Deduplication processing is performed on the learning entities and event center words, and term matching is performed on the deduplication-processed learning entities and event center words based on the target term library to determine the target entity and target event center word;
[0024] Building an entity library based on the target entity;
[0025] An event central word vocabulary is constructed based on the target event central word.
[0026] In some embodiments, determining the event center words contained in each of the text paragraphs based on the analysis and recognition results, and constructing a paragraph knowledge graph based on the event center words contained in the text paragraphs, includes:
[0027] Matching the words in each of the text paragraphs based on all the event center words in the analysis and recognition results to determine the event center words contained in each of the text paragraphs;
[0028] Determining the relationship between the event center words contained in the text paragraph based on a plurality of preset relationship data representing the association relationship between different event center words;
[0029] A paragraph knowledge graph is constructed based on the relationship and the event center words contained in the corresponding text paragraphs.
[0030] In some embodiments, performing content recognition on the plurality of text paragraphs and generating corresponding question-and-answer data based on the content recognition results includes:
[0031] Performing content recognition on each of the text paragraphs;
[0032] Generate matching questions and answers based on the recognition results;
[0033] Matching the words in each of the text paragraphs based on all the event center words in the analysis and recognition results to determine the event center words contained in each of the text paragraphs;
[0034] Matching the question and answer corresponding to each text paragraph based on the event core word contained in each text paragraph to determine the event core word involved in the question and answer;
[0035] The question and answer data are formed based on the questions and answers and event core words involved in the questions and answers.
[0036] In some embodiments, determining the first relationship between entities and event central words involved in each graph based on the triple knowledge graph, the paragraph knowledge graph, and the question-answer knowledge graph includes:
[0037] Constructing a prompt template, wherein the prompt template includes a relational word that can be selected to represent the first relation;
[0038] Based on the prompt template, the relational words are determined for the first relations between entities and entities, and entities and event central words involved in the triple knowledge graph, paragraph knowledge graph and question-answer knowledge graph.
[0039] In some embodiments, the text paragraphs include paragraph numbers;
[0040] The second relationship between the entities involved in each graph and the text paragraph is determined based on the triple knowledge graph, the paragraph knowledge graph and the question-answer knowledge graph, including
[0041] Based on the paragraph sequence number of the text paragraph, the entities in the triple knowledge graph, the paragraph knowledge graph and the question-and-answer knowledge graph and the text paragraphs to which the entities belong are connected and fused to determine the second relationship between the entities and the text paragraphs.
[0042] Another embodiment of the present invention also provides a knowledge graph generation device, which is characterized by comprising:
[0043] An acquisition module, used for acquiring target text data, wherein the target text data includes a plurality of text paragraphs;
[0044] A first recognition module is used to analyze and recognize the target text data to obtain an analysis and recognition result, wherein the analysis and recognition result includes entities and event core words contained in the target text data;
[0045] A first construction module is used to construct a triple knowledge graph according to the analysis and recognition results;
[0046] A first determination module is used to determine the event center words contained in each of the text paragraphs according to the analysis and recognition results, and to construct a paragraph knowledge graph based on the event center words contained in the text paragraphs;
[0047] A second recognition module, configured to perform content recognition on the plurality of text paragraphs and generate corresponding question-answer data based on the content recognition results;
[0048] A second construction module is used to construct a question-answering knowledge graph based on the question-answering data;
[0049] A second determination module is used to determine, according to the triple knowledge graph, the paragraph knowledge graph, and the question-answer knowledge graph, the first relationship between the entities and event center words involved in each graph, and the second relationship between the entity and the text paragraph;
[0050] A fusion module is used to fuse the triple knowledge graph, the paragraph knowledge graph, and the question-answer knowledge graph according to the first relationship and the second relationship to obtain a fused knowledge graph.
[0051] Based on the disclosure of the above embodiments, it can be known that the beneficial effects of the embodiments of the present invention include the ability to generate a personalized knowledge graph that conforms to the user's language habits, so that when the knowledge graph is connected to a large language model, the large language model can have a better ability to analyze scenarios and contexts based on the user's knowledge data in the graph, ensuring that the language model can output content that better matches the user's language habits and thinking habits.
[0052] Other features and advantages of the present invention will be described in the following description, and partly become apparent from the description, or understood by practicing the present invention. The purpose and other advantages of the present invention can be realized and obtained by the structures particularly pointed out in the written description, claims, and drawings.
[0053] The technical solution of the present invention is further described in detail below through the accompanying drawings and embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0054] The following drawings are used to provide a further understanding of the present invention and constitute a part of the specification. Together with the embodiments of the present invention, they are used to explain the present invention and do not constitute a limitation of the present invention. In the drawings:
[0055] Figure 1 Schematic diagram of the flow of the method for generating a knowledge graph in an embodiment of the present invention.
[0056] Figure 2 Schematic diagram of the application process of the method for generating a knowledge graph in an embodiment of the present invention.
[0057] Figure 3 It is a structural block diagram of the knowledge graph generating device in an embodiment of the present invention. DETAILED DESCRIPTION
[0058] The specific embodiments of the present invention are described in detail below with reference to the accompanying drawings, but are not intended to limit the present invention.
[0059] It should be understood that various modifications may be made to the embodiments disclosed herein. Therefore, the following description should not be considered as limiting, but merely as an example of an embodiment. Other modifications within the scope and spirit of the present disclosure will occur to those skilled in the art.
[0060] The accompanying drawings, which are incorporated in and constitute a part of the specification, illustrate embodiments of the present disclosure and, together with the general description of the present disclosure given above and the detailed description of the embodiments given below, serve to explain the principles of the present disclosure.
[0061] These and other characteristics of the invention will become apparent from the following description of a preferred form of embodiment given as a non-limiting example, with reference to the accompanying drawings.
[0062] It should also be understood that, although the invention has been described with reference to some specific examples, those skilled in the art will be able to realize many other equivalent forms of the invention that have the characteristics recited in the claims and are therefore within the scope of protection defined thereby.
[0063] The above and other aspects, features and advantages of the present disclosure will become more apparent from the following detailed description when taken in conjunction with the accompanying drawings.
[0064] Specific embodiments of the present disclosure are described hereinafter with reference to the accompanying drawings; however, it should be understood that the disclosed embodiments are merely examples of the present disclosure, which may be implemented in a variety of ways. Well-known and / or repeated functions and structures are not described in detail to avoid obscuring the present disclosure with unnecessary or redundant details. Therefore, the specific structural and functional details disclosed herein are not intended to be limiting, but merely serve as a basis and representative basis for the claims to teach those skilled in the art to use the present disclosure in a variety of ways with substantially any suitable detailed structure.
[0065] This specification may use the phrases "in one embodiment," "in another embodiment," "in a further embodiment," or "in other embodiments," all of which may refer to one or more of the same or different embodiments according to the present disclosure.
[0066] The embodiments of the present invention are described in detail below with reference to the accompanying drawings.
[0067] like Figure 1 and Figure 2 As shown, an embodiment of the present invention provides a knowledge graph generation method, including:
[0068] S1: Obtain target text data, wherein the target text data includes a plurality of text paragraphs;
[0069] S2: Analyze and identify the target text data to obtain analysis and identification results, wherein the analysis and identification results include entities and event core words contained in the target text data;
[0070] S3: constructing a triple knowledge graph based on the analysis and recognition results;
[0071] S4: determining the event center words contained in each of the text paragraphs based on the analysis and recognition results, and constructing a paragraph knowledge graph based on the event center words contained in the text paragraphs;
[0072] S5: performing content recognition on the plurality of text paragraphs, and generating corresponding question-and-answer data based on the content recognition results;
[0073] S6: Construct a question-answer knowledge graph based on the question-answer data;
[0074] S7: Determine, based on the triple knowledge graph, the paragraph knowledge graph, and the question-answer knowledge graph, a first relationship between entities and event central words involved in each graph, and a second relationship between the entity and the text paragraph;
[0075] S8: Based on the first relationship and the second relationship, the triple knowledge graph, the paragraph knowledge graph, and the question-answer knowledge graph are fused to obtain a fused knowledge graph.
[0076] For example, the target text data obtained is personalized data of the corresponding user, that is, the target text data is related to the user, which can be in the form of a document, including multiple text paragraphs, and the contents recorded in different text paragraphs can be relevant or irrelevant data. Each text paragraph is related to an event. The acquisition of the target text data can be actively input by the user, or it can be acquired by the system, and the specific method is uncertain. After obtaining the target text data, the system will analyze and identify the target text data, including analyzing and identifying the entities and event center words contained in the target text data. The entity can be a noun, such as a park, a road, lunch, etc., and the event center word can be dinner, watermelon, sweetness, etc. For example, a user and a friend discuss a party, dinner, whether the watermelon they bought is sweet, etc. in a chat software, and the topic of each discussion can be the event center word, and each discussion is an event. After the system obtains the analysis and recognition results, it can build a unit group knowledge graph based on this. For example, based on the analysis and recognition results, all entities of each text paragraph are matched to determine the entities of each text paragraph. At the same time, based on the analysis and recognition results, all event center words of each text paragraph are matched to determine the event center words of each text paragraph. After that, the system can determine the association between the event center words of each text paragraph based on the preset association relationship of the event center words, such as "time", "place", "person", "action", etc. At this time, the system can extract triple data based on the entities of the text paragraph, the event center words and the association between the event center words, and build a triple knowledge graph based on multiple triple data. Next, the system constructs a paragraph knowledge graph based on the event center words contained in the text paragraph, and performs content recognition on multiple text paragraphs, and generates corresponding question-and-answer data based on the content recognition results, and then constructs a question-and-answer knowledge graph based on the question-and-answer data; after obtaining three different knowledge graphs, the system will determine the entities involved in each graph, the first relationship between the event center words, and the second relationship between the entity and the text paragraph based on the triple knowledge graph, the paragraph knowledge graph, and the question-and-answer knowledge graph, and fuse the triple knowledge graph, the paragraph knowledge graph, and the question-and-answer knowledge graph based on the first relationship and the second relationship to obtain a fused knowledge graph. The fused knowledge graph contains the user's personalized knowledge. When the fused knowledge graph is input into the large language model for learning, the large language model can simulate the user's output of information that matches the user's personalized style by learning the fused knowledge graph, such as simulating the user to ask questions, etc.
[0077] Based on the above embodiments, it can be seen that the solution based on this embodiment can generate a personalized knowledge graph that conforms to the user's language habits, that is, a fused knowledge graph, so that when the knowledge graph is connected to a large language model, the large language model can have a better ability to analyze scenarios and contexts based on the user's knowledge data in the graph, ensuring that the language model can output content that better matches the user's language habits and way of thinking, that is, output content that conforms to the user's personalized style.
[0078] In one embodiment, obtaining the target text data includes:
[0079] S9: Obtain target text data including the user's language habits and thinking patterns.
[0080] The above-mentioned acquisition method can be to obtain the target text data through active input by the user, or to obtain the target text data in the following manner:
[0081] S10: Collect one or more data from the user's chat records, text data published on the first platform, comment data on the second platform, and recorded logs to obtain target text data containing the user's language habits and thinking patterns.
[0082] For example, the system can collect data from preset or preconfigured programs and platforms, such as collecting users' chat records, published articles, participating comment data, recorded logs, etc., which can reflect the user's language habits, the user's way of thinking or thinking patterns to obtain target text data that contains the user's language habits and thinking patterns.
[0083] Further, after obtaining the target data, the system will analyze and identify it, such as analyzing and identifying the target text data to obtain analysis and identification results, including:
[0084] S11: matching and identifying the target text data based on entities in a preset entity library to determine all entities included in the target text data;
[0085] S12: matching and identifying the target text data based on the event core words in a preset event core word database to determine all event core words included in the target text data.
[0086] Exemplarily, the system can match and identify each word in the target text data with the entities in a preset entity library to determine all entities contained in the target text data; then match and identify each word in the target text data based on the event center words in a preset event center word library to determine all event center words contained in the target text data.
[0087] For the construction of the preset entity library and event center word library, the method includes:
[0088] S13: Analyze and identify the acquired learning text data to determine all learning entities and event center words;
[0089] S14: performing deduplication processing on the learning entities and event center words, and performing term matching on the deduplication-processed learning entities and event center words based on the target term library to determine the target entity and target event center word;
[0090] S15: Building an entity library based on the target entity;
[0091] S16: Construct an event central word vocabulary based on the target event central word.
[0092] Specifically, the system obtains text data for learning, which is not limited to any specific data and can be text data of the same user, text data of multiple different users, or any other type of text data. When the system obtains the text data, it analyzes and identifies it to determine all entities and event center words for learning. Next, the learning entities and event center words are reprocessed, and based on the target entry library, which can be any existing entry library, the deduplicated learning entities and event center words are matched to determine the target entity and target event center word. After obtaining the target entity and target event center word, the system can build an entity library based on the target entity, and build a center word library based on the target event center word.
[0093] The determining the event center words contained in each of the text paragraphs based on the analysis and recognition results, and constructing a paragraph knowledge graph based on the event center words contained in the text paragraphs, includes:
[0094] S17: Matching the words in each of the text paragraphs based on all the event core words in the analysis and recognition results to determine the event core words contained in each of the text paragraphs;
[0095] S18: determining the relationship between the event center words contained in the text paragraph based on a plurality of preset relationship data representing the association relationship between different event center words;
[0096] S19: Construct a paragraph knowledge graph based on the relationship and the event center words contained in the corresponding text paragraph.
[0097] like Figure 2As shown, the system first matches the words in each of the text paragraphs based on all the event center words in the analysis and recognition results, and determines the event center words contained in each text paragraph. Then the system determines the association relationship between the event center words contained in each text paragraph based on the preset relationship data. The relationship data contains a variety of relationship words, and each relationship word is used to characterize the association relationship between two event center words. When the system determines the event center words of each text paragraph and the relationship between the event center words, it constructs a paragraph knowledge graph.
[0098] Furthermore, performing content recognition on the plurality of text paragraphs and generating corresponding question-and-answer data based on the content recognition results includes:
[0099] S20: performing content recognition on each of the text paragraphs;
[0100] S21: Generate matching questions and answers based on the recognition results;
[0101] S22: matching the words in each of the text paragraphs based on all the event core words in the analysis and recognition results to determine the event core words contained in each of the text paragraphs;
[0102] S23: Matching the question and answer corresponding to each text paragraph based on the event core word contained in each text paragraph to determine the event core word involved in the question and answer;
[0103] S24: forming the question and answer data based on the question and answer and the event core words involved in the question and answer.
[0104] In this embodiment, the system will perform content recognition on the text paragraphs, and after obtaining the recognition results, it will generate matching questions and answers based on the recognition results. The content of the specific questions and answers is not limited. For example, the questions and answers are related to a discussion content in which the user participates. Next, the system will match the words in each of the text paragraphs based on all the event center words in the analysis and recognition results, determine the event center words contained in each text paragraph, and then match the questions and answers corresponding to the text paragraph based on the event center words contained in each text paragraph to determine the event center words involved in the questions and answers. Finally, after the system obtains the event center words of all questions and answers, it can generate question and answer data based on this, that is, the question and answer data includes questions and answers and the event center words involved in the questions and answers.
[0105] Furthermore, the determining of the first relationship between the entities and event central words involved in each graph based on the triple knowledge graph, the paragraph knowledge graph and the question-answer knowledge graph includes:
[0106] S25: constructing a prompt template, wherein the prompt template includes a relational word that can be selected to represent the first relationship;
[0107] S26: Determine the relationship words for the first relationship between entities and entities, and entities and event center words involved in the triple knowledge graph, paragraph knowledge graph, and question-answer knowledge graph based on the prompt template.
[0108] The specific form of the prompt template in this embodiment is not limited, and the purpose of the prompt template is to prompt the relationship words that can be selected to represent the first relationship, such as inclusion relationship, approximate relationship, etc. Based on the content of the prompt template, the system can determine the relationship words for the first relationship between entities and entities, and entities and event center words involved in the triple knowledge graph, paragraph knowledge graph, and question-answer knowledge graph.
[0109] In another embodiment, the text paragraph includes a paragraph number; the entity includes a first attribute and a second attribute, the first attribute is the paragraph number of the text paragraph to which it belongs, and the second attribute is a node attribute, and the node attribute includes an entity node attribute and a paragraph node attribute.
[0110] When the system determines the second relationship between the entity involved in each graph and the text paragraph based on the triple knowledge graph, the paragraph knowledge graph and the question-answer knowledge graph, it includes:
[0111] S27: Connect and fuse the entities in the triple knowledge graph, paragraph knowledge graph and question-answer knowledge graph and the text paragraphs to which the entities belong based on the paragraph sequence number of the text paragraph to determine the second relationship between the entity and the text paragraph.
[0112] That is to say, the relationship between each entity and the text paragraph to which it belongs is determined. Based on this relationship, the knowledge graph can have the contextual information, scene information and other content of the relationship entity. Based on this, the subsequent introduction of a large language model that integrates the knowledge graph can be used to better learn the contextual information and scene information of the entity, and then output content that is more in line with the user's language habits and thinking mode, and meet the user's personalized needs.
[0113] like Figure 3 As shown, another embodiment of the present invention also provides a knowledge graph generation device 100, including:
[0114] An acquisition module, used for acquiring target text data, wherein the target text data includes a plurality of text paragraphs;
[0115] A first recognition module is used to analyze and recognize the target text data to obtain an analysis and recognition result, wherein the analysis and recognition result includes entities and event core words contained in the target text data;
[0116] A first construction module is used to construct a triple knowledge graph according to the analysis and recognition results;
[0117] A first determination module is used to determine the event center words contained in each of the text paragraphs according to the analysis and recognition results, and to construct a paragraph knowledge graph based on the event center words contained in the text paragraphs;
[0118] A second recognition module, configured to perform content recognition on the plurality of text paragraphs and generate corresponding question-answer data based on the content recognition results;
[0119] A second construction module is used to construct a question-answering knowledge graph based on the question-answering data;
[0120] A second determination module is used to determine, according to the triple knowledge graph, the paragraph knowledge graph, and the question-answer knowledge graph, the first relationship between the entities and event center words involved in each graph, and the second relationship between the entity and the text paragraph;
[0121] A fusion module is used to fuse the triple knowledge graph, the paragraph knowledge graph, and the question-answer knowledge graph according to the first relationship and the second relationship to obtain a fused knowledge graph.
[0122] In some embodiments, obtaining the target text data includes:
[0123] Obtain target text data containing user language habits and thinking patterns.
[0124] In some embodiments, obtaining target text data including user language habits and thinking patterns includes:
[0125] Collect one or more data from the user's chat records, text data published on the first platform, comment data in the second platform, and recorded logs to obtain target text data containing the user's language habits and thinking patterns.
[0126] In some embodiments, analyzing and identifying the target text data to obtain an analysis and identification result includes:
[0127] Matching and identifying the target text data based on entities in a preset entity library to determine all entities contained in the target text data;
[0128] The target text data is matched and identified based on the event center words in a preset event center word library to determine all the event center words included in the target text data.
[0129] In some embodiments, the apparatus further comprises:
[0130] The second recognition module is used to analyze and recognize the acquired learning text data to determine all learning entities and event center words;
[0131] A third determination module is used to perform deduplication processing on the learning entities and event center words, and perform term matching on the deduplication-processed learning entities and event center words based on a target term library to determine a target entity and a target event center word;
[0132] A third construction module is used to construct an entity library according to the target entity;
[0133] The fourth construction module is used to construct an event central word vocabulary based on the target event central word.
[0134] In some embodiments, determining the event center words contained in each of the text paragraphs based on the analysis and recognition results, and constructing a paragraph knowledge graph based on the event center words contained in the text paragraphs, includes:
[0135] Matching the words in each of the text paragraphs based on all the event center words in the analysis and recognition results to determine the event center words contained in each of the text paragraphs;
[0136] Determining the relationship between the event center words contained in the text paragraph based on a plurality of preset relationship data representing the association relationship between different event center words;
[0137] A paragraph knowledge graph is constructed based on the relationship and the event center words contained in the corresponding text paragraphs.
[0138] In some embodiments, performing content recognition on the plurality of text paragraphs and generating corresponding question-and-answer data based on the content recognition results includes:
[0139] Performing content recognition on each of the text paragraphs;
[0140] Generate matching questions and answers based on the recognition results;
[0141] Matching the words in each of the text paragraphs based on all the event center words in the analysis and recognition results to determine the event center words contained in each of the text paragraphs;
[0142] Matching the question and answer corresponding to each text paragraph based on the event core word contained in each text paragraph to determine the event core word involved in the question and answer;
[0143] The question and answer data are formed based on the questions and answers and event core words involved in the questions and answers.
[0144] In some embodiments, determining the first relationship between entities and event central words involved in each graph based on the triple knowledge graph, the paragraph knowledge graph, and the question-answer knowledge graph includes:
[0145] Constructing a prompt template, wherein the prompt template includes a relational word that can be selected to represent the first relation;
[0146] Based on the prompt template, the relational words are determined for the first relations between entities and entities, and entities and event central words involved in the triple knowledge graph, paragraph knowledge graph and question-answer knowledge graph.
[0147] In some embodiments, the text paragraphs include paragraph numbers;
[0148] The second relationship between the entities involved in each graph and the text paragraph is determined based on the triple knowledge graph, the paragraph knowledge graph and the question-answer knowledge graph, including
[0149] Based on the paragraph sequence number of the text paragraph, the entities in the triple knowledge graph, the paragraph knowledge graph and the question-and-answer knowledge graph and the text paragraphs to which the entities belong are connected and fused to determine the second relationship between the entities and the text paragraphs.
[0150] Another embodiment of the present invention further provides an electronic device, including:
[0151] at least one processor; and,
[0152] a memory communicatively connected to the at least one processor; wherein,
[0153] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to implement the knowledge graph generation method as described in any one of the embodiments above.
[0154] Furthermore, an embodiment of the present invention also provides a storage medium on which a computer program is stored, and when the program is executed by a processor, the method for generating a knowledge graph as described above is implemented. It should be understood that each solution in this embodiment has the corresponding technical effect in the above method embodiment, which will not be repeated here.
[0155] Furthermore, an embodiment of the present invention also provides a computer program product, which is tangibly stored on a computer-readable medium and includes computer-readable instructions, which, when executed, cause at least one processor to perform a knowledge graph generation method such as that in the embodiment described above.
[0156] It should be noted that the computer storage medium of the present application may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, system or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access storage medium (RAM), a read-only storage medium (ROM), an erasable programmable read-only storage medium (EPROM or flash memory), an optical fiber, a portable compact disk read-only storage medium (CD-ROM), an optical storage medium, a magnetic storage medium, or any suitable combination of the above. In the present application, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, system or device. In the present application, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium that can send, propagate or transmit a program configured to be used by or in conjunction with an instruction execution system, system or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, antenna, optical cable, RF, etc., or any suitable combination of the above.
[0157] In addition, it should be understood by those skilled in the art that the embodiments of the present application can be provided as methods, systems, or computer program products. Therefore, the present application can adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present application can adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage and optical storage, etc.) containing computer-usable program codes.
[0158] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1A process or multiple processes and / or boxes Figure 1 A system that specifies the functions of a box or multiple boxes.
[0159] These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory produce a product including an instruction system, which is implemented in the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0160] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0161] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
Claims
1. A knowledge graph generation method, It is characterized in that include: Obtaining target text data including the user's language habits and thinking patterns, wherein the target text data includes a plurality of text paragraphs; Analyzing and identifying the target text data to obtain analysis and identification results, wherein the analysis and identification results include entities and event core words contained in the target text data; Constructing a triple knowledge graph based on the analysis and recognition results, including extracting triple data based on entities, event center words, and associations between event center words in the text paragraph, and constructing a triple knowledge graph based on multiple triple data; Based on the analysis and recognition results, the event center words contained in each of the text paragraphs are determined, and a paragraph knowledge graph is constructed based on the event center words contained in the text paragraphs, including matching words in each of the text paragraphs based on all the event center words in the analysis and recognition results to determine the event center words contained in each of the text paragraphs; based on a plurality of preset relationship data representing the association relationship between different event center words, the relationship between the event center words contained in the text paragraphs is determined; Constructing a paragraph knowledge graph based on the relationship and the event center words contained in the corresponding text paragraph; Performing content recognition on the plurality of text paragraphs, and generating corresponding question-and-answer data based on the content recognition results; Constructing a question-and-answer knowledge graph based on the question-and-answer data; Determine, based on the triple knowledge graph, the paragraph knowledge graph, and the question-answer knowledge graph, a first relationship between entities and event central words involved in each graph, and a second relationship between the entity and the text paragraph; Based on the first relationship and the second relationship, the triple knowledge graph, the paragraph knowledge graph, and the question-answer knowledge graph are fused to obtain a fused knowledge graph.
2. The knowledge graph generation method according to claim 1, It is characterized in that The obtaining of target text data containing the user's language habits and thinking patterns includes: Collect one or more data from the user's chat records, text data published on the first platform, comment data in the second platform, and recorded logs to obtain target text data containing the user's language habits and thinking patterns.
3. The knowledge graph generation method according to claim 1, It is characterized in that The analyzing and identifying the target text data to obtain the analysis and identification result includes: Matching and identifying the target text data based on entities in a preset entity library to determine all entities contained in the target text data; The target text data is matched and identified based on the event center words in a preset event center word library to determine all the event center words included in the target text data.
4. The knowledge graph generation method according to claim 3, It is characterized in that The entity library and event center word library are constructed based on the following method: Analyze and identify the acquired learning text data to determine all entities and event center words used for learning; Deduplication processing is performed on the learning entities and event center words, and term matching is performed on the deduplication-processed learning entities and event center words based on the target term library to determine the target entity and target event center word; Building an entity library based on the target entity; An event central word vocabulary is constructed based on the target event central word.
5. The knowledge graph generation method according to claim 1, It is characterized in that The determining the event center words contained in each of the text paragraphs based on the analysis and recognition results, and constructing a paragraph knowledge graph based on the event center words contained in the text paragraphs, includes: Matching the words in each of the text paragraphs based on all the event center words in the analysis and recognition results to determine the event center words contained in each of the text paragraphs; Determining the relationship between the event center words contained in the text paragraph based on a plurality of preset relationship data representing the association relationship between different event center words; A paragraph knowledge graph is constructed based on the relationship and the event center words contained in the corresponding text paragraphs.
6. The knowledge graph generation method according to claim 1, It is characterized in that The performing content recognition on the plurality of text paragraphs and generating corresponding question-answer data based on the content recognition results includes: Performing content recognition on each of the text paragraphs; Generate matching questions and answers based on the recognition results; Matching the words in each of the text paragraphs based on all the event center words in the analysis and recognition results to determine the event center words contained in each of the text paragraphs; Matching the question and answer corresponding to each text paragraph based on the event core word contained in each text paragraph to determine the event core word involved in the question and answer; The question and answer data are formed based on the questions and answers and event core words involved in the questions and answers.
7. The knowledge graph generation method according to claim 1, It is characterized in that The determining, based on the triple knowledge graph, the paragraph knowledge graph, and the question-answer knowledge graph, the first relationship between the entities and event central words involved in each graph includes: Constructing a prompt template, wherein the prompt template includes a relational word that can be selected to represent the first relation; Based on the prompt template, the relational words are determined for the first relations between entities and entities, and entities and event central words involved in the triple knowledge graph, paragraph knowledge graph and question-answer knowledge graph.
8. The knowledge graph generation method according to claim 1, It is characterized in that The text paragraphs include paragraph numbers; The second relationship between the entities involved in each graph and the text paragraph is determined based on the triple knowledge graph, the paragraph knowledge graph and the question-answer knowledge graph, including Based on the paragraph sequence number of the text paragraph, the entities in the triple knowledge graph, the paragraph knowledge graph and the question-and-answer knowledge graph and the text paragraphs to which the entities belong are connected and fused to determine the second relationship between the entities and the text paragraphs.
9. A knowledge graph generation device, It is characterized in that include: An acquisition module, used to acquire target text data containing the user's language habits and thinking patterns, wherein the target text data includes a plurality of text paragraphs; A first recognition module is used to analyze and recognize the target text data to obtain an analysis and recognition result, wherein the analysis and recognition result includes entities and event core words contained in the target text data; A first construction module is used to construct a triple knowledge graph according to the analysis and recognition results, including extracting triple data based on the entities of the text paragraph, event center words and the association relationship between event center words, and constructing a triple knowledge graph based on multiple triple data; The first determination module is used to determine the event center words contained in each of the text paragraphs according to the analysis and recognition results, and to construct a paragraph knowledge graph based on the event center words contained in the text paragraphs, including matching the words in each of the text paragraphs based on all the event center words in the analysis and recognition results to determine the event center words contained in each of the text paragraphs; determining the relationship between the event center words contained in the text paragraphs based on a plurality of preset relationship data representing the association relationship between different event center words; Constructing a paragraph knowledge graph based on the relationship and the event center words contained in the corresponding text paragraph; A second recognition module, configured to perform content recognition on the plurality of text paragraphs and generate corresponding question-answer data based on the content recognition results; A second construction module is used to construct a question-answering knowledge graph based on the question-answering data; A second determination module is used to determine, according to the triple knowledge graph, the paragraph knowledge graph, and the question-answer knowledge graph, the first relationship between the entities and event center words involved in each graph, and the second relationship between the entity and the text paragraph; A fusion module is used to fuse the triple knowledge graph, the paragraph knowledge graph, and the question-answer knowledge graph according to the first relationship and the second relationship to obtain a fused knowledge graph.
