Knowledge base construction method and apparatus, device, and medium

By generating block relation data and using vector fusion, the problem of fragmented content block associations in multimodal document processing is solved, thereby improving the retrieval accuracy and precision of the knowledge base.

CN123138355APending Publication Date: 2026-11-20BEIJING QIYI CENTURY SCI & TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611158535.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-31
Publication Date
2026-11-20

AI Technical Summary

Technical Problem

In existing technologies, multimodal document processing severs the connections between different document content blocks, resulting in information gaps during knowledge base construction and affecting the accuracy and precision of retrieval.

Method used

By acquiring multiple content blocks and their attribute information from a document, block relationship data is generated, encoded according to type identifiers, and fused into vectors to create a knowledge base, fully exploring the relationships between content blocks.

Benefits of technology

The generated vectors better reflect the contextual semantics of multimodal content, improving the accuracy and precision of knowledge base retrieval and meeting the structural characteristics of multimodal documents.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123138355A_ABST
    Figure CN123138355A_ABST
Patent Text Reader

Abstract

Embodiments of the present disclosure relate to a knowledge base construction method and device, equipment and medium, wherein the method comprises: obtaining a plurality of content blocks of a to-be-processed document and attribute information corresponding to each content block, wherein the attribute information comprises a type identifier and hierarchical relationship data; generating block relationship data according to the hierarchical relationship data of each content block, wherein the block relationship data represents the association relationship between different content blocks; encoding each content block according to the type identifier of each content block to generate a first content vector of each content block; determining the associated content block of each content block, and performing vector fusion on the first content vector of each content block and the corresponding associated content block according to the block relationship data to obtain a second content vector of each content block; and creating a knowledge base based on the second content vectors corresponding to the plurality of content blocks respectively. By fully mining the relationship between different content blocks, the generated vector can better reflect the context semantics of multi-modal content.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of document processing technology, and in particular to a method, apparatus, device and medium for constructing a knowledge base. Background Technology

[0002] As the demand for richer knowledge base content increases, plain text content alone is no longer sufficient to meet users' needs for retrieving and responding to multimodal information such as images, tables, and graphs. It is necessary to process multimodal documents to create knowledge bases that include multimodal content. However, current technologies for processing multimodal documents suffer from problems such as fragmented relationships between document content blocks and a lack of structural adaptability. This leads to information gaps in the constructed knowledge base, which in turn affects the accuracy of subsequent knowledge base retrieval. Summary of the Invention

[0003] To address the aforementioned technical problems, this disclosure provides a method, apparatus, device, and medium for constructing a knowledge base.

[0004] This disclosure provides a method for constructing a knowledge base, the method comprising: Obtain multiple content blocks of the document to be processed and the attribute information corresponding to each content block, wherein the attribute information includes type identifier and hierarchical relationship data; Block relationship data is generated based on the hierarchical relationship data of each content block, wherein the block relationship data represents the association between different content blocks; Each content block is encoded according to its type identifier to generate a first content vector for each content block; Determine the associated content blocks of each content block, and according to the block relationship data, perform vector fusion between each content block and the first content vector of the corresponding associated content block to obtain the second content vector of each content block; A knowledge base is created based on the second content vectors corresponding to the multiple content blocks.

[0005] This disclosure also provides a knowledge base construction apparatus, the apparatus comprising: The acquisition module is used to acquire multiple content blocks of the document to be processed and the attribute information corresponding to each content block, wherein the attribute information includes type identifier and hierarchical relationship data; The relationship module is used to generate block relationship data based on the hierarchical relationship data of each content block, wherein the block relationship data represents the association relationship between different content blocks; An encoding module is used to encode each content block according to the type identifier of each content block, and generate a first content vector for each content block; The fusion module is used to determine the associated content blocks of each content block, and according to the block relationship data, to perform vector fusion between each content block and the first content vector of the corresponding associated content block to obtain the second content vector of each content block. A creation module is used to create a knowledge base based on the second content vectors corresponding to the multiple content blocks.

[0006] This disclosure also provides an electronic device, the electronic device comprising: a processor; a memory for storing executable instructions of the processor; the processor being configured to read the executable instructions from the memory and execute the instructions to implement the knowledge base construction method provided in this disclosure.

[0007] This disclosure also provides a computer-readable storage medium storing a computer program for executing the knowledge base construction method provided in this disclosure.

[0008] The technical solution provided in this disclosure has the following advantages compared with the prior art: By generating block relationship data representing the associations between different content blocks based on the hierarchical relationship data corresponding to multiple content blocks in the document to be processed, and encoding the content data into content vectors according to the type identifier of each content block, the vectors of the content blocks and related content blocks are fused according to the block relationship data. A knowledge base is created based on the fused content vectors. By fully exploring the relationships between different content blocks, this approach breaks through the limitations of the traditional fragmented associations in knowledge base creation, making the generated vectors more reflective of the contextual semantics of multimodal content. Furthermore, the vector fusion for different content blocks results in vectors that better fit the document structure characteristics of multimodal documents, providing high-quality data support for subsequent knowledge base retrieval and thus improving the accuracy of knowledge base retrieval. Attached Figure Description

[0009] The above and other features, advantages, and aspects of the embodiments of this disclosure will become more apparent from the accompanying drawings and the following detailed description. Throughout the drawings, the same or similar reference numerals denote the same or similar elements. It should be understood that the drawings are schematic, and the originals and elements are not necessarily drawn to scale.

[0010] Figure 1 A flowchart illustrating a knowledge base construction method provided in this embodiment of the disclosure; Figure 2 A flowchart illustrating another knowledge base construction method provided in this disclosure embodiment; Figure 3 A schematic diagram illustrating a block relation data determination process provided in an embodiment of this disclosure; Figure 4A schematic diagram illustrating a first content vector determination process provided in an embodiment of this disclosure; Figure 5 A schematic diagram illustrating a second content vector determination process provided in an embodiment of this disclosure; Figure 6 This is a schematic diagram of the structure of a knowledge base construction apparatus provided in an embodiment of the present disclosure; Figure 7 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this disclosure. Detailed Implementation

[0011] Embodiments of this disclosure will now be described in more detail with reference to the accompanying drawings. While some embodiments of this disclosure are shown in the drawings, it should be understood that this disclosure can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of this disclosure. It should be understood that the accompanying drawings and embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of protection of this disclosure.

[0012] It should be understood that the steps described in the method embodiments of this disclosure may be performed in different orders and / or in parallel. Furthermore, the method embodiments may include additional steps and / or omit the steps shown. The scope of this disclosure is not limited in this respect.

[0013] The term "comprising" and its variations as used herein are open-ended inclusions, meaning "including but not limited to". The term "based on" means "at least partially based on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". Definitions of other terms will be given in the description below.

[0014] It should be noted that the concepts of "first" and "second" mentioned in this disclosure are used only to distinguish different devices, modules or units, and are not used to limit the order of functions performed by these devices, modules or units or their interdependencies.

[0015] It should be noted that the terms "a" and "a plurality of" used in this disclosure are illustrative rather than restrictive, and those skilled in the art should understand that, unless otherwise expressly indicated in the context, they should be understood as "one or more".

[0016] The names of messages or information exchanged between multiple devices in the embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.

[0017] In related technologies, the processing of multimodal documents treats images, text, and tables as independent units for vector transformation, which severs the natural connections between different document content blocks. This results in a lack of knowledge base and makes it easy to lose contextual information during subsequent retrieval, affecting the accuracy of retrieval responses. On the other hand, related technologies cannot make full use of the structured characteristics of content blocks, making it difficult to meet the needs of accurate retrieval in office scenarios.

[0018] To address the aforementioned problems, this disclosure provides a method for constructing a knowledge base, which will be described below with reference to specific embodiments.

[0019] Figure 1 This is a flowchart illustrating a knowledge base construction method provided in an embodiment of this disclosure. The method can be executed by a knowledge base construction device, which can be implemented using software and / or hardware, and is generally integrated into an electronic device. Figure 1 As shown, the method includes: Step 101: Obtain multiple content blocks of the document to be processed and the attribute information corresponding to each content block. The attribute information includes type identifiers and hierarchical relationship data.

[0020] The knowledge base construction method of this disclosure can be used to construct a knowledge base based on documents, realize an automated process from document to knowledge base generation, and provide data support for subsequent retrieval responses. Here, the retrieval responses can be achieved using Retrieval-Augmented Generation (RAG) technology.

[0021] The document to be processed can be a document that needs to be analyzed and processed to build a knowledge base. A content block can be the smallest independent editable unit that makes up the document content, also known as a block component. Each content block corresponds to a type of document content and has independent style, structure and interactivity. Content blocks can include text blocks, image blocks and table blocks. The document to be processed can be a multimodal document that includes multiple types of content blocks. In this embodiment of the disclosure, the document to be processed can be represented by a tree model. The tree model can be a hierarchical data structure for document structuring. The tree model can be a tree-shaped structured model built with the content blocks in the document to be processed as nodes and based on the logical subordinate and hierarchical relationship between the content blocks. The tree model can include multiple nodes, and each node represents a content block.

[0022] The attribute information of a content block can be a set of information used to describe, configure, and constrain the content block, determining its appearance, content structure, interactive behavior, and data relationships. In this embodiment, the attribute information may include a type identifier and hierarchical relationship data. The type identifier may indicate the type of document content corresponding to the content block, and specific types may include text blocks, image blocks, and table blocks, etc. The hierarchical relationship data may be data that reflects the hierarchical relationship between different content blocks. For example, the "parent id" carried in a content block indicates the identifier of the parent content block of the current content block, and the "childrenid" carried indicates the identifier of the child content block of the current content block.

[0023] Specifically, when the knowledge base building device detects that a user has triggered knowledge base building, it can obtain documents to be processed. The number of documents to be processed is unlimited. It can also call the application programming interface (API) of the document platform where the documents to be processed are located to obtain the attribute information corresponding to the multiple content blocks included in the documents to be processed. Alternatively, after obtaining the documents to be processed, it can analyze the tree model of the documents to obtain the attribute information of each content block. The attribute information corresponding to different content blocks is different.

[0024] Step 102: Generate block relationship data based on the hierarchical relationship data of each content block, where the block relationship data represents the association between different content blocks.

[0025] Block relationship data can be data describing the association between different content blocks. The relationship types between different content blocks can include parent-child relationship and sibling relationship. Parent-child relationship means that one content block includes the other content block. For example, two text blocks A and B, the text content of text block A includes the text content of text block B. These two text blocks A and B have a parent-child relationship. Sibling relationship means that two content blocks belong to the same other content block, are at the same level, and have no inclusion relationship but only a parallel relationship. For example, a text block C includes image block D and table block F. Image block D and table block F belong to text block C. Image block D and table block F have a sibling relationship.

[0026] In some embodiments, generating block relationship data based on the hierarchical relationship data of each content block includes: combining multiple content blocks according to parent-child or sibling relationships to generate multiple relationship groups according to the hierarchical relationship data of each content block; and determining the multiple relationship groups as block relationship data.

[0027] Optionally, each relationship group includes two content blocks and a relationship type between the two content blocks. The relationship type includes a parent-child relationship or a sibling relationship. A parent-child relationship indicates that one content block includes the other content block, and a sibling relationship indicates that the two content blocks belong to the same other content block. A relationship group can be data describing an association relationship between at least two content blocks. In this embodiment of the disclosure, the relationship group can be represented by a triple, specifically "content block - relationship type - associated content block". The associated content block can be another content block that has a relationship type corresponding to the content block. Since the relationship type can include a parent-child relationship or a sibling relationship, that is, another content block that has a parent-child relationship or a sibling relationship with the content block is the associated content block.

[0028] Specifically, after acquiring the attribute information corresponding to multiple content blocks of the document to be processed, the knowledge base construction device extracts two content blocks with parent-child or sibling relationships based on the hierarchical relationship data of each content block to form a relationship group. Multiple relationship groups are then combined to obtain block relationship data. By acquiring the hierarchical relationship data of content blocks, the device fully explores the associations between different content blocks, realizing the association of multimodal content, which is helpful for the subsequent construction of the knowledge base.

[0029] Step 103: Encode each content block according to its type identifier to generate the first content vector for each content block.

[0030] The first content vector can be a content block, or a vector obtained by encoding a content block and associated content blocks.

[0031] In some embodiments, encoding each content block according to its type identifier to generate a first content vector for each content block may include: sequentially extracting multiple content blocks as the current content block; if the current content block is determined to be a text block according to its type identifier, encoding the text block using a text encoding model to obtain a text vector; if the current content block is determined to be an image block according to its type identifier, encoding the image block using an image encoding model to obtain a visual vector, and encoding the associated text block of the image block using a text encoding model to obtain a description vector, and fusing the visual vector and the description vector to obtain an image vector for the image block; if the current content block is determined to be a table block according to its type identifier, encoding the table block using a text encoding model to obtain a table vector; and using the text vector, image vector, or table vector as the first content vector.

[0032] The current content block can be the content block currently being encoded among multiple content blocks, with each content block being treated as the current content block in turn. A text block can be a content block containing only text content, and can include title blocks, code blocks, and body blocks, etc. An image block can be a content block containing only images. A table block can be a content block containing table row headers, column headers, and table data.

[0033] A text encoding model can be a model that encodes text content to obtain corresponding vectors. The specific model type is not limited; for example, it can be a bidirectional encoder (BERT) model based on transducers. A text vector can be a vector obtained by encoding the text content of a text block.

[0034] Image encoding models can be models that encode images; specific models include, for example, Contrastive Language-Image Pre-Training (CLIP) models. Visual vectors can be vectors obtained by encoding image patches. Associated text blocks of image patches can be text blocks that are siblings of image patches; the text content of these associated text blocks can be considered as descriptive text for the image patch.

[0035] A description vector can be a vector encoded from the text content of the associated text block of an image patch. An image vector can be a vector encoded from the image of the image patch and the text content of the associated text block of the image patch. A table vector can be a vector encoded from the row headers, column headers, and table data of a table block.

[0036] When the knowledge base construction device encodes each content block according to its type identifier to generate the first content vector for each content block, it can sequentially extract multiple content blocks as the current content block. If the current content block is determined to be a text block based on its type identifier, it can be input into a text encoding model for encoding and output as a text vector. If the current content block is determined to be an image block based on its type identifier, it can be input into an image encoding model for encoding and output as a visual vector. The associated text block is then extracted, and the associated text block or the image description text generated based on the associated text block is input into a text encoding model for encoding and output as a description vector. Then, a weighted summation method can be used to fuse the visual vector and the description vector. The weights can be set according to the actual situation, for example, the weight of the visual vector is 0.6 and the weight of the description vector is 0.4 to generate an image vector. If the current content block is determined to be a table block based on its type identifier, it is input into a text encoding model for output as a table vector. The above-mentioned text vector, image vector, or table vector is the first content vector. In the above scheme, different encoding methods are used for different types of content blocks. When encoding image blocks, the associated text blocks are encoded in combination, which effectively improves the accuracy of vector determination.

[0037] Optionally, the table block includes row headers, column headers, and table data. The table block is encoded using a text encoding model to obtain a table vector, including: encoding the row headers and column headers using a text encoding model to obtain a table structure vector; converting the table data into descriptive text based on the row headers and column headers; encoding the descriptive text using a text encoding model to obtain a table data vector; and fusing the table structure vector and the table data vector to obtain a table vector.

[0038] Table structure vectors can be vectors obtained by encoding the row and column headers of a table block, reflecting the table's structural characteristics. Description text can be text obtained by converting the row and column headers and table data into natural language. Description text can be generated by filling the row and column headers and table data into a preset template, or by inputting the row and column headers and table data into a large language model. For example, description text could be "Row header: Product A, Column header: Sales volume 2024, Corresponding value: 1000 units". Table data vectors can be vectors obtained by encoding the description text.

[0039] When the knowledge base construction device encodes table blocks using a text encoding model to obtain table vectors, it can input row and column headers into the text encoding model to output a table structure vector. Next, it extracts the table data, converts the table data into corresponding descriptive text based on the row and column headers, and inputs this descriptive text into the text encoding model to output a table data vector. The table structure vector and table data vector are then fused using a weighted summation method. The weights can be set according to the actual situation; for example, the weights of both the table structure vector and the table data vector are 0.5 to generate a table vector. By encoding the row headers, column headers, and table data of a table block separately and then fusing them to generate the table vector, the table vector can fully reflect the characteristics of the table, improving the accuracy of table vector determination.

[0040] Step 104: According to the block relationship data, perform vector fusion between each content block and the first content vector of the corresponding associated content block to obtain the second content vector of each content block.

[0041] The associated content blocks of a content block can be other content blocks that have a parent-child or sibling relationship with it. The second content vector can be a vector obtained by fusing the vectors of the associated content blocks for the content block. The second content vector is obtained by fusing the first content vector of the content block with the first content vector of the associated content blocks. The second content vector can reflect the tightness of the relationship between the content block and its associated content blocks. Compared with the first content vector, the second content vector is richer because it has been fused with the associated content blocks.

[0042] Specifically, after determining the first content vector of each content block, the knowledge base creation device can extract the associated content blocks of the content block based on the block relationship data, and then perform a weighted summation of the first content vector of the content block and the first content vector of the associated content blocks. The weight of the associated content blocks can be determined according to the relationship type, and different relationship types have different weights, ultimately obtaining the second content vector of each content block.

[0043] Step 105: Create a knowledge base based on the second content vectors corresponding to the multiple content blocks.

[0044] After determining the second content vector for each content block of the document to be processed, the knowledge base creation device can store multiple second content vectors in the knowledge base, which can be a vector database, thus completing the transformation process from document to knowledge base.

[0045] The knowledge base construction scheme provided in this disclosure generates block relationship data representing the association between different content blocks based on the hierarchical relationship data corresponding to multiple content blocks of the document to be processed. After encoding the content data into content vectors according to the type identifier of each content block, the vectors of the content blocks and related content blocks are fused according to the block relationship data. A knowledge base is created based on the fused content vectors. By fully exploring the relationship between different content blocks, it breaks the limitation of the traditional knowledge base creation that separates the associations. The generated vectors can better reflect the contextual semantics of multimodal content. Furthermore, the vector fusion for different content blocks makes the generated vectors more consistent with the document structure characteristics of multimodal documents, providing high-quality data support for subsequent knowledge base retrieval and thus improving the accuracy of knowledge base retrieval.

[0046] For example, Figure 2 A flowchart illustrating another knowledge base construction method provided in this disclosure embodiment is shown below. Figure 2 As shown, in some embodiments, according to block relationship data, the first content vector of each content block is fused with the first content vector of the corresponding associated content block to obtain the second content vector of each content block, which may include: Step 201: For each content block, find the target relationship group to which the content block belongs according to the block relationship data.

[0047] The target relation group can be the relation group containing the current content block among multiple relation groups included in the block relation data. The target relation group can include two content blocks of different types, or two content blocks of the same type. A content block can belong to one or more target relation groups. For each content block, the knowledge base creation device can first search for the target relation group containing that content block among the multiple relation groups included in the block relation data.

[0048] Optionally, for image blocks and table blocks among multiple content blocks in the document to be processed, use... Figure 2 The second content vector is determined by fusing the associated content block vectors, while for text blocks, the first content vector can be directly determined as the second content vector, thus improving processing efficiency.

[0049] Step 202: Identify the other content block in the target relation group, excluding the content block, as the associated content block of the content block.

[0050] After determining the target relationship group for each content block, the knowledge base creation device identifies another content block in the target relationship group (excluding the content block itself) as a related content block. That is, the related content blocks of a content block are other content blocks of different types, or other content blocks of the same type. In some embodiments, when a content block is an image block, its related content blocks include text blocks and table blocks; when a content block is a table block, its related content blocks include text blocks and image blocks; and when a content block is a text block, its related content blocks are image blocks and table blocks. By finding related content blocks of different or the same type, the device effectively utilizes the relationships between different content blocks, improving the accuracy of document processing.

[0051] Step 203: Determine the first calculated weight of the associated content block based on the relationship type in the target relationship group.

[0052] The first calculated weight can be the calculated weight set for vector fusion of related content blocks of a content block. Different relationship types correspond to different first calculated weights. The first calculated weight is directly proportional to the related content blocks and the tightness of the relationship between the content blocks. The tighter the relationship, the greater the first calculated weight.

[0053] In some embodiments, determining a first calculated weight of an associated content block based on the relationship type in the target relationship group includes: if the relationship type in the target relationship group is a parent-child relationship, then setting the first calculated weight to a first value; if the relationship type in the target relationship group is a sibling relationship, then setting the first calculated weight to a second value, wherein the first value is greater than the second value.

[0054] The first value can be a specific value of the first calculated weight set for related content blocks that have a parent-child relationship with the content block. The second value can be a specific value of the first calculated weight set for related content blocks that have a sibling relationship with the content block. The specific values ​​of the first and second values ​​are set according to the actual situation, with the first value being greater than the second value; for example, the first value is 0.3 and the second value is 0.1. By setting different calculated weight values ​​for different relationship types during fusion processing, fusion can be performed based on the closeness of the relationship, which helps to improve the accuracy of fusion processing.

[0055] Step 204: Obtain the second calculated weight of the content block, wherein the second calculated weight is greater than the first calculated weight.

[0056] The second calculated weight can be the weight set for a content block when performing vector fusion with its associated content blocks. The second calculated weight is greater than the first calculated weight, and the specific value is set according to the actual situation. The sum of the second calculated weight and the first calculated weight is equal to 1.

[0057] Step 205: Determine the first product of the first content vector of the content block and the first product of the corresponding second calculated weight, and the second product of the first content vector of the associated content block and the corresponding first calculated weight, and take the sum of the first product and the second product as the second content vector of the content block.

[0058] For each content block, the knowledge base creation device obtains its second calculated weight as 'a', and its first content vector as 'V1'. The first calculated weight of related content blocks with a parent-child relationship is 'b', and its corresponding first content vector is 'V2'. The first calculated weight of related content blocks with a sibling relationship is 'c', and its corresponding first content vector is 'V3'. The second content vector VF is calculated using the following formula: VF = V1 a+V2 b+V3 c, V1 'a' represents the first product, V2 b and V3 c represents the second product. For example, for a table block, the second calculated weight is 0.6, and the first content vector is represented as V1. The related content blocks of the table block include text blocks with parent-child relationships and image blocks with sibling relationships. The first calculated weight of the text block is 0.3, corresponding to the first content vector represented as V2, and the first calculated weight of the image block is 0.1, corresponding to the first content vector represented as V3. The second content vector of the table block is VF = V1. 0.6+V2 0.3+V3 0.1.

[0059] In the above scheme, the vector fusion of related content blocks is performed when determining the vector based on the fully explored relationship between different content blocks. Furthermore, the related content blocks can be of different or the same type, breaking the limitation of the fragmented content association in traditional multimodal embedding technology, and making the vector generated by the content blocks more reflective of the contextual relationship of multimodal content.

[0060] In some embodiments, the knowledge base construction method may further include: obtaining a retrieval request for the knowledge base, wherein the retrieval request includes retrieval content; matching the retrieval content among multiple second content vectors in the knowledge base, and determining the second content vector with the highest matching degree as the retrieval result.

[0061] The search content can be reference content or basic content included in the search request for subsequent searches. Search content can include text, images, etc., and is not limited to any specific type. The search request can be obtained in response to user input on the input interface. The matching degree can be a numerical value obtained by calculating the similarity between the search content and the second content vector, and can be determined using Euclidean distance or cosine similarity algorithms. The search results can be content retrieved from the knowledge base created in the above embodiments. The number of search results can be one or more, and the response content can be displayed to the user based on these search results. Because the created knowledge base can effectively reflect the contextual semantics of multimodal content, it provides high-quality data support for retrieval, improving the richness and accuracy of search responses when conducting searches in a search scenario.

[0062] The knowledge base construction scheme of this disclosure embodiment will be further illustrated by a specific example below. For example, Figure 3 This is a schematic diagram illustrating a block relation data determination process provided in an embodiment of this disclosure, such as... Figure 3 As shown, the parent content block with block identifier 1001 can be a text block with the title "Product Sales Analysis" as an example; the child content block 1 with block identifier 1002 can be a table block, which can include sales data for three products, with the row header being the product name and the column header being the sales volume; the child content block 2 with block identifier 1003 can be an image block, which can include a line chart of product sales trends; the solid arrows between the content blocks indicate a parent-child relationship, with the solid arrows pointing from the parent content block to child content block 1 and child content block 2, generating two relationship groups, which can be represented as "1001, parent-child relationship, 1002" and "1001, parent-child relationship, 1003"; the dashed arrows between the content blocks indicate a sibling relationship, with the dashed arrows connecting child content block 1 and child content block 2 to generate a relationship group represented as "1002, sibling relationship, 1003". This diagram can intuitively show the construction logic of the relationship groups. In the diagram, processing node 1 and processing node 2 are process nodes used to determine the first content vector of the content block, and the end node is used to determine the second content vector.

[0063] For example, Figure 4 This is a schematic diagram of a first content vector determination process provided in an embodiment of the present disclosure, such as... Figure 4As shown in the figure, the process of determining the first content vectors for text blocks, image blocks, and table blocks is illustrated. After content block type identification at the starting node, multiple content blocks are divided into text blocks, image blocks, and table blocks based on the type identifier. For text blocks, a text vector is output after encoding, for example, with a dimension of 768, which can be represented as V_text. For image blocks, a visual vector is obtained after encoding the image block, for example, with a dimension of 512, which can be represented as V_image. The associated text block of the image block is encoded to obtain a description vector, for example, with a dimension of 768, which can be represented as V_img_desc. The visual vector and the description vector are fused to obtain the image vector. Specifically, the fusion is performed by using zero-padding to expand the dimension of V_image to 768, and then weighted and summed with V_img_desc with weights of 0.6 and 0.4 to obtain the image vector V_pic. For each table block, the row and column headers are encoded to obtain a table structure vector, for example, a 768-dimensional vector denoted as V_table_struct. The table data is then converted into descriptive text based on the row and column headers, and this descriptive text is encoded to obtain a table data vector, for example, a 768-dimensional vector denoted as V_table_data. The table structure vector and table data vector are then merged to obtain a table vector, for example, by weighting V_table_struct and V_table_data with weights of 0.5 and 0.5 respectively. Finally, each branch aggregates the text vector, image vector, and table vector into a multimodal vector set, which is the first content vector mentioned above.

[0064] For example, Figure 5 This is a schematic diagram of a second content vector determination process provided in an embodiment of the present disclosure, such as... Figure 5 As shown, with Figure 3 Taking the table block with the middle block identifier 1002 as an example, which is the content block currently being processed, we can demonstrate its vector fusion process with the associated content blocks and clearly present the core computational logic of association enhancement embedding. Figure 5 The central area is a table block, with block identifier 1002 and corresponding vector representation V_tab. The associated content blocks of the table block include the text block to the left (block identifier 1001) and the adjacent image block to the right (block identifier 1003). The table vector V_tab of the table block is multiplied by its corresponding second calculated weight of 0.6; the text vector V_text of the text block is multiplied by its corresponding first calculated weight of 0.3; and the image vector V_pic of the image block is multiplied by its corresponding first calculated weight of 0.1. These are then summed to obtain the second content vector of the table block: 0.6V_tab + 0.3V_text + 0.1. V_pic, the specific values ​​of the weights in the diagram are only examples. After the second content vector of the table block is labeled with the second content vector of its associated content block, it is stored in the knowledge base.

[0065] This solution models the relationships between different content blocks in a tree-structured document, breaking through the limitations of traditional multimodal embedding techniques that fragment content connections. This allows the generated vectors to better reflect the contextual semantics of multimodal content, improving the accuracy of subsequent retrieval. Differentiated feature fusion schemes are designed for different types of content blocks, combined with association-enhanced embedding. The generated structured association vectors better fit the structural characteristics of multimodal documents, providing high-quality vector data support for multimodal responses generated based on retrieval enhancement, thus improving the richness and accuracy of the response content. This solution is highly scalable and applicable to structured documents with various block-tree structures, possessing broad application scenarios. Furthermore, this solution enables cross-modal content retrieval, significantly improving the richness, completeness, and accuracy of retrieval-enhanced question-and-answer content, meeting the business needs for accurate cross-modal retrieval.

[0066] Figure 6 This is a schematic diagram of a knowledge base construction apparatus provided in an embodiment of this disclosure. The apparatus can be implemented by software and / or hardware, and is generally integrated into an electronic device. Figure 6 As shown, the device includes: The acquisition module 601 is used to acquire multiple content blocks of the document to be processed and attribute information corresponding to each content block, wherein the attribute information includes type identifier and hierarchical relationship data; The relationship module 602 is used to generate block relationship data based on the hierarchical relationship data of each content block, wherein the block relationship data represents the association relationship between different content blocks; The encoding module 603 is used to encode each content block according to the type identifier of each content block, and generate a first content vector for each content block; The fusion module 604 is used to determine the associated content blocks of each content block, and to perform vector fusion of each content block with the first content vector of the corresponding associated content block according to the block relationship data to obtain the second content vector of each content block. A creation module 605 is used to create a knowledge base based on the second content vectors corresponding to the multiple content blocks respectively.

[0067] Optionally, relation module 602 is specifically used for: Based on the hierarchical relationship data of each content block, the multiple content blocks are combined according to parent-child or sibling relationships to generate multiple relationship groups; The plurality of relation groups are identified as the block relation data.

[0068] Optionally, each of the relationship groups includes two content blocks and a relationship type between the two content blocks. The relationship type includes a parent-child relationship or a sibling relationship. The parent-child relationship indicates that one of the two content blocks includes the other content block, and the sibling relationship indicates that the two content blocks belong to the same other content block.

[0069] Optionally, the encoding module 603 includes: The first unit is used to sequentially extract the plurality of content blocks as the current content block; The second unit is used to encode the text block using a text encoding model if the current content block is determined to be a text block based on the type identifier of the current content block, thereby obtaining a text vector; The third unit is used to encode the image block into a visual vector using an image encoding model and to encode the associated text block of the image block into a description vector using the text encoding model if the current content block is determined to be an image block based on the type identifier of the current content block; and to fuse the visual vector and the description vector into an image vector of the image block. The fourth unit is used to encode the table block using the text encoding model if the current content block is determined to be a table block based on the type identifier of the current content block, thereby obtaining a table vector; The fifth unit is used to use the text vector, the image vector, or the table vector as the first content vector.

[0070] Optionally, the table block includes row headers, column headers, and table data, and the fourth unit is specifically used for: The table structure vector is obtained by encoding the row headers and column headers using the text encoding model described above. Based on the row headers and column headers, the table data is converted into descriptive text, and the descriptive text is encoded using the text encoding model to obtain a table data vector; The table structure vector is obtained by fusing the table data vector with the table structure vector.

[0071] Optionally, the fusion module 604 includes: The lookup unit is used to find the target relationship group to which the content block belongs, according to the block relationship data, for each content block; A determining unit is configured to determine another content block in the target relationship group, excluding the content block, as the associated content block of the content block; A first weighting unit is used to obtain a second calculated weight of the content block, wherein the second calculated weight is greater than the first calculated weight; The second weighting unit is used to determine the first calculated weight of the associated content block according to the relationship type of the target relationship group; An execution unit is configured to determine the first product of the first content vector of the content block and the first product of the corresponding second calculated weight, and the second product of the first content vector of the associated content block and the corresponding first calculated weight, and to use the sum of the first product and the second product as the second content vector of the content block.

[0072] Optionally, the second weighting unit is used for: If the relationship type in the target relationship group is a parent-child relationship, then the first calculated weight is set to the first value; If the relationship type in the target relationship group is a sibling relationship, then the first calculated weight is set to the second value, wherein the first value is greater than the second value.

[0073] Optionally, when the content block is an image block, the associated content blocks of the content block include text blocks and table blocks; When the content block is a table block, the associated content blocks of the content block include text blocks and image blocks.

[0074] Optionally, the device further includes a retrieval module, which is specifically used for: Obtain a retrieval request for the knowledge base, wherein the retrieval request includes retrieval content; Based on the search content, the search results are matched among multiple second content vectors in the knowledge base, and the second content vector with the highest matching degree is determined as the search result.

[0075] The knowledge base construction apparatus provided in this disclosure can execute the knowledge base construction method provided in any embodiment of this disclosure, and has the corresponding functional modules and beneficial effects of the execution method.

[0076] This disclosure also provides a computer program product, including a computer program / instruction. When executed by a processor, the computer program / instruction implements the knowledge base construction method provided in any embodiment of this disclosure, and has the corresponding functional modules and beneficial effects of the execution method.

[0077] Figure 7 This is a schematic diagram of an electronic device provided in an embodiment of the present disclosure. See below for details. Figure 7The diagram illustrates a structural schematic suitable for implementing the electronic device 700 in the embodiments of this disclosure. The electronic device 700 in the embodiments of this disclosure may include, but is not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and fixed terminals such as digital TVs and desktop computers. Figure 7 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of the embodiments disclosed herein.

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

[0079] Typically, the following devices can be connected to I / O interface 705: input devices 706 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 707 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 708 including, for example, magnetic tapes, hard disks, etc.; and communication devices 709. Communication device 709 allows electronic device 700 to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 7 An electronic device 700 with various devices is shown; however, it should be understood that it is not required to implement or possess all of the devices shown. More or fewer devices may be implemented or possessed alternatively.

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

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

[0082] In some implementations, clients and servers can communicate using any currently known or future-developed network protocol such as HTTP (Hypertext Transfer Protocol) and can interconnect with digital data communication (e.g., communication networks) of any form or medium. Examples of communication networks include local area networks (“LANs”), wide area networks (“WANs”), the Internet (e.g., the Internet of Things), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future-developed networks.

[0083] The aforementioned computer-readable medium may be included in the aforementioned electronic device; or it may exist independently and not assembled into the electronic device.

[0084] The aforementioned computer-readable medium carries one or more programs. When the aforementioned one or more programs are executed by the electronic device, the electronic device causes the following: it acquires multiple content blocks of a document to be processed and attribute information corresponding to each content block, wherein the attribute information includes type identifiers and hierarchical relationship data; it generates block relationship data based on the hierarchical relationship data of each content block, wherein the block relationship data represents the association relationship between different content blocks; it encodes each content block according to its type identifier to generate a first content vector for each content block; it determines the associated content blocks of each content block, and performs vector fusion between each content block and the first content vector of the corresponding associated content block according to the block relationship data to obtain a second content vector for each content block; and it creates a knowledge base based on the second content vectors corresponding to the multiple content blocks.

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

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

[0087] The units described in the embodiments of this disclosure can be implemented in software or hardware. The names of the units are not, in some cases, intended to limit the specific unit.

[0088] The functions described above in this document can be performed at least in part by one or more hardware logic components. For example, exemplary types of hardware logic components that can be used, without limitation, include: field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), system-on-a-chip (SoCs), complex programmable logic devices (CPLDs), and so on.

[0089] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0090] It is understood that before using the technical solutions disclosed in the various embodiments of this disclosure, users should be informed of the types, scope of use, and usage scenarios of the information involved in this disclosure in an appropriate manner in accordance with relevant laws and regulations, and user authorization should be obtained.

[0091] The above description is merely a preferred embodiment of this disclosure and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of this disclosure is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the above-described concept. For example, technical solutions formed by substituting the above features with (but not limited to) technical features disclosed in this disclosure that have similar functions.

[0092] Furthermore, while the operations are described in a specific order, this should not be construed as requiring these operations to be performed in the specific order shown or in a sequential order. In certain environments, multitasking and parallel processing may be advantageous. Similarly, while several specific implementation details are included in the above discussion, these should not be construed as limiting the scope of this disclosure. Certain features described in the context of individual embodiments may also be implemented in combination in a single embodiment. Conversely, various features described in the context of a single embodiment may also be implemented individually or in any suitable sub-combination in multiple embodiments.

[0093] Although the subject matter has been described using language specific to structural features and / or methodological logic, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. Rather, the specific features and actions described above are merely illustrative examples of implementing the claims.

Claims

1. A method for constructing a knowledge base, characterized in that, include: Obtain multiple content blocks of the document to be processed and the attribute information corresponding to each content block, wherein the attribute information includes type identifier and hierarchical relationship data; Block relationship data is generated based on the hierarchical relationship data of each content block, wherein the block relationship data represents the association between different content blocks; Each content block is encoded according to its type identifier to generate a first content vector for each content block; Determine the associated content blocks of each content block, and according to the block relationship data, perform vector fusion between each content block and the first content vector of the corresponding associated content block to obtain the second content vector of each content block; A knowledge base is created based on the second content vectors corresponding to the multiple content blocks.

2. The method according to claim 1, characterized in that, Block relationship data is generated based on the hierarchical relationship data of each content block, including: Based on the hierarchical relationship data of each content block, the multiple content blocks are combined according to parent-child or sibling relationships to generate multiple relationship groups; The plurality of relation groups are identified as the block relation data.

3. The method according to claim 2, characterized in that, Each relationship group includes two content blocks and a relationship type between the two content blocks. The relationship type includes a parent-child relationship or a sibling relationship. The parent-child relationship indicates that one of the two content blocks includes the other content block. The sibling relationship indicates that the two content blocks belong to the same other content block.

4. The method according to claim 1, characterized in that, Encoding each content block according to its type identifier to generate a first content vector for each content block includes: Extract the multiple content blocks sequentially as the current content block; If the current content block is determined to be a text block based on its type identifier, a text encoding model is used to encode the text block to obtain a text vector; If the current content block is determined to be an image block based on the type identifier of the current content block, the image block is encoded using an image encoding model to obtain a visual vector, and the associated text block of the image block is encoded using the text encoding model to obtain a description vector. The visual vector and the description vector are then fused to obtain the image vector of the image block. If the current content block is determined to be a table block based on the type identifier of the current content block, the table block is encoded using the text encoding model to obtain a table vector; The text vector, the image vector, or the table vector is used as the first content vector.

5. The method according to claim 4, characterized in that, The table block includes row headers, column headers, and table data. The table block is encoded using the text encoding model to obtain a table vector, which includes: The table structure vector is obtained by encoding the row headers and column headers using the text encoding model described above. Based on the row headers and column headers, the table data is converted into descriptive text, and the descriptive text is encoded using the text encoding model to obtain a table data vector; The table structure vector is obtained by fusing the table data vector with the table structure vector.

6. The method according to claim 1, characterized in that, According to the block relationship data, each content block is vector-fused with the first content vector of its corresponding associated content block to obtain the second content vector of each content block, including: For each content block, find the target relationship group to which the content block belongs according to the block relationship data; The other content block in the target relationship group, excluding the content block, is identified as the associated content block of the content block; Based on the relationship type in the target relationship group, determine the first calculated weight of the associated content block; Obtain the second calculated weight of the content block, wherein the second calculated weight is greater than the first calculated weight; Determine the first content vector of the content block and the first product of the corresponding second calculated weight, and the second product of the first content vector of the associated content block and the corresponding first calculated weight, and use the sum of the first product and the second product as the second content vector of the content block.

7. The method according to claim 6, characterized in that, Based on the relationship types in the target relationship group, the first calculated weight of the associated content block is determined, including: If the relationship type in the target relationship group is a parent-child relationship, then the first calculated weight is set to the first value; If the relationship type in the target relationship group is a sibling relationship, then the first calculated weight is set to the second value, wherein the first value is greater than the second value.

8. The method according to claim 6, characterized in that, When the content block is an image block, the associated content blocks of the content block include text blocks and table blocks; When the content block is a table block, the associated content blocks of the content block include text blocks and image blocks.

9. The method according to claim 1, characterized in that, The method further includes: Obtain a retrieval request for the knowledge base, wherein the retrieval request includes retrieval content; Based on the search content, the search results are matched among multiple second content vectors in the knowledge base, and the second content vector with the highest matching degree is determined as the search result.

10. A knowledge base construction apparatus, characterized in that, include: The acquisition module is used to acquire multiple content blocks of the document to be processed and the attribute information corresponding to each content block, wherein the attribute information includes type identifier and hierarchical relationship data; The relationship module is used to generate block relationship data based on the hierarchical relationship data of each content block, wherein the block relationship data represents the association relationship between different content blocks; An encoding module is used to encode each content block according to the type identifier of each content block, and generate a first content vector for each content block; The fusion module is used to determine the associated content blocks of each content block, and according to the block relationship data, to perform vector fusion between each content block and the first content vector of the corresponding associated content block to obtain the second content vector of each content block. A creation module is used to create a knowledge base based on the second content vectors corresponding to the multiple content blocks.

11. An electronic device, characterized in that, The electronic device includes: processor; Memory used to store the processor's executable instructions; The processor is configured to read the executable instructions from the memory and execute the instructions to implement the knowledge base construction method according to any one of claims 1-9.

12. A computer-readable storage medium, characterized in that, The storage medium stores a computer program for executing the knowledge base construction method according to any one of claims 1-9.