Document generation method, system and electronic device

Through sharding processing and mind map adjustment technology, we solve the problem that the content of documents generated by large language models does not meet user needs, reduce the workload of regenerating documents, and improve the efficiency and accuracy of document generation.

CN118551740BActive Publication Date: 2024-10-15SICHUAN WUJI SMART TECH CO LTD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202411018805.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-29
Publication Date
2024-10-15
Estimated Expiration
2044-07-29

AI Technical Summary

Technical Problem

When generating documents, the content of large language models is too broad and lacks focus, making it unable to meet user needs. Moreover, the workload of regenerating documents is large and difficult to adjust.

Method used

By obtaining the prompt information and the original document, perform segmentation processing to form text blocks, generate the target document and its related mind map based on the large language model, use the modification information of the mind map to adjust the target document, and reduce the workload of regeneration.

Benefits of technology

It achieves efficient adjustment and optimization of target documents, reduces the processing workload of regenerating documents with large language models, and improves content accuracy and user demand matching.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118551740B_ABST
    Figure CN118551740B_ABST
Patent Text Reader

Abstract

The present invention provides a document generation method, system and electronic device. After obtaining prompt information and at least one original document, at least one original document is segmented to obtain multiple text blocks. A target document is generated based on a large language model and in accordance with the prompt information and the multiple text blocks, and a mind map related to the target document is generated. Modification information of the mind map is obtained, the mind map is adjusted based on the modification information, and the target document is adjusted based on the modification information based on the large language model to obtain the adjusted target document. In this solution, by generating a target document and its related mind map, the mind map is used to intuitively display information related to the target document, and the target document can be adjusted to generate a new target document based on the modification information of the mind map, thereby avoiding the problem of large processing workload when a large language model needs to regenerate a new target document based on the original document.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a document generation method, system and electronic device. Background Art

[0002] In applications of document generation based on large language models, the documents currently generated by large language models suffer from serious hallucinations. Documents are generated only through the single understanding of the large language model. Therefore, the generated content may be too broad, unfocused, or even irrelevant to the user's intentions.

[0003] The document content generated by the large language model is usually generated once and is not adjustable. It cannot meet user needs in one go. Therefore, there is usually a large deviation between the generated content and the user's purpose. When regenerating a document, the large language model needs to be processed again based on the original document to obtain a new document. It can be seen that the large language model in the prior art has the defect of being difficult to meet user needs when generating documents. In addition, when regenerating a document, the large language model needs to be processed again based on the source document, which has a large processing workload. Summary of the invention

[0004] Objectives of the present invention include, for example, providing a document generation method, system, and electronic device that can reduce the processing workload when regenerating a target document.

[0005] The embodiments of the present invention can be implemented as follows:

[0006] In a first aspect, the present invention provides a document generation method, the method comprising:

[0007] Obtain prompt information and at least one original document;

[0008] Segmenting the at least one original document to obtain a plurality of text blocks;

[0009] Generate a target document based on the large language model and according to the prompt information and the multiple text blocks, and generate a mind map related to the target document;

[0010] Modification information of the mind map is obtained, the mind map is adjusted based on the modification information, and the target document is adjusted according to the modification information based on the large language model to obtain an adjusted target document.

[0011] In an optional implementation, the target document is divided into a plurality of sentences, and the method further includes:

[0012] For each of the sentences, determining the text block corresponding to the sentence, and determining the original document to which the text block belongs;

[0013] The identifier of the corresponding text block and the identifier of the original document to which it belongs are obtained, and a traceability tag is set for the sentence in the target document according to the identifier of the corresponding text block and the identifier of the original document to which it belongs.

[0014] In an optional embodiment, the method further comprises:

[0015] For each of the sentences, obtaining a text block and an original document corresponding to the sentence;

[0016] Based on the natural language inference model and according to the sentence and its corresponding text block and original document, an attribution determination result is obtained, and the attribution determination result represents whether the expression information and traceability information of the sentence are accurate.

[0017] In an optional embodiment, the method further comprises:

[0018] When the attribution determination result indicates that the expression information or the traceability information of the sentence is inaccurate, obtaining attribution analysis information;

[0019] The expression information or the source tracing information of the sentence is adjusted based on the large language model and according to the attribution analysis information.

[0020] In an optional implementation, before the step of generating a mind map related to the target document, the method further includes:

[0021] Obtaining structured information of the mind map, wherein the structured information includes nodes in the mind map and hierarchical relationships between the nodes;

[0022] Importing the structured information and the target document into a natural language inference model for processing to obtain a matching relevance, wherein the matching relevance is used to characterize a matching degree between the mind map and the target document;

[0023] In an optional embodiment, the method further comprises:

[0024] When the matching relevance is lower than a set threshold, generating a prompt word based on the matching relevance;

[0025] The mind map is modified based on the large language model and according to the prompt word.

[0026] In an optional implementation, the step of generating a target document based on the large language model and according to the prompt information and the multiple text blocks includes:

[0027] Calculating the similarity between the prompt information and each of the text blocks;

[0028] Filter out text blocks whose similarity is greater than or equal to a preset threshold;

[0029] Detecting whether the number of the filtered text blocks is greater than a preset number, if greater than the preset number, selecting a preset number of text blocks with the highest similarity from the filtered text blocks, and generating a target document based on the large language model according to the prompt information and the selected preset number of text blocks;

[0030] If it is less than or equal to the preset number, a target document is generated based on the large language model according to the prompt information and the filtered text blocks.

[0031] In an optional embodiment, the method further comprises:

[0032] It is detected whether the data of the plurality of text blocks exceeds a set number. If the data exceeds the set number, the plurality of text blocks are subjected to summary processing so that the data of the text blocks after the summary processing is the set number.

[0033] In a second aspect, the present invention provides a document generation system, the system comprising:

[0034] An acquisition module, used for acquiring prompt information and at least one original document;

[0035] A processing module, configured to perform segmentation processing on the at least one original document to obtain a plurality of text blocks;

[0036] A generating module, configured to generate a target document based on a large language model and according to the prompt information and the plurality of text blocks, and to generate a mind map related to the target document;

[0037] The adjustment module is used to obtain modification information of the mind map, adjust the mind map based on the modification information, and adjust the target document according to the modification information based on the large language model to obtain an adjusted target document.

[0038] In a third aspect, the present invention provides an electronic device comprising one or more storage media and one or more processors communicating with the storage media, wherein the one or more storage media store machine executable instructions executable by the processors, and when the electronic device is running, the processor executes the machine executable instructions to perform the method described in any one of the aforementioned embodiments.

[0039] The beneficial effects of the embodiments of the present invention include, for example:

[0040] The present invention provides a document generation method, system and electronic device. After obtaining prompt information and at least one original document, the at least one original document is segmented to obtain multiple text blocks. A target document is generated based on a large language model and in accordance with the prompt information and the multiple text blocks, and a mind map related to the target document is generated. Modification information of the mind map is obtained, the mind map is adjusted based on the modification information, and the target document is adjusted based on the modification information based on the large language model to obtain the adjusted target document. In this solution, by generating a target document and its related mind map, the relevant information of the target document is intuitively displayed with the mind map, and the target document can be adjusted to generate a new target document based on the modification information of the mind map, thereby avoiding the problem of large processing workload when a large language model needs to regenerate a new target document based on the original document. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments are briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention 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 creative work.

[0042] Figure 1 A flowchart of a document generation method provided by an embodiment of the present invention;

[0043] Figure 2 for Figure 1 A flowchart of the sub-steps included in S13;

[0044] Figure 3 A flowchart of a tag setting method in a document generation method provided by an embodiment of the present invention;

[0045] Figure 4 Schematic diagram of tracing the source in an embodiment of the present invention;

[0046] Figure 5 A flowchart of an attribution determination method in a document generation method provided by an embodiment of the present invention;

[0047] Figure 6 A flowchart of an adjustment method in a document generation method provided by an embodiment of the present invention;

[0048] Figure 7 A flowchart of a matching relevance determination method in a document generation method provided by an embodiment of the present invention;

[0049] Figure 8 Another flow chart of the adjustment method in the document generation method provided by the embodiment of the present invention;

[0050] Fig. 9 A functional module block diagram of a document generation system provided by an embodiment of the present invention;

[0051] Fig.10 This is a structural block diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0052] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Generally, the components of the embodiments of the present invention described and shown in the drawings here can be arranged and designed in various different configurations.

[0053] Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the invention claimed for protection, but merely represents selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0054] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, further definition and explanation thereof is not required in subsequent drawings.

[0055] It should be noted that, in the absence of conflict, the features in the embodiments of the present invention may be combined with each other.

[0056] Figure 1 The flowchart of the document generation method provided by the embodiment of the present invention is shown. The document generation method can be implemented by a document generation system. The document generation system can be implemented by software and / or hardware and can be configured in an electronic device. The electronic device can be a computer device. The detailed steps of the document generation method are described as follows.

[0057] S11, obtaining prompt information and at least one original document.

[0058] S12, segmenting the at least one original document to obtain a plurality of text blocks.

[0059] S13, generating a target document based on the large language model and according to the prompt information and the multiple text blocks, and generating a mind map related to the target document.

[0060] S14, obtaining modification information of the mind map, adjusting the mind map based on the modification information, and adjusting the target document according to the modification information based on the large language model to obtain an adjusted target document.

[0061] In this embodiment, the user can select one or more original documents whose content needs to be extracted for upload. The uploaded original documents are stored in the Object Storage Service (OSS) layer of the electronic device and saved in the database. The uploaded original documents are unstructured documents. After the system loads the original documents, it uses the slicing and word segmentation technology to slice each original document to obtain multiple text blocks.

[0062] For example, multiple comparison text blocks may be set and saved in advance, and the original document may be segmented according to the comparison text blocks to obtain multiple text blocks, or segmented according to set paragraph division, phrase division, sentence division, etc.

[0063] In addition, users can also upload relevant prompt information based on the requirements of the document to be generated, and the prompt information includes prompt sentences, topics, purposes, etc. For example, the prompt information is to generate a speech, generate a solution, etc. The prompt information is used to indicate the type, function, subject, form, etc. of the document to be generated.

[0064] In this embodiment, for the multiple text blocks generated, each text block can be vectorized. For example, knowledge enhancement technology can be combined and a vector model can be pre-trained. The vector model can be used to vectorize each text block, and the vectorized text blocks can be stored in a database.

[0065] In this way, when document generation is subsequently implemented based on text blocks, efficient retrieval and matching effects can be achieved, the accuracy and efficiency of retrieval can be improved through high-dimensional vectors, and the quality of text generation can be improved by combining knowledge enhancement technology.

[0066] On the basis of the above, the prompt information and multiple text blocks are imported into the large language model for processing. Under the guidance of the prompt information, the large language model can generate a target document of the corresponding subject, purpose, etc. indicated by the prompt information based on the multiple text blocks. The large language model can adopt a currently open source model, or can be obtained by further training based on the currently open source large language model.

[0067] In addition, the large language model can also generate a mind map related to the target document based on the prompt information and multiple text blocks. The mind map generated by the large language model is the structured information of the mind map, and finally the rendering tool can be used to render the mind map presented on the interface based on the structured information.

[0068] Among them, the mind map includes multiple nodes, and the multiple nodes are associated according to a hierarchical relationship, which reflects the hierarchical relationship between the nodes, such as the superior-subordinate relationship, parallel relationship, causal relationship, etc. The hierarchical relationship of the nodes is consistent with the logical relationship between paragraphs, sentences, phrases, etc. in the target document.

[0069] In this way, based on the mind map, the theme, sub-themes and the relationship between the target document can be clearly and intuitively displayed. Users can understand the content of the target document by viewing the mind map. Users can quickly understand the document content, article structure, article ideas, etc. without having to read all the document content.

[0070] At the same time, each node in the mind map has corresponding content in the target document, and users can easily switch between the mind map and the target document content.

[0071] Considering that the large language model can generate a mind map related to the target document, the large language model may not be able to generate a target document that fully meets the user's needs under the guidance of the instruction information, or there may be changes in user needs. Therefore, when such a situation occurs, the target document needs to be adjusted. However, if the instruction information is re-entered and the target document is regenerated based on the instruction information and the original document using the large language model, this process will result in a large processing workload.

[0072] Based on the above considerations, in this embodiment, an interactive interface is provided, based on which the user can directly modify the mind map, including deleting nodes, adding nodes, modifying the association relationship between nodes, etc. The modification information obtained can be obtained based on the user directly dragging nodes in the mind map, connecting nodes, etc., or it can also be obtained by the user inputting editing information in the editing area that controls the generation of the mind map.

[0073] The system can adjust the mind map based on the modification information obtained, and at the same time, can import the modification information into the large language model, and the large language model can adjust the target document based on the modification information, and then obtain the target document corresponding to the adjusted mind map. In this way, the generated target document and mind map can be more in line with the user's needs.

[0074] The document generation method provided in this embodiment generates a target document and its related mind map, and uses the mind map to intuitively display the relevant information of the target document. The target document can be adjusted based on the modification information of the mind map to generate a new target document, thereby avoiding the problem of large processing workload when a large language model needs to regenerate a new target document based on the original document.

[0075] Considering that the original document may be long, the number of multiple text blocks obtained after the original document is segmented may be large. When processing a large number of text blocks, the processing workload will increase. There may be some text blocks in the multiple text blocks that do not contribute much to the expression of the meaning of the article, which will cause unnecessary processing workload. In addition, the large language model may be insufficient in understanding long texts.

[0076] Based on the above considerations, the document generation method provided in this embodiment also includes the following steps:

[0077] It is detected whether the data of the plurality of text blocks exceeds a set number. If the data exceeds the set number, the plurality of text blocks are subjected to summary processing so that the data of the text blocks after the summary processing is the set number.

[0078] In this embodiment, when the number of text blocks after the segmentation process exceeds the set number, a summary processing technology can be used to extract summaries from multiple text blocks, so that the number of text blocks can be reduced while retaining the accurate meaning of the document. Among them, the set number can be set relatively large to avoid not being able to fully retain the accurate meaning of the document. The text blocks after the summary processing can improve the density and accuracy of the represented content, ensuring that the document content that meets the requirements can be obtained efficiently and accurately in the future.

[0079] See also Figure 2 In this embodiment, when the target document is generated based on the large language model and according to the prompt information and multiple text blocks, it can be achieved in the following ways:

[0080] S131, calculating the similarity between the prompt information and each of the text blocks.

[0081] S132, filtering out text blocks whose similarity is greater than or equal to a preset threshold.

[0082] S133, detecting whether the number of the filtered text blocks is greater than a preset number, if it is greater than the preset number, executing the following step S134, if it is less than or equal to the preset number, executing the following step S135.

[0083] S134, selecting a preset number of text blocks with the highest similarity from the screened text blocks, and generating a target document based on the prompt information and the selected preset number of text blocks based on the large language model;

[0084] S135, generating a target document according to the prompt information and the filtered text blocks based on the large language model.

[0085] In this embodiment, for each text block finally stored in the database, the similarity between each text block and the prompt information can be calculated. The similarity between the text block and the prompt information can be calculated by semantic analysis. For example, the similarity can be obtained based on semantic analysis using methods such as Word2Vec, Doc2Vec, BERT, etc.

[0086] In addition, in this embodiment, a preset threshold is pre-set, and the similarity corresponding to each text block can be compared with the preset threshold, so as to filter out text blocks with similarity greater than or equal to the preset threshold.

[0087] If the number of selected text blocks is small, for example, less than or equal to the preset number K, the selected text blocks can be directly used to generate the target document. If the number of selected text blocks is large, considering the limitation of the understanding ability of the large language model, text blocks with higher similarity can be selected from them, and the target document can be generated based on the selected text blocks.

[0088] The preset number K can be set in advance according to the understanding ability of the large language model used.

[0089] In this embodiment, through the above method, the text blocks that best match the user's needs can be screened out based on similarity, ensuring that the target document generated based on the screened text blocks is more in line with the user's purpose. In addition, considering the understanding ability of the large language model, an upper limit value of the number of text blocks ultimately used is set to avoid problems in the large language model processing process.

[0090] Based on the above, the target document and the mind map related to the target text can be generated based on the large language model.

[0091] In the prior art, the large language model will perform document segmentation and word segmentation in the early stage of generation processing, and will assign corresponding identifiers to each paragraph, key sentence or phrase. These identifiers will be hidden after the large language model generates the document. Therefore, after extracting content from multiple documents to form a new document, it is impossible to trace the source, and it is impossible to know which original document the generated document content comes from. There is a situation where only the generated document can be displayed, and the original source is invisible, resulting in the inability to trace the document.

[0092] Based on the above considerations, in this embodiment, the generated target document can be divided into multiple sentences, where a sentence can be a paragraph, a phrase, a sentence, etc. Figure 3 The document generation method provided in this embodiment may further include the following steps:

[0093] S21, for each of the sentences, determining the text block corresponding to the sentence, and determining the original document to which the text block belongs.

[0094] S22, obtaining the identifier of the corresponding text block and the identifier of the original document to which it belongs, and setting a traceability tag for the sentence in the target document according to the identifier of the corresponding text block and the identifier of the original document to which it belongs.

[0095] In this embodiment, the large language model can be combined with knowledge enhancement technology (RAG) to generate a target document and a mind map with traceability tags. Among them, the target document includes multiple sentences, and each sentence can be generated based on one or more text blocks. For example, the large language model can perform semantic analysis on the one or more text blocks to obtain the expression content of the text blocks, and then generate corresponding sentences based on the expression content. Therefore, the text blocks corresponding to each sentence can be obtained.

[0096] Since the text blocks are obtained by segmenting the original document, each text block has its own original document.

[0097] In this embodiment, each original document can be identified, and the identification can be a number, for example, numbered A, B, C... In addition, each text block in the original document can be identified, for example, identified as 1, 2, 3... In this way, after determining the text block corresponding to a sentence, the original document to which the text block belongs can be obtained. In this way, the identification of the original document and the identification of the text block can be obtained, and based on the identification of the original document and the identification of the text block, a traceability label can be set for the sentence in the target document. For example, the traceability label can be consistent with the identification of the corresponding text block.

[0098] For example, Figure 4 As shown in , the generated document has three sentences with their traceability labels 1, 2, and 3 respectively. The sentences with traceability labels 1 and 2 are generated based on the text blocks marked as 1 and 2 in document A, and the sentence with traceability label 3 is generated based on the text block marked as 3 in document B.

[0099] On the basis of the above, users can click on the traceability tag in the target document to trace the source of the text block, so that users can clearly understand the source information of each sentence, improve the transparency and credibility of the document. At the same time, it is convenient for users to quickly locate and check the original text.

[0100] In this embodiment, although the large language model can set the source tag for each sentence in the target document, it is possible that the source tag will be incorrectly set. Figure 5 ,In this embodiment, a pre-trained natural language inference model is also used to ,verify the traceability information.

[0101] Specifically, the document generation method provided in this embodiment may further include the following steps:

[0102] S31, for each of the sentences, obtaining the text block and the original document corresponding to the sentence.

[0103] S32, based on the natural language inference model and according to the sentence and its corresponding text block and original document, an attribution determination result is obtained, and the attribution determination result represents whether the expression information and traceability information of the sentence are accurate.

[0104] In this embodiment, a natural language reasoning model is pre-trained. The natural sentence reasoning model has semantic analysis and processing capabilities, and can determine the degree of consistency in semantic expression of two or more input contents, for example, consistency in semantic expression, inconsistency in semantic expression, possible inconsistency in semantic expression, etc.

[0105] The text block and original document corresponding to each sentence can be determined by the traceability processing of the large language model. The sentence, the text block corresponding to the sentence, and the original document are input into the natural language inference model. The natural language inference model can perform semantic analysis on the three to determine whether the meaning expressed by the sentence is consistent with the text block and the meaning expressed by the text block in the original document. Here, the result output by the natural language model is used as the attribution judgment result. The attribution judgment result reflects two levels of meaning. One is whether the expression information of the sentence is accurate, that is, whether the expression meaning of the sentence is consistent with the expression meaning of the corresponding text block. The other is whether the traceability information of the sentence is consistent, that is, whether the sentence comes from the original document.

[0106] If the attribution discrimination result obtained by the natural language inference model indicates that the expression information or traceability information of the sentence is inaccurate, it is necessary to adjust the sentence or adjust the traceability label of the sentence.

[0107] Based on the above, please refer to Figure 6 The document generation method provided in this embodiment also includes the following steps:

[0108] S33, when the attribution identification result indicates that the expression information or the traceability information of the sentence is inaccurate, obtaining attribution analysis information.

[0109] S34: adjusting the expression information or the source tracing information of the sentence based on the large language model and according to the attribution analysis information.

[0110] In this embodiment, when the attribution discrimination result obtained based on the natural language inference model represents that the expression information of a sentence or its traceability information is inaccurate, attribution analysis information can be obtained. The attribution analysis information includes, for example, whether the expression information of a sentence is logically inconsistent with the expression information of the corresponding text block, which part of the content in the original document of its corresponding source is inconsistent with the expression information of a sentence, etc. The attribution analysis information can also include prompt information for the large language model, for example, "This attribution has potential errors, please review it. If it is correct, please explain the reason; if there is an error, please regenerate the sentence or traceability label."

[0111] The attribution analysis information can be provided to the large language model, and the large language model will adjust the sentence based on the attribution analysis information, or adjust the source tag of the sentence, etc.

[0112] In this embodiment, a natural language inference model is introduced to distinguish attribution and verify the accuracy of the traceability label, which can ensure that the traceability information and attribution logic are clear and accurate, and improve the reliability and credibility of the target document content.

[0113] From the above, we can see that the large language model can generate a mind map related to the target document while generating the target document. In order to ensure that the generated mind map is highly consistent with the content of the target document, a post-verification mechanism is introduced. For details, please refer to Figure 7 In this embodiment, after generating the mind map related to the target document, the following steps may also be included:

[0114] S41, obtaining structured information of the mind map, wherein the structured information includes nodes in the mind map and hierarchical relationships between the nodes.

[0115] S42, importing the structured information and the target document into a natural language inference model for processing to obtain a matching relevance, where the matching relevance is used to characterize the matching degree between the mind map and the target document.

[0116] As can be seen from the above, each node in the mind map is associated according to the corresponding logical relationship, and each node can correspond to a sentence, paragraph, etc. in the target document. In theory, the logical relationship reflected by the hierarchical relationship of the nodes in the mind map should be consistent with the logical relationship between the sentences in the target document. However, in the actual processing process, the mind map may not be consistent with the target document.

[0117] Therefore, in this embodiment, after obtaining the structured information of the mind map, the structured information and the target document are imported into the natural language reasoning model for processing. The natural language reasoning model can analyze the target document to obtain the logical relationship between the sentences in the target document. Then, the logical relationship between the sentences in the target document is compared with the hierarchical relationship between the nodes in the structured information of the mind map to obtain the matching correlation between the two.

[0118] If the matching correlation is high, it means that the mind map is consistent with the target document and there is no need to adjust the mind map. If the matching correlation is low, it means that the mind map may be correct and needs to be adjusted.

[0119] Therefore, based on the above, please refer to Figure 8 The document generation method provided in this embodiment may further include the following steps:

[0120] S43: When the matching relevance is lower than a set threshold, generate a prompt word based on the matching relevance.

[0121] S44, modifying the mind map based on the large language model and according to the prompt word.

[0122] In this embodiment, when the matching relevance is lower than the set threshold, prompt words can be generated based on prompt word engineering technology (Prompt Engineering), and the prompt words may include specific problems existing in the mind map, for example, the hierarchical relationship between which two nodes in the mind map is inconsistent with the logical relationship between the corresponding sentences in the target document, and a node that appears in the mind map has no corresponding sentence in the target document, etc. The large language model will modify the mind map according to the prompt words.

[0123] In this embodiment, the above verification process can be repeated for multiple times, and after multiple verifications, the large language model can be continuously guided to perform output corrections. Through comprehensive and accurate verification, it can be ensured that the generated mind map is highly consistent with the target document content.

[0124] In summary, the document generation method provided by the embodiment of the present invention combines knowledge enhancement (RAG) and attribution processing (Attribution) technology in practical applications. After the original document is segmented to obtain multiple text blocks, each text block is processed into a text block in the form of a high-dimensional vector, and stored efficiently in the database. Based on the prompt information input by the user, the system will use the text blocks of these high-dimensional vectors and the prompt information to perform similarity calculations, thereby screening out the text blocks used to generate the target document. At the same time, based on the large language model's in-depth understanding of long texts and the current context window size, the system will intelligently set a preset number K value. Based on this K value, the system will accurately recall the K text blocks that best match the user prompt from the screened text blocks.

[0125] Taking into account that a large language model may have comprehension deviations when processing long texts, this embodiment may further perform summary processing on multiple text blocks obtained by pre-segmentation to ensure that the document expression information is accurately retained while improving the density and accuracy of the text blocks.

[0126] In addition, the large language model can set traceability tags for each sentence in the generated target document, which is used to trace back to its corresponding original document to view the source. The sentence traceability tags, original documents and other data are transmitted to the system for storage, and the system will record the source path of the text block in detail. After the target document is generated, the system will display these traceability tags, the original source document and the location of the paragraphs, sentences, and phrases, so that users can clearly understand the source information of each sentence. In the generated target document, there can be a backtracking function to support tracing the source of paragraphs, sentences, and phrases. By clicking on the traceability marks of these specific paragraphs, sentences, or phrases, users can quickly locate the corresponding content in the original document.

[0127] Furthermore, in this embodiment, a natural language inference model is also used to attribute the sentences and their traceability labels in the generated target document. If the natural language inference model determines that the attribution of a sentence is not logical or factual, it will provide feedback to the large language model to guide the large language model to adjust the sentences in the target document and their corresponding traceability labels, and at the same time, adjust the mind map related to the target document.

[0128] In this embodiment, if the generated mind map and target document do not fully meet the user's needs, the user can directly modify the mind map, and the large language model can adjust the target document based on the user's modification information on the mind map. In this way, the processing workload of regenerating the target document is greatly reduced.

[0129] Furthermore, in this embodiment, a natural language inference model can be used in combination with the mind map and the target document to detect whether the mind map matches the target document. If not, a prompt word can be given to prompt the large language model to readjust the mind map to ensure that the mind map and the target document are highly consistent.

[0130] Based on the same inventive concept, please refer to Fig. 9 , shows a schematic diagram of the functional modules of the document generation system provided by an embodiment of the present invention. This embodiment can divide the functional modules of the document generation system according to the above method embodiment. For example, each functional module can be divided according to each function, or two or more functions can be integrated into one processing module. The above integrated module can be implemented in the form of hardware or in the form of software functional modules.

[0131] It should be noted that the division of modules in the embodiments of the present invention is schematic and is only a logical function division. There may be other division methods in actual implementation. For example, in the case of dividing each functional module according to each function, Fig. 9 The document generation system shown is only a schematic diagram of the system. The document generation system may include an acquisition module, a processing module, a generation module and an adjustment module. The functions of each functional module of the document generation system are described in detail below.

[0132] An acquisition module, used for acquiring prompt information and at least one original document;

[0133] A processing module, configured to perform segmentation processing on the at least one original document to obtain a plurality of text blocks;

[0134] A generating module, configured to generate a target document based on a large language model and according to the prompt information and the plurality of text blocks, and to generate a mind map related to the target document;

[0135] The adjustment module is used to obtain modification information of the mind map, adjust the mind map based on the modification information, and adjust the target document according to the modification information based on the large language model to obtain an adjusted target document.

[0136] It can be understood that the above-mentioned acquisition module, processing module, generation module and adjustment module can be used to execute the above-mentioned S11 to S14. The detailed implementation method of the acquisition module, processing module, generation module and adjustment module can refer to the above-mentioned contents related to the above-mentioned S11 to S14.

[0137] In a possible implementation, the target document is divided into multiple sentences, and the generation module can also be used to:

[0138] For each of the sentences, determining the text block corresponding to the sentence, and determining the original document to which the text block belongs;

[0139] The identifier of the corresponding text block and the identifier of the original document to which it belongs are obtained, and a traceability tag is set for the sentence in the target document according to the identifier of the corresponding text block and the identifier of the original document to which it belongs.

[0140] In a possible implementation, the above generation module may also be used to:

[0141] For each of the sentences, obtaining a text block and an original document corresponding to the sentence;

[0142] Based on the natural language inference model and according to the sentence and its corresponding text block and original document, an attribution determination result is obtained, and the attribution determination result represents whether the expression information and traceability information of the sentence are accurate.

[0143] In a possible implementation, the above generation module may also be used to:

[0144] When the attribution determination result indicates that the expression information or the traceability information of the sentence is inaccurate, obtaining attribution analysis information;

[0145] The expression information or the source tracing information of the sentence is adjusted based on the large language model and according to the attribution analysis information.

[0146] In a possible implementation, the above generation module may also be used to:

[0147] Obtaining structured information of the mind map, wherein the structured information includes nodes in the mind map and hierarchical relationships between the nodes;

[0148] The structured information and the target document are imported into a natural language inference model for processing to obtain a matching relevance, where the matching relevance is used to characterize the matching degree between the mind map and the target document.

[0149] In a possible implementation, the above generation module may also be used to:

[0150] When the matching relevance is lower than a set threshold, generating a prompt word based on the matching relevance;

[0151] The mind map is modified based on the large language model and according to the prompt word.

[0152] In a possible implementation, the above generation module may be specifically used for:

[0153] Calculating the similarity between the prompt information and each of the text blocks;

[0154] Filter out text blocks whose similarity is greater than or equal to a preset threshold;

[0155] Detecting whether the number of the filtered text blocks is greater than a preset number, if greater than the preset number, selecting a preset number of text blocks with the highest similarity from the filtered text blocks, and generating a target document based on the large language model according to the prompt information and the selected preset number of text blocks;

[0156] If it is less than or equal to the preset number, a target document is generated based on the large language model according to the prompt information and the filtered text blocks.

[0157] In a possible implementation, the above generation module may also be used to:

[0158] It is detected whether the data of the plurality of text blocks exceeds a set number. If the data exceeds the set number, the plurality of text blocks are subjected to summary processing so that the data of the text blocks after the summary processing is the set number.

[0159] The document generation system provided in this embodiment can execute the method described in any of the implementation modes in the above embodiments, which will not be described in detail here. In addition, the technical effects of the document generation system in this embodiment can refer to the technical effects of the method described in any of the implementation modes in the above embodiments, which will not be described in detail here.

[0160] See also Fig.10 , is a structural block diagram of an electronic device provided in an embodiment of the present invention, the electronic device may be a computer device, a server, etc., and the electronic device includes a storage medium, a processor, and a communication module. The storage medium, the processor, and the communication module are electrically connected to each other directly or indirectly to achieve data transmission or interaction. For example, these components can be electrically connected to each other via one or more communication buses or signal lines.

[0161] The storage medium is used to store programs or data. The storage medium may be, but is not limited to, random access memory (RAM), read only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), and electrically erasable programmable read-only memory (EEPROM).

[0162] The processor is used to read / write data or programs stored in the storage medium and execute the document generation method provided by any embodiment of the present invention.

[0163] The communication module is used to establish a communication connection between the electronic device and other communication terminals through the network, and is used to send and receive data through the network.

[0164] It should be understood that Fig.10 The structure shown is only a schematic diagram of the structure of the electronic device. The electronic device may also include Fig.10 More or fewer components as shown, or with Fig.10 Different configurations are shown.

[0165] Furthermore, an embodiment of the present invention also provides a computer-readable storage medium, which stores machine-executable instructions. When the machine-executable instructions are executed, the document generation method provided in the above embodiment is implemented.

[0166] Specifically, the computer-readable storage medium can be a general storage medium, such as a mobile disk, a hard disk, etc. When the computer program on the computer-readable storage medium is executed, the above document generation method can be executed. Regarding the process involved when the machine executable instructions in the computer-readable storage medium are executed, reference can be made to the relevant description in the above method embodiment, which will not be described in detail here.

[0167] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed by the present invention should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.

Claims

1. A document generation method, characterized in that: The method comprises: Obtain prompt information and at least one original document; Segmenting the at least one original document to obtain a plurality of text blocks; Generate a target document based on the large language model and according to the prompt information and the multiple text blocks, and generate a mind map related to the target document; Obtaining modification information of the mind map, adjusting the mind map based on the modification information, and adjusting the target document according to the modification information based on the large language model to obtain an adjusted target document; The target document is divided into a plurality of sentences, and the method further comprises: For each of the sentences, determine the text block corresponding to the sentence, and determine the original document to which the text block belongs; obtain the identifier of the corresponding text block and the identifier of the original document to which it belongs, and set a traceability tag for the sentence in the target document according to the identifier of the corresponding text block and the identifier of the original document to which it belongs; For each of the sentences, obtain the text block and original document corresponding to the sentence; based on the natural language inference model and according to the sentence and its corresponding text block and original document, obtain an attribution judgment result, and the attribution judgment result represents whether the expression information and traceability information of the sentence are accurate.

2. The document generation method according to claim 1, characterized in that: The method further comprises: When the attribution determination result indicates that the expression information or the traceability information of the sentence is inaccurate, obtaining attribution analysis information; The expression information or the source tracing information of the sentence is adjusted based on the large language model and according to the attribution analysis information.

3. The document generation method according to claim 1, characterized in that: After the step of generating a mind map related to the target document, the method further includes: Obtaining structured information of the mind map, wherein the structured information includes nodes in the mind map and hierarchical relationships between the nodes; The structured information and the target document are imported into a natural language inference model for processing to obtain a matching relevance, where the matching relevance is used to characterize the matching degree between the mind map and the target document.

4. The document generation method according to claim 3, characterized in that: The method further comprises: When the matching relevance is lower than a set threshold, generating a prompt word based on the matching relevance; The mind map is modified based on the large language model and according to the prompt word.

5. The document generation method according to claim 1, characterized in that: The step of generating a target document based on the large language model and according to the prompt information and the multiple text blocks includes: Calculating the similarity between the prompt information and each of the text blocks; Filter out text blocks whose similarity is greater than or equal to a preset threshold; Detecting whether the number of the filtered text blocks is greater than a preset number, if greater than the preset number, selecting a preset number of text blocks with the highest similarity from the filtered text blocks, and generating a target document based on the large language model according to the prompt information and the selected preset number of text blocks; If it is less than or equal to the preset number, a target document is generated based on the large language model according to the prompt information and the filtered text blocks.

6. The document generation method according to claim 1, characterized in that: The method further comprises: It is detected whether the data of the plurality of text blocks exceeds a set number. If the data exceeds the set number, the plurality of text blocks are subjected to summary processing so that the data of the text blocks after the summary processing is the set number.

7. A document generation system, characterized in that: For implementing the document generation method according to any one of claims 1 to 6, the system comprises: An acquisition module, used for acquiring prompt information and at least one original document; A processing module, configured to perform segmentation processing on the at least one original document to obtain a plurality of text blocks; A generating module, configured to generate a target document based on a large language model and according to the prompt information and the plurality of text blocks, and to generate a mind map related to the target document; The adjustment module is used to obtain modification information of the mind map, adjust the mind map based on the modification information, and adjust the target document according to the modification information based on the large language model to obtain an adjusted target document.

8. An electronic device, characterized in that: The electronic device comprises one or more storage media and one or more processors communicating with the storage media, wherein the one or more storage media store machine executable instructions executable by the processors, and when the electronic device is running, the processor executes the machine executable instructions to execute the method described in any one of claims 1 to 6.

Citation Information

Cited By

  • AI-driven multilingual intelligent document abstract and mind map generation system

    CN119494394A

  • AI-Driven Multilingual Intelligent Document Summarization and Mind Map Generation System

    CN119494394B