Knowledge graph construction method and device

By converting the table data in the document into a table knowledge graph and combining it with the document's text knowledge graph, and using a large language model to build a knowledge graph, the problem of poor Q&A effect when processing table data in the existing technology is solved, and the problem of poor Q&A effect is achieved Efficient knowledge graph construction and table data processing.

CN119443237APending Publication Date: 2025-02-14ALIPAY (HANGZHOU) INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411515146.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-28
Publication Date
2025-02-14

AI Technical Summary

Technical Problem

It is difficult for the prior art to effectively build a knowledge graph containing table data, especially when processing table data nested in text in large language models, there is a problem of poor Q&A effect.

Method used

By converting the table data in the document into a table knowledge graph and combining it with the document's text knowledge graph, a knowledge graph is constructed using a large language model to realize the effective processing of table data and the construction of knowledge graphs.

Benefits of technology

It improves the efficiency and effectiveness of the construction of table knowledge graphs, enhances the processing ability of table data, and improves the Q&A effect in large language models.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119443237A_ABST
    Figure CN119443237A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a knowledge graph construction method and device.The knowledge graph construction method comprises the steps that firstly, format conversion is conducted on table data according to a conversion mode corresponding to a table format in a document, and converted table data are obtained; the method comprises the following steps: firstly, converting table data, then inputting the converted table data and a prompt text corresponding to a table data type into a large language model to construct a table knowledge graph to obtain the table knowledge graph, and finally, merging the table knowledge graph and a text knowledge graph of a text in a document to obtain a knowledge graph of the document.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This document relates to the field of data processing technology, and in particular to a knowledge graph construction method and device. Background Art

[0002] With the continuous development and promotion of the Internet, various services are provided to users online, and more and more data are processed and maintained online. In order to enhance users' perception of data, online data can exist in different forms, such as text or table, so that users can perceive data clearly and intuitively. With the development of online services, it is becoming more and more common for users to query and process data online, which places higher requirements on data processors. Summary of the invention

[0003] One or more embodiments of the present specification provide a method for constructing a knowledge graph, including: converting the format of table data according to the conversion method corresponding to the table format in the document to obtain conversion table data. Inputting the conversion table data and the prompt text corresponding to the table data type into a large language model to construct a table knowledge graph to obtain a table knowledge graph. Merging the table knowledge graph and the text knowledge graph of the text in the document to obtain the knowledge graph of the document.

[0004] One or more embodiments of the present specification provide a knowledge graph construction device, including: a format conversion module, configured to perform format conversion on table data according to a conversion method corresponding to the table format in a document, and obtain conversion table data. A table knowledge graph construction module, configured to input the conversion table data and the prompt text corresponding to the table data type into a large language model to construct a table knowledge graph, and obtain a table knowledge graph. A merging processing module, configured to merge the table knowledge graph and the text knowledge graph of the text in the document, and obtain the knowledge graph of the document.

[0005] One or more embodiments of the present specification provide a knowledge graph construction device, including: a processor; and a memory configured to store computer executable instructions, wherein when the computer executable instructions are executed, the processor: performs format conversion on table data according to the conversion method corresponding to the table format in the document to obtain conversion table data. The conversion table data and the prompt text corresponding to the table data type are input into a large language model to construct a table knowledge graph to obtain a table knowledge graph. The table knowledge graph and the text knowledge graph of the text in the document are merged to obtain the knowledge graph of the document.

[0006] One or more embodiments of the present specification provide a computer-readable storage medium for storing computer-executable instructions, which implement the following process when executed: convert the table data in a format corresponding to the table format in the document to obtain conversion table data. Input the conversion table data and the prompt text corresponding to the table data type into a large language model to construct a table knowledge graph to obtain a table knowledge graph. Merge the table knowledge graph and the text knowledge graph of the text in the document to obtain the knowledge graph of the document. BRIEF DESCRIPTION OF THE DRAWINGS

[0007] In order to more clearly illustrate one or more embodiments of the present specification or the technical solutions in the prior art, the drawings required for use in the embodiments or the prior art descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present specification. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative labor. Figure 1 A schematic diagram of an implementation environment of a knowledge graph construction method provided for one or more embodiments of this specification; Figure 2 A process flow chart of a knowledge graph construction method provided for one or more embodiments of this specification; Figure 3 A process flow chart of a knowledge graph construction method applied to a document knowledge graph construction scenario provided in one or more embodiments of this specification; Figure 4 A schematic diagram of an embodiment of a knowledge graph construction device provided in one or more embodiments of this specification; Figure 5 A schematic diagram of the structure of a knowledge graph construction device provided for one or more embodiments of this specification. DETAILED DESCRIPTION

[0008] In order to enable those skilled in the art to better understand the technical solutions in one or more embodiments of this specification, the technical solutions in one or more embodiments of this specification will be clearly and completely described below in conjunction with the drawings in one or more embodiments of this specification. Obviously, the described embodiments are only part of the embodiments of this specification, not all of them. Based on one or more embodiments of this specification, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of this document.

[0009] The knowledge graph construction method provided in one or more embodiments of this specification can be applied to the implementation environment of document knowledge graph construction. Figure 1 , the implementation environment at least includes: A server 101 for constructing a knowledge graph, and a large language model 102 for constructing a table knowledge graph; The server 101 is used to construct a knowledge graph for the document. The server 101 may be a single server, or a server cluster consisting of a plurality of servers, or one or more cloud servers in a cloud computing platform. The large language model 102 is used to construct a table knowledge graph based on the conversion table data and the prompt text corresponding to the table data type. In addition, the large language model 102 also constructs a text knowledge graph; In this implementation environment, during the process of constructing the knowledge graph of the document, the server 101 first converts the format of the table data in the document according to the conversion method corresponding to the table format in the document to obtain the converted table data, and then inputs the converted table data and the prompt text corresponding to the table data type into the large language model 102 to construct the table knowledge graph to obtain the table knowledge graph, and finally merges the table knowledge graph and the text knowledge graph obtained by constructing the text knowledge graph based on the large language model 102 to obtain the knowledge graph of the document.

[0010] One or more embodiments of a knowledge graph construction method provided in this specification are as follows: Reference Figure 2 , the knowledge graph construction method provided in this embodiment specifically includes steps S202 to S206.

[0011] Step S202: convert the table data in accordance with the conversion method corresponding to the table format in the document to obtain converted table data.

[0012] In practical applications, in the RAG (Retrieval-augmented generation) data construction process, table data is a widely existing data form. RAG based on a large language model still has defects in the question-answering effect for table data embedded in text. In this embodiment, the table data in the document containing the table data is converted into a table knowledge graph to realize RAG's processing of the table data.

[0013] The table data in this embodiment includes the table in the document. In order to improve the integrity of the table data, the acquired table data may include not only the table itself but also the description text of the table in the document; that is, before converting the table data into a format according to the conversion method corresponding to the table format in the document and obtaining the converted table data, the table and the table description text in the document may also be extracted as the table data of the document.

[0014] The table format in this embodiment includes the format in which the table exists in the document; the table in the document can exist in different formats, such as image format, MarkDown (markup syntax) format and / or HTML (HyperText Markup Language) format. The conversion table data refers to table data whose table format is a preset table format. Optionally, in order to improve the convenience of large language model processing while retaining the visual semantics of the table, the preset table format can be an HTML format that is easy for the large language model to understand.

[0015] In the specific implementation, in order to improve the convenience and efficiency of generating table knowledge graphs, in this embodiment, the table data in the document is first converted into table data in a preset table format; in the process of converting the table data in the document into table data in a preset table format, since the table format of the table data in the document may be a picture format or a MarkDown format, for table data in different table formats, the table data can be format converted according to the conversion method corresponding to the table format of the table data to obtain the converted table data in the preset table format.

[0016] In the specific execution process, in the process of converting the table data according to the conversion method corresponding to the table format in the document to obtain the converted table data, for the table data in the first table format, the format conversion can be performed by the large language model conversion method to obtain the converted table data; that is, the table data in the first table format in the document is converted according to the large language model conversion method to obtain the converted table data; specifically, in an optional implementation provided by this embodiment, in the process of converting the table data according to the conversion method corresponding to the table format in the document to obtain the converted table data, the table data in the first table format in the document and the format conversion prompt text of the preset table format can be input into the large language model for format conversion to obtain the conversion table data of the preset table format. For example, the first table format is a picture format, and the preset table format is an HTML format. The table data in the picture format and the format conversion prompt text "Please convert the table data in the picture format to the table data in the HTML format" are input into the large language model for format conversion to obtain the table data in the HTML format output by the large language model. It should be noted that the content of the table data in the HTML format output by the large language model is consistent with the content of the table data in the picture format.

[0017] In the process of converting the table data into a format according to the conversion method corresponding to the table format in the document to obtain the converted table data, for the table data in the second table format, the conversion method can be called through the interface to convert the format and obtain the converted table data; that is, the table data in the second table format in the document is converted into a format according to the conversion method called through the interface to obtain the converted table data. Specifically, in an optional implementation provided by the present embodiment, in the process of converting the table data into a format according to the conversion method corresponding to the table format in the document to obtain the converted table data, the format conversion interface is called to convert the table data in the second table format in the document to obtain the converted table data. For example, if the second table format is MarkDown format, the table data in MarkDown format is input into a pre-configured format conversion interface to convert the table data in MarkDown format into table data in HTML format as the converted table data. It should be noted that the content of the table data in HTML format returned by the format conversion interface is consistent with the content of the table data in MarkDown format.

[0018] In addition, the table format of the table data in the document can also be directly in HTML format. Since HTML format is a preset table format, the table data in HTML format may not be format-converted, and the table data in HTML format may be directly determined as conversion table data; that is, in the process of converting the table data according to the conversion method corresponding to the table format in the document to obtain conversion table data, the table data in the third table format in the document is used as conversion table data. The third table format is a preset table format.

[0019] It should be noted that the above description of using picture format as the first table format, MarkDown format as the second table format, and HTML format as the third table format is merely exemplary. The MarkDown format can also be the first table format or the third table format, the picture format can also be the second table format or the third table format, and the HTML format can be the first table format or the second table format. The specific formats of the first table format, the second table format, and the third table format can be configured according to the actual scenario, and this embodiment is not limited here.

[0020] The above-mentioned process of format conversion of table data according to the corresponding conversion method with different table formats is specifically described. In this embodiment, the table format may not be distinguished, that is, for all table formats, the table data may be format converted according to the same conversion method; step S202 may also be replaced by format conversion of the table data in the document according to the preset conversion method to obtain conversion table data, and form a new implementation method with one or more other steps provided in this embodiment. Specifically, the table data in the document may be format converted according to the large language model conversion method to obtain conversion table data; or, the table data in the document may be format converted according to the interface call conversion method to obtain conversion table data. Further, in the process of format conversion of the table data in the document according to the large language model conversion method to obtain conversion table data, the table data in the document and the format conversion prompt text of the preset table format may be input into the large language model for format conversion to obtain the conversion table data of the preset table format; the format conversion prompt text may be, please convert the table data into table data in HTML format. In the process of converting the format of the table data in the document according to the interface calling conversion mode to obtain the converted table data, the format conversion interface can be called to convert the format of the table data in the document to obtain the converted table data in a preset table format.

[0021] Step S204: input the conversion table data and the prompt text corresponding to the table data type into a large language model to construct a table knowledge graph to obtain a table knowledge graph.

[0022] The large language model can be an LLM (large language model) composed of an artificial neural network with many parameters. The table knowledge graph includes a knowledge graph constructed by the content in the table data in the document. It should be noted that the knowledge graph is a structured semantic knowledge base used to describe concepts and their relationships in the physical world in symbolic form. Its basic component unit is the "entity-relationship-entity" triple, as well as entities and their related attributes. Entities are connected to each other through relationships to form a network knowledge structure.

[0023] In the above steps, the table data is formatted according to the conversion method corresponding to the table format in the document to obtain conversion table data, thereby obtaining conversion table data in a preset table format to improve the efficiency and convenience of constructing a table knowledge graph with a large language model. However, in actual applications, there are many types of tables, such as entity type, relational type, matrix type and complex type. Different types of tables can contain different amounts of data, and the relationships between table contents are also different. Therefore, in this step, the conversion table data and the prompt text corresponding to the table data type are input into the large language model to construct a table knowledge graph to obtain a table knowledge graph. In this way, the prompt text corresponding to the table data type is input to prompt the large language model to construct a table knowledge graph, thereby improving the flexibility and efficiency of constructing a table knowledge graph.

[0024] In specific implementation, for tables with relatively small contents, entity recognition and entity attribute recognition can be directly performed by a large language model to further construct a table knowledge graph. However, for tables with relatively large contents, entity recognition and entity attribute recognition through a large language model will take a lot of time, and if the recognition fails, it will affect the accuracy of the constructed table knowledge graph. Therefore, in this embodiment, the table data type can be divided into a first data type and a second data type, wherein the first data type can be a table data type with relatively small contents, such as an entity table, a matrix table and / or a complex table; the second data type can be a table data type that may include a large amount of contents, such as a relational table.

[0025] In the first optional implementation manner provided in this embodiment, if the table data type is the first data type, the large language model can construct the table knowledge graph in the following manner: Performing semantic recognition on a first prompt text corresponding to the first data type to obtain text semantics; Perform entity recognition and parameter recognition on the table data according to the text semantics to obtain entity identifiers in the table data and entity parameters corresponding to each entity identifier; The table knowledge graph is constructed according to the entity identifier and the entity parameters.

[0026] During the specific execution process, for the table data of the first data type, the large language model may first perform semantic recognition on the first prompt text corresponding to the first data type during the construction of the table knowledge graph, and then perform entity recognition and parameter recognition on the table data based on the semantic recognition result to obtain the entity identifiers in the table data and the entity parameters corresponding to each entity identifier, and finally construct the table knowledge graph based on the entity identifiers and entity parameters.

[0027] For example, the table data is of entity type, and the first prompt text corresponding to the pre-configured entity type table data type is: Please build a knowledge graph based on the table data, and output the table knowledge graph of the table data; input the preset table type entity type table data and the first prompt text into the large language model to build the table knowledge graph and obtain the table knowledge graph.

[0028] In the second optional implementation manner provided in this embodiment, if the table data type is the second data type, the large language model can construct the table knowledge graph in the following manner: Reading an entity identifier in the table data according to the entity position data included in the second prompt data corresponding to the second data type, and reading an entity parameter in the table data according to the parameter position data included in the second prompt data; The table knowledge graph is constructed according to the entity identifier and the entity parameters.

[0029] During the specific execution process, for the table data of the second data type, the large language model can first read the entity identifier in the table data according to the entity position data contained in the second prompt data corresponding to the second data type, and read the entity parameters corresponding to each entity identifier in the table data according to the parameter position data contained in the second prompt data, and then construct the table knowledge graph according to the entity identifier and the entity parameters corresponding to each entity identifier.

[0030] For example, the table data is relational, and the second prompt text corresponding to the pre-configured relational table data type is: the first column in the table is the entity identifier, and the second to fifth columns are entity parameters. Please construct a knowledge graph for the table data and output the table knowledge graph of the table data; input the relational data in the preset table format and the second prompt text into the large language model to construct the table knowledge graph and obtain the table knowledge graph.

[0031] In addition, step S204 can also be replaced by constructing a table knowledge graph based on the conversion table data and the table data type of the conversion table data to obtain a table knowledge graph, and forming a new implementation method with one or more other processing steps provided in this embodiment.

[0032] Step S206: merge the table knowledge graph and the text knowledge graph of the text in the document to obtain the knowledge graph of the document.

[0033] In the above steps, the conversion table data and the prompt text corresponding to the table data type are input into the big language model to construct the table knowledge graph to obtain the table knowledge graph. Since the document contains not only table data but also text, in order to obtain a complete and effective knowledge graph of the document, in this step, the table knowledge graph and the text knowledge graph of the text in the document are merged to obtain a knowledge graph containing both the table data content and the text content as the knowledge graph of the document. Optionally, the text knowledge graph can be obtained by inputting the text and the prompt text corresponding to the text into the big language model to construct the text knowledge graph.

[0034] In the specific implementation, in the process of merging the table knowledge graph and the text knowledge graph, in order to improve the indirectness of the merged knowledge graph and avoid the merged knowledge graph containing repeated entity identifiers or entity parameters, in an optional implementation provided by this embodiment, the process of merging the table knowledge graph and the text knowledge graph can be implemented as follows: Determine the same entity identifiers in the table knowledge graph and the text knowledge graph, and read entity parameters corresponding to the entity identifiers in the table knowledge graph and the text knowledge graph; Merge the read entity parameters to obtain merged entity parameters; The table knowledge graph and the text knowledge graph are merged based on the entity identifier and the merged entity parameter to obtain the knowledge graph.

[0035] Specifically, the entity parameters corresponding to the same entity identifier in the table knowledge graph and the text knowledge graph are merged to obtain the merged entity parameters, and then the table knowledge graph and the text knowledge graph are merged based on the same entity identifier and the merged entity parameters to obtain the knowledge graph.

[0036] For example, both the table knowledge graph and the text knowledge graph contain entity identifier 1, the entity parameter corresponding to entity identifier 1 in the table knowledge graph is entity parameter 1, and the entity parameter corresponding to entity identifier 1 in the text knowledge graph is entity parameter 2. Entity parameter 1 and entity parameter 2 are merged to obtain merged entity parameters, and then the table knowledge graph and the text knowledge graph are merged based on entity identifier 1 and the merged entity parameters to obtain a knowledge graph. The knowledge graph contains entity identifier 1, and the entity parameter corresponding to entity identifier 1 is the merged entity parameter.

[0037] In some documents, for the same entity, there may be a situation where the entity identifier is written in full or abbreviated. For example, the entity identifier of the entity is written in full in the table data, and the entity identifier of the entity in the text is abbreviated. In this case, the full-written entity identifier and the abbreviated entity identifier are identified as different entity identifiers, but the full-written entity identifier and the abbreviated entity identifier are essentially the same entity identifier. Therefore, in another optional implementation provided by this embodiment, the following method can be used to realize the process of merging the table knowledge graph and the text knowledge graph to obtain the knowledge graph of the document: Determine a text entity identifier in the text knowledge graph that is different from a table entity identifier in the table knowledge graph, and input the table entity identifier, the text entity identifier, and a detection prompt text into the large language model for related detection; Determine the related entity identifier of the table entity identifier according to the detection result, and merge the entity parameters corresponding to the table entity identifier in the table knowledge graph and the entity parameters corresponding to the related entity identifier in the text knowledge graph; The table knowledge graph and the text knowledge graph are merged according to the merged entity parameters obtained by merging the table entity identifier, the related entity identifier and the parameters to obtain the knowledge graph.

[0038] In the specific implementation process, for the text entity identifier in the text knowledge graph that is different from the table entity identifier in the table knowledge graph, a large language model is used to detect whether the text entity identifier in the text knowledge graph that is different from the table entity identifier in the table knowledge graph is a related entity identifier of the table entity identifier. If not, the text entity identifier and the table entity identifier are separated for knowledge graph merging. If so, the entity parameters corresponding to the table entity identifier in the table knowledge graph and the entity parameters corresponding to the related entity identifier of the table entity identifier in the text knowledge graph are parameter merged. Finally, the knowledge graphs are merged according to the merged entity parameters obtained by merging the table entity identifier, the related entity identifier and the parameters to obtain a knowledge graph.

[0039] For example, there is entity identifier 3 in the table knowledge graph. Based on entity identifier 3, entity identifiers are recalled from entity identifiers different from entity identifier 1 in the text knowledge graph to obtain entity identifier 4 and entity identifier 5. Then entity identifier 3, entity identifier 4 and detection prompt text "Please check whether these two entity identifiers are related" are input into the large language model for related detection, and entity identifier 3, entity identifier 5 and detection prompt text are input into the large language model for related detection to obtain detection results. After detection, entity identifier 5 is a related entity identifier of entity identifier 3. Then, the entity parameters of entity identifier 3 in the table knowledge graph and the entity parameters of entity identifier 5 in the text knowledge graph are merged to obtain merged entity parameters. Then, knowledge graphs are merged based on the table entity identifiers, related entity identifiers and merged entity parameters to obtain a knowledge graph. The obtained knowledge graph includes two entity identifiers, namely entity identifier 3 or entity identifier 5 and entity identifier 4. Among them, the entity parameters corresponding to entity identifier 3 or entity identifier 5 are merged entity parameters, and the entity parameters corresponding to entity identifier 4 are the entity parameters corresponding to entity identifier 4 in the text knowledge graph.

[0040] It should be noted that in the above-mentioned process of merging parameters of the table knowledge graph and the text knowledge graph, the entity parameters corresponding to the same entity identifier and / or related entity identifier are merged, and the knowledge graphs are merged based on the same entity identifier and / or related entity identifier and the merged entity parameters to obtain the knowledge graph. In addition, there may be completely different or completely unrelated table entity identifiers and text entity identifiers in the table knowledge graph and the text knowledge graph. For these table entity identifiers and text entity identifiers, the knowledge graphs are merged separately, that is, for completely different (different or unrelated) table entity identifiers and text entity identifiers, they are directly merged or spliced. For example, the table knowledge graph includes entity identifier 6 and the corresponding entity parameter 6, and the text knowledge graph includes entity identifier 7 and the corresponding entity parameter 7. Entity identifier 6 and entity identifier 7 are not the same and not related. Therefore, the knowledge graphs of the table knowledge graph and the text knowledge graph are merged, and the obtained knowledge graph includes two entity identifiers, entity identifier 6 and entity identifier 7, wherein entity identifier 6 corresponds to entity parameter 6, and entity identifier 7 corresponds to entity parameter 7.

[0041] It should also be noted that the text knowledge graph may include the same entity identifiers as those in the table knowledge graph, related entity identifiers, and completely different entity identifiers. In this case, the above processes can be combined to merge the table knowledge graph and the text knowledge graph, which is not limited in this embodiment. In addition, in this embodiment, the related entity identifiers in the text knowledge graph and the table entity identifier in the table knowledge graph can also be determined as the same entity identifier as the table entity identifier. Specifically, in an optional implementation provided by this embodiment, in the process of merging the table knowledge graph and the text knowledge graph of the text in the document to obtain the knowledge graph of the document, the first entity data in the table knowledge graph and the text knowledge graph are subjected to a first merge process, and the second entity data in the table knowledge graph and the text knowledge graph are subjected to a second merge process. Optionally, the first entity data refers to the same or related entity identifiers in the table knowledge graph and the text knowledge graph. Correspondingly, the first merging process includes merging the entity parameters of the same and / or related entity identifiers in the table knowledge graph and the text knowledge graph to obtain merged entity parameters, using the same or related entity identifier as the entity identifier of the knowledge graph, and using the merged entity parameters as the entity parameters corresponding to the entity identifier, thereby realizing the knowledge graph merging of the same and / or related entity identifiers; the second entity data refers to different and / or unrelated entity identifiers. Correspondingly, the second merging process includes merging the knowledge graphs of different and / or unrelated entity identifiers in the table knowledge graph and the text knowledge graph to obtain a knowledge graph containing different and / or unrelated entity identifiers and corresponding entity parameters in the table knowledge graph and the text knowledge graph.

[0042] After obtaining the knowledge graph, RAG can be supported based on the knowledge graph. Specifically, if the question data for asking and answering the document is obtained, the answer can be generated based on the knowledge graph of the document to obtain the answer data. Optionally, in the specific process of question and answer processing, after obtaining the question data for asking and answering the document, the question data and the question and answer prompt data configured for the document are input into the large language model to generate answers based on the knowledge graph to obtain answer data; correspondingly, in an optional implementation provided by this embodiment, the large language model first performs semantic recognition on the question and answer prompt data during the process of answer generation, and then encodes the question data according to the semantic recognition result to obtain the encoding feature, and finally reads the answer data in the knowledge graph according to the encoding feature. Alternatively, after obtaining the encoding feature, the initial answer data is read in the knowledge graph according to the encoding feature, and then the answer data is generated according to the initial answer data.

[0043] For example, if the question data is the relevant data of xx organization in the statistical document, the question and answer prompt text configured for the document is read first, "The question data is:; please generate answer data", and the prompt data "The question data is: the relevant data of xx organization in the statistical document; please generate answer data" is constructed based on the question data and the question and answer prompt text. The prompt data is input into the large language model, and the large language model reads the entity parameters corresponding to the entity identifier of xx organization in the knowledge graph of the document and outputs it as answer data.

[0044] In addition, in the process of obtaining answer data, there are often some table location data. For example, the question data may include what the data in the third row of the table data means. In this case, it is impossible to generate answers effectively and accurately based on the knowledge graph alone. In order to improve the efficiency of answer generation and the accuracy of the generated answer data, in this embodiment, a table call interface can be configured or implanted in the question and answer prompt data configured for the document, so that the table data can be queried through the table call interface when necessary to improve the accuracy and effectiveness of the generated answer data. In an optional implementation provided by this embodiment, the large language model can generate answers in the following manner: According to the table location data contained in the question data, the table calling interface in the question and answer prompt data is called to query the table data, and the target table data at the position corresponding to the table location data in the table data is obtained; An answer is generated according to the target table data and the knowledge graph to obtain the answer data.

[0045] Optionally, the table location data includes data describing a specified location in the table data.

[0046] During the specific execution process, after receiving the question data and question and answer prompt data, the large language model first calls the table call interface in the question and answer prompt data to query the table data based on the table location data contained in the question data, and obtains the target table data at the position corresponding to the table location data in the table data, and then generates an answer based on the table data or both the table data and the knowledge graph to obtain the answer data.

[0047] Specifically, after receiving the question data and question and answer prompt data, the large language model first identifies whether the question data contains table location data. If not, it generates an answer based on the knowledge graph. If so, based on the table location data contained in the question data, it calls the table call interface in the question and answer prompt data to query the table data, obtains the target table data at the position corresponding to the table location data in the table data, and then generates an answer based on at least one of the target table data and the knowledge graph.

[0048] For example, the question data is: count the relevant data of xx organization in the document, and explain what data the third row and third column in Table 1 of the document represents; then the question data and question and answer prompt data are input into the large language model, and the large language model detects that the question data contains the table location data "the third row and third column of Table 1", then based on the table location data, the table call interface configured in the question and answer prompt data is called to query the table data, and the data in the third row and third column of Table 1 in the document is data 1, and the table header and table name of Table 1 are queried to obtain the third row and third column of Table 1 as the annual unified summary indicators of each organization, and read the entity parameters corresponding to the entity identifier of xx organization in the knowledge graph, and generate the following answer data: xx organization + entity parameters, the data in the third row and third column of Table 1 of the document is data 1, and the data identifies the annual unified summary indicators of xx organization.

[0049] In addition, in order to further enhance the user's perception of the answer data, the table position data of the initial answer data in the table data may be configured in the answer data, so that the user can query the initial answer data in the answer data in the table according to the table position data, thereby enhancing the user's trust in the answer data. Specifically, in an optional implementation manner provided by this embodiment, the answer generation may also be implemented in the following manner: Performing semantic recognition on the question and answer prompt data, and encoding the question data according to the semantic recognition result to obtain encoding features; Reading the initial answer data in the knowledge graph according to the encoding feature; According to the initial answer data, the table calling interface embedded in the question and answer prompt data is called to perform table position query, and the table position data of the position where the initial answer data is located in the table data is obtained; The answer data is generated based on the initial answer data and the table location data.

[0050] For example, if the question data is the relevant data of xx organization in the statistical document, the question data and question and answer prompt data are input into the large language model. After the large language model queries the entity parameters corresponding to the entity identifier of xx organization according to the knowledge graph, the table call interface embedded in the question and answer prompt data is called to perform table location query. The data in the third row and third column of Table 1 in the document is the annual unified summary index in the entity parameters. The data in the third row and third column of Table 1 returned by the table call interface is the table location data of the annual unified summary index in the entity parameters. The following answer data is generated based on the entity parameters and table location data: xx organization + entity parameters, wherein the third row and third column of Table 1 in the document identifies the annual unified summary index of xx organization.

[0051] It should be noted that in addition to constructing a table knowledge graph for tables in documents, a table knowledge graph can also be constructed for pure tables through the above-mentioned related content. For example, the table data is formatted according to the conversion method corresponding to the table format to obtain converted table data, and the converted table data and the prompt text corresponding to the table data type are input into the large language model to construct a table knowledge graph to obtain a table knowledge graph.

[0052] In summary, the knowledge graph construction method provided in this embodiment, in the process of constructing the knowledge graph of a document, for the text in the document, the text and the prompt text are input into the large language model to construct the text knowledge graph to obtain the text knowledge graph, and for the table (table data) in the document, first, according to the conversion method corresponding to the table format in the document, the table in the document is converted into a conversion table of a preset format, and then the conversion table and the prompt text corresponding to the table type are input into the large language model to construct the table knowledge graph to obtain the table knowledge graph, thereby improving the construction efficiency of the table knowledge graph, and also improving the effectiveness and accuracy of the constructed table knowledge graph; After obtaining the table knowledge graph and the text knowledge graph, parameters are merged for the same and related entity identifiers in the table knowledge graph and the text knowledge graph, and different and unrelated entity identifiers in the table knowledge graph and the text knowledge graph are merged. In this way, a knowledge graph that includes both table knowledge and text knowledge is obtained, so that the knowledge graph can be used for document question and answer processing, and the effect of RAG in question and answering in tabular data can be improved. In addition, a table calling interface is implanted in the question and answer prompt data for the document to improve the flexibility and comprehensiveness of document question and answer, and also improve the correctness of document question and answer.

[0053] The following takes the application of a knowledge graph construction method provided in this embodiment in a document knowledge graph construction scenario as an example, combined with Figure 3 , the knowledge graph construction method provided in this embodiment is further described, see Figure 3 , a knowledge graph construction method applied to the document knowledge graph construction scenario specifically includes the following steps.

[0054] Step S302, obtaining the document for which the knowledge graph is to be constructed.

[0055] Step S304: convert the format of the table in the document according to the conversion method corresponding to the table format of the table to obtain a conversion table in a preset format.

[0056] Step S306: Input the conversion table and the prompt text corresponding to the table type into the large language model to construct a table knowledge graph to obtain a table knowledge graph.

[0057] Step S308: Input the text in the document and the corresponding prompt text into the large language model to construct a text knowledge graph to obtain a text knowledge graph.

[0058] The process from step S304 to step S306 and the execution order of step S308 are not limited in this embodiment.

[0059] Step S310, merge the entity parameters corresponding to the same entity identifier in the table knowledge graph and the text knowledge graph to obtain merged entity parameters.

[0060] Step S312, taking the merged entity parameters as the entity parameters corresponding to the same entity identifier in the table knowledge graph.

[0061] Step S314, merge the entity identifiers and entity parameters in the text knowledge graph that are different from those in the table knowledge graph into the table knowledge graph to obtain the document knowledge graph.

[0062] On this basis, question and answer prompt data can be configured for the document. Optionally, a table calling interface can be embedded in the question and answer prompt data so that the table calling interface can be called as needed to query the table data during the process of answer generation by the large language model.

[0063] It should be noted that any one of steps S302 to S314 or any combination of multiple steps can be combined with any one of steps S202 to S206 to form a new implementation method according to the needs of implementation deployment; in addition, according to the needs of actual deployment, any one or multiple technical features can be selected from steps S302 to S314 and combined with any one or multiple technical features provided by steps S202 to S206 to form a new implementation method; or, any one or multiple technical features in steps S302 to S314 can be replaced by any one or multiple technical features provided by steps S202 to S206 to form a new implementation method according to the needs of actual deployment, which will not be elaborated here.

[0064] An embodiment of a knowledge graph construction device provided in this specification is as follows: In the above-mentioned embodiment, a knowledge graph construction method is provided, and correspondingly, a knowledge graph construction device is also provided, which is described below in conjunction with the accompanying drawings.

[0065] Reference Figure 4 , which shows a schematic diagram of an embodiment of a knowledge graph construction device provided in this embodiment.

[0066] Since the device embodiment corresponds to the method embodiment, the description is relatively simple, and the relevant parts can refer to the corresponding description of the method embodiment provided above. The device embodiment described below is only illustrative.

[0067] This embodiment provides a knowledge graph construction device, the device comprising: The format conversion module 402 is configured to perform format conversion on the table data according to the conversion method corresponding to the table format in the document to obtain converted table data; The table knowledge graph construction module 404 is configured to input the conversion table data and the prompt text corresponding to the table data type into a large language model to construct a table knowledge graph to obtain a table knowledge graph; The merging processing module 406 is configured to merge the table knowledge graph and the text knowledge graph of the text in the document to obtain the knowledge graph of the document.

[0068] An embodiment of a knowledge graph construction device provided in this specification is as follows: Corresponding to the knowledge graph construction method described above, based on the same technical concept, one or more embodiments of this specification also provide a knowledge graph construction device, which is used to execute the knowledge graph construction method provided above. Figure 5 A schematic diagram of the structure of a knowledge graph construction device provided for one or more embodiments of this specification.

[0069] This embodiment provides a knowledge graph construction device, including: like Figure 5 As shown, the knowledge graph construction device may have relatively large differences due to different configurations or performances, and may include one or more processors 501 and memory 502, and the memory 502 may store one or more storage applications or data. Among them, the memory 502 can be short-term storage or persistent storage. The application stored in the memory 502 may include one or more modules (not shown in the figure), and each module may include a series of computer executable instructions in the knowledge graph construction device. Furthermore, the processor 501 can be configured to communicate with the memory 502 and execute a series of computer executable instructions in the memory 502 on the knowledge graph construction device. The knowledge graph construction device may also include one or more power supplies 503, one or more wired or wireless network interfaces 504, one or more input / output interfaces 505, one or more keyboards 506, etc.

[0070] In a specific embodiment, the knowledge graph construction device includes a memory and one or more programs, wherein the one or more programs are stored in the memory, and the one or more programs may include one or more modules, and each module may include a series of computer executable instructions in the knowledge graph construction device, and the one or more programs are configured to be executed by one or more processors, including the following computer executable instructions: Perform format conversion on the table data according to the conversion method corresponding to the table format in the document to obtain conversion table data; Inputting the conversion table data and the prompt text corresponding to the table data type into a large language model to construct a table knowledge graph to obtain a table knowledge graph; The table knowledge graph and the text knowledge graph of the text in the document are merged to obtain the knowledge graph of the document.

[0071] An embodiment of a computer-readable storage medium provided in this specification is as follows: Corresponding to the knowledge graph construction method described above, based on the same technical concept, one or more embodiments of this specification also provide a computer-readable storage medium.

[0072] The computer-readable storage medium provided in this embodiment is used to store computer-executable instructions, and the computer-executable instructions implement the following process when executed: Perform format conversion on the table data according to the conversion method corresponding to the table format in the document to obtain conversion table data; Inputting the conversion table data and the prompt text corresponding to the table data type into a large language model to construct a table knowledge graph to obtain a table knowledge graph; The table knowledge graph and the text knowledge graph of the text in the document are merged to obtain the knowledge graph of the document.

[0073] It should be noted that an embodiment of a computer-readable storage medium in this specification and an embodiment of a knowledge graph construction method in this specification are based on the same inventive concept, so the specific implementation of this embodiment can refer to the implementation of the aforementioned corresponding method, and the repeated parts will not be repeated.

[0074] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referenced to each other. Each embodiment focuses on the differences from other embodiments. For example, the device embodiment, equipment embodiment and computer-readable storage medium embodiment are similar to the method embodiment, so the description is relatively simple. To read the relevant contents in the device embodiment, equipment embodiment and computer-readable storage medium embodiment, please refer to the partial description of the method embodiment.

[0075] The above is a description of a specific embodiment of the present specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0076] In the 1930s, improvements to a technology could be clearly distinguished as hardware improvements (for example, improvements to circuit structures such as diodes, transistors, switches, etc.) or software improvements (improvements to method flows). However, with the development of technology, many of today's method flow improvements can be regarded as direct improvements to hardware circuit structures. Designers almost always obtain the corresponding hardware circuit structure by programming the improved method flow into the hardware circuit. Therefore, it cannot be said that an improvement in a method flow cannot be implemented using hardware entity modules. For example, a programmable logic device (PLD) (such as a field programmable gate array (FPGA)) is such an integrated circuit whose logical function is determined by the user's programming of the device. Designers can "integrate" a digital system on a PLD by programming it themselves, without having to ask chip manufacturers to design and produce dedicated integrated circuit chips. Moreover, nowadays, instead of manually making integrated circuit chips, this kind of programming is mostly implemented by "logic compiler" software, which is similar to the software compiler used when developing and writing programs, and the original code before compilation must also be written in a specific programming language, which is called hardware description language (HDL). There is not only one kind of HDL, but many kinds, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, RHDL (Ruby Hardware Description Language), etc. The most commonly used ones are VHDL (Very-High-Speed ​​Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art should also know that it is only necessary to program the method flow slightly in the above-mentioned hardware description languages ​​and program it into the integrated circuit, and then it is easy to obtain the hardware circuit that implements the logic method flow.

[0077] The controller may be implemented in any suitable manner, for example, the controller may take the form of a microprocessor or processor and a computer-readable medium storing a computer-readable program code (e.g., software or firmware) executable by the (micro)processor, a logic gate, a switch, an application-specific integrated circuit (ASIC), a programmable logic controller, and an embedded microcontroller, examples of which include but are not limited to the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320, and the memory controller may also be implemented as part of the control logic of the memory. It is also known to those skilled in the art that, in addition to implementing the controller in a purely computer-readable program code manner, the controller may be implemented in the form of a logic gate, a switch, an application-specific integrated circuit, a programmable logic controller, and an embedded microcontroller by logically programming the method steps. Therefore, such a controller may be considered as a hardware component, and the devices for implementing various functions included therein may also be considered as structures within the hardware component. Or even, the devices for implementing various functions may be considered as both software modules for implementing the method and structures within the hardware component.

[0078] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.

[0079] For the convenience of description, the above devices are described in terms of functions and are divided into various units. Of course, when implementing the embodiments of this specification, the functions of each unit can be implemented in the same or multiple software and / or hardware.

[0080] It should be understood by those skilled in the art that one or more embodiments of the present specification may be provided as a method, system or computer program product. Therefore, one or more embodiments of the present specification may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present specification may take the form of a computer program product implemented on one or more computer-readable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0081] This specification 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 this specification. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks 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 produce 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 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0082] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0083] 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.

[0084] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0085] Memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. Memory is an example of a computer-readable medium.

[0086] Computer-readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer-readable instructions, data structures, program modules or other data. Examples of computer-readable storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include transitory media such as modulated data signals and carrier waves.

[0087] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of further restrictions, the elements defined by the sentence "includes at least one ..." do not exclude the presence of other identical elements in the process, method, commodity or device including the elements.

[0088] One or more embodiments of the present specification may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. One or more embodiments of the present specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.

[0089] The above description is only an embodiment of this document and is not intended to limit this document. For those skilled in the art, this document may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of this document should be included in the scope of the claims of this document.

Claims

1. A knowledge graph construction method, comprising: Perform format conversion on the table data according to the conversion method corresponding to the table format in the document to obtain conversion table data; Inputting the conversion table data and the prompt text corresponding to the table data type into a large language model to construct a table knowledge graph to obtain a table knowledge graph; The table knowledge graph and the text knowledge graph of the text in the document are merged to obtain the knowledge graph of the document.

2. According to the knowledge graph construction method of claim 1, the step of converting the table data in accordance with the conversion method corresponding to the table format in the document to obtain the converted table data comprises: The table data of the first table format in the document and the format conversion prompt text of the preset table format are input into the large language model for format conversion to obtain the conversion table data of the preset table format.

3. According to the knowledge graph construction method of claim 1, the step of converting the table data in accordance with the conversion method corresponding to the table format in the document to obtain the converted table data comprises: A format conversion interface is called to perform format conversion on the table data of the second table format in the document to obtain the converted table data.

4. According to the knowledge graph construction method of claim 1, if the table data type is the first data type, the table knowledge graph construction is implemented in the following manner: Performing semantic recognition on a first prompt text corresponding to the first data type to obtain text semantics; Perform entity recognition and parameter recognition on the table data according to the text semantics to obtain entity identifiers in the table data and entity parameters corresponding to each entity identifier; The table knowledge graph is constructed according to the entity identifier and the entity parameters.

5. According to the knowledge graph construction method of claim 1, if the table data type is the second data type, the table knowledge graph construction is implemented in the following manner: Reading an entity identifier in the table data according to the entity position data included in the second prompt data corresponding to the second data type, and reading an entity parameter in the table data according to the parameter position data included in the second prompt data; The table knowledge graph is constructed according to the entity identifier and the entity parameters.

6. According to the knowledge graph construction method of claim 1, the step of merging the table knowledge graph and the text knowledge graph of the text in the document to obtain the knowledge graph of the document comprises: Determine the same entity identifiers in the table knowledge graph and the text knowledge graph, and read entity parameters corresponding to the entity identifiers in the table knowledge graph and the text knowledge graph; Merge the read entity parameters to obtain merged entity parameters; The table knowledge graph and the text knowledge graph are merged based on the entity identifier and the merged entity parameter to obtain the knowledge graph.

7. According to the knowledge graph construction method of claim 1, the step of merging the table knowledge graph and the text knowledge graph of the text in the document to obtain the knowledge graph of the document comprises: Determine a text entity identifier in the text knowledge graph that is different from a table entity identifier in the table knowledge graph, and input the table entity identifier, the text entity identifier, and a detection prompt text into the large language model for related detection; Determine the related entity identifier of the table entity identifier according to the detection result, and merge the entity parameters corresponding to the table entity identifier in the table knowledge graph and the entity parameters corresponding to the related entity identifier in the text knowledge graph; The table knowledge graph and the text knowledge graph are merged according to the merged entity parameters obtained by merging the table entity identifier, the related entity identifier and the parameters to obtain the knowledge graph.

8. According to the knowledge graph construction method of claim 1, after the step of merging the table knowledge graph and the text knowledge graph of the text in the document to obtain the knowledge graph of the document is performed, the method further comprises: Obtaining question data for asking and answering questions about the document; The question data and the question and answer prompt data configured for the document are input into the large language model to generate answers according to the knowledge graph to obtain answer data.

9. According to the knowledge graph construction method of claim 8, the answer generation is implemented in the following manner: Performing semantic recognition on the question and answer prompt data, and encoding the question data according to the semantic recognition result to obtain encoding features; The answer data is read in the knowledge graph according to the encoding feature.

10. According to the knowledge graph construction method of claim 8, the answer generation is implemented in the following manner: According to the table location data contained in the question data, the table calling interface in the question and answer prompt data is called to query the table data, and the target table data at the position corresponding to the table location data in the table data is obtained; An answer is generated according to the target table data and the knowledge graph to obtain the answer data.

11. A knowledge graph construction device, comprising: A format conversion module is configured to perform format conversion on the table data according to a conversion method corresponding to the table format in the document to obtain converted table data; A table knowledge graph construction module is configured to input the conversion table data and the prompt text corresponding to the table data type into a large language model to construct a table knowledge graph to obtain a table knowledge graph; The merging processing module is configured to merge the table knowledge graph and the text knowledge graph of the text in the document to obtain the knowledge graph of the document.

12. A knowledge graph construction device, comprising: processor; and a memory configured to store computer executable instructions that, when executed, cause the processor to: Perform format conversion on the table data according to the conversion method corresponding to the table format in the document to obtain conversion table data; Inputting the conversion table data and the prompt text corresponding to the table data type into a large language model to construct a table knowledge graph to obtain a table knowledge graph; The table knowledge graph and the text knowledge graph of the text in the document are merged to obtain the knowledge graph of the document.

13. A computer-readable storage medium for storing computer-executable instructions, wherein the computer-executable instructions implement the steps of the method of claim 1 when executed.