A document structured editing method and device based on deep learning
Through the deep learning-based document structured editing method, hierarchical semantic analysis and structural adjustment of multi-level documents is solved, and the problems of low efficiency and uncertainty of manual editing in the existing technology are solved, and efficient and accurate document editing and management are achieved.
Patent Information
- Application Number
- CN202411750733.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-02
- Publication Date
- 2025-06-06
- Estimated Expiration
- 2044-12-02
AI Technical Summary
Existing document editing systems rely on manual operations, are inefficient and prone to human errors. Especially when dealing with complex technical documents, academic papers or legal contracts, it is difficult to ensure the consistency and accuracy of documents.
Using a deep learning-based document structured editing method, multi-level documents are hierarchically analyzed through an optimized editing model, structured editing suggestions are generated, and structured adjustments are made to each level of the document based on these suggestions to realize automated document structured editing.
It significantly improves the efficiency and accuracy of document editing, reduces manual intervention, can better understand the multi-level semantic structure of complex documents, adapt to multilingual and multi-field documents, and improves the efficiency and quality of document management.
Smart Images

Figure CN119227649B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of data processing, and in particular to a document structured editing method, apparatus, device and computer-readable storage medium based on deep learning. Background Art
[0002] With the increasing demand for document processing, automated editing and semantic understanding of complex documents have gradually become important challenges in document management. Existing document editing systems mostly rely on manual operations, and users need to manually adjust the structure of document content, such as adjusting the order of chapters, merging or splitting paragraphs, and reorganizing sentences. This is not only time-consuming and labor-intensive, but also prone to human errors. Especially when dealing with complex technical documents, academic papers or legal contracts, manual editing efficiency is low, and the consistency and accuracy of documents are difficult to guarantee.
[0003] In the prior art, some rule-based automatic document processing systems can format some content and perform simple grammar checks according to predefined rules, but the systems lack the ability to deeply understand the semantics of the document content and are unable to optimize the editing of the document's semantic structure. In addition, existing document editing systems have limited support for multi-language and multi-field documents and are difficult to adapt to the differences in different language expressions and field specifications, resulting in poor flexibility in multi-language document processing.
[0004] Therefore, how to use deep learning technology to effectively understand the multi-level semantic structure of complex documents, automatically complete the structured editing of documents, reduce manual intervention, and improve the efficiency and accuracy of document editing is a problem that needs to be solved urgently. Summary of the invention
[0005] According to the embodiments of the present application, a document structured editing solution based on deep learning is provided. Through deep learning technology, the multi-level semantic structure of complex documents is deeply understood, thereby realizing automated document structured editing, reducing manual intervention, significantly improving editing efficiency and accuracy, and overcoming the limitations of existing rule-based systems in flexibility and semantic understanding capabilities. In particular, when processing multi-language and multi-domain documents, it can provide more powerful support and adaptability, optimize the structure of the document through intelligent document editing methods, ensure the consistency and correctness of the content, and greatly improve the efficiency and quality of document management.
[0006] In a first aspect of the present application, a document structured editing method based on deep learning is provided. The method comprises:
[0007] Get the multi-level documents to be processed;
[0008] Performing hierarchical semantic analysis on the multi-level document through an optimized editing model to generate structured editing suggestions;
[0009] Based on the structured editing suggestion, structural adjustments are made to each level of the multi-level document to complete the structured editing of the multi-level document;
[0010] The editing model can be optimized by fine-tuning the following parameters:
[0011] ;
[0012] in, To fine-tune the parameters;
[0013] It is the loss function for multi-level document semantic analysis tasks;
[0014] is the number of chapters;
[0015] For chapter The number of paragraphs;
[0016] For paragraphs The number of sentences in
[0017] For Sentences The number of words in
[0018] is the lth word in the kth sentence;
[0019] is the hyperparameter that controls the regularization term;
[0020] is the adaptive regularization term.
[0021] In a possible implementation, the multi-level document includes chapter, paragraph, sentence and / or vocabulary levels.
[0022] In a possible implementation, the multi-level document is a hierarchical tree structure:
[0023] ;
[0024] in, A hierarchical tree structure of a multi-level document.
[0025] In a possible implementation, performing hierarchical semantic analysis on the multi-level document by using an optimized editing model to generate structured editing suggestions includes:
[0026] Through the optimized editing model, semantic analysis is performed on the chapter level, paragraph level, and sentence level of the multi-level document respectively;
[0027] The semantic analysis results of each level are combined through the following formula to generate hierarchical semantic analysis results:
[0028] ;
[0029] in, It is a hierarchical semantic representation of the overall multi-level document;
[0030] , and They are the self-attention weight matrices for chapters, paragraphs, and sentences respectively;
[0031] , and These are the vector representations of chapters, paragraphs, and sentences respectively;
[0032] , and are the weighting coefficients for chapters, paragraphs, and sentences respectively;
[0033] Based on the hierarchical semantic analysis results, structured editing suggestions are generated.
[0034] In a possible implementation, generating a structured editing suggestion based on the hierarchical semantic analysis result includes:
[0035] Based on the hierarchical semantic analysis results, the weight matrices and vector representations of each level are integrated through the following formula to generate structured editing suggestions:
[0036] ;
[0037] in, Provide suggestions for structured editing;
[0038] is the weighting coefficient at the lexical level;
[0039] is the self-attention weight matrix at the vocabulary level.
[0040] In a possible implementation, the structural adjustment of each level of the multi-level document based on the structured editing suggestion to complete the structured editing of the multi-level document includes:
[0041] Based on the structured editing suggestions, adjusting the chapter level, paragraphs and / or sentences of the multi-level document respectively;
[0042] The adjustment results of the chapter level, paragraph and / or sentence are integrated through the following formula to complete the structural editing of the multi-level document:
[0043] ;
[0044] The final multi-level document after structure editing;
[0045] It is the paragraph merging function;
[0046] Adjust functions for chapters;
[0047] Function for sentence reorganization.
[0048] In a second aspect of the present application, a document structured editing device based on deep learning is provided. The device comprises:
[0049] An acquisition module is used to acquire multi-level documents to be processed;
[0050] A generation module, configured to perform hierarchical semantic analysis on the multi-level document through an optimized editing model to generate structured editing suggestions;
[0051] An editing module, configured to perform structural adjustments on each level of the multi-level document based on the structured editing suggestion, and complete structured editing of the multi-level document;
[0052] The editing model can be optimized by fine-tuning the following parameters:
[0053] ;
[0054] in, To fine-tune the parameters;
[0055] It is the loss function for multi-level document semantic analysis tasks;
[0056] is the number of chapters;
[0057] For chapter The number of paragraphs;
[0058] For paragraphs The number of sentences in
[0059] For Sentences The number of words in
[0060] is the lth word in the kth sentence;
[0061] is the hyperparameter that controls the regularization term;
[0062] is the adaptive regularization term.
[0063] In a third aspect of the present application, an electronic device is provided, which includes a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the program, the method described above is implemented.
[0064] In a fourth aspect of the present application, a computer-readable storage medium is provided, on which a computer program is stored, and when the program is executed by a processor, the method according to the first aspect of the present application is implemented.
[0065] The deep learning-based document structured editing method provided in the embodiment of the present application obtains a multi-level document to be processed; performs hierarchical semantic analysis on the multi-level document through an optimized editing model to generate structured editing suggestions; and based on the structured editing suggestions, performs structural adjustments on each level of the multi-level document to complete the structured editing of the multi-level document, thereby greatly improving the efficiency and quality of document management.
[0066] It should be understood that the contents described in the Summary of the Invention are not intended to limit the key or important features of the embodiments of the present application, nor are they intended to limit the scope of the present application. Other features of the present application will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0067] The above and other features, advantages and aspects of the embodiments of the present application will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. In the accompanying drawings, the same or similar reference numerals represent the same or similar elements, wherein:
[0068] Figure 1 is a flowchart of a document structured editing method based on deep learning according to an embodiment of the present application;
[0069] Figure 2 is a block diagram of a document structured editing device based on deep learning according to an embodiment of the present application;
[0070] Figure 3 It is a schematic diagram of the structure of a terminal device or a server suitable for implementing the embodiments of the present application. DETAILED DESCRIPTION
[0071] In order to make the purpose, technical solution and advantages of the embodiments of the present disclosure clearer, the technical solution in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are part of the embodiments of the present disclosure, not all of the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present disclosure.
[0072] In addition, the term "and / or" in this article is only a description of the association relationship between the associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship.
[0073] Figure 1 A flowchart of a document structured editing method based on deep learning according to an embodiment of the present disclosure is shown. The method comprises:
[0074] S110, obtaining a multi-level document to be processed.
[0075] In some embodiments, the multi-level document includes four levels: chapter, paragraph, sentence and / or vocabulary. Usually the initial format is plain text, PDF, Word or other text format files.
[0076] In some embodiments, in order to better process the multi-level documents to be processed and improve the efficiency of document structured editing, the following operations may be performed first:
[0077] Defines the chapter hierarchy in a multi-level document as the top level ;in, Represents a collection of chapters in a multi-level document, each chapter is , , is the number of chapters;
[0078] Define the paragraph hierarchy of a multi-level document as the middle level ;in, Represents the collection of all paragraphs in a multi-level document, each paragraph is , , is the number of paragraphs, and each paragraph The corresponding chapter There is a containment relationship between them;
[0079] Identify the sentence hierarchy of multi-level documents as sub-levels ;in, Represents the set of all sentences in a multi-level document, each sentence is , is the number of sentences, and each sentence The paragraph in which it is located There is a containment relationship between them;
[0080] Identify the vocabulary hierarchy in a multi-level document as the lowest level ;in Represents the set of all words in a multi-level document, each word is , is the number of words, and each word The sentence in which it is located There is a containment relationship between them;
[0081] Furthermore, the various levels of the multi-level document are associated to generate a hierarchical tree structure of the multi-level document:
[0082] ;
[0083] in, Represents a hierarchical tree structure of multi-level documents;
[0084] is the jth paragraph in the i-th chapter;
[0085] For chapter The number of paragraphs;
[0086] is the kth sentence in the jth paragraph;
[0087] For paragraphs The number of sentences in
[0088] is the lth word in the kth sentence;
[0089] For Sentences The number of words in .
[0090] S120, performing hierarchical semantic analysis on the multi-level document by using an optimized editing model to generate structured editing suggestions.
[0091] In some embodiments, in order to further improve the efficiency of subsequent document structured editing, operations such as character encoding standardization, text formatting, and / or removal of irrelevant noise may be performed on the multi-level document obtained in step S110.
[0092] In some embodiments, the editing model may be optimized by:
[0093] The editing model is a pre-trained BERT model based on the Hugging Face Transformers framework. The BERT model can be fine-tuned to adapt the BERT model to the document semantic analysis task of multi-level documents. The parameter matrix of the BERT model It can be obtained through the following training:
[0094] ;
[0095] Where N is the number of training samples;
[0096] and are the input samples and the corresponding target labels respectively;
[0097] is the loss function for pre-training;
[0098] is the regularization term coefficient;
[0099] is the L2 norm regularization term;
[0100] is the model parameter matrix.
[0101] Furthermore, the BERT model can be adjusted to meet the new task requirements by introducing a specific multi-level semantic objective function combined with the specific semantic analysis task of multi-level documents. The multi-level semantic objective function combined with the multi-level structure of the document's chapters, paragraphs, sentences, and words is defined as:
[0102] ;
[0103] in, To fine-tune the parameters;
[0104] It is the loss function for multi-level document semantic analysis tasks;
[0105] is the number of chapters;
[0106] For chapter The number of paragraphs;
[0107] For paragraphs The number of sentences in
[0108] For Sentences The number of words in
[0109] is the lth word in the kth sentence;
[0110] is the hyperparameter that controls the regularization term;
[0111] is the adaptive regularization term.
[0112] In some embodiments, a multi-level document is input into the optimized editing model, and each level of the multi-level document is converted into a vector representation through an embedding layer. That is, the vectors of each level of the multi-level document are chapter vectors , paragraph vector , sentence vector and vocabulary vectors .
[0113] Furthermore, the chapter level of the multi-level document is semantically analyzed and the chapter vector is input The contextual semantic relationship between chapters is captured by the multi-head self-attention mechanism of the BERT model, and the self-attention weight matrix at the chapter level can be Defined as:
[0114] ;
[0115] in, and They are the query matrix and key matrix at the chapter level respectively;
[0116] represents the dimension of the key vector;
[0117] Through self-attention weight Identify the logical relationships between chapters.
[0118] Furthermore, semantic analysis is performed on the paragraph level of multi-level documents, and the paragraph vector is input It is used to extract the core information in a paragraph. The feature extraction at the paragraph level is performed through the encoding layer of the BERT model. The context association at the paragraph level is determined by the self-attention weight matrix of the paragraph. express:
[0119] ;
[0120] in, and They are the query matrix and key matrix at the paragraph level, respectively, and the relationship between paragraphs is identified through the semantic association at the paragraph level.
[0121] Furthermore, semantic analysis is performed on the sentence level of multi-level documents, and the sentence vector is input It is used to extract the semantic core of each sentence. The sentence-level semantic analysis results are obtained through the sentence self-attention weight matrix Defined as:
[0122] ;
[0123] in, and They are the query matrix and key matrix at the sentence level, respectively, and the relationship between sentences and paragraphs is identified through the sentence self-attention mechanism.
[0124] Furthermore, the semantic analysis results of each level are combined to generate a hierarchical semantic representation of the multi-level document:
[0125] ;
[0126] in, It is a hierarchical semantic representation of the overall multi-level document;
[0127] , and They are the self-attention weight matrices for chapters, paragraphs, and sentences respectively;
[0128] , and These are the vector representations of chapters, paragraphs, and sentences respectively;
[0129] , and are the weighting coefficients for chapters, paragraphs and sentences respectively.
[0130] In some embodiments, the order of chapters is optimized based on the hierarchical semantic representation of multi-level documents, using a chapter-level self-attention weight matrix and chapter vector representation Calculate the logical priority of each chapter; analyze the merging or splitting of paragraphs, using the semantic analysis results at the paragraph level and paragraph vector Calculate the relevance between paragraphs; reorganize sentences based on sentence-level semantic core analysis using the sentence self-attention weight matrix and sentence vector Calculate the relationship between sentences; perform consistency processing of key terms based on semantic analysis results at the lexical level and vocabulary vectors Calculate the matching degree of vocabulary;
[0131] Furthermore, based on the analysis results at the chapter, paragraph, sentence and / or vocabulary levels, the weight matrices and vector representations at each level are integrated to define a structured editing suggestion function for the entire document and generate structured editing suggestions:
[0132] ;
[0133] in, Provide suggestions for structured editing;
[0134] is the weighting coefficient at the lexical level;
[0135] is the self-attention weight matrix at the vocabulary level.
[0136] S130: Based on the structured editing suggestion, structural adjustments are made to each level of the multi-level document to complete the structured editing of the multi-level document.
[0137] In some embodiments, the structure of each level of the multi-level document can be adjusted based on the structured editing suggestion, using the logical priority function of the chapters. Sort and define chapter adjustment function :
[0138] ;
[0139] in, For the adjusted chapter order, based on the logical priority function of the chapter Arrange chapters so that the order of chapters conforms to a logical or user-specified standard;
[0140] Furthermore, according to the semantic relevance function of the paragraph Merge or split paragraphs when the correlation between paragraphs exceeds a predetermined threshold Merge paragraphs when defining paragraph merging function :
[0141] ;
[0142] in, The result of merging or splitting paragraphs;
[0143] Furthermore, according to the relationship function of the sentence Reorganize the sentences and define the sentence reorganization function ;
[0144] Further, according to the structured editing suggestions Integrate the editing suggestions in the chapter, paragraph, and sentence adjustment results to generate an adjusted multi-level document structure :
[0145] ;
[0146] The final multi-level document after structure editing;
[0147] It is the paragraph merging function;
[0148] Adjust functions for chapters;
[0149] Function for sentence reorganization.
[0150] A specific embodiment according to the present application is given below:
[0151] Take a complex legal contract as an example. This complex legal contract contains technical terms, market terms and legal terms, and uses three languages: Chinese, English and German. The document is more than 150,000 words long, including 80 chapters, 500 paragraphs and 2,000 sentences, and involves a large number of legal terms and industry technical terms. Traditional manual editing methods take a long time in such scenarios and are prone to logical errors, semantic inconsistencies and terminology confusion.
[0152] The contract documents were processed using the method disclosed in the present invention. The system loaded the pre-trained BERT model through the Hugging Face Transformers framework, and fine-tuned 500 legal contracts and related documents archived within the company, enabling the BERT model to perform accurate semantic analysis on multi-level documents.
[0153] When the contract document is uploaded to the system, it is preprocessed. The system automatically identifies the character encoding format in the document, converts it to a unified UTF-8 format, and removes irrelevant characters, blank lines, and format errors in the text. After the initial structuring of the document is completed, the system performs a hierarchical analysis of each level of the document.
[0154] The contract document is subjected to chapter-level semantic analysis. The system identifies 80 chapters of the contract document and generates a semantic association graph between chapters through a self-attention mechanism. Problems such as duplication of content and improper order of some chapters are identified. Chapters 6 and 7 of the technical terms section have similar descriptions. The present disclosure can automatically give suggestions for merging chapters and adjust the content of Chapter 7 to the subordinate paragraphs of Chapter 6. The time required to adjust the order of chapters in the document and generate merging suggestions is 15 seconds.
[0155] Furthermore, a semantic association analysis was performed on 500 paragraphs, and it was detected that some paragraphs in the contract document were logically incoherent, especially in the legal terms. The system identified the logical jump problem between paragraphs 25, 26 and 27. By calculating the semantic association between the paragraphs, it automatically generated paragraph adjustment suggestions, merged paragraphs 26 and 27 into one paragraph, and inserted a new logical guide paragraph in the first half of the legal terms, solving the logical jump problem.
[0156] A detailed reorganization analysis was performed on 2,000 sentences in the document. The system used the sentence self-attention weight matrix to calculate the semantic core and structure of each sentence, and identified that there were many lengthy sentence structures in the technical terms, which could easily cause difficulty in understanding. The sentence in paragraph 45 "The technology license under this agreement will be granted to Party A. Party A may license the technology to Party B and Party C without violating the terms of the contract. Unless otherwise specified, all licensed technologies shall comply with the protection provisions of the Patent Law" was split into two concise sentences, thereby improving readability. The system reorganized 78 complex sentences in the process.
[0157] Consistency processing of key terms involved in the document. It was identified that the term "licensing" in the technical terms and "license" in the legal terms were expressed differently in different parts of the contract, and the system suggested the unified use of the term "licensing". In addition, it was detected that the term "software system" in the contract was inconsistent in the German translation, and the system automatically generated a term translation consistency suggestion, suggesting that all German translations related to the software system be unified as "Softwaresystem".
[0158] All the adjustment suggestions for the document were integrated to generate the final structured editing results, and the edited contract document was output. The document structure adjustment process took only 30 minutes, which greatly improved the editing efficiency compared to the traditional manual editing process which takes at least 5 working days.
[0159] As shown in Table 1, Table 1 shows the data comparison results of the method of the present disclosure and the traditional method;
[0160] Table 1
[0161] project Method of the present invention Traditional methods Editing time 30 minutes 5 working days Chapter optimization times 6 times 3 times Number of paragraph merges 10 times 5 times Number of sentence reorganizations 78 times 45 times Terminology consistency process 120 times 65 times Logical error rate 0.2% 3.5% Editing accuracy 99.5% 90%
[0162] As can be seen from Table 1, the method of the present invention shows significant advantages in editing time, chapter optimization, paragraph merging, sentence reorganization and terminology consistency processing. In particular, the accuracy of document editing is improved by 9.5%, and the logic error rate is reduced by 3.3%. The data fully proves the efficiency and accuracy of the method of the present invention in processing complex multi-level documents. Especially in multi-language and multi-field document editing tasks, the method of the present invention has extremely high practicality.
[0163] According to the embodiments of the present disclosure, the following technical effects are achieved:
[0164] Through the mapping of four levels, chapter, paragraph, sentence and vocabulary, a dynamic dependency relationship of multi-level documents is constructed. Different from the static document analysis method in the prior art, the method disclosed in the present invention can capture and reflect the structural and semantic changes of each level of the document in real time, ensuring that the hierarchical dependency relationship remains consistent during the document processing process, effectively solving the problem that the prior art is difficult to flexibly adjust and dynamically optimize when facing complex document structures, and significantly improving the efficiency and accuracy of document processing;
[0165] Through the self-attention mechanism, the dependencies between chapters, paragraphs, sentences and words are dynamically analyzed, and corresponding structured editing suggestions are generated. A new network architecture is proposed to solve the multi-node dependency problem in document structure optimization and ensure the accuracy of information transmission and dependency relationships between levels. In particular, the introduction of the priority sorting algorithm makes the information flow in the document processing process more efficient and reduces information conflicts.
[0166] In summary, the solution disclosed herein optimizes the structure of documents through intelligent document editing, greatly improving the efficiency and quality of document management while ensuring the consistency and correctness of the content.
[0167] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described order of actions, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily required by the present application.
[0168] The above is an introduction to the method embodiment. The following is a further explanation of the scheme described in this application through an apparatus embodiment.
[0169] Figure 2 A block diagram of a document structured editing device based on deep learning according to an embodiment of the present application is shown, Figure 2 Shown include:
[0170] An acquisition module 210 is used to acquire a multi-level document to be processed;
[0171] A generating module 220, configured to perform hierarchical semantic analysis on the multi-level document through an optimized editing model to generate structured editing suggestions;
[0172] An editing module 230, configured to perform structural adjustments on each level of the multi-level document based on the structured editing suggestion, thereby completing the structured editing of the multi-level document;
[0173] The editing model can be optimized by fine-tuning the following parameters:
[0174] ;
[0175] in, To fine-tune the parameters;
[0176] Loss function for multi-level document semantic analysis tasks
[0177] is the number of chapters;
[0178] For chapter The number of paragraphs;
[0179] For paragraphs The number of sentences in
[0180] For Sentences The number of words in
[0181] is the lth word in the kth sentence;
[0182] is the hyperparameter that controls the regularization term;
[0183] is the adaptive regularization term.
[0184] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the described module can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0185] Figure 3 A schematic diagram of the structure of a terminal device or server suitable for implementing an embodiment of the present application is shown.
[0186] like Figure 3As shown, the terminal device or server includes a central processing unit (CPU) 301, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 302 or the program loaded from the storage part 308 to the random access memory (RAM) 303. In the RAM 303, various programs and data required for the operation of the terminal device or server are also stored. The CPU 301, the ROM 302, and the RAM 303 are connected to each other through a bus 304. An input / output (I / O) interface 305 is also connected to the bus 304.
[0187] The following components are connected to the I / O interface 305: an input section 306 including a keyboard, a mouse, etc.; an output section 307 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 308 including a hard disk, etc.; and a communication section 309 including a network interface card such as a LAN card, a modem, etc. The communication section 309 performs communication processing via a network such as the Internet. A drive 310 is also connected to the I / O interface 305 as needed. A removable medium 311, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 310 as needed, so that a computer program read therefrom is installed into the storage section 308 as needed.
[0188] In particular, according to an embodiment of the present application, the above method flow steps can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a machine-readable medium, and the computer program includes a program code for executing the method shown in the flow chart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 309, and / or installed from the removable medium 311. When the computer program is executed by the central processing unit (CPU) 301, the above-mentioned functions defined in the system of the present application are executed.
[0189] It should be noted that the computer-readable medium shown in the present application may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present application, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0190] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each box in the flow chart or block diagram can represent a module, a program segment or a part of the code, and the aforementioned module, program segment or a part of the code contains one or more executable instructions for realizing 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 boxes represented in succession 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 flow chart, and the combination of the boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0191] The units or modules involved in the embodiments described in the present application may be implemented by software or hardware. The units or modules described may also be arranged in a processor. The names of these units or modules do not, in some cases, constitute limitations on the units or modules themselves.
[0192] As another aspect, the present application further provides a computer-readable storage medium, which may be included in the electronic device described in the above embodiment; or may exist independently without being assembled into the electronic device. The above computer-readable storage medium stores one or more programs, and when the above programs are used by one or more processors to execute the method described in the present application.
[0193] The above description is only a preferred embodiment of the present application and an explanation of the technical principles used. Those skilled in the art should understand that the scope of application involved in the present application is not limited to the technical solution formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the aforementioned application concept. For example, the above features are replaced with (but not limited to) technical features with similar functions applied in the present application.
Claims
1. A document structured editing method based on deep learning, characterized in that: include: Get the multi-level documents to be processed; Performing hierarchical semantic analysis on the multi-level document through an optimized editing model to generate structured editing suggestions; Based on the structured editing suggestion, structural adjustments are made to each level of the multi-level document to complete the structured editing of the multi-level document; The editing model is optimized by fine-tuning the following parameters: ; in, To fine-tune the parameters; It is the loss function for multi-level document semantic analysis tasks; is the number of chapters; For chapter The number of paragraphs; For paragraphs The number of sentences in For Sentences The number of words in is the lth word in the kth sentence; is the hyperparameter that controls the regularization term; is the adaptive regularization term; The multi-level document includes chapter, paragraph, sentence and / or word levels; The multi-level document is a hierarchical tree structure: ; in, A hierarchical tree structure for multi-level documents is the jth paragraph in the i-th chapter; For chapter The number of paragraphs; is the kth sentence in the jth paragraph; For paragraphs The number of sentences in is the lth word in the kth sentence; For Sentences The number of words in the document; the hierarchical semantic analysis of the multi-level document by the optimized editing model to generate structured editing suggestions includes: Through the optimized editing model, semantic analysis is performed on the chapter level, paragraph level, and sentence level of the multi-level document respectively; The semantic analysis results of each level are combined through the following formula to generate hierarchical semantic analysis results: ; in, It is a hierarchical semantic representation of the overall multi-level document; , and The self-attention weight matrices for chapters, paragraphs, and sentences respectively; , and These are the vector representations of chapters, paragraphs, and sentences respectively; , and are the weighting coefficients for chapters, paragraphs, and sentences respectively; Generating structured editing suggestions based on the hierarchical semantic analysis results; The generating of structured editing suggestions based on the hierarchical semantic analysis results includes: Based on the hierarchical semantic analysis results, the weight matrices and vector representations of each level are integrated through the following formula to generate structured editing suggestions: ; in, Provide suggestions for structured editing; is the weighting coefficient at the lexical level; is a self-attention weight matrix at the vocabulary level; and the structural adjustment of each level of the multi-level document based on the structured editing suggestion to complete the structured editing of the multi-level document includes: Based on the structured editing suggestions, adjusting the chapter level, paragraphs and / or sentences of the multi-level document respectively; The adjustment results of the chapter level, paragraph and / or sentence are integrated through the following formula to complete the structural editing of the multi-level document: ; The final multi-level document after structure editing; It is the paragraph merging function; Adjust functions for chapters; Reorganize functions for sentences; The paragraph merging function is determined according to the following formula: ; in, The result of merging or segmenting paragraphs according to the semantic relevance function of the paragraphs Merge or split paragraphs when the correlation between paragraphs exceeds a predetermined threshold Merge paragraphs when The chapter adjustment function Determined according to the following formula: ; in, The adjusted chapter order is based on the logical priority function of the chapters Arrange chapters so that the order of chapters conforms to a logical or user-specified standard; The sentence reorganization function According to the relationship function of the sentence Sure.
2. The method according to claim 1, characterized in that Also includes: Character encoding standardization, text formatting and / or noise removal processing are performed on the multi-level document.
3. A document structured editing device based on deep learning, characterized in that: include: An acquisition module is used to acquire multi-level documents to be processed; A generation module, configured to perform hierarchical semantic analysis on the multi-level document through an optimized editing model to generate structured editing suggestions; An editing module, configured to perform structural adjustments on each level of the multi-level document based on the structured editing suggestions, thereby completing the structured editing of the multi-level document; The editing model is optimized by fine-tuning the following parameters: ; in, To fine-tune the parameters; It is the loss function for multi-level document semantic analysis tasks; is the number of chapters; For chapter The number of paragraphs; For paragraphs The number of sentences in For Sentences The number of words in is the lth word in the kth sentence; is the hyperparameter that controls the regularization term; is the adaptive regularization term; The multi-level document includes chapter, paragraph, sentence and / or word levels; The multi-level document is a hierarchical tree structure: ; in, A hierarchical tree structure for multi-level documents is the jth paragraph in the i-th chapter; For chapter The number of paragraphs; is the kth sentence in the jth paragraph; For paragraphs The number of sentences in is the lth word in the kth sentence; For Sentences The number of words in ; The step of performing hierarchical semantic analysis on the multi-level document by using the optimized editing model to generate structured editing suggestions includes: Through the optimized editing model, semantic analysis is performed on the chapter level, paragraph level, and sentence level of the multi-level document respectively; The semantic analysis results of each level are combined through the following formula to generate hierarchical semantic analysis results: ; in, It is a hierarchical semantic representation of the overall multi-level document; , and The self-attention weight matrices for chapters, paragraphs, and sentences respectively; , and These are the vector representations of chapters, paragraphs, and sentences respectively; , and are the weighting coefficients for chapters, paragraphs, and sentences respectively; Generating structured editing suggestions based on the hierarchical semantic analysis results; The generating of structured editing suggestions based on the hierarchical semantic analysis results includes: Based on the hierarchical semantic analysis results, the weight matrices and vector representations of each level are integrated through the following formula to generate structured editing suggestions: ; in, Provide suggestions for structured editing; is the weighting coefficient at the lexical level; is the self-attention weight matrix at the vocabulary level; The step of adjusting the structure of each level of the multi-level document based on the structured editing suggestion to complete the structured editing of the multi-level document includes: Based on the structured editing suggestions, adjusting the chapter level, paragraphs and / or sentences of the multi-level document respectively; The adjustment results of the chapter level, paragraph and / or sentence are integrated through the following formula to complete the structural editing of the multi-level document: ; The final multi-level document after structure editing; It is the paragraph merging function; Adjust functions for chapters; Reorganize functions for sentences; The paragraph merging function is determined according to the following formula: ; in, The result of merging or segmenting paragraphs according to the semantic relevance function of the paragraphs Merge or split paragraphs when the correlation between paragraphs exceeds a predetermined threshold Merge paragraphs when The chapter adjustment function Determined according to the following formula: ; in, The adjusted chapter order is based on the logical priority function of the chapters Arrange chapters so that the order of chapters conforms to a logical or user-specified standard; The sentence reorganization function According to the relationship function of the sentence Sure.
4. An electronic device comprising a memory and a processor, wherein a computer program is stored in the memory, wherein: When the processor executes the computer program, the method according to any one of claims 1 to 2 is implemented.
5. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 2 is implemented.
Citation Information
Patent Citations
Document-based question generation method and device and server
CN115688792A
Document revision method and device, electronic equipment and storage medium
CN118747494A