Knowledge retrieval method and product for intelligent marketing agent

CN123012151APending Publication Date: 2026-10-30BEIJING VOLCANO ENGINE TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611507802.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-09-24
Publication Date
2026-10-30

AI Technical Summary

Benefits of technology

[0006]由此,在进行知识检索时可以先通过对交互请求分析获得检索类型和元数据检索条件,从而可以基于元数据检索条件和知识库中的知识元数据进行初步筛选,获得第一候选知识,之后从第一候选知识中进行相关性检索,可以有效降低知识检索过程中所需的数据计算量,提高知识检索的效率和准确性。并且,在知识检索过程中还可以基于不同检索模式进行融合检索,并基于检索类型确定不同检索模式对应的权重,通过动态获取第一权重和第二权重的方式,保证不同检索模式获得的检索结果进行融合的准确性,使得知识检索过程和交互请求相匹配,进一步提升召回知识的准确性和可用性,为后续确定交互请求对应的响应信息提供有效的数据支持。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123012151A_ABST
    Figure CN123012151A_ABST
Patent Text Reader

Abstract

A knowledge retrieval method and product for an intelligent marketing intelligent agent, relating to the technical field of computers, the method comprising: acquiring a retrieval type and metadata retrieval conditions based on an interaction request; acquiring a first weight and a second weight based on the retrieval type, the first weight representing the weight of a first retrieval mode, and the second weight representing the weight of a second retrieval mode; retrieving from a knowledge base based on the metadata retrieval conditions to obtain first candidate knowledge; retrieving from the first candidate knowledge based on the first retrieval mode, the second retrieval mode, the first weight, and the second weight to obtain second candidate knowledge; and acquiring recall knowledge corresponding to the interaction request based on the second candidate knowledge. Thus, in the knowledge retrieval process, fusion retrieval can be performed based on different retrieval modes, and the weights corresponding to different retrieval modes can be dynamically determined based on the retrieval type, thereby improving the accuracy of knowledge retrieval.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This article relates to the field of computer technology, specifically to a knowledge retrieval method and product for intelligent marketing agents. Background Technology

[0002] Retrieval-Augmented Generation (RAG) retrieves relevant information from a document knowledge set, enabling large language models to guide their generation process based on this retrieved information. Therefore, the accuracy of the knowledge recalled by RAG has a significant impact on the output of the large language model. Summary of the Invention

[0003] This content section is provided to briefly introduce the ideas, which will be described in detail in the examples section later. This content section is not intended to identify key or essential features of the claimed content, nor is it intended to limit the scope of the claimed content.

[0004] Firstly, a knowledge retrieval method for intelligent marketing agents is provided, including: The search type and metadata search conditions are obtained based on the interaction request, which is used to interact with the intelligent marketing agent; A first weight and a second weight are obtained based on the search type, wherein the first weight represents the weight of the first search mode and the second weight represents the weight of the second search mode; Based on the aforementioned metadata retrieval criteria, a first candidate knowledge is obtained by retrieving information from the knowledge base. Based on the first retrieval mode, the second retrieval mode, the first weight, and the second weight, a second candidate knowledge is obtained by retrieving from the first candidate knowledge. Based on the second candidate knowledge, the recall knowledge corresponding to the interaction request is obtained.

[0005] In a second aspect, a computer program product is provided, comprising a computer program, wherein the computer program implements the method described in the first aspect when executed.

[0006] Therefore, during knowledge retrieval, the search type and metadata search conditions can be obtained first by analyzing the interaction request. This allows for preliminary screening based on the metadata search conditions and the knowledge metadata in the knowledge base, yielding first-line candidate knowledge. Relevance retrieval is then performed from these first-line candidate knowledge, effectively reducing the amount of data computation required and improving the efficiency and accuracy of knowledge retrieval. Furthermore, the knowledge retrieval process can be integrated based on different search modes, with weights determined according to the search type. By dynamically acquiring the first and second weights, the accuracy of integrating search results from different search modes is ensured, matching the knowledge retrieval process with the interaction request. This further improves the accuracy and usability of the retrieved knowledge, providing effective data support for determining the response information corresponding to the interaction request.

[0007] Other features and advantages will be described in detail in the following examples section. Attached Figure Description

[0008] The above and other features, advantages, and aspects of this document will become more apparent when viewed in conjunction with the accompanying drawings and the following examples. 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. In the drawings: Figure 1 These are schematic diagrams illustrating implementation scenarios based on certain conditions.

[0009] Figure 2 This is a flowchart illustrating a knowledge retrieval method for intelligent marketing agents, based on certain scenarios.

[0010] Figure 3 This is a flowchart illustrating the construction process of a knowledge base based on certain scenarios.

[0011] Figure 4 This is a flowchart illustrating a knowledge retrieval method for intelligent marketing agents, based on certain scenarios.

[0012] Figure 5 This is a block diagram illustrating a knowledge retrieval device for intelligent marketing agents, shown in some scenarios.

[0013] Figure 6 These are schematic diagrams of the structure of electronic devices shown in various scenarios. Detailed Implementation

[0014] The following description will be given in more detail with reference to the accompanying drawings. While certain scenarios are shown in the drawings, it should be understood that this document can be implemented in various forms and should not be construed as limited to the scenarios described herein. Rather, these scenarios are provided to provide a more thorough and complete understanding of this document. It should be understood that the accompanying drawings and the scenarios depicted are for illustrative purposes only and are not intended to limit the scope of this document.

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

[0016] The term "comprising" and its variations can be open-ended, meaning "including but not limited to". The term "based on" can mean "at least partially based on". The term "one case" means "at least one case"; the term "another case" means "at least one additional case"; the term "some cases" means "at least some cases". Definitions of other terms will be given in the following description.

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

[0018] It should be noted that the modifiers “one” and “multiple” can be 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”.

[0019] The names of messages or information exchanged between multiple devices are for illustrative purposes only and are not intended to limit the scope of these messages or information.

[0020] It is understandable that the data involved in the technical solution (including but not limited to the data itself, the acquisition or use of the data) should comply with the requirements of relevant regulations.

[0021] Figure 1The diagram illustrates an implementation scenario based on various conditions. The implementation scenario may include a terminal device 101, a server 102, and an intelligent system 103. Communication between the terminal device 101, server 102, and intelligent system 103 can be achieved using communication methods commonly used in the field, including but not limited to wired or wireless methods, and can also be established simultaneously through direct or indirect communication connections. The terminal device 101 may include, but is not limited to, mobile terminals such as mobile phones, laptops, and PADs (Tablet Personal Computers), as well as fixed terminals such as digital TVs (Televisions) and desktop computers. The intelligent system 103 may be an intelligent marketing agent.

[0022] For example, a user can input interactive information on terminal device 101. Based on this interactive information, terminal device 101 initiates an interactive request, which may carry the user-input interactive information. Terminal device 101 sends the interactive request to server 102, which then calls intelligent system 103 for processing to obtain response information corresponding to the interactive request. During the processing of the interactive request by intelligent system 103, a retrieval enhancement generation tool can be invoked to retrieve knowledge from the knowledge base to obtain recalled knowledge. After obtaining the recalled knowledge, intelligent system 103 can invoke a large model based on the recalled knowledge and the interactive request, and obtain response information based on the output of the large model. The response information is then returned to terminal device 101 via server 102 and displayed to the user on terminal device 101, completing the interaction loop. Therefore, the accuracy of the retrieved knowledge in the knowledge base has a significant impact on the response result of the interactive request. Based on this, this paper provides a knowledge retrieval method and product for intelligent marketing agents. Figure 2 The diagram shows a flowchart illustrating a knowledge retrieval method for intelligent marketing agents, illustrating various scenarios. Figure 2 As shown, the method may include: In step 21, the search type and metadata search conditions are obtained based on the interaction request, which is used to interact with the intelligent marketing agent.

[0023] In this context, the intelligent marketing agent can be understood as a business-domain-oriented intelligent system that can describe problems using natural language and retrieve knowledge from a knowledge base while invoking relevant tools. Thus, the intelligent system can process the input problem and retrieved knowledge through a process of perception, planning, tool invocation, execution, and feedback iteration to obtain a response.

[0024] In one context, an intelligent system is an information processing system. This intelligent system uses at least one or more models to process one or more inputs. The intelligent system may include the one or more models as components, or it may use models external to the system for processing. Those skilled in the art will recognize that there are various implementations of intelligent systems in the industry, including but not limited to agents, AI (Artificial Intelligence) assistants, AI workers, copilot systems, and chatbots. The inputs include data in one or more modalities. The modal data includes, but is not limited to, text, audio, images, video, application-specific data, or scientific computing data. The models include, but are not limited to, one or more combinations of the following: large-scale parametric models, deep learning models, neural network models, machine learning models, statistical models, rule-based models, or other models capable of processing the inputs. The specific implementation of the models can employ various existing or improved models. The intelligent system may involve one or more of the following operations: receiving single-round or multi-round input; recognizing and / or understanding the input; generating answers, decisions, or processing results using one or more models; invoking one or more external tools, interfaces, knowledge bases, or other systems to obtain information or perform operations; processing in a self-decision-making or human-machine collaborative manner, or transferring tasks to human or other systems for processing. Self-decision-making refers to execution without human intervention. Human-machine collaboration refers to partial human participation or confirmation. The above explanation of "intelligent system" is illustrative, and each description is an example, not necessarily necessary, and does not constitute an exhaustive list.

[0025] The retrieval type refers to the type of interaction request. The retrieval type can include, but is not limited to, factual, definitional, process-oriented, comparative, and enumeration types, and can be pre-set based on the actual application scenario. For example, the retrieval type can be obtained by analyzing the interaction information in the interaction request based on a pre-trained classification model, or it can be obtained by analyzing the interaction information in the interaction request based on a large language model.

[0026] The metadata retrieval conditions may include the retrieval fields in the interaction request. The retrieval fields can be identified and determined through the interaction information in the interaction request. The fields to be identified can be preset. For example, the fields to be identified from the interaction request include, but are not limited to, entity fields, document type fields, time fields, etc. Therefore, the interaction information can be identified through a large language model or a pre-trained recognition model to determine whether the interaction information contains retrieval fields, and when a retrieval field is identified, the field value of the retrieval field is obtained.

[0027] In step 22, a first weight and a second weight are obtained based on the search type. The first weight represents the weight of the first search mode, and the second weight represents the weight of the second search mode.

[0028] In some cases, the first retrieval mode can be a dense retrieval mode, such as a vector retrieval mode. For example, interactive information can be encoded to obtain the corresponding interactive vector. Retrieval and recall can be performed by comparing the interactive vector with the vectors corresponding to various knowledge in the knowledge base. This is applicable to the retrieval of knowledge such as technical documents and product documents. The second retrieval mode can be a sparse retrieval mode, such as the BM (Best Matching) 25 algorithm. This is applicable to the retrieval of knowledge such as natural language question answering and concept understanding. Different user input interactive information may result in different emphases of knowledge during knowledge retrieval. Therefore, a first weight range and a second weight range corresponding to different retrieval types can be pre-configured. These can be obtained based on actual application scenarios and prior statistics and experiments. The first weight range represents the candidate value range for the first weight, and the second weight range represents the candidate value range for the second weight. Therefore, after determining the retrieval type, the first weight and the second weight can be obtained based on the first weight range and the second weight range corresponding to the retrieval type, so as to accurately fuse the knowledge recalled by the first retrieval mode and the second retrieval mode.

[0029] In some cases, the first weight can be obtained by sampling within the first weight range, and the difference between the first weight and the first weight can be used as a candidate second weight. If the candidate second weight belongs to the second weight range, the candidate second weight is determined as the second weight. If the candidate second weight does not belong to the second weight range, the first weight is sampled again until the corresponding candidate second weight belongs to the second weight range.

[0030] In some cases, the second weight can be obtained by sampling within the second weight range. The difference between the first weight and the second weight is used as a candidate first weight. If the candidate first weight belongs to the first weight range, the candidate first weight is determined as the first weight. If the candidate first weight does not belong to the first weight range, the second weight is sampled again until the corresponding candidate first weight belongs to the first weight range.

[0031] In some cases, the first weight can be obtained by sampling within the first weight range, and the second weight can be obtained by sampling within the second weight range.

[0032] In this way, the weights corresponding to the first and second retrieval modes can be quickly determined, so as to integrate the knowledge retrieved by the first and second retrieval modes. At the same time, the first and second weights can be dynamically obtained to ensure the matching degree between the knowledge retrieval process and the interaction request, thereby improving the accuracy of the recalled knowledge obtained by knowledge retrieval and providing effective data support for subsequent intelligent system interaction.

[0033] In step 23, the first candidate knowledge is obtained by retrieving from the knowledge base based on the metadata retrieval conditions.

[0034] Among these methods, the knowledge in the knowledge base can be initially filtered based on the search fields in the metadata search conditions to obtain the first candidate knowledge.

[0035] In some cases, the knowledge in the knowledge base is associated with knowledge metadata, which is generated when the knowledge is generated based on the document. For example, the knowledge metadata may include information about text blocks obtained by segmenting the document. This knowledge metadata may include source file metadata, structural metadata, semantic metadata, quality metadata, and retrieval metadata. The source file metadata may include the document to which the knowledge belongs, the document type, the document version, and the document parsing time. The structural metadata may include the hierarchical path, parent text block, anchor type, and anchor value. The semantic metadata may include the topic tags, key entities, and role information corresponding to the knowledge. The quality metadata may include the completeness dimension score, information density dimension score, consistency dimension score, retrieval dimension score, and quality score corresponding to the knowledge document. The retrieval metadata may include sparse search keywords, dense search vectors, and search suggestion information. The relevant data in this knowledge metadata will be explained in the following description of the knowledge base construction.

[0036] Accordingly, the step of retrieving first candidate knowledge from the knowledge base based on the metadata retrieval conditions may include: matching the metadata retrieval conditions with the knowledge metadata in the knowledge base to obtain matching knowledge metadata; and using the knowledge associated with the matching knowledge metadata as the first candidate knowledge.

[0037] In this process, matching can be performed between the search fields in the metadata retrieval conditions and the knowledge metadata in the knowledge base. For example, the first field value of the search field in the knowledge metadata can be matched with the second field value of the search field in the metadata retrieval conditions. If the first field value and the second field value are the same or the similarity exceeds a specified threshold, the knowledge metadata can be considered to match the metadata retrieval conditions. Then, the knowledge associated with the matched knowledge metadata is taken as the first candidate knowledge. This allows for initial screening of knowledge from the knowledge base based on the metadata retrieval conditions, filtering knowledge based on the metadata retrieval conditions determined by the interaction request, reducing the amount of knowledge that needs to be relevance calculated later, and improving the efficiency of knowledge retrieval.

[0038] It should be noted that steps 22 and 23 can be executed in parallel or sequentially; step 22 can be executed first and then step 23, or vice versa. Figure 2 The execution order shown is merely an example order and is not intended to be restrictive.

[0039] In step 24, based on the first retrieval mode, the second retrieval mode, the first weight, and the second weight, a retrieval is performed from the first candidate knowledge to obtain the second candidate knowledge.

[0040] The retrieval process can be based on a first retrieval mode, where the search is performed on first candidate knowledge. This can be achieved by calculating the similarity between the encoded vector of the interaction information and the vector corresponding to each piece of knowledge in the first candidate knowledge set, such as using cosine similarity. The first retrieval result is then determined from the first candidate knowledge based on this similarity. For example, knowledge with a similarity greater than a first threshold can be used as the first retrieval result. Alternatively, the similarity can be sorted from largest to smallest, and the top N pieces of similar knowledge can be used as the first retrieval result, where N is a positive integer. Furthermore, a second retrieval mode can be used to retrieve information from the first candidate knowledge. This can be achieved by calculating the score corresponding to each piece of knowledge in the first candidate knowledge set using the BM25 algorithm, sorting the scores from largest to smallest, and using the top N pieces of similar knowledge as the second retrieval result, where N is a positive integer.

[0041] Then, the first and second search results can be merged based on the first and second weights.

[0042] For example, the first and second search results can be fused using the RRF (Reciprocal Rank Fusion) algorithm. For the first search result, a first score can be determined based on the ranking of the knowledge within it; for example, the reciprocal of the sum of the knowledge's ranking in the first search result and a smoothing constant can be used as the first score. For the second search result, a second score can be determined based on the ranking of the knowledge within it; for example, the reciprocal of the sum of the knowledge's ranking in the second search result and a smoothing constant can be used as the second score. Then, for each piece of knowledge in both the first and second search results, the fusion score can be the sum of the product of its first score and first weight, and the product of its second score and second weight. If a piece of knowledge appears only in the first search result, its second score is zero; if it appears only in the second search result, its first score is zero. Thus, the knowledge in the first and second search results can be merged and sorted according to the fusion scores in descending order to obtain the second candidate knowledge.

[0043] In step 25, based on the second candidate knowledge, the recall knowledge corresponding to the interaction request is obtained.

[0044] As an example, the second candidate knowledge can be directly used as the recalled knowledge. As another example, the recalled knowledge can be obtained by filtering according to the number of recalled knowledge items and the order of the second candidate knowledge items. For example, if the number of recalled knowledge items is M, then the top M items from the second candidate knowledge items can be used as the recalled knowledge items. After obtaining the recalled knowledge items, the intelligent marketing agent can invoke the corresponding large language model based on the interaction request, the recalled knowledge items, and the prompt words. This allows the large language model to perform data reasoning based on the interaction request and the recalled knowledge items to obtain the processing results. The intelligent marketing agent then integrates the processing results to obtain the response information corresponding to the interaction request.

[0045] Therefore, during knowledge retrieval, the search type and metadata search conditions can be obtained first by analyzing the interaction request. This allows for preliminary screening based on the metadata search conditions and the knowledge metadata in the knowledge base, yielding first-line candidate knowledge. Relevance retrieval is then performed from these first-line candidate knowledge, effectively reducing the amount of data computation required and improving the efficiency and accuracy of knowledge retrieval. Furthermore, the knowledge retrieval process can be integrated based on different search modes, with weights determined according to the search type. By dynamically acquiring the first and second weights, the accuracy of integrating search results from different search modes is ensured, matching the knowledge retrieval process with the interaction request. This further improves the accuracy and usability of the retrieved knowledge, providing effective data support for determining the response information corresponding to the interaction request.

[0046] In some cases, the second candidate knowledge is associated with a parent identifier, whereby, while segmenting the document to obtain text blocks, parent-child relationships between different text blocks can be constructed. For example, for each document chapter, a parent text block can be generated based on the chapter title and chapter summary. This parent text block serves as the parent text block for each child text block in the main text of that chapter, and the parent identifier is the identifier of the parent text block.

[0047] Accordingly, the method may further include: Based on the parent identifier associated with the second candidate knowledge, the parent knowledge corresponding to the parent identifier is obtained from the knowledge base.

[0048] In knowledge retrieval scenarios, in order to ensure the comprehensiveness of the retrieved knowledge, after obtaining the second candidate knowledge, its associated parent identifier can be obtained, thereby obtaining the parent knowledge corresponding to the parent identifier from the knowledge base.

[0049] Obtain the child knowledge corresponding to the parent knowledge, and perform deduplication on the child knowledge to obtain the third candidate knowledge.

[0050] As an example, each piece of knowledge in the knowledge base contains a sub-knowledge identifier. This allows the sub-knowledge identifier to be obtained from the parent knowledge's data, and then the corresponding sub-knowledge to be retrieved from the knowledge base based on this identifier. The obtained sub-knowledge is then deduplicated to obtain the final retained knowledge as the third candidate knowledge. Deduplication can be performed using methods commonly used in this field, and there are no restrictions on this. The third candidate knowledge can represent knowledge associated with the parent-child relationship based on the second candidate knowledge.

[0051] Based on the second candidate knowledge and the third candidate knowledge, the recall knowledge is obtained.

[0052] For example, both the second and third candidate knowledge can be used as recalled knowledge. Alternatively, the recalled knowledge can be obtained by filtering according to the number of recalled knowledge and the order of the second candidate knowledge. For instance, if the number of recalled knowledge is M, it can be iterated sequentially according to the ranking of the second candidate knowledge. During the iteration, knowledge and its associated third candidate knowledge can be added to the recalled knowledge until the number of recalled knowledge reaches the corresponding threshold.

[0053] Therefore, during the knowledge retrieval process, the retrieved knowledge can be expanded to obtain various knowledge corresponding to the same parent knowledge as the second candidate knowledge, ensuring the comprehensiveness and diversity of the recalled knowledge, improving the accuracy of knowledge retrieval, avoiding the lack of necessary context during the generation of large language models leading to fragmented or contradictory answers, and ensuring the accuracy and usability of the output results determined by the large language model based on the recalled knowledge.

[0054] In some cases, the knowledge base is constructed in the following manner: The first document is segmented to obtain multiple first text blocks.

[0055] The first document can be a structured document obtained by parsing an original document, which can be provided by the user. The user can provide the original document used to build the knowledge base. This original document can be unstructured data and can contain various document types, such as Word, PDF (Portable Document Format), and plain text (e.g., with .txt or .md extensions). Corresponding document parsers can be pre-set for different document types to parse the original document into a structured document. Parsing can be based on document parsing methods available in the field for various document types, and there is no limitation on this. After parsing the original document to obtain the parsed data, the parsed data can be stored according to a pre-set format, thus obtaining the first document.

[0056] After obtaining the first document, it can be segmented into multiple text chunks. As an example, a fixed-length window slicing method can be used. The first document can be converted into a plain text string, and then continuously sliced ​​along the character stream according to a preset number of characters N. An overlap of length O is maintained between adjacent text chunks to alleviate boundary fragmentation. The number of characters N and the overlap length O can be pre-configured based on the actual application scenario. Another example is recursive slicing based on delimiters. A set of priority delimiters can be preset, such as paragraph marks, periods, commas, and spaces, with decreasing priority. Slicing is then performed first based on the highest priority delimiter. If the length of the obtained text chunk exceeds the preset length, the next lower priority delimiter is used recursively to obtain the segmented first text chunk.

[0057] After obtaining the first text block, determine the dimension scores of the first text block in multiple evaluation dimensions; based on the multiple dimension scores of the first text block, determine the quality score of the first text block.

[0058] Among them, multiple evaluation dimensions can be pre-set based on actual application scenarios, so as to analyze and detect each first text block for each evaluation dimension, and to evaluate the quality of the segmented text blocks.

[0059] As an example, the evaluation dimensions may include multiple of the following: completeness dimension, information density dimension, consistency dimension, and retrieval dimension, and the following provides an illustrative description of each dimension.

[0060] The completeness dimension is used to characterize whether the semantics of the first text block are complete. The dimension score corresponding to the completeness dimension can be determined using the following metrics: The first integrity sub-index is used to characterize syntactic integrity. It can be determined by checking whether syntactic integrity rules are met. Syntactic integrity rules may include: the first and last parts of the first text block are at the boundaries of a complete sentence; the first text block has no sentence breaks; the first text block has no hanging clauses; the first text block has no unclosed parentheses or quotation marks, etc. Different rules can be assigned corresponding scores, and the index value of the first integrity sub-index can be the sum of the scores of the matched syntactic integrity rules.

[0061] The second integrity sub-index is used to characterize structural integrity. It can be determined by verifying whether structural integrity rules are met. Structural integrity rules could include rules such as the list in the first text block not being truncated, the table code block in the first text block not being truncated, and the code block in the first text block not being truncated. Different rules can be assigned corresponding scores, and the index value of the second integrity sub-index can be the sum of the scores of the met structural integrity rules.

[0062] The third completeness sub-index is used to characterize the completeness of reference. For example, it can be determined by checking whether there are pronouns in the first text block that lack antecedents. The index value can be determined based on the number of pronouns that lack antecedents. The fewer the number of pronouns, the larger the index value.

[0063] For example, the score corresponding to the integrity dimension can be a weighted sum of the values ​​of the first, second, and third integrity sub-indicators, where the weights of the first, second, and third integrity sub-indicators can be preset. Thus, the integrity dimension can be used to assess the degree of closure of the first text block at the semantic, syntactic, and structural levels, thereby minimizing the occurrence of semantically broken text blocks.

[0064] The information density dimension, used to characterize the amount of information contained in the first text block, can be determined by the following indicators: The dimension score corresponding to the information density dimension is: Effective character percentage indicators can be used as the ratio of meaningful characters in the first text block after removing stop words, punctuation, and spaces to the total number of characters in the first text block.

[0065] Entity density metrics, such as the frequency of occurrence of entity keywords within a unit length in the first text block, can be used as the metric value. Entity keywords can be named entities, numbers, and general terms in the first text block.

[0066] Information entropy metrics, such as Shannon entropy estimates based on word frequency distribution in the first text block, can be calculated.

[0067] For example, the dimension score corresponding to the information density dimension can be a weighted sum of the values ​​of the effective character percentage index, entity density index, and information entropy index, where the weights of the effective character percentage index, entity density index, and information entropy index can be preset. Thus, the effective information content carried in the first text block can be evaluated through the information density dimension, avoiding text blocks with low information density such as pure table of contents, pure blank spaces, or pure page numbers.

[0068] The consistency dimension, used to characterize whether the content themes contained in the first text block are consistent, can be determined by the following indicators: The consistency dimension score can be determined using the following metrics: The topic cohesion index can be used to segment the first text block by sentence, calculate the cosine similarity between the embedding vectors of different sentences, and use the mean or variance of the cosine similarity as the index value.

[0069] Parent-child consistency index: If the first text block has a parent text block, the semantic similarity between the first text block and its parent text block can be used as the index value. If the first text block does not have a parent text block, this index value can be set to the default value.

[0070] The adjacency consistency index can be determined by calculating the semantic deviation between the first text block and its adjacent text blocks. The higher the semantic deviation, the higher the index value.

[0071] For example, the dimensional score corresponding to the consistency dimension can be a weighted sum of the values ​​of the topic cohesion index, the parent-child consistency index, and the adjacent consistency index, where the weights of the topic cohesion index, the parent-child consistency index, and the adjacent consistency index can be preset. Thus, the consistency dimension can be used to assess whether the internal semantics of the first text block focuses on a unified topic, avoiding the situation where a text block contains multiple unrelated topics.

[0072] The retrieval dimension, used to characterize whether the first text block is recallable, can be determined by the dimension score corresponding to the retrieval dimension using the following metrics: The index feature strength index can be determined based on the number of meaningful keywords and term coverage in the first text block. Term coverage is used to represent the ratio of the number of terms in the first text block to the total number of terms to be included. This index value can be the number of meaningful keywords, the term coverage, or a weighted sum of the two.

[0073] The recall metric can be determined by simulating the reverse generation of multiple simulated query conditions from the first text block, querying the index including the first text block based on the model query conditions, and determining the metric value based on the query results. The higher the ranking of the first text block in the query results, the larger the metric value.

[0074] Vector space distribution index: It can determine the distance distribution between the vectors of the first text block and each text block in the knowledge base, and determine the index value by comparing the distance distribution with the benchmark distribution.

[0075] For example, the dimension score corresponding to the retrieval dimension can be a weighted sum of the index feature strength index, recall index, and vector space distribution index, where the weights of the index feature strength index, recall index, and vector space distribution index can be preset. Thus, the retrieval dimension can be used to evaluate whether the first text block has sufficient features to be retrieved, ensuring that the text block stored in the knowledge base can be recalled based on query conditions, and avoiding the storage of unretrieved knowledge in the knowledge base.

[0076] In some cases, the evaluation dimensions may include the four dimensions mentioned above, thereby determining the dimension scores of the first text block under the four dimensions. In other cases, the evaluation dimensions may also include other dimensions, such as a timeliness dimension, used to characterize the segmentation time of the first text block; the shorter the segmentation time, the higher the dimension score of the timeliness dimension.

[0077] As an example, the weights corresponding to each evaluation dimension can be pre-set. Therefore, the weighted sum of the dimension scores of the first text block can be calculated based on the weights and dimension scores, and this weighted sum can be used as the quality score of the first text block.

[0078] As another example, the weights of each evaluation dimension can be dynamically determined based on the document features of the first document. For instance, the mapping relationship between document features and the weights of evaluation dimensions can be predetermined using a pattern mapping table. Therefore, the document features of the first document can be extracted, and then the weights of each evaluation dimension corresponding to the first document can be determined based on these document features and the pattern mapping table. Finally, the weighted sum of the scores of each dimension is used as the quality score of the first text block.

[0079] Therefore, the first text block can be detected through the above-mentioned multiple evaluation dimensions to verify the document slicing results, avoid storing invalid or redundant text blocks in the knowledge base, and ensure the accuracy and usability of subsequent text blocks stored in the knowledge base, thus guaranteeing the validity of the knowledge in the knowledge base and enabling accurate knowledge retrieval.

[0080] If the quality score of the first text block meets the knowledge base storage conditions, knowledge metadata is generated based on the first document, the first text block, and the quality score, and the first text block is stored in the knowledge base. Each first text block corresponds to a knowledge in the knowledge base, and the knowledge corresponding to the first text block is associated with the knowledge metadata corresponding to the first text block.

[0081] For example, the quality score of the first text block satisfies the knowledge base storage conditions, which can be that the quality score of the first text block is greater than a first threshold, and the first threshold can be set based on the actual application scenario. If the quality score of the first text block satisfies the knowledge base storage conditions, it indicates that the quality of the first text block is high, such as semantic completeness, high information density, consistent content theme within the first text block, and the ability to be effectively recalled. In this way, the first text block can be stored in the knowledge base so that the intelligent marketing agent can perform knowledge retrieval and recall from the knowledge base during problem handling.

[0082] Accordingly, when storing the first text block as knowledge in the knowledge base, quality metadata can be generated based on the obtained quality score and the dimension scores obtained from the aforementioned evaluation dimensions. Source file metadata is generated based on the first document, structural metadata is generated based on the position of the first text block in the first document, and retrieval metadata is generated based on the index information of the first text block in the knowledge base. Furthermore, topic tags, key entities, and role information can be determined based on the text block content of the first text block, which can be summarized and implemented based on a large language model. The knowledge metadata can include source file metadata, structural metadata, semantic metadata, quality metadata, and retrieval metadata. The information contained in each of these metadata categories has been detailed above and will not be repeated here. Thus, after the first text block is stored in the knowledge base, it can serve as a piece of knowledge in the knowledge base, and its corresponding knowledge and corresponding knowledge metadata are associated, so that a preliminary retrieval can be performed based on the knowledge metadata during knowledge retrieval.

[0083] If the quality score of the first text block meets the segmentation conditions, the first document is re-segmented based on the first text block to obtain a second text block, and the knowledge base is constructed based on the second text block.

[0084] The quality score of the first text block satisfies the segmentation condition, which can be either a quality score less than a second threshold, or a second threshold less than a first threshold. The second threshold can be preset based on the actual application scenario. If the quality score of the first text block satisfies the segmentation condition, it can be considered that the quality of the first text block is low. For example, the content in the first text block may be over-segmented, resulting in fragmented content, or there may be hard cuts across sentences or paragraphs in the first text block, breaking semantic closure, causing the first text block to contain incomplete information or isolated references. If such first text blocks are directly stored in the knowledge base, they will provide erroneous knowledge to the intelligent system when such first text blocks are retrieved, causing the intelligent system to output incorrect processing results. Therefore, for the first text block whose quality score meets the segmentation condition, it is not directly stored in the knowledge base. Instead, the first document is re-segmented based on the first text block to obtain the second text block, and the knowledge base is built based on the re-segmented text block.

[0085] As another example, the quality score of the first text block satisfying the knowledge base storage condition can also mean that the quality score of the first text block is greater than the first threshold and the confidence level is greater than the third threshold. Similarly, the quality score of the first text block satisfying the segmentation condition can also mean that the quality score of the first text block is less than the first threshold and the confidence level is greater than the third threshold. If the confidence level is less than or equal to the third threshold, it is considered that neither the knowledge base storage condition nor the segmentation condition is satisfied. The confidence level can be calculated based on confidence level calculation methods in this field, such as distance confidence level or smooth confidence level functions, such as the sigmoid function; there is no limitation on this.

[0086] Therefore, the first document is segmented to obtain the first text block. Before storing the first text block in the knowledge base, a quality assessment can be performed on the first text block to obtain a quality score. Then, based on the quality score, it is determined whether the first text block can be directly stored in the knowledge base. This ensures the quality of the text blocks stored in the knowledge base, avoids knowledge pollution by low-quality text blocks, and reduces the construction and testing costs of the knowledge base. At the same time, text blocks whose quality scores meet the segmentation conditions can trigger a re-segmentation process, which can also ensure that the knowledge in the first document can be accurately and effectively segmented, ensuring the integrity of the knowledge in the first document. This further improves the comprehensiveness and completeness of the knowledge in the knowledge base, thereby improving the accuracy and usability of the knowledge retrieved during the knowledge retrieval process. It can also avoid the impact on the reasoning process of the intelligent system due to errors or incompleteness in the retrieved knowledge.

[0087] In some cases, segmenting the first document to obtain multiple first text blocks may include: Feature extraction is performed on the first document to obtain document features under multiple feature dimensions.

[0088] This allows for the pre-setting of multiple feature dimensions for feature extraction from the first document, avoiding bias in feature segmentation mode selection based on a single feature dimension. For example, the feature dimensions may include multiple of the following: format dimension, feature dimension, and semantic dimension. The format dimension is used to indicate the document type of the first document.

[0089] For example, document type identification can be performed based on information such as file extension, MIME type (Multipurpose Internet Mail Extensions), and the magic number in the document header. The magic number (file signature) represents a fixed sequence of bytes at the beginning of the file that identifies its specific format, enabling rapid document type identification. Document types can include PDF, Markdown, HTML (Hypertext Markup Language), Word, and plain text. For instance, feature dimensions can be prioritized, and document type identification can be performed in descending order of priority. When a document type is identified based on the current feature dimension, the identified document type is used as the document feature under that format dimension. Alternatively, document type identification can be performed based on the above information separately, and the results can be fused using decision trees or similar methods to obtain the final document type.

[0090] The structural dimension is used to represent the content composition structure information of the first document.

[0091] For example, the structural features to be extracted can be pre-defined. These structural features include, but are not limited to: heading hierarchy depth distribution, item numbering regularity patterns (such as "Item X", "XYZ"), question-answer pair patterns (such as "Q:…A:…"), table density, list depth, and paragraph length distribution. Table density can represent the proportion of content in the table to the overall content of the first document, and list depth can characterize the nesting depth of ordered lists in the first document. Therefore, the above features can be extracted to obtain the document features of the first document in the structural dimension. The extraction method can be determined based on existing feature extraction or statistical methods.

[0092] Semantic dimension, used to represent the semantic tag information corresponding to the content of the first document.

[0093] For example, various semantic tag information can be pre-set based on actual application scenarios. Semantic tag information can include contracts, frequently asked questions, technical manuals, research reports, meeting minutes, data dictionaries, code documents, etc. The above is for illustrative purposes only and does not constitute an exhaustive list. Correspondingly, key fragments can be extracted from the first document, and the semantic tag information can be obtained by classifying based on these key fragments and a classification model. The key fragments can be the first page of the first document, the first paragraph of a chapter, etc. The classification model can be a pre-trained model, which can be implemented based on a general model in the field, a rule engine, vector embedding and K-nearest neighbor classification algorithms, or a large language model; there are no limitations on this.

[0094] Subsequently, a first segmentation pattern is determined based on the mapping relationship between the document features and the pattern mapping table. The first document is then segmented based on the first segmentation pattern to obtain multiple first text blocks. For example, the document features of the first document can be matched with the document features contained in the pattern mapping table. If a mapping relationship is matched, the segmentation pattern in the matched mapping relationship is taken as the first segmentation pattern.

[0095] When segmenting the first document, multiple segmentation modes can be supported. A pattern mapping table represents the mapping relationship between document features and segmentation modes, enabling the rapid and automated determination of the appropriate segmentation mode based on the document features, ensuring a high degree of matching between the first segmentation mode and the first document. The pattern mapping table can be stored using any of the following methods: relational table, key-value (KV) storage, graph database, or vector embedding retrieval. The mapping relationships in the pattern mapping table can be pre-configured based on human experience and can be updated and optimized based on historical log statistics and reinforcement learning policy networks.

[0096] In some cases, the splitting patterns contained in the pattern mapping table can include multiple of the following: The basic segmentation mode is used to recursively segment the first document based on preset segmentation parameters to obtain the first text block. The segmentation parameters include window length, overlap length, and delimiter priority.

[0097] Configure a segmentation mode to segment the first document based on the configuration information in the configuration file to obtain the first text block. The configuration information is generated based on user input or text blocks from historical documents. The configuration information includes text block boundary regular expression mode, keyword anchors, and reserved fields. This mode can be applied to enumeration type and question-and-answer type documents with strong boundary constraints imposed by rules.

[0098] A semantic segmentation mode is used to perform segmentation processing based on the semantics of the first document.

[0099] The hierarchical segmentation mode is used to characterize the segmentation process based on the document hierarchy relationship of the first document. The document hierarchy relationship can be a heading hierarchy relationship, such as including six levels such as H1 (Heading 1, first-level heading) to H6 (Heading 6, sixth-level heading), in order to semantically structure the page content.

[0100] The aforementioned segmentation modes can coexist in the same segmentation engine, so that after receiving the first document and determining the first segmentation mode, they can all be segmented through the same segmentation engine.

[0101] For example, the mapping relationships contained in the pattern mapping table are as follows: The mapping conditions indicate that the document features in the semantic dimension are contract, agreement, and other clause-type semantics, and the features in the format and structure dimensions meet the conditions such as "Article X" and "XYZ" numbering regular expressions, and clause-level parallel structure. The mapping segmentation mode is a configured segmentation mode, and the segmentation rules include: the boundary anchor point is the clause number regular expression, a single clause is the smallest text block, merging text blocks across clauses is prohibited, the clause number + clause title is used as the text block prefix, and anchor fields such as effective date, contracting parties, and clause validity are retained as searchable metadata.

[0102] The mapping conditions indicate that the document features in the semantic dimension are question-and-answer semantics such as work order knowledge, frequently asked questions, and customer service Q&A. The features in the format and structure dimensions meet the conditions that the frequency of occurrence of the pairing patterns "Q:...A:...", "Question:...Answer:...", and "Question / Answer" is greater than a preset threshold. The mapping segmentation mode is a configured segmentation mode. The segmentation rules include: each question-and-answer pair is segmented into a text block; the question in the text block is used as a separate searchable field; if the text length of the text block exceeds the maximum length of a single text block, the answer text in the text block is semantically segmented into multiple sub-blocks, and the question in the text block is used as the search field for each sub-block.

[0103] The mapping conditions indicate that the document features under the semantic dimension are hierarchical semantics such as product manuals, technical documents, and interface documents. The features in the format and structure dimensions conform to the complete H1-H6 hierarchical structure, with substantial text under each level heading, and the existence of conditions such as table of contents and cross-references. The mapping segmentation mode is a hierarchical segmentation mode. The segmentation rules include: generating text block pairs of parent text blocks and child text blocks, with each child text block carrying a hierarchical path as a separate vectorizable retrieval field.

[0104] The mapping conditions indicate that the document features under the semantic dimension are narrative semantics such as research reports and papers, and the features of the format and structure dimensions conform to conditions such as long paragraphs with coherent narration, sparse titles, implicit semantic boundaries, and the inclusion of figure and table numbering in the body text; the mapping segmentation mode is the semantic segmentation mode; the segmentation rules include: segmentation based on the first model and the second model, where the first model is a lightweight model, the second model is a large language model, and the abstract is used as the parent retrieval feature.

[0105] The mapping condition indicates that the document features in the semantic dimension are indicated by semantic tags such as empty, plain text, and short document, while the features in the format and structure dimensions do not conform to other mapping relationships. The segmentation mode of the mapping is the basic segmentation mode. The segmentation rules include: the priority of the recursive delimiter from high to low is paragraph, period, comma, and space; the window size is 512 tokens; and the overlap size is 64 tokens. This mapping relationship can be used as the matching mapping relationship when other mapping relationships do not match or the identification confidence is below a threshold.

[0106] Therefore, after obtaining the document features of the first document, matching can be performed based on the mapping conditions in each mapping relationship of the first document features and the pattern mapping table to obtain the matching degree between the document features of the first document and the mapping conditions. This matching degree can be determined by rule-based judgment or by calculating semantic similarity. As an example, the segmentation pattern of the mapping condition with the highest matching degree can be used as the first segmentation pattern.

[0107] As another example, a corresponding mapping confidence level can be set for each mapping relationship in the mapping table. This allows determining the confidence level corresponding to the matching degree while simultaneously determining the matching degree between the document features of the first document and the mapping conditions. For example, matching and its corresponding confidence level can be achieved through weighted voting, decision trees, or large language models.

[0108] Thus, for each mapping condition, if the confidence level corresponding to the matching degree is greater than or equal to its mapping confidence threshold, then the segmentation pattern corresponding to that mapping condition is taken as the first segmentation pattern. If multiple first segmentation patterns are matched, the segmentation rules corresponding to these multiple first segmentation patterns can be combined to perform segmentation based on the combination of multiple first segmentation patterns. If there is no mapping condition with a confidence level greater than the mapping confidence threshold, the segmentation patterns of the top M mapping conditions with matching degrees sorted from high to low can be taken as the first segmentation patterns.

[0109] As another example, a corresponding mapping category can be determined for each mapping relationship. For example, mapping categories can include, but are not limited to, the following types: clause-based, question-and-answer, hierarchical, narrative, tabular, and code-based. Accordingly, a classifier can be pre-trained based on the mapping relationships. Then, document features under each feature dimension can be input into the classifier to determine the mapping category corresponding to the first document, and the segmentation pattern in the mapping relationship corresponding to that mapping category can be used as the first segmentation pattern. This classifier can be implemented based on a classification model in this field.

[0110] In some cases, the segmentation patterns determined based on the pattern mapping table can be displayed to the user, allowing them to select from the displayed patterns. The selected segmentation pattern will then be used as the first segmentation pattern. For example, the segmentation patterns displayed to the user can simultaneously show the corresponding segmentation parameters, or they can support user-input parameter configuration operations. The parameters indicated by the parameter configuration operation will then be used as the segmentation parameters corresponding to the first segmentation pattern, enabling users to customize configurations based on their actual application needs.

[0111] In some cases, if the determined first segmentation mode is a basic segmentation mode or a configured segmentation mode, the first document can be segmented based on the segmentation parameters defined therein and the general segmentation method in the art.

[0112] In some cases, the first segmentation pattern is used to characterize segmentation processing based on the semantics of the first document, that is, the first segmentation pattern is a semantic segmentation pattern; correspondingly, the segmentation processing of the first document based on the first segmentation pattern to obtain the first text block may include: The first document is semantically parsed based on the first model to obtain segmentation points and their confidence levels. The first model can be an embedded model or a lightweight NLP (Natural Language Processing) model, allowing for initial semantic screening of the first document using the first model to obtain multiple segmentation points and the confidence level of each segmentation point.

[0113] For the first segmentation point whose confidence level is less than the confidence level threshold, the first document segment corresponding to the first segmentation point is determined from the first document.

[0114] If the confidence level is greater than or equal to the confidence threshold, the document can be directly segmented from that segmentation point. If the confidence level is less than the confidence threshold, it means that segmenting from that segmentation point may cause a break in the semantics of the document. Therefore, in order to ensure the semantic integrity of the segmented text blocks, the first segmentation point can be judged again to obtain the final segmentation point.

[0115] For example, the segments corresponding to the N closest segmentation points to the first segmentation point in the first document can be used as the first document segments. Alternatively, segments in the first document that start from the N segmentation points before the first segmentation point and end at the N segmentation points after the first segmentation point can also be used as the first document segments. For instance, if N is 2 and the first segmentation point is the 7th segmentation point in the first document, then the segments from the 5th segmentation point to the 9th segmentation point can be used as the first document segments.

[0116] The second model is used to perform semantic parsing on the first document fragment to obtain the second segmentation point.

[0117] For example, the second model could be a large language model, allowing for a more precise determination of the uncertain first segmentation point in the output of the first model. For instance, the first document fragment could be input into the second model, which would then segment the fragment using semantic segmentation constraints from prompt words to obtain the second segmentation point.

[0118] The first document segment is segmented based on the second segmentation point, and the second document segment is segmented based on the segmentation points in the second document segment to obtain the first text block. The second document segment is the part of the first document excluding the first document segment. In this way, the first document segment can be segmented based on the second segmentation point output by the second model, and the second document segment can be segmented based on the segmentation point output by the first model, thereby achieving the segmentation of the first document.

[0119] Therefore, by initially determining the segmentation points using the first model and then re-evaluating the uncertain segmentation points in the first model using the second model, accurate semantic segmentation of the first document can be achieved based on both models. Furthermore, only segmentation points with low confidence in the first model require re-evaluation by the second model, significantly reducing the number of calls to the second model and the amount of data computation. This also ensures the accuracy of semantic segmentation of the first document, improves the accuracy and semantic integrity of text blocks in the knowledge base, and enhances the accuracy of knowledge retrieval.

[0120] In some cases, the first segmentation mode is used to characterize segmentation processing based on the document hierarchy of the first document, i.e., a hierarchical segmentation mode. The document hierarchy can be a heading hierarchy, such as represented by H1-H6. Correspondingly, the segmentation processing of the first document based on the first segmentation mode to obtain the first text block may include: The main text content in the first document is segmented to obtain sub-text blocks.

[0121] This can be achieved by traversing the heading levels in the first document and obtaining the body content under each heading, then segmenting the body content. The segmentation can be done using the segmentation parameters in the basic segmentation mode, or based on the semantics of the body content. Alternatively, the segmentation parameters for the specific segmentation mode can be pre-set to obtain the individual sub-text blocks corresponding to the body content. The segmentation method can be set based on the actual application scenario.

[0122] Based on the document hierarchy of the first document, the document chapter to which each sub-text block belongs is determined, and the parent text block of the sub-text block is generated based on the chapter information of the document chapter.

[0123] The document chapter to which the main text content belongs refers to the document chapter to which each sub-text block is divided based on the main text content. The chapter information may include a chapter title and a chapter summary. Therefore, for each document chapter in the first document, a parent text block can be generated based on the chapter title and summary. This parent text block serves as the parent text block for each sub-text block within the main text content of that chapter. This parent text block can be used to retrieve matching scenario categories.

[0124] The first text block is generated based on the sub-text block and the parent text block of the sub-text block.

[0125] Each sub-text block can carry the identifier of its corresponding parent text block. When a sub-text block is retrieved, the parent text block can be identified based on its identifier, and other sub-text blocks under that parent text block can be further identified, thus enabling knowledge retrieval within the same chapter.

[0126] As an example, each sub-text block can carry a hierarchical path identifier, representing the path from the top-level hierarchy to the sub-text block's hierarchy. For example, if the hierarchy of the sub-text block is H4, its corresponding hierarchical path can be represented as H1:XX1->H2:XX2->H3:XX3->H4:XX4. In this way, based on this hierarchical path identifier, both a separate vectorized index can be implemented, and hierarchical filtering during retrieval can be supported, providing contextual support for subsequent retrieval.

[0127] Therefore, when segmenting the first document, a hierarchical relationship between text blocks can be constructed based on the document hierarchy in the first document. This can improve the association between text blocks in the knowledge base, increase the relevance and comprehensiveness of knowledge in the knowledge base, provide data support for subsequent knowledge retrieval and recall based on the knowledge base, and ensure the accuracy and efficiency of knowledge retrieval.

[0128] In some cases, the step of re-segmenting the first document based on the first text block to obtain the second text block may include: A first dimension is determined based on the dimension score of the first text block, wherein the dimension score of the first dimension is less than a dimension threshold.

[0129] Specifically, a corresponding threshold can be set for each evaluation dimension. If the dimension score of the evaluation dimension is less than the dimension threshold, the first text block can be considered to have failed the quality test of that evaluation dimension.

[0130] Based on the first text block and the first document, a second document fragment corresponding to the first text block is determined, wherein the second document fragment is a portion of the first document.

[0131] Specifically, the second document fragment can be a document within a preset range containing the first text block. This preset range can be a paragraph, a chapter, the length of a sliding window, etc. Taking a paragraph as an example, the paragraph in the first document that contains the first text block can be used as the second document fragment, thereby allowing the paragraph to be re-segmented.

[0132] The second segmentation mode and segmentation parameters are determined based on the first dimension.

[0133] As an example, optimization strategies for each evaluation dimension can be pre-set based on rule mapping. These strategies then determine the second segmentation mode and parameters. For instance, the optimization strategy for the integrity dimension could be to switch to a more conservative boundary rule. If the first segmentation mode is the basic segmentation mode, the second segmentation mode can continue to be the basic segmentation mode, but with an increased window length to prioritize the protection of complete semantic units. Semantic integrity is ensured by increasing the length of the segmented text blocks. Similarly, the optimization strategy for the consistency dimension could be to reduce the window size or switch to a semantic slicing mode. If the first segmentation mode is a hierarchical segmentation mode, the second segmentation mode can be a semantic segmentation mode, with a reduced window length.

[0134] As another example, the second segmentation mode and segmentation parameters can be determined based on the large language model. For instance, the second document fragment and the dimension score of the first dimension can be input into the large language model to select the segmentation mode and segmentation parameters to be used for re-segmentation based on the large language model.

[0135] Then, the second document fragment can be segmented based on the second segmentation mode and the segmentation parameters to obtain the second text block. The second segmentation mode, the segmentation parameters, and the second document fragment can be sent to the segmentation engine for segmentation processing.

[0136] Therefore, when resegmenting the first document based on the first text block, the entire first document is not resegmented, but rather a local area containing the first text block is resegmented. This can effectively reduce the overhead of index reconstruction, ensure the accuracy of text blocks in the knowledge base, and improve the efficiency of knowledge retrieval.

[0137] In some cases, building a knowledge base based on a second text block may include: determining the dimensional scores of the second text block across multiple evaluation dimensions; determining the quality score of the second text block based on its multiple dimensional scores; storing the second text block in the knowledge base if its quality score meets the knowledge base storage conditions; and re-segmenting the first document based on the second text block if its quality score meets the segmentation conditions and the number of segmentations is less than a preset number, using the re-segmented text block as the new second text block, and re-executing the steps of determining the dimensional scores of the second text block across multiple evaluation dimensions and subsequent steps. If the number of segmentations equals the preset number, re-segmentation is not performed, and a prompt message can be output to indicate that manual intervention is required for segmentation. This allows setting an upper limit on the number of segmentations when re-segmenting a portion of the first document, preventing the segmentation process from entering an infinite loop, ensuring the controllability of the knowledge base construction process, improving the accuracy of the knowledge base, ensuring the accuracy of knowledge retrieval, and avoiding errors in the output of large language models due to incorrect knowledge stored in the knowledge base.

[0138] In some cases, the method may further include: Based on the processing results output by the intelligent marketing agent and the third text block, the accuracy of the third text block is determined, whereby the third text block represents the text block recalled by generating the processing results. Based on the accuracy of the third text block, the recall of the third text block, and the first mapping relationship corresponding to the third text block, the matching priority of the pattern mapping table is updated. The first mapping relationship is used to represent the mapping relationship matched when determining the segmentation pattern corresponding to the third text block, and the matching priority is used to represent the priority of matching the mapping relationship.

[0139] Based on the matching priority in the pattern mapping table, after obtaining the document features of the first document, matching calculations can be performed sequentially according to the mapping relationship priority in the pattern mapping table from high to low based on the document features. When obtaining the mapping relationship for document feature matching, the segmentation pattern in the mapping relationship is used as the first segmentation pattern corresponding to the first document. This can reduce the amount of data calculation in the matching process, and at the same time, it can quickly match higher priority mapping relationships, ensuring the accuracy of text block segmentation of the first document, thereby improving the efficiency and accuracy of knowledge base construction.

[0140] To ensure consistency between the matching priority in the pattern mapping table and the application process of the knowledge base, the matching priority in the pattern mapping table can be updated based on the recall information of knowledge in the knowledge base. During the application of the knowledge base, the text blocks generated by the intelligent marketing agent for retrieval enhancement (i.e., the third text block) can be stored, along with the processing results generated based on these third text blocks. For example, the stored information can be statistically analyzed and calculated at preset time intervals; for instance, the accuracy of the third text block can be determined based on the third text block and the processing results. As an example, the relevance between the third text block and the processing results can be used as the accuracy. As another example, the content of the third text block can be validated based on a large language model to obtain a validation score, and the weighted sum of the validation score, the relevance between the third text block and the processing results can be used as the accuracy. Thus, this accuracy can, to a certain extent, characterize the usability of the third text block in the retrieval enhancement generation process.

[0141] Furthermore, a counter can be used to count the recall counts of text blocks stored in the knowledge base. As mentioned above, the text blocks in the knowledge base are segmented based on the segmentation patterns determined by mapping relationships. Therefore, for each text block, the mapping relationship matched when determining its corresponding segmentation pattern can be associated with a record, indicating which mapping relationship the text block was segmented based on. For example, text blocks corresponding to the same mapping relationship can be aggregated to determine the average precision and average recall count corresponding to that mapping relationship based on the precision and recall counts of the aggregated text blocks. Furthermore, the matching priority can be updated based on the average precision and average recall counts corresponding to each mapping relationship. For example, the matching priority update can be implemented using a policy model or a large language model.

[0142] Therefore, a comprehensive analysis can be performed based on the recall application information of text blocks in the knowledge base and the mapping relationships used when segmenting text blocks. This allows for updating the matching priority in the pattern mapping table, ensuring that the matching order of the mapping relationships matches the actual application scenario. Furthermore, it can prioritize mapping relationships with higher precision and recall. This updated pattern mapping table provides more accurate segmentation patterns for input documents, improving the accuracy of the text blocks obtained from document segmentation. This further enhances the efficiency and accuracy of knowledge base construction, providing accurate data support for the knowledge retrieval process.

[0143] Figure 3 The diagram shown is a flowchart illustrating the construction process of a knowledge base based on certain scenarios, such as... Figure 3 As shown: Step 31: Receive the first document; Step 32: Extract features from the first document to obtain document features across multiple feature dimensions; Step 33: Determine the first segmentation pattern based on document features and the pattern mapping table; Step 34: Segment the first document based on the first segmentation mode to obtain multiple first text blocks. The first segmentation mode can be one of the preset segmentation modes. Step 35: Determine the quality score of the first text block; Step 36: If the quality score meets the knowledge base storage conditions, store the first text block in the knowledge base; Step 37: If the quality score meets the segmentation conditions, re-segment the first document based on the first text block and return to step 33.

[0144] Step 38: If the quality score does not meet the knowledge base storage conditions and segmentation conditions, associate the detection tag with the first text block and store the first text block in the knowledge base; Step 39: Update the matching priority of the pattern mapping table based on the processing result and the text blocks recalled by the processing result.

[0145] The specific implementation methods of steps 31-39 have been described in detail above.

[0146] Figure 4 The diagram shown is a flowchart illustrating a knowledge retrieval method for intelligent marketing agents based on several scenarios. Figure 4 As shown: Step 41: Receive interaction request; Step 42: Obtain the search type and metadata search conditions based on the interactive request; Step 43: Retrieve from the knowledge base based on metadata retrieval criteria to obtain the first candidate knowledge; Step 44: Obtain the first weight and the second weight based on the search type; Step 45: Search from the first candidate knowledge based on the first search mode to obtain the first search result; Step 46: Based on the second retrieval mode, perform a retrieval from the first candidate knowledge to obtain the second retrieval results; Step 47: Based on the first weight and the second weight, fuse the first search result and the second search result to obtain the second candidate knowledge; Step 48: Based on the parent identifier associated with the second candidate knowledge, retrieve the parent knowledge corresponding to the parent identifier from the knowledge base; Step 49: Obtain the child knowledge corresponding to the parent knowledge, and perform deduplication on the child knowledge to obtain the third candidate knowledge; Step 50: Obtain recall knowledge based on the second and third candidate knowledge; Step 51: Generate response information for the interaction request based on the recalled knowledge, interaction request, and large language model.

[0147] The specific implementation methods of steps 41 to 51 have been described in detail above.

[0148] Figure 5 The diagram shown is a block diagram of a knowledge retrieval device for intelligent marketing agents, illustrating several scenarios. Figure 5 As shown, the knowledge retrieval device 10 for intelligent marketing agents includes: The first acquisition module 100 is used to acquire the search type and metadata search conditions based on the interaction request, wherein the interaction request is used to interact with the intelligent marketing agent; The second acquisition module 200 is used to acquire a first weight and a second weight based on the search type, wherein the first weight represents the weight of the first search mode and the second weight represents the weight of the second search mode. The first retrieval module 300 is used to retrieve first candidate knowledge from the knowledge base based on the metadata retrieval conditions; The second retrieval module 400 is used to retrieve second candidate knowledge from the first candidate knowledge based on the first retrieval mode, the second retrieval mode, the first weight, and the second weight; The third acquisition module 500 is used to acquire recall knowledge corresponding to the interaction request based on the second candidate knowledge.

[0149] Therefore, during knowledge retrieval, the search type and metadata search conditions can be obtained first by analyzing the interaction request. This allows for preliminary screening based on the metadata search conditions and the knowledge metadata in the knowledge base, yielding first-line candidate knowledge. Relevance retrieval is then performed from these first-line candidate knowledge, effectively reducing the amount of data computation required and improving the efficiency and accuracy of knowledge retrieval. Furthermore, the knowledge retrieval process can be integrated based on different search modes, with weights determined according to the search type. By dynamically acquiring the first and second weights, the accuracy of integrating search results from different search modes is ensured, matching the knowledge retrieval process with the interaction request. This further improves the accuracy and usability of the retrieved knowledge, providing effective data support for determining the response information corresponding to the interaction request.

[0150] Optionally, the second candidate knowledge is associated with a parent identifier, and the knowledge retrieval device 10 for intelligent marketing agents further includes: The fourth acquisition module is used to acquire the parent knowledge corresponding to the parent identifier based on the parent identifier associated with the second candidate knowledge from the knowledge base; The processing module is used to obtain the child knowledge corresponding to the parent knowledge, and to perform deduplication processing on the child knowledge to obtain the third candidate knowledge; The third acquisition module 500 is used to acquire the recall knowledge based on the second candidate knowledge and the third candidate knowledge.

[0151] Optionally, the knowledge in the knowledge base is associated with knowledge metadata, which is generated when the knowledge is generated based on the document; The first retrieval module 300 is used for: Based on the metadata retrieval conditions and the knowledge metadata in the knowledge base, the matching knowledge metadata is obtained; The knowledge associated with the matched knowledge metadata is used as the first candidate knowledge.

[0152] Optionally, the knowledge retrieval device 10 for intelligent marketing agents further includes a construction module, through which the knowledge base is constructed. The construction module includes: The first processing submodule is used to segment the first document to obtain multiple first text blocks; The first determining submodule is used to determine the dimension scores of the first text block in multiple evaluation dimensions; The second determining submodule is used to determine the quality score of the first text block based on the multiple dimension scores of the first text block; The second processing submodule is used to generate knowledge metadata based on the first document, the first text block and the quality score if the quality score of the first text block meets the knowledge base storage conditions, and to store the first text block in the knowledge base. Each first text block corresponds to a knowledge in the knowledge base, and the knowledge corresponding to the first text block is associated with the knowledge metadata corresponding to the first text block. The third processing submodule is used to re-segment the first document based on the first text block to obtain a second text block if the quality score of the first text block meets the segmentation conditions, and to construct the knowledge base based on the second text block.

[0153] Optionally, the first processing submodule includes: The first extraction submodule is used to extract features from the first document to obtain document features under multiple feature dimensions; The third determining submodule is used to determine the first segmentation pattern based on the document features and the pattern mapping table, wherein the pattern mapping table contains the mapping relationship between document features and segmentation patterns. The first segmentation module is used to segment the first document based on the first segmentation mode to obtain the first text block.

[0154] Optionally, the first segmentation pattern is used to characterize segmentation processing based on the semantics of the first document; The first molecular cleaving module includes a second molecular cleaving module, the second molecular cleaving module being used for: Based on the first model, semantic parsing is performed on the first document to obtain the segmentation points and the confidence level of the segmentation points; For the first segmentation point whose confidence level is less than the confidence threshold, determine the first document segment corresponding to the first segmentation point from the first document; Based on the second model, semantic parsing is performed on the first document fragment to obtain the second segmentation point; The first document segment is segmented based on the second segmentation point, and the second document segment is segmented based on the segmentation point in the second document segment to obtain the first text block. The second document segment is the part of the first document excluding the first document segment.

[0155] Optionally, the first segmentation mode is used to characterize the segmentation process based on the document hierarchy relationship of the first document; The first molecular slicing module includes a third molecular slicing module, the third molecular slicing module being used for: The main text content in the first document is segmented to obtain sub-text blocks; Based on the document hierarchy of the first document, determine the document chapter to which each sub-text block belongs, and generate the parent text block of the sub-text block based on the chapter information of the document chapter; The first text block is generated based on the sub-text block and the parent text block of the sub-text block.

[0156] Optionally, the evaluation dimensions include multiple of the following: The integrity dimension is used to characterize whether the semantics of the first text block are complete; The information density dimension is used to characterize the amount of information contained in the first text block; The consistency dimension is used to characterize whether the themes of the content contained in the first text block shown are consistent. The retrieval dimension is used to characterize whether the first text block shown is recallable.

[0157] Optionally, the third processing submodule is used for: The first dimension is determined based on the dimension score of the first text block, and the dimension score of the first dimension is less than the dimension threshold. Based on the first text block and the first document, a second document fragment corresponding to the first text block is determined, wherein the second document fragment is a portion of the first document; The second segmentation mode and segmentation parameters are determined based on the first dimension; The second document fragment is segmented based on the second segmentation mode and the segmentation parameters to obtain the second text block.

[0158] Regarding the knowledge retrieval device 10 for intelligent marketing agents mentioned above, the method logic executed by each functional module has been explained in detail in the section on methods, and will not be repeated here.

[0159] Based on the same concept, an electronic device is also provided, comprising: a storage device storing a computer program thereon; and a processing device for executing the computer program in the storage device to implement the steps of the knowledge retrieval method for intelligent marketing agents described above. Thus, during knowledge retrieval, the retrieval type and metadata retrieval conditions can be obtained first by analyzing the interaction request. Based on the metadata retrieval conditions and the knowledge metadata in the knowledge base, preliminary screening can be performed to obtain first candidate knowledge. Then, relevance retrieval can be performed from the first candidate knowledge, effectively reducing the amount of data computation required in the knowledge retrieval process and improving the efficiency and accuracy of knowledge retrieval. Furthermore, during the knowledge retrieval process, fusion retrieval can be performed based on different retrieval modes, and the weights corresponding to different retrieval modes can be determined based on the retrieval type. By dynamically obtaining the first and second weights, the accuracy of fusing the retrieval results obtained from different retrieval modes is ensured, making the knowledge retrieval process match the interaction request, further improving the accuracy and usability of the retrieved knowledge, and providing effective data support for subsequently determining the response information corresponding to the interaction request.

[0160] The following is for reference. Figure 6 It shows an electronic device suitable for implementing the above method (e.g. Figure 1 The diagram below shows the structure of the terminal device or server 600. The terminal device may include, but is not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Tablet Personal Computers), PMPs (Portable Media Players), in-vehicle terminals (such as in-vehicle navigation terminals), and fixed terminals such as digital TVs (Televisions), desktop computers, etc. Figure 6 The electronic device shown is merely an example and should not be construed as limiting its functionality or scope of use.

[0161] like Figure 6As shown, electronic device 600 may include a processing unit (e.g., a central processing unit, a graphics processing unit, etc.) 601, which can perform various appropriate actions and processes according to a program stored in read-only memory (ROM) 602 or a program loaded from storage device 608 into random access memory (RAM) 603. The random access memory 603 also stores various programs and data required for the operation of electronic device 600. The processing unit 601, ROM 602, and RAM 603 are interconnected via bus 604. An input / output (I / O) interface 605 is also connected to bus 604.

[0162] Typically, the following devices can be connected to the input / output interface 605: input devices 606 including, for example, a touchscreen, touchpad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; output devices 607 including, for example, a liquid crystal display (LCD), speaker, vibrator, etc.; storage devices 608 including, for example, magnetic tape, hard disk, etc.; and communication devices 609. Communication device 609 allows electronic device 600 to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 6 An electronic device 600 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.

[0163] Specifically, depending on certain circumstances, the processes described in the flowchart above can be implemented as computer software programs. For example, a computer-readable medium storing a computer program is also provided, which, when executed by a processing device, implements the steps of the knowledge base construction method for intelligent marketing agents described above. As another example, a computer program product is provided, 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 flowchart. This computer program can be downloaded and installed from a network via a communication device 609, or installed from a storage device 608, or installed from a read-only memory 602. When the computer program is executed by a processing device 601, it performs the functions defined in the above-described method.

[0164] It should be noted that the aforementioned computer-readable medium may be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium may 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 disc read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In one case, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In another case, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. The transmitted data signal can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. The computer-readable signal medium can also 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.

[0165] In some scenarios, 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), and peer-to-peer networks (e.g., ad-hoc peer-to-peer networks), as well as any currently known or future-developed networks.

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

[0167] The aforementioned computer-readable medium carries one or more programs that, when executed by the electronic device, cause the electronic device to: obtain a search type and metadata search conditions based on an interaction request, the interaction request being used to interact with an intelligent marketing agent; obtain a first weight and a second weight based on the search type, the first weight representing the weight of a first search mode and the second weight representing the weight of a second search mode; search from a knowledge base based on the metadata search conditions to obtain first candidate knowledge; search from the first candidate knowledge based on the first search mode, the second search mode, the first weight, and the second weight to obtain second candidate knowledge; and obtain recall knowledge corresponding to the interaction request based on the second candidate knowledge.

[0168] Computer program code for performing the above operations can be written in one or more programming languages ​​or a combination thereof. These programming languages ​​include, but are not limited to, object-oriented programming languages, as well as conventional procedural programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a separate 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).

[0169] The flowcharts and block diagrams in the accompanying figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products under various scenarios. 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 the specified logical function. It should also be noted that, in some alternative cases, the functions indicated in the blocks may occur in a different order than those indicated in the figures. 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.

[0170] The modules mentioned above can be implemented in software or hardware. In some cases, the name of a module does not necessarily limit the module itself; for example, the first acquisition block can also be described as "a module that acquires search types and metadata search conditions based on interactive requests."

[0171] The functions described above 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 Parts (ASSPs), Systems on Chips (SoCs), Complex Programmable Logic Devices (CPLDs), and so on.

[0172] In this context, 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 fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0173] The above description is merely illustrative and explains the technical principles employed. Those skilled in the art should understand that the scope of this document is not limited to the specific combinations of the above-described technical features, but should also cover any combination of the above-described technical features or their equivalents without departing from the above concept.

[0174] 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. Multitasking and parallel processing may be advantageous in certain environments. Similarly, while some specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of this paper. Certain features described in the context of a single example can also be implemented in combination in a single example. Conversely, various features described in the context of a single example can also be implemented individually or in any suitable sub-combination in multiple examples.

[0175] Although this document 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. Regarding the aforementioned apparatus, the specific manner in which the various modules perform their operations has already been described in detail in the section concerning the method, and will not be elaborated upon here.

Claims

1. A knowledge retrieval method for intelligent marketing agents, comprising: The search type and metadata search conditions are obtained based on the interaction request, which is used to interact with the intelligent marketing agent; A first weight and a second weight are obtained based on the search type, wherein the first weight represents the weight of the first search mode and the second weight represents the weight of the second search mode; Based on the aforementioned metadata retrieval criteria, a search is conducted in the knowledge base to obtain the first candidate knowledge. Based on the first retrieval mode, the second retrieval mode, the first weight, and the second weight, a second candidate knowledge is obtained by retrieving from the first candidate knowledge. Based on the second candidate knowledge, the recall knowledge corresponding to the interaction request is obtained.

2. The method according to claim 1, wherein the second candidate knowledge is associated with a parent identifier, and the method further includes: Based on the parent identifier associated with the second candidate knowledge, obtain the parent knowledge corresponding to the parent identifier from the knowledge base; Obtain the child knowledge corresponding to the parent knowledge, and perform deduplication on the child knowledge to obtain the third candidate knowledge; Based on the second candidate knowledge and the third candidate knowledge, the recall knowledge is obtained.

3. The method according to claim 1, wherein the knowledge in the knowledge base is associated with knowledge metadata, and the knowledge metadata is generated when the knowledge is generated based on the document; The step of retrieving first candidate knowledge from the knowledge base based on the metadata retrieval conditions includes: Based on the metadata retrieval conditions and the knowledge metadata in the knowledge base, the matching knowledge metadata is obtained; The knowledge associated with the matched knowledge metadata is used as the first candidate knowledge.

4. The method according to claim 1, wherein the knowledge base is constructed in the following manner: The first document is segmented to obtain multiple first text blocks; Determine the dimensional scores of the first text block across multiple evaluation dimensions; A quality score for the first text block is determined based on the scores of multiple dimensions of the first text block. If the quality score of the first text block meets the knowledge base storage conditions, knowledge metadata is generated based on the first document, the first text block and the quality score, and the first text block is stored in the knowledge base. Each first text block corresponds to a knowledge in the knowledge base, and the knowledge corresponding to the first text block is associated with the knowledge metadata corresponding to the first text block. If the quality score of the first text block meets the segmentation conditions, the first document is re-segmented based on the first text block to obtain a second text block, and the knowledge base is constructed based on the second text block.

5. The method according to claim 4, wherein the segmentation of the first document to obtain a plurality of first text blocks includes: Feature extraction is performed on the first document to obtain document features under multiple feature dimensions; A first segmentation pattern is determined based on the document features and the pattern mapping table, wherein the pattern mapping table contains the mapping relationship between document features and segmentation patterns; The first document is segmented based on the first segmentation mode to obtain the first text block.

6. The method according to claim 5, wherein the first segmentation mode is used to characterize segmentation processing based on the semantics of the first document; The step of segmenting the first document based on the first segmentation mode to obtain the first text block includes: Based on the first model, semantic parsing is performed on the first document to obtain the segmentation points and the confidence level of the segmentation points; For the first segmentation point whose confidence level is less than the confidence threshold, determine the first document segment corresponding to the first segmentation point from the first document; Based on the second model, semantic parsing is performed on the first document fragment to obtain the second segmentation point; The first document segment is segmented based on the second segmentation point, and the second document segment is segmented based on the segmentation point in the second document segment to obtain the first text block. The second document segment is the part of the first document excluding the first document segment.

7. The method according to claim 5, wherein the first segmentation mode is used to characterize segmentation processing based on the document hierarchy relationship of the first document; The step of segmenting the first document based on the first segmentation mode to obtain the first text block includes: The main text content in the first document is segmented to obtain sub-text blocks; Based on the document hierarchy of the first document, determine the document chapter to which each sub-text block belongs, and generate the parent text block of the sub-text block based on the chapter information of the document chapter; The first text block is generated based on the sub-text block and the parent text block of the sub-text block.

8. The method of claim 4, wherein the evaluation dimensions include multiple of the following: The integrity dimension is used to characterize whether the semantics of the first text block are complete; The information density dimension is used to characterize the amount of information contained in the first text block; The consistency dimension is used to characterize whether the themes of the content contained in the first text block shown are consistent. The retrieval dimension is used to characterize whether the first text block shown is recallable.

9. The method according to claim 4, wherein re-segmenting the first document based on the first text block to obtain the second text block comprises: The first dimension is determined based on the dimension score of the first text block, and the dimension score of the first dimension is less than the dimension threshold. Based on the first text block and the first document, a second document fragment corresponding to the first text block is determined, wherein the second document fragment is a portion of the first document; The second segmentation mode and segmentation parameters are determined based on the first dimension; The second document fragment is segmented based on the second segmentation mode and the segmentation parameters to obtain the second text block.

10. A computer program product comprising a computer program, wherein, The computer program implements the method described in any one of claims 1-9 when executed.