Text generation method and device, electronic equipment and computer readable storage medium

By combining the retrieved target information blocks and surrounding information blocks in the information retrieval system, the problems of inaccurate and incomplete information retrieval results in the prior art are solved, and higher accuracy and completeness of text generation are achieved.

CN119647406AActive Publication Date: 2025-03-18TIANJIN YIKANG INTERNET TECH CO LTD
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202510179888.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-19
Publication Date
2025-03-18
Estimated Expiration
2045-02-19

AI Technical Summary

Technical Problem

When existing information retrieval systems extract relevant information from large-scale knowledge bases, it is difficult to accurately locate specific and small knowledge points, resulting in the search results containing a large amount of fragment information that does not exactly match or is only partially related to the user's query intention, which affects the accuracy and completeness of the text.

Method used

By setting the model to retrieve document and information block information related to the input information, match the target information block, and merge the target information block with the surrounding information blocks to generate the target text to improve the integrity and accuracy of the text.

Benefits of technology

By merging the target information block and the surrounding information block, the generated target text is more comprehensive and accurate, improving the completeness and accuracy of the text, and enhancing the accuracy and relevance of information retrieval.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119647406A_ABST
    Figure CN119647406A_ABST
Patent Text Reader

Abstract

The invention provides a text generation method and device, electronic equipment and a computer readable storage medium. The method comprises the steps that documents and information block information related to input information are retrieved through a set model; each document comprises one or more information blocks, and the information blocks are obtained by decomposing texts in the document; matching a target information block related to the input information according to the input information; determining one or more information blocks surrounded by the target information block; combining the target information block and one or more information blocks around the target information block to generate a target text; the target text is an output text corresponding to the input information. When retrieval is carried out, the target information block obtained through retrieval and other information blocks around the target information block are combined, the target information block is combined, the obtained target text can be more comprehensive and accurate, and the integrity and accuracy of the target text are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of information processing, and in particular, to a text generation method, device, electronic device and computer-readable storage medium. Background Art

[0002] The current information retrieval field, especially the retrieval enhancement generation (RAG) system, usually relies on powerful embedding models or traditional information retrieval algorithms such as BM25 to extract relevant information from large-scale knowledge bases. When using embedding models for information retrieval, although it can capture the semantic similarity between documents, it is often difficult to accurately locate specific and small knowledge points due to the complexity of high-dimensional vector space. As a result, the retrieval results may contain a large amount of fragmented information that does not fully match the user's query intent or is only partially related, affecting the accuracy and completeness of the text. Summary of the invention

[0003] In view of this, an object of the embodiments of the present application is to provide a text generation method, device, electronic device and computer-readable storage medium, which can improve the accuracy and completeness of the text.

[0004] In a first aspect, an embodiment of the present application provides a text generation method, comprising: retrieving documents and information block information related to input information by setting a model; wherein each document includes one or more information blocks, and the information blocks are configured to be obtained by decomposing the text in the document; according to the input information, matching a target information block related to the input information; determining one or more information blocks around the target information block; merging the target information block and one or more information blocks around the target information block to generate a target text; wherein the target text is the output text corresponding to the input information.

[0005] In the above implementation process, when performing retrieval, the retrieved target information block and other information blocks around the target information block are merged. Merging the target information block can make the obtained target text more comprehensive and accurate, thereby improving the completeness and accuracy of the target text.

[0006] In one embodiment, the information block information includes: document meta-information to which the information block belongs; before matching the target information block related to the input information according to the input information, the method further includes: determining the document to which each information block belongs according to the document meta-information; performing flag identification on the content in the document, and classifying the information block according to the flag identification result; wherein the information blocks in a document are of the same type; matching the target information block related to the input information according to the input information includes: matching the target information block related to the input information according to the matching method corresponding to the input information and the type to which the information block belongs.

[0007] In the above implementation process, by classifying the information blocks, each type of information block is matched with the target information block through a corresponding matching method, which can improve the accuracy of the matched target information block.

[0008] In one embodiment, the type of the information block includes a title enhanced type; matching the target information block related to the input information according to the matching method corresponding to the input information and the type of the information block includes: if it is identified that the document includes a flag, and the flag is a title flag, then determining that the information block is a title enhanced type; taking out all information blocks in the document; matching the title flag corresponding to the input information, and determining that the information block corresponding to the matched title flag is the target information block; merging the target information block and one or more information blocks around the target information block to generate a target text includes: obtaining all text content under the target information block; determining the information blocks before and after the target information block, and obtaining all text content in the information blocks before and after the target information block; merging all text content under the target information block with all text content in the information blocks before and after the target information block to generate the target text.

[0009] In the above implementation process, when matching the target information block, matching is performed according to the matching method corresponding to the type of the target information block, which can improve the accuracy of the target information block. In addition, when the information block is a title enhanced type, the corresponding target information block is directly determined by matching the title flag bit, which can reduce the difficulty of matching the target information block and improve the matching efficiency.

[0010] In one embodiment, the type of the information block includes a large model summary type; matching the target information block related to the input information according to the matching method corresponding to the input information and the type of the information block includes: if it is identified that the document includes a flag bit, and the flag bit is a large model summary flag bit, then determining that the information block is a large model summary type; taking out all information blocks in the document; matching the large model summary paragraph overview corresponding to the input information, and determining that the information block corresponding to the matched large model summary paragraph overview is the target information block; merging the target information block and one or more information blocks around the target information block to generate a target text, includes: obtaining all text content under the large model summary paragraph overview; determining the information blocks before and after the large model summary paragraph overview, and obtaining all text content in the information blocks before and after the large model summary paragraph overview; merging all text content under the large model summary paragraph overview and all text content in the information blocks before and after the large model summary paragraph overview to generate the target text.

[0011] In the above implementation process, when the information block is a large model generalization type, the corresponding target information block can be determined by matching the large model generalization type, thereby reducing the matching difficulty of the target information block and improving the matching efficiency.

[0012] In one embodiment, the type of the information block includes a general type; matching the target information block related to the input information according to the matching method corresponding to the input information and the type of the information block includes: if it is identified that the document does not include a flag, determining that the information block is a general type; taking out all information blocks in the document; determining the target information block according to the correlation score between the information block and the input information; merging the target information block and one or more information blocks around the target information block to generate a target text, includes: determining a target information block within a set distance range, and obtaining all text contents in the target information block within the set distance range, as well as all text contents in the information blocks between the target information blocks within the set distance range; merging all text contents in the target information block within the set distance range, as well as all text contents in the information blocks between the target information blocks within the set distance range, to generate the target text.

[0013] In the above implementation process, by setting the information block as a universal type, the corresponding merging method can increase the application scenarios of the text generation method. In addition, for universal information blocks, when matching the target information block, matching is performed according to the correlation score between the information block and the input information, so that the information block that is strongly associated with the input information can be matched, thereby improving the accuracy of the target information block.

[0014] In one embodiment, before retrieving documents and information blocks related to the input information through a set model, the method also includes: extracting relevant title levels in the document; dividing the information in the document through the titles; isolating each title and the information content corresponding to the title through title flags to obtain multiple fragments; if the number of flags of a fragment is greater than the set number of flags, fragmenting the information content; wherein each fragment includes a title string.

[0015] In the above implementation process, the information content in the document is segmented according to the title by using the title flag, and the segmentation method is simple and easy to implement. In addition, after segmenting by title, when matching the target information block, the corresponding target information block can be directly determined by matching the title flag, which reduces the difficulty of matching the target information block and improves the matching efficiency.

[0016] In one embodiment, before retrieving documents and information blocks related to the input information by setting a model, the method also includes: dividing the information content in the document into blocks by paragraph level; obtaining a corresponding content summary of the information content in each block; and isolating each content summary and the corresponding information content by a large model summary flag.

[0017] In the above implementation process, by using the large model overview flag to segment the information content in the document according to paragraphs, the segmentation effect is good and the content in the information block after segmentation can be reduced. Furthermore, when matching the target information block, the corresponding target information block can be directly determined by the large model overview flag, which reduces the difficulty of matching the target information block and improves the matching efficiency.

[0018] In a second aspect, an embodiment of the present application also provides a text generation device, comprising: a retrieval module, used to retrieve documents and information block information related to input information by setting a model; wherein each document includes one or more information blocks, and the information blocks are configured to be obtained by decomposing the text in the document; a matching module, used to match a target information block related to the input information according to the input information; a determination module, used to determine one or more information blocks around the target information block; a merging module, used to merge the target information block and one or more information blocks around the target information block to generate a target text; wherein the target text is the output text corresponding to the input information.

[0019] In a third aspect, an embodiment of the present application further provides an electronic device, comprising: a processor and a memory, wherein the memory stores machine-readable instructions executable by the processor, and when the electronic device is running, the machine-readable instructions are executed by the processor to perform the steps of the method in the above-mentioned first aspect, or any possible implementation of the first aspect.

[0020] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the text generation method in the above-mentioned first aspect, or any possible implementation of the first aspect are executed.

[0021] In order to make the above-mentioned objects, features and advantages of the present application more obvious and understandable, embodiments are given below and described in detail with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0023] Figure 1 A block diagram of an electronic device provided in an embodiment of the present application; Figure 2 A flowchart of a text generation method provided in an embodiment of the present application; Figure 3 A schematic diagram of the functional modules of the text generation device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0024] The technical solutions in the embodiments of the present application will be described below in conjunction with the accompanying drawings in the embodiments of the present application.

[0025] It should be noted that similar reference numerals and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings. At the same time, in the description of this application, the terms "first", "second", etc. are only used to distinguish the description and cannot be understood as indicating or implying relative importance.

[0026] In the existing retrieval enhancement generation (RAG) system, knowledge base information retrieval is a core link, which is directly related to whether the system can accurately and efficiently provide users with the required information. In order to achieve this goal, the system generally uses the Embedding model or the BM25 scheme for retrieval.

[0027] The Embedding model is a natural language processing technology that can convert text into numerical vectors that can capture the semantic meaning and contextual information of the text. Therefore, in the RAG system, the Embedding model can be used to vectorize query statements and documents in the knowledge base, and then retrieve relevant information by calculating the similarity between vectors. The advantage of this method is that it can capture the deep semantic information of the text, thereby improving the accuracy and relevance of the retrieval. However, since the Embedding model is based on the vector representation of the text for retrieval, it may be affected by problems such as the diversity of text expressions and synonyms, resulting in some information in the retrieval results that does not fully match the query but is semantically similar, which in turn causes information fragmentation.

[0028] The BM25 scheme is a classic information retrieval algorithm based on word frequency and inverse document frequency. It counts and analyzes the words in the document, calculates the importance of each word in the document, and sorts and filters the documents according to these importances. The BM25 scheme performs well in processing long documents and short queries, and can quickly find the most relevant documents to the query. However, because it is based on lexical matching for retrieval, it may ignore some information that is semantically related to the query but not directly lexically matched, which also leads to information fragmentation in the retrieval results.

[0029] In view of this, the present application proposes a text generation method, which merges the target information block retrieved and other information blocks around the target information block during retrieval. Merging the target information blocks can make the obtained target text more comprehensive and accurate, thereby improving the completeness and accuracy of the target text.

[0030] To facilitate understanding of this embodiment, an electronic device that executes the text generation method disclosed in the embodiment of the present application is first introduced in detail.

[0031] like Figure 1 , which is a block diagram of an electronic device. The electronic device 100 may include a memory 111 and a processor 113. A person skilled in the art may understand that Figure 1 The structure shown is only for illustration and does not limit the structure of the electronic device 100. For example, the electronic device 100 may further include Figure 1 More or fewer components as shown, or with Figure 1 Different configurations are shown.

[0032] The memory 111 and the processor 113 are directly or indirectly electrically connected to each other to achieve data transmission or interaction. For example, these elements can be electrically connected to each other via one or more communication buses or signal lines. The processor 113 is used to execute the executable module stored in the memory.

[0033] The memory 111 may be, but is not limited to, a random access memory (RAM), a read only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable read-only memory (EEPROM), etc. The memory 111 is used to store programs, and the processor 113 executes the program after receiving an execution instruction. The method executed by the electronic device 100 defined by the process disclosed in any embodiment of the present application can be applied to the processor 113, or implemented by the processor 113.

[0034] The processor 113 may be an integrated circuit chip with signal processing capability. The processor 113 may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it may also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present application may be implemented or executed. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.

[0035] The electronic device 100 in this embodiment can be used to execute each step in each method provided in the embodiments of the present application. The implementation process of the text generation method is described in detail below through several embodiments.

[0036] See also Figure 2 , is a flowchart of the text generation method provided in the embodiment of the present application. Figure 2 The specific process shown is described in detail.

[0037] Step 201, retrieving documents and information blocks related to input information by setting a model.

[0038] The set model here is a query model that is set in advance for document and information block retrieval, for example, the Embedding vectorization model, the BM25 retrieval model, etc. The set model can be selected according to the actual situation.

[0039] Among them, the BM25 retrieval model is a traditional retrieval model based on term frequency-inverse document frequency (TF-IDF), which is used to measure the relevance between queries and documents. The Embedding model uses a neural network to generate vector representations of words or sentences and retrieves semantically related content by measuring the distance in the vector space.

[0040] The above-mentioned input information refers to information such as words, sentences, pictures, etc. used to obtain search results, and the input information can be selected according to actual conditions.

[0041] It can be understood that in some AI big model application scenarios, users input corresponding questions, instructions and other information into the window of the AI ​​big model. The AI ​​big model searches the knowledge base, segments and merges the searched structure to obtain corresponding results, and displays the results in the window of the AI ​​big model.

[0042] The document here may be a document in one or more knowledge bases associated with the set model. The information block information refers to one or more information blocks in the document.

[0043] Each document includes one or more information blocks, and the information blocks are configured to be obtained by decomposing the text in the document.

[0044] In one embodiment, the information block information may include: document meta information to which the information block belongs, document meta information to which the information block belongs, information block content text, etc. The document meta information to which the information block belongs may include document ID, knowledge base ID, information block index, etc. The specific content of the information block information may be selected according to actual conditions.

[0045] Step 202: Match target information blocks related to the input information according to the input information.

[0046] The information blocks here are matched based on their relevance to the input information.

[0047] Optionally, the target information block may be one or more.

[0048] The target information block can be determined based on the relevance with the input information. For example, an information block with a relevance greater than a relevance threshold is determined as the target information block.

[0049] Step 203: determine one or more information blocks around the target information block.

[0050] Here, the one or more information blocks around the target information refer to the information blocks on the upper side or the lower side adjacent to the target information. Of course, the information blocks around the target information can also be information blocks within a set range from the target information. The one or more information blocks around the target information can be selected according to actual conditions.

[0051] Step 204: merge the target information block and one or more information blocks surrounding the target information block to generate a target text.

[0052] Among them, the target text is the output text corresponding to the input information.

[0053] In one embodiment, when information blocks are merged, information blocks in the same document are merged.

[0054] It is understandable that one or more target information blocks matched by input information are likely to be scattered. When merging information blocks in the same document, directly merging these scattered target information blocks may result in low coherence and accuracy of the merged target text. The present application proposes merging the target information block with the surrounding information blocks when merging information blocks, and then generating the corresponding target text, which can improve the coherence and accuracy of the target text.

[0055] After the target information block is determined, all text contents corresponding to the target information can be determined. After the information blocks surrounding the target information block are determined, all text contents corresponding to the information surrounding the target information block can also be determined. Furthermore, when the target information block and one or more information blocks surrounding the target information block are merged, all text contents corresponding to the target information and all text contents corresponding to the information surrounding the target information block can be merged to obtain the target text.

[0056] In the above implementation process, when performing retrieval, the retrieved target information block and other information blocks around the target information block are merged. Merging the target information block can make the obtained target text more comprehensive and accurate, thereby improving the completeness and accuracy of the target text.

[0057] In a possible implementation, before step 202, the method further includes: determining the document to which each information block belongs based on the document meta-information; performing flag bit recognition on the content in the document, and classifying the information blocks based on the flag bit recognition result.

[0058] The document to which each information block belongs can be determined by the document ID. The information blocks in one document are of the same type.

[0059] In one embodiment, information blocks in a document may be isolated by flags, such as a title flag, a large model summary flag, and the like.

[0060] It can be understood that the type of the information block can be determined by identifying the specific string structure of the flag bit in the document.

[0061] Optionally, the type of the information block includes title enhancement type, large model summary type and general type, and the type of the information block can be selected according to actual conditions.

[0062] In one embodiment, step 202 includes: matching a target information block related to the input information according to a matching method corresponding to the input information and the type of the information block.

[0063] It is understandable that a corresponding matching method can be set for each type of information block. When matching the target information block, the matching is performed according to the matching method corresponding to the type of the information block.

[0064] In the above implementation process, by classifying the information blocks, each type of information block is matched with the target information block through a corresponding matching method, which can improve the accuracy of the matched target information block.

[0065] In one possible implementation, the target information block related to the input information is matched according to the matching method corresponding to the input information and the type of the information block, including: if the recognized document includes a flag bit, and the flag bit is a title flag bit, then the information block is determined to be a title enhanced type; all information blocks in the document are taken out; the title flag bit corresponding to the input information is matched, and the information block corresponding to the matched title flag bit is determined to be the target information block.

[0066] In one embodiment, before determining that the information block is of title enhancement type, the method further includes: performing flag bit identification on the classified information blocks in the document, wherein each information block is isolated by the flag bit.

[0067] The flag here can be a special string. For example, the title flag can be: ##title_split##, and the large model summary flag can be: ##model_split##.

[0068] The above-mentioned title-enhanced information block may be represented in the form of: information block corresponding level title + flag bit + information block content.

[0069] It can be understood that the document ID can be determined first, and then all information blocks contained in the document can be retrieved.

[0070] It should be understood that after obtaining the input information, the title matching can be performed through the keywords and other information in the input information to match the corresponding title flag. After determining the information block corresponding to the matched title flag, the information block corresponding to the title flag is determined as the target information block.

[0071] In one embodiment, step 204 includes: obtaining all text content under the target information block; determining the information blocks before and after the target information block, and obtaining all text content in the information blocks before and after the target information block; merging all text content under the target information block and all text content in the information blocks before and after the target information block to generate the target text.

[0072] Optionally, the information blocks before and after the target information block can be one information block before and after the target information block, or two information blocks before and after the target information block, or three information blocks before and after the target information block, etc. The number of information blocks before and after the target information block can be selected according to actual conditions.

[0073] It should be understood that when text contents are merged, they can be merged sequentially according to the order of the text contents in the document.

[0074] In the above implementation process, when matching the target information block, matching is performed according to the matching method corresponding to the type of the target information block, which can improve the accuracy of the target information block. In addition, when the information block is a title enhanced type, the corresponding target information block is directly determined by matching the title flag bit, which can reduce the difficulty of matching the target information block and improve the matching efficiency.

[0075] In one possible implementation, the target information block related to the input information is matched according to the matching method corresponding to the input information and the type of the information block, including: if the recognized document includes a flag, and the flag is a large model summary flag, then the information block is determined to be a large model summary type; all information blocks in the document are taken out; the large model summary paragraph overview corresponding to the input information is matched, and the information block corresponding to the matched large model summary paragraph overview is determined to be the target information block.

[0076] In one embodiment, before determining that the information block is a large model generalization type, the method further includes: performing flag bit identification on the classified information blocks in the document, wherein each information block is isolated by the flag bit.

[0077] The above-mentioned large model summary information block can be represented in the form of: large model paragraph overview + flag + information block content.

[0078] The large-scale summary type here refers to the type of summary through a paragraph or a sentence.

[0079] It is understandable that when there are one or more paragraphs in a document and the paragraphs contain a lot of content, the paragraphs can be summarized by a paragraph or a sentence. When matching the target information block, the matching efficiency can be improved by matching the input information with the large model summary flag.

[0080] After the input information is obtained, the large model summary flag bit can be matched through the keywords and key words in the input information to match the corresponding large model summary flag bit. After determining the information block corresponding to the matched large model summary flag bit, the information block corresponding to the large model summary flag bit is determined as the target information block.

[0081] In one embodiment, step 204 includes: obtaining all text content under the large model summary paragraph overview; determining the information blocks before and after the large model summary paragraph overview, and obtaining all text content in the information blocks before and after the large model summary paragraph overview; merging all text content under the large model summary paragraph overview and all text content in the information blocks before and after the large model summary paragraph overview to generate a target text.

[0082] In the above implementation process, when the information block is a large model generalization type, the corresponding target information block can be determined by matching the large model generalization type, thereby reducing the matching difficulty of the target information block and improving the matching efficiency.

[0083] In a possible implementation, a target information block related to the input information is matched according to a matching method corresponding to the type of the input information and the information block, including: if the recognized document does not include a flag, determining that the information block is a universal type; extracting all information blocks in the document; and determining the target information block according to a correlation score between the information block and the input information.

[0084] The general type here refers to information blocks that are not segmented using flag bits.

[0085] In one embodiment, each information block may be grouped according to its information block information, and the information block associated with the document information may be retrieved from the database.

[0086] The above-mentioned relevance score refers to the relevance between each information block and the input information.

[0087] Optionally, an information block having a relevance score greater than a relevance threshold may be determined as a target information block.

[0088] In one embodiment, step 204 includes: determining a target information block within a set distance range, and obtaining all text contents in the target information blocks within the set distance range, and all text contents in information blocks between the target information blocks within the set distance range; merging all text contents in the target information blocks within the set distance range, and all text contents in information blocks between the target information blocks within the set distance range, to generate a target text.

[0089] Herein, setting the distance range refers to setting the distance range in advance.

[0090] Optionally, the set distance range may refer to: a range of a set number of information blocks around a target information block; the set distance range may also refer to: a range between two adjacent target information blocks when the number of information blocks between the two adjacent target information blocks is within a set number, etc. Of course, the set distance may also be a combination of the above two methods. The set distance range may be adjusted according to actual conditions.

[0091] Exemplarily, if the set distance range refers to: the range between two adjacent target information blocks when the number of information blocks between the two adjacent target information blocks is less than or equal to 5. And the determined target information blocks include: target information block 1, target information block 5 and target information block 13. Among them, the number of information blocks between target information block 1 and target information block 5 is 3, and the number of information blocks between target information block 5 and target information block 13 is 7. Then, all text contents in all information blocks from target information block 1 to target information block 5 are obtained, and these text contents are merged. In addition, since the number of information blocks between target information block 13 and target information block 5 exceeds 5, the text content of target information block 13 is obtained separately, and the text content of target information block 13 is output separately.

[0092] If the set distance range refers to: when the number of information blocks between two adjacent target information blocks is less than or equal to 5, the range between two adjacent target information blocks, and the range of one information block around the target information block. And the determined target information blocks include: target information block 1, target information block 5 and target information block 13. Among them, the number of information blocks between target information block 1 and target information block 5 is 3, and the number of information blocks between target information block 5 and target information block 13 is 7. Then, all the text contents in all information blocks from target information block 1 to target information block 5 are obtained, and these text contents are merged. In addition, since the number of information blocks between target information block 13 and target information block 5 exceeds 5, the text contents of an adjacent information block above target information block 13 and below target information block 13 are obtained respectively, and the text contents of target information block 13, an information block above target information block 13 and an information block below target information block 13 are merged.

[0093] In the above implementation process, by setting the information block as a universal type, the corresponding merging method can increase the application scenarios of the text generation method. In addition, for universal information blocks, when matching the target information block, matching is performed according to the correlation score between the information block and the input information, so that the information block that is strongly associated with the input information can be matched, thereby improving the accuracy of the target information block.

[0094] In a possible implementation, before step 201, the method further includes: extracting relevant title levels in the document; dividing the information in the document by title; isolating each title and the information content corresponding to the title by title flags to obtain multiple fragments; if the flag number of a fragment is greater than the set flag number, fragmenting the information content.

[0095] In one embodiment, after extracting the relevant title levels in the document, a parent-child structure may be formed.

[0096] Each title level here has its own corresponding information content. Among them, the parent-child structure corresponding to the information content can be flattened into a title string. For example, Title 1->Title 2->Title 3, this structure will be flattened into Title 1-Title 2-Title 3.

[0097] It can be understood that after the parent-child structure corresponding to the information content is flattened into a title string, the flattened title string and the corresponding information content can be merged and separated by the title flag bit in between.

[0098] If the number of flags of the information content is greater than the maximum number of flags supported by the fragment in which it is located, the information content can be fragmented.

[0099] Each fragment here includes a header string and is separated by a flag string.

[0100] In the above implementation process, the information content in the document is segmented according to the title by using the title flag, and the segmentation method is simple and easy to implement. In addition, after segmenting by title, when matching the target information block, the corresponding target information block can be directly determined by matching the title flag, which reduces the difficulty of matching the target information block and improves the matching efficiency.

[0101] In a possible implementation, before step 201, the method further includes: dividing the information content in the document into blocks by paragraph level; obtaining a content summary corresponding to the information content in each block; and isolating each content summary and the corresponding information content by a large model summary flag.

[0102] The content summary refers to a summary of the content in the paragraph, and the content summary can be controlled within a certain number of characters.

[0103] It should be understood that after obtaining the corresponding content overview of the information content in each block, the overview and the information content can be merged and then isolated by the large model overview flag.

[0104] In the above implementation process, by using the large model overview flag to segment the information content in the document according to paragraphs, the segmentation effect is good and the content in the information block after segmentation can be reduced. Furthermore, when matching the target information block, the corresponding target information block can be directly determined by the large model overview flag, which reduces the difficulty of matching the target information block and improves the matching efficiency.

[0105] Based on the same application concept, the embodiment of the present application also provides a text generation device corresponding to the text generation method. Since the principle of solving the problem by the device in the embodiment of the present application is similar to that of the aforementioned text generation method embodiment, the implementation of the device in this embodiment can refer to the description in the embodiment of the above method, and the repeated parts will not be repeated.

[0106] See also Figure 3 , is a functional module diagram of the text generation device provided in the embodiment of the present application. Each module in the text generation device in this embodiment is used to execute each step in the above method embodiment. The text generation device includes a retrieval module 301, a matching module 302, a determination module 303, and a merging module 304; wherein, The retrieval module 301 is used to retrieve documents and information blocks related to the input information by setting a model; wherein each document includes one or more information blocks, and the information blocks are configured to be obtained by decomposing the text in the document.

[0107] The matching module 302 is used to match the target information block related to the input information according to the input information.

[0108] The determination module 303 is used to determine one or more information blocks around the target information block.

[0109] The merging module 304 is used to merge the target information block and one or more information blocks around the target information block to generate a target text; wherein the target text is an output text corresponding to the input information.

[0110] In a possible implementation, the text generation device also includes a classification module, which is used to: determine the document to which each information block belongs based on the document meta-information; perform flag bit recognition on the content in the document, and classify the information blocks based on the flag bit recognition results; wherein the information blocks in a document are of the same type.

[0111] In a possible implementation manner, the matching module 302 is further configured to: match the target information block related to the input information according to a matching mode corresponding to the type of the input information and the information block.

[0112] In one possible implementation, the matching module 302 is specifically used to: if it is identified that the document includes a flag bit, and the flag bit is a title flag bit, determine that the information block is a title enhanced type; extract all information blocks in the document; match the title flag bit corresponding to the input information, and determine that the information block corresponding to the matched title flag bit is the target information block.

[0113] In a possible implementation, the merging module 304 is further used to: obtain all text contents under the target information block; determine the information blocks before and after the target information block, and obtain all text contents in the information blocks before and after the target information block; merge all text contents under the target information block and all text contents in the information blocks before and after the target information block to generate the target text.

[0114] In one possible implementation, the matching module 302 is specifically used to: if it is identified that the document includes a flag bit, and the flag bit is a large model summary flag bit, then determine that the information block is a large model summary type; extract all information blocks in the document; match the large model summary paragraph summary corresponding to the input information, and determine that the information block corresponding to the matched large model summary paragraph summary is the target information block.

[0115] In a possible implementation, the merging module 304 is also used to: obtain all text content under the large model summary paragraph overview; determine the information blocks before and after the large model summary paragraph overview, and obtain all text content in the information blocks before and after the large model summary paragraph overview; merge all text content under the large model summary paragraph overview and all text content in the information blocks before and after the large model summary paragraph overview to generate the target text.

[0116] In a possible implementation, the matching module 302 is specifically used to: if it is identified that the document does not include a flag, determine that the information block is universal; extract all information blocks in the document; and determine a target information block based on a correlation score between the information block and the input information.

[0117] In one possible implementation, the merging module 304 is further used to: determine a target information block within a set distance range, and obtain all text contents in the target information block within the set distance range, and all text contents in the information blocks between the target information blocks within the set distance range; merge all text contents in the target information block within the set distance range, and all text contents in the information blocks between the target information blocks within the set distance range to generate the target text.

[0118] In a possible implementation, the text generation device also includes a fragmentation module, which is used to: extract relevant title levels in the document; divide the information in the document according to the titles; isolate each title and the information content corresponding to the title through title flags to obtain multiple fragments; if the flag number of a fragment is greater than the set flag number, the information content is fragmented; wherein each fragment includes a title string.

[0119] In a possible implementation, the text generation device also includes an isolation module, which is used to: extract relevant title levels in the document; divide the information in the document according to the titles; isolate each title and the information content corresponding to the title through title flags to obtain multiple fragments; if the flag number of a fragment is greater than the set flag number, the information content is fragmented; wherein each fragment includes a title string.

[0120] In addition, an embodiment of the present application also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the text generation method described in the above method embodiment are executed.

[0121] The computer program product of the text generation method provided in the embodiment of the present application includes a computer-readable storage medium storing program code, and the instructions included in the program code can be used to execute the steps of the text generation method described in the above method embodiment. For details, please refer to the above method embodiment, which will not be repeated here.

[0122] In several embodiments provided in the present application, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely schematic. For example, the flowcharts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the devices, methods and computer program products according to multiple embodiments of the present application. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the module, a program segment or a part of a code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of boxes in the block diagram and / or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.

[0123] In addition, the functional modules in the various embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.

[0124] If the function is implemented in the form of a software function module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes. It should be noted that in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprises" or any other variation thereof are intended to cover non-exclusive inclusion, so that a process, method, article or apparatus that includes a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or apparatus. In the absence of more restrictions, the elements defined by the sentence "includes..." do not exclude the presence of other identical elements in the process, method, article or apparatus that includes the elements. The above description is only a preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the protection scope of the present application. It should be noted that similar numbers and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further defined and explained in the subsequent drawings.

[0125] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims

1. A text generation method, characterized in that: include: Retrieving documents and information blocks related to the input information by setting a model; wherein each document includes one or more information blocks, and the information blocks are configured to be obtained by decomposing text in the document; According to the input information, matching a target information block related to the input information; determining one or more information blocks around the target information block; Merging the target information block and one or more information blocks around the target information block to generate a target text; The target text is the output text corresponding to the input information.

2. The method according to claim 1, characterized in that in, The information block information includes: document meta information to which the information block belongs; Before matching the target information block related to the input information according to the input information, the method further includes: Determine the document to which each information block belongs according to the document meta information; Performing flag bit recognition on the content in the document, and classifying the information blocks according to the flag bit recognition result; wherein the information blocks in one document are of the same type; The step of matching a target information block related to the input information according to the input information includes: According to the matching modes corresponding to the input information and the types of the information blocks, the target information blocks related to the input information are matched.

3. The method according to claim 2, characterized in that in, The information block belongs to a type including a title enhancement type; The matching of the target information block related to the input information according to the matching mode corresponding to the input information and the type of the information block includes: If it is identified that the document includes a flag bit, and the flag bit is a title flag bit, determining that the information block is a title enhanced type; Retrieving all information blocks from the document; Matching the title flag corresponding to the input information, and determining the information block corresponding to the matched title flag as the target information block; The step of merging the target information block with one or more information blocks around the target information block to generate a target text includes: Obtain all text content under the target information block; Determine the information blocks before and after the target information block, and obtain all text contents in the information blocks before and after the target information block; All text contents under the target information block and all text contents in the information blocks before and after the target information block are merged to generate the target text.

4. The method according to claim 2, characterized in that: in, The information block belongs to a type including a large model summary type; The matching of the target information block related to the input information according to the matching mode corresponding to the input information and the type of the information block includes: If it is identified that the document includes a flag bit, and the flag bit is a large model summary flag bit, then determining that the information block is a large model summary type; Retrieving all information blocks from the document; Matching the large model summary paragraph overview corresponding to the input information, and determining the information block corresponding to the matched large model summary paragraph overview as the target information block; The step of merging the target information block with one or more information blocks around the target information block to generate a target text includes: Obtain all text content under the summary paragraph of the large model; Determine the information blocks before and after the summary of the large model summary paragraph, and obtain all text contents in the information blocks before and after the summary of the large model summary paragraph; All text contents under the summary paragraph of the large model and all text contents in the information blocks before and after the summary paragraph of the large model are merged to generate the target text.

5. The method according to claim 2, characterized in that: in, The information block belongs to a type including a general type; The matching of the target information block related to the input information according to the matching mode corresponding to the input information and the type of the information block includes: If it is determined that the document does not include a flag bit, then the information block is determined to be a universal type; Retrieving all information blocks from the document; Determining a target information block according to a relevance score between the information block and the input information; The step of merging the target information block with one or more information blocks around the target information block to generate a target text includes: Determine the target information block within the set distance range, and obtain all text contents in the target information block within the set distance range, and all text contents in the information blocks between the target information blocks within the set distance range; All text contents in the target information blocks within the set distance range and all text contents in the information blocks between the target information blocks within the set distance range are merged to generate the target text.

6. The method according to any one of claims 1 to 5, characterized in that: Before retrieving documents and information blocks related to the input information by setting the model, the method further includes: Extract relevant heading levels in the document; Dividing the information in the document by the title; Isolate each title and the information content corresponding to the title through the title flag bit to obtain multiple fragments; If the number of flags of a certain fragment is greater than the set number of flags, the information content is fragmented; Each fragment includes a title string.

7. The method according to any one of claims 1 to 5, characterized in that: Before retrieving documents and information blocks related to the input information by setting the model, the method further includes: Divide the information content in the document into chunks using paragraph levels; Get the corresponding content overview of the information content in each block; Each content summary and the corresponding information content are isolated by the large model summary flag.

8. A text generation device, characterized in that: include: A retrieval module, used to retrieve documents and information blocks related to the input information by setting a model; wherein each document includes one or more information blocks, and the information blocks are configured to be obtained by decomposing the text in the document; A matching module, used for matching a target information block related to the input information according to the input information; A determination module, used to determine one or more information blocks around the target information block; A merging module, used for merging the target information block with one or more information blocks around the target information block to generate a target text; The target text is the output text corresponding to the input information.

9. An electronic device, characterized in that: include: A processor and a memory, wherein the memory stores machine-readable instructions executable by the processor, and when the electronic device is running, the machine-readable instructions are executed by the processor to perform the steps of any method described in claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are executed.

Citation Information

Patent Citations

  • Data set generation method and device, electronic equipment and computer readable medium

    CN117993489A

  • Document searching method and device and electronic equipment

    CN118093809A

  • Document retrieval method and device, computer readable storage medium and electronic equipment

    CN118626593A

  • Method, system and equipment for retrieval enhancement generation based on large language model and medium

    CN118964387A

  • Question and answer method and device, related equipment and computer program product

    CN119227813A