Knowledge base construction method, medium and product for intelligent marketing agent

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

Patent Information

Application Number
CN202611424615.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-09-14
Publication Date
2026-10-16

AI Technical Summary

Benefits of technology

[0007] Therefore, by segmenting the first document to obtain the first text block, a quality assessment can be performed on the first text block to obtain its quality score before storing it in the knowledge base. 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 text blocks stored in the knowledge base, avoids knowledge contamination by low-quality text blocks, reduces the construction and testing costs of the knowledge base, and avoids the problem of locating low-quality text blocks in the knowledge base when the intelligent system outputs incorrect processing results, as is common in related technologies. Simultaneously, text blocks whose quality scores meet the segmentation conditions can trigger re-segmentation, ensuring that the knowledge in the first document is accurately and effectively segmented, guaranteeing the integrity of the knowledge in the first document, and further improving the comprehensiveness and completeness of the knowledge in the knowledge base. This provides accurate data support for the retrieval enhancement generation process and also avoids the impact of incorrect or incomplete retrieved knowledge on the reasoning process of the intelligent system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122927475A_ABST
    Figure CN122927475A_ABST
Patent Text Reader

Abstract

A knowledge base construction method, medium and product for an intelligent marketing agent, relating to the technical field of computers, the method comprising: performing segmentation processing on a first document based on a first segmentation mode to obtain a plurality of first text blocks; determining dimension scores of the first text blocks in a plurality of evaluation dimensions; determining a quality score of the first text blocks based on the plurality of dimension scores of the first text blocks; if the quality score of the first text blocks meets a knowledge base storage condition, storing the first text blocks to a knowledge base, the knowledge base being used for knowledge retrieval by the intelligent marketing agent; and if the quality score of the first text blocks meets a segmentation condition, performing re-segmentation on the first document based on the first text blocks to obtain second text blocks, and constructing the knowledge base based on the second text blocks. Thus, before storing the first text blocks obtained by segmenting the first document to the knowledge base, quality evaluation is performed on the first text blocks to ensure the quality of the text blocks stored in the knowledge base.
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 method, medium, and product for constructing a knowledge base 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 the retrieved information. The RAG process typically includes document parsing, document slicing, vectorization and indexing, and retrieval and generation. Document slicing, as a pre-indexing step, divides the original document into several semantically complete text blocks. Each text block is vectorized and stored in a vector database, serving as the smallest retrieval unit when a user asks a question, and is then fed into the large language model to generate the answer. 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 method for constructing a knowledge base for intelligent marketing agents is provided, including: The first document is segmented based on the first segmentation mode to obtain multiple first text blocks. The first segmentation mode is determined based on the mode mapping table and the document features of the first document under multiple feature dimensions. The mode mapping table contains the mapping relationship between document features and segmentation modes. 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, the first text block is stored in the knowledge base, and the knowledge base is used by the intelligent marketing agent for knowledge retrieval. 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.

[0005] In a second aspect, a computer-readable medium is provided having a computer program stored thereon, wherein the computer program, when executed by a processing device, implements the method described in the first aspect.

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

[0007] Therefore, by segmenting the first document to obtain the first text block, a quality assessment can be performed on the first text block to obtain its quality score before storing it in the knowledge base. 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 text blocks stored in the knowledge base, avoids knowledge contamination by low-quality text blocks, reduces the construction and testing costs of the knowledge base, and avoids the problem of locating low-quality text blocks in the knowledge base when the intelligent system outputs incorrect processing results, as is common in related technologies. Simultaneously, text blocks whose quality scores meet the segmentation conditions can trigger re-segmentation, ensuring that the knowledge in the first document is accurately and effectively segmented, guaranteeing the integrity of the knowledge in the first document, and further improving the comprehensiveness and completeness of the knowledge in the knowledge base. This provides accurate data support for the retrieval enhancement generation process and also avoids the impact of incorrect or incomplete retrieved knowledge on the reasoning process of the intelligent system.

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

[0009] 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 situations.

[0010] Figure 2 This is a flowchart illustrating a method for building a knowledge base for intelligent marketing agents, based on several scenarios.

[0011] Figure 3 This is a flowchart illustrating a method for building a knowledge base for intelligent marketing agents, based on several scenarios.

[0012] Figure 4 This is a block diagram illustrating a knowledge base building apparatus for intelligent marketing agents, based on certain scenarios.

[0013] Figure 5 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 1 The diagram illustrates an implementation scenario based on various conditions. The implementation scenario may include a terminal device 101 and a server 102. The terminal device 101 and server 102 can communicate using communication methods commonly used in the art, including but not limited to wired or wireless methods, and can also simultaneously establish 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.

[0022] For example, a user can initiate a document segmentation request on terminal device 101. This request can be sent to server 102 for processing. Server 102 obtains the original document to be segmented based on the request, then parses the document and segments it to obtain multiple text blocks corresponding to the original document. These text blocks are then vectorized and indexed to store them in a knowledge base. Therefore, the accuracy of document segmentation has a significant impact on the accuracy and recall of knowledge in the knowledge base. Based on this, this paper provides a method, medium, and product for constructing a knowledge base for intelligent marketing agents. Figure 2 The diagram shown is a flowchart illustrating a knowledge base construction method for intelligent marketing agents under certain scenarios, as illustrated below. Figure 2 As shown, the method may include: In step 21, the first document is segmented based on the first segmentation mode to obtain multiple first text blocks. The first segmentation mode is determined based on a pattern mapping table and the document features of the first document in multiple feature dimensions. The pattern mapping table contains the mapping relationship between document features and segmentation modes.

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

[0024] In some cases, the first segmentation pattern can be determined in the following way: Feature extraction is performed on the first document to obtain document features under multiple feature dimensions.

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

[0026] For example, document type identification can be performed based on information such as file extension, MIME type (Multipurpose Internet Mail Extensions), and document header magic number. Document types can include PDF, Markdown, HTML (Hypertext Markup Language), Word, and plain text. For instance, priority can be set for feature dimensions, 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.

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

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

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

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

[0031] Subsequently, a first segmentation pattern is determined based on the mapping relationship between the document features and the pattern mapping table. 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.

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

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

[0034] In step 22, the dimension scores of the first text block in multiple evaluation dimensions are determined.

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

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

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

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

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

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

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

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

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

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

[0045] 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 by 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.

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

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

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

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

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

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

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

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

[0054] 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, ensure the accuracy and usability of subsequent text blocks stored in the knowledge base, guarantee the effectiveness of knowledge in the knowledge base, and provide accurate contextual references for retrieval enhancement generation.

[0055] In step 23, the quality score of the first text block is determined based on the multiple dimension scores of the first text block.

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

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

[0058] In step 24, if the quality score of the first text block meets the knowledge base storage conditions, the first text block is stored in the knowledge base, which is used by the intelligent marketing agent for knowledge retrieval.

[0059] Intelligent marketing agents can be understood as intelligent systems oriented towards business domains. They can describe problems using natural language and, based on knowledge retrieved from a knowledge base, process the problem through a process of perception, planning, tool invocation, execution, and feedback iteration to obtain the problem's solution.

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

[0061] 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 processing, and obtain processing results based on the retrieved knowledge through comprehensive analysis.

[0062] In step 25, if the quality score of the first text block meets the segmentation condition, the first document is re-segmented based on the first text block to obtain the second text block, and a knowledge base is constructed based on the second text block.

[0063] The quality score of the first text block meets the segmentation criteria, which can be either a quality score less than a second threshold, or a second threshold less than the first threshold. The second threshold can be preset based on the actual application scenario. If the quality score of the first text block meets the segmentation criteria, 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 incorrect 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 criteria, 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.

[0064] Therefore, by segmenting the first document to obtain the first text block, a quality assessment can be performed on the first text block to obtain its quality score before storing it in the knowledge base. 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 text blocks stored in the knowledge base, avoids knowledge contamination by low-quality text blocks, reduces the construction and testing costs of the knowledge base, and avoids the problem of locating low-quality text blocks in the knowledge base when the intelligent system outputs incorrect processing results, as is common in related technologies. Simultaneously, text blocks whose quality scores meet the segmentation conditions can trigger re-segmentation, ensuring that the knowledge in the first document is accurately and effectively segmented, guaranteeing the integrity of the knowledge in the first document, and further improving the comprehensiveness and completeness of the knowledge in the knowledge base. This provides accurate data support for the retrieval enhancement generation process and also avoids the impact of incorrect or incomplete retrieved knowledge on the reasoning process of the intelligent system.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

[0079] As another example, a corresponding mapping category can be determined for each mapping relationship. Accordingly, a classifier can be pre-trained based on the mapping relationship. 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 the mapping category is taken as the first segmentation pattern. The classifier can be implemented based on a classification model in this field.

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

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

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

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

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

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

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

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

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

[0089] 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, improving the accurate segmentation and semantic integrity of text blocks in the knowledge base, and enhancing the accuracy and usability of the knowledge within the knowledge base.

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

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

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

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

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

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

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

[0097] 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 provide accurate contextual support for the reasoning process of the intelligent system.

[0098] In some cases, the method may further include: If the quality score of the first text block does not meet the knowledge base storage conditions and the segmentation conditions, an associated detection tag is assigned to the first text block, and the first text block is stored in the knowledge base. The detection tag is used to characterize the recall detection of the first text block.

[0099] If the quality score of the first text block does not meet the knowledge base storage conditions and the segmentation conditions, it indicates that the quality assessment of the first text block is moderate, and a detection tag can be associated with it. Thus, during knowledge retrieval and recall based on the knowledge base, application statistics can be performed on text blocks associated with detection tags to determine the accuracy of such text blocks during knowledge base application. For example, the recall frequency of text blocks associated with detection tags can be counted. If the recall frequency is less than a threshold, it indicates that the recall probability of the text block is low, suggesting that the text block may be improperly segmented. In this case, a prompt message can be output to suggest that the text block be re-segmented. Alternatively, the accuracy of the text block can be characterized based on the accuracy of the intelligent system's output when recalling such text blocks. If the output result is incorrect or not adopted, a prompt message can also be output to suggest that the text block be re-segmented.

[0100] Therefore, when constructing a knowledge base, it is possible to associate detection tags with text blocks whose quality scores do not meet the knowledge base storage conditions and the segmentation conditions. This can effectively reduce the number of text blocks that need to be re-segmented, improve the construction efficiency of the knowledge base, and continuously detect text blocks of medium quality, avoiding the storage of low-quality text blocks in the knowledge base, thereby improving the knowledge accuracy and effectiveness of the knowledge base and providing accurate data support for the retrieval enhancement generation process.

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

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

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

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

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

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

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

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

[0109] 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 construction efficiency of the knowledge base.

[0110] 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, and improving the accuracy of the knowledge base.

[0111] In some cases, the method may further include: Based on the processing result 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 result. 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.

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

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

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

[0115] 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 accuracy and recall. This updated pattern mapping table provides more accurate segmentation patterns for input documents, thereby improving the accuracy of the text blocks obtained from document segmentation and further enhancing the efficiency and accuracy of knowledge base construction.

[0116] Figure 3 The diagram shown is a flowchart illustrating a knowledge base construction method for intelligent marketing agents based on several scenarios. 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 a variety of 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.

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

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

[0119] Figure 4 The diagram shown is a block diagram of a knowledge base construction device for intelligent marketing agents, illustrating several scenarios. Figure 4 As shown, the knowledge base construction device 40 for intelligent marketing agents includes: The first processing module 41 is used to segment the first document based on a first segmentation mode to obtain multiple first text blocks. The first segmentation mode is determined based on a pattern mapping table and document features of the first document under multiple feature dimensions. The pattern mapping table contains the mapping relationship between document features and segmentation modes. The first determining module 42 is used to determine the dimension scores of the first text block in multiple evaluation dimensions; The second determining module 43 is used to determine the quality score of the first text block based on the multiple dimension scores of the first text block; Storage module 44 is used to store the first text block in the knowledge base if the quality score of the first text block meets the knowledge base storage conditions. The knowledge base is used by the intelligent marketing agent to perform knowledge retrieval. The second processing module 45 is configured to, if the quality score of the first text block meets the segmentation conditions, re-segment the first document based on the first text block to obtain a second text block, and construct the knowledge base based on the second text block.

[0120] Therefore, by segmenting the first document to obtain the first text block, a quality assessment can be performed on the first text block to obtain its quality score before storing it in the knowledge base. 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 text blocks stored in the knowledge base, avoids knowledge contamination by low-quality text blocks, reduces the construction and testing costs of the knowledge base, and avoids the problem of locating low-quality text blocks in the knowledge base when the intelligent system outputs incorrect processing results, as is common in related technologies. Simultaneously, text blocks whose quality scores meet the segmentation conditions can trigger re-segmentation, ensuring that the knowledge in the first document is accurately and effectively segmented, guaranteeing the integrity of the knowledge in the first document, and further improving the comprehensiveness and completeness of the knowledge in the knowledge base. This provides accurate data support for the retrieval enhancement generation process and also avoids the impact of incorrect or incomplete retrieved knowledge on the reasoning process of the intelligent system.

[0121] Optionally, the first segmentation mode is used to characterize segmentation processing based on the semantics of the first document; the first processing module 41 includes a first segmentation module, which is used to: 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.

[0122] Optionally, the first segmentation mode is used to characterize segmentation processing based on the document hierarchy relationship of the first document; the first processing module 41 includes a second segmentation module, the second segmentation 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.

[0123] Optionally, the feature dimension includes multiple of the following: The format dimension is used to represent the document type of the first document; The structural dimension is used to represent the content composition structure information of the first document; Semantic dimension, used to represent the semantic tag information corresponding to the content of the first document.

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

[0125] Optionally, the knowledge base construction device 40 for intelligent marketing agents further includes: The association module is used to associate a detection tag with the first text block if the quality score of the first text block does not meet the knowledge base storage conditions and the segmentation conditions, and to store the first text block in the knowledge base. The detection tag is used to characterize the recall detection of the first text block.

[0126] Optionally, the second processing module 45 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.

[0127] Optionally, the knowledge base construction device 40 for intelligent marketing agents further includes: The third determining module is used to determine the accuracy of the third text block based on the processing result output by the intelligent marketing agent and the third text block, wherein the third text block represents the text block recalled by generating the processing result; An update module is used to update the matching priority of the pattern mapping table 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 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.

[0128] Regarding the knowledge base construction device 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.

[0129] 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 above-described method for constructing a knowledge base for an intelligent marketing agent. Thus, a first document is segmented to obtain a 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 text blocks stored in the knowledge base, avoids low-quality text blocks from polluting the knowledge base, reduces the construction and testing costs of the knowledge base, and avoids the problem of locating low-quality text blocks in the knowledge base when the processing results output by the intelligent system are incorrect, as found in related technologies. Meanwhile, text blocks that meet the segmentation criteria based on quality scores can trigger re-segmentation, ensuring that the knowledge in the first document can be accurately and effectively segmented, guaranteeing the integrity of the knowledge in the first document, further improving the comprehensiveness and completeness of the knowledge in the knowledge base, providing accurate data support for the retrieval enhancement generation process, and avoiding the impact on the reasoning process of the intelligent system due to errors or incompleteness of the retrieved knowledge.

[0130] The following is for reference. Figure 5 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 5The electronic device shown is merely an example and should not be construed as limiting its functionality or scope of use.

[0131] like Figure 5 As 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.

[0132] 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 5 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.

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

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

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

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

[0137] The aforementioned computer-readable medium carries one or more programs. When the electronic device executes the aforementioned one or more programs, the electronic device causes the following: it segments a first document based on a first segmentation pattern to obtain multiple first text blocks, wherein the first segmentation pattern is determined based on a pattern mapping table and document features of the first document in multiple feature dimensions, and the pattern mapping table contains the mapping relationship between document features and segmentation patterns; it determines the dimension scores of the first text blocks in multiple evaluation dimensions; it determines the quality score of the first text blocks based on the multiple dimension scores of the first text blocks; if the quality score of the first text blocks meets the knowledge base storage conditions, it stores the first text blocks in the knowledge base, which is used by the intelligent marketing agent for knowledge retrieval; if the quality score of the first text blocks meets the segmentation conditions, it re-segments the first document based on the first text blocks to obtain second text blocks, and constructs the knowledge base based on the second text blocks.

[0138] 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).

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

[0140] The modules mentioned above can be implemented in software or hardware. In some cases, the name of a module does not constitute a limitation on the module itself. For example, the first processing module can also be described as "a module that performs segmentation processing on a first document based on a first segmentation mode to obtain multiple first text blocks".

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

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

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

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

[0145] 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 method for constructing a knowledge base for intelligent marketing agents, comprising: The first document is segmented based on the first segmentation mode to obtain multiple first text blocks. The first segmentation mode is determined based on the mode mapping table and the document features of the first document under multiple feature dimensions. The mode mapping table contains the mapping relationship between document features and segmentation modes. 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, the first text block is stored in the knowledge base, and the knowledge base is used by the intelligent marketing agent for knowledge retrieval. 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.

2. The method according to claim 1, 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.

3. The method according to claim 1, wherein the first segmentation mode is used to characterize the 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.

4. The method according to claim 1, wherein the feature dimension comprises multiple of the following: The format dimension is used to represent the document type of the first document; The structural dimension is used to represent the content composition structure information of the first document; Semantic dimension, used to represent the semantic tag information corresponding to the content of the first document.

5. The method according to claim 1, 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.

6. The method according to claim 1, further comprising: If the quality score of the first text block does not meet the knowledge base storage conditions and the segmentation conditions, an associated detection tag is assigned to the first text block, and the first text block is stored in the knowledge base. The detection tag is used to characterize the recall detection of the first text block.

7. The method according to claim 1, 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.

8. The method according to any one of claims 1-7, further comprising: Based on the processing result 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 result. 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.

9. A computer-readable medium having a computer program stored thereon, wherein, When executed by a processing device, the computer program implements the method described in any one of claims 1-8.

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