A document processing method and apparatus
By constructing a document tree and using a second language model to iteratively summarize layer by layer, the problem of low efficiency in summarizing structured documents is solved, achieving efficient and accurate document summarization results.
Patent Information
- Application Number
- CN202411137673.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-16
- Publication Date
- 2026-11-10
- Estimated Expiration
- 2044-08-16
AI Technical Summary
Existing technologies struggle to efficiently summarize structured documents, especially long and varied documents, resulting in low efficiency.
By constructing a document tree and using the second largest language model to iteratively summarize layer by layer, combining the document structure and text content, the summary results of leaf nodes and non-leaf nodes are inferred level by level, and finally the document summary result is obtained.
It improves the efficiency and accuracy of document summarization, makes full use of the characteristics of structured documents, enhances the understanding of the semantic content and structural relationships of various parts of the document by the large language model, and is suitable for various forms of document summarization.
Smart Images

Figure CN119025613B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of artificial intelligence technology, and in particular to a document processing method and apparatus. Background Technology
[0002] More and more enterprise and individual users are adopting structured methods to organize information into documents, such as OKR (Objectives and Key Results) documents, project management documents, service planning documents, and so on. These documents are usually maintained by users over a long period of time, and the content is complex. It is difficult to understand the main content of the documents, and it requires sorting and summarizing them one by one, which is inefficient. Summary of the Invention
[0003] In view of this, this application provides a document processing method and apparatus for automatically summarizing documents that organize information in a structured manner, thereby improving efficiency.
[0004] This application provides the following solution:
[0005] Firstly, a document processing method is provided, the method comprising:
[0006] Get the document to be processed;
[0007] The document is parsed, and a document tree corresponding to the document is constructed based on the parsing results and the document's structure.
[0008] Starting from the leaf node of the document tree, the second language model is called to iterate and summarize layer by layer until the summary result of the root node is obtained. The summary result of the leaf node is obtained by the second language model using the text content of the leaf node, and the summary result of the non-leaf node is obtained by the second language model using the summary result of the child node of the non-leaf node.
[0009] The summary result of the document is obtained by using the summary result of the root node.
[0010] According to one achievable method in an embodiment of this application, parsing the document includes:
[0011] Parse the text content of the document, which includes plain text and rich text;
[0012] The type of the rich text is identified, and the first language model corresponding to the type of the rich text is called to extract the content of the rich text to obtain the plain text corresponding to the rich text.
[0013] According to one achievable method in the embodiments of this application, the leaf nodes of the document tree include: the plain text corresponding to the rich text or the segmentation result of the plain text contained in the document; the non-leaf nodes include headings at all levels;
[0014] The plain text corresponding to different types of rich text is used as different leaf nodes, and each leaf node is labeled with the corresponding rich text type.
[0015] According to one achievable method in the embodiments of this application, starting from the leaf nodes of the document tree, the second largest language model is called to perform iterative summarization layer by layer until the summary result of the root node is obtained, including:
[0016] The second largest language model is invoked to perform inference based on each leaf node, and the summary results of each leaf node are obtained.
[0017] Each leaf node is used as the current layer node;
[0018] The second largest language model is invoked to perform inference based on the summary results of the current layer node corresponding to the same upper layer node, so as to obtain the summary results of the upper layer node;
[0019] The upper-level node is taken as the current-level node, and the process proceeds to the step of calling the second language model to perform inference based on the summary result of the current-level node corresponding to the same upper-level node, until the summary result of the root node is obtained.
[0020] According to one achievable method in this application embodiment, the invocation of the second large language model to perform inference based on each leaf node, and the resulting summary of each leaf node, includes:
[0021] The prompt instruction is constructed using the text content of the leaf node, the path information from the leaf node to the root node, and the rule information summarized in this paper. If the leaf node corresponds to rich text, the prompt instruction also includes the type information of the rich text.
[0022] The second language model is invoked using the prompt instruction, and the summary result of the leaf node obtained by the second language model based on the prompt instruction is obtained.
[0023] According to one achievable method in this application embodiment, the step of calling the second language model to perform inference based on the summary results of the current layer node corresponding to the same upper-level node, and obtaining the summary results of the upper-level node, includes:
[0024] Construct prompt instructions using the summary results of all current-level nodes corresponding to the same upper-level node and the rule information of this summary;
[0025] The second language model is invoked using the prompt instruction to obtain the summary result of the upper-level node obtained by the second language model based on the prompt instruction.
[0026] According to one achievable method in an embodiment of this application, the document contains text content corresponding to different time information;
[0027] The document corresponds to multiple document trees, and the multiple document trees correspond to different time information. The nodes contained in the same document tree all correspond to the same time information.
[0028] The summary result of the document is obtained by using the summary result of the root node. This includes obtaining the summary result of the document by using the summary results of the root nodes contained in the multiple document trees corresponding to the document.
[0029] Secondly, a document processing method is provided, the method comprising:
[0030] Obtain the documentation for the target management system;
[0031] The document is parsed, and a document tree corresponding to the document is constructed based on the parsing results and the structure of the document. The root node of the document tree is the target, the leaf nodes are the segmented results of the plain text included in the document or the plain text extracted from the rich text included in the document, and the nodes at each intermediate level are the headings at each level.
[0032] Starting from the leaf node of the document tree, the second language model is called to iterate and summarize layer by layer until the summary result of the root node is obtained. The summary result of the leaf node is obtained by the second language model using the text content of the leaf node, and the summary result of the non-leaf node is obtained by the second language model using the summary result of the child node of the non-leaf node.
[0033] Using the summary results of the root node, the summary results of the document are obtained, and the summary results include the results summary corresponding to the target.
[0034] According to one achievable method in the embodiments of this application, the service page corresponding to the target management system includes components that trigger document processing and document information;
[0035] The step of obtaining documents from the target management system includes: in response to an event triggered by the component, obtaining the document corresponding to the document information from the target management system;
[0036] The method further includes displaying the summary results of the document on the service page.
[0037] Thirdly, a document processing method is provided, applied to a cloud server, the method comprising:
[0038] In response to a document processing request sent by a user terminal, retrieve the document to be processed;
[0039] The document is parsed, and a document tree corresponding to the document is constructed based on the parsing results and the document's structure.
[0040] Starting from the leaf node of the document tree, the second language model is called to iterate and summarize layer by layer until the summary result of the root node is obtained. The summary result of the leaf node is obtained by the second language model using the text content of the leaf node, and the summary result of the non-leaf node is obtained by the second language model using the summary result of the child node of the non-leaf node.
[0041] Using the summary results of the root node, the summary results of the document are obtained;
[0042] The summary results of the document are sent to the user terminal.
[0043] Fourthly, a document processing apparatus is provided, the apparatus comprising:
[0044] The document acquisition unit is configured to acquire documents to be processed.
[0045] The document parsing unit is configured to parse the document and construct a document tree corresponding to the document based on the parsing results and the structure of the document.
[0046] The iterative summarization unit is configured to start from the leaf node of the document tree, call the second language model to perform iterative summarization layer by layer until the summarization result of the root node is obtained; wherein, the summarization result of the leaf node is obtained by the second language model using the text content of the leaf node, and the summarization result of the non-leaf node is obtained by the second language model using the summarization result of the child node of the non-leaf node.
[0047] The result determination unit is configured to obtain a summary result of the document using the summary result of the root node.
[0048] According to a fifth aspect, a computer-readable storage medium is provided, on which a computer program is stored, which, when executed by a processor, implements the steps of the method described in any one of the first to third aspects.
[0049] According to a sixth aspect, an electronic device is provided, comprising:
[0050] One or more processors; and
[0051] A memory associated with the one or more processors, the memory being used to store program instructions that, when read and executed by the one or more processors, perform the steps of the method described in any one of the first to third aspects.
[0052] According to a seventh aspect, a computer program product is provided, comprising a computer program that is processed by a processor to perform the steps of the method described in any one of the first to third aspects.
[0053] According to the specific embodiments provided in this application, the following technical effects are disclosed:
[0054] 1) This application constructs a document tree using the parsing results and structure of the document. It then calls a second-largest language model to iteratively summarize the document tree layer by layer. Leveraging the language understanding capabilities of the second-largest language model, it first infers the text content of the leaf nodes to obtain their summary results. Then, based on the leaf node summary results, it iteratively summarizes layer by layer, finally using the summary results of the root node to obtain the document's summary result. This method is designed for documents that organize information in a structured manner, achieving automatic document summarization and improving efficiency. Furthermore, it fully utilizes the characteristics of document-based information organization, breaking down the summarization task into multi-level tasks based on the document's structure. Compared to simply inputting the entire document into a large language model for summarization, the large language model can better understand the semantic content of each part of the document and the structural relationships between them, thus resulting in a better summarization effect.
[0055] 2) For rich text in a document, this application calls the first major language model corresponding to the type of rich text to extract the content of the rich text and convert the rich text into plain text, thereby preserving the core content of the rich text and making the document summary applicable to documents containing various forms.
[0056] 3) In this application, the segmentation results of the plain text corresponding to the rich text or the plain text contained in the text are respectively used as leaf nodes, and the headings at all levels are respectively used as non-leaf nodes. Furthermore, the plain text corresponding to different types of rich text are respectively used as different leaf nodes. This enables the summarization of each leaf node to be more accurate when calling the second language model for iterative reasoning, thereby accurately obtaining the summary results of the document.
[0057] 4) In this application, during the iterative summarization process of calling the second largest language model, reasoning starts from the leaf node, and the summary results of the nodes corresponding to the same upper-level node are reasoned to obtain the summary results of the upper-level nodes. The summary is carried out layer by layer until the root node. This method follows the structure of the document and is very consistent with the characteristics of document information organized in a structured form, so that the summary results of the document can achieve better results.
[0058] 5) In this application, when summarizing leaf nodes using the second language model, the path information from the leaf node to the root node is used in the prompt instruction. This allows the second language model to fully consider the structural position of the leaf node in the document during the summary, resulting in a more accurate summary of the leaf node. If the leaf node corresponds to rich text, the prompt instruction further includes the type information of the rich text, enabling the second language model to fully understand the characteristics of that type of rich text, thereby improving the summary effect of the leaf node.
[0059] 6) In this application, multiple document trees can be constructed for a document, with each document tree corresponding to different time information. After obtaining the summary results of each root node for each document tree, the summary results of the document are then combined. This method can fully consider the impact of time information for documents with significant time progression characteristics, thereby obtaining higher quality summary results.
[0060] Of course, any product implementing this application does not necessarily need to achieve all of the advantages described above at the same time. Attached Figure Description
[0061] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0062] Figure 1 This is a system architecture diagram applicable to the embodiments of this application;
[0063] Figure 2 A flowchart of a document processing method provided in an embodiment of this application;
[0064] Figure 3 A schematic diagram of a document tree provided for an embodiment of this application;
[0065] Figure 4 A flowchart illustrating an iterative summary provided in this application embodiment;
[0066] Figure 5 A flowchart illustrating a method for processing OKR documents in a target management system, provided in an embodiment of this application;
[0067] Figure 6 A schematic diagram of a service page provided in an embodiment of this application;
[0068] Figure 7 A schematic diagram illustrating the display of summary results on a service page, provided as an embodiment of this application;
[0069] Figure 8 A schematic block diagram of a document processing apparatus provided in the embodiments of this application;
[0070] Figure 9 A schematic block diagram of an electronic device provided in an embodiment of this application. Detailed Implementation
[0071] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. All other embodiments obtained by those skilled in the art based on the embodiments of this application are within the scope of protection of this application.
[0072] The terminology used in the embodiments of this invention is for the purpose of describing particular embodiments only and is not intended to limit the invention. The singular forms “a,” “the,” and “the” as used in the embodiments of this invention and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise.
[0073] It should be understood that the term "and / or" used in this article is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Additionally, the character " / " in this article generally indicates that the preceding and following related objects have an "or" relationship.
[0074] Depending on the context, the word "if" as used here can be interpreted as "when," "when," "in response to determination," or "in response to detection." Similarly, depending on the context, the phrase "if determination" or "if detection (of the stated condition or event)" can be interpreted as "when determination," "in response to determination," "when detection (of the stated condition or event)," or "in response to detection (of the stated condition or event)."
[0075] With the emergence and continuous development of large language model technology, some technologies now exist that allow direct input of documents with structured information into large language models for summarization. However, due to the typical length and diverse formats of these documents, the summarization effect of large language models on these documents is not ideal.
[0076] In view of this, this application provides a new approach. To facilitate understanding of this application, the system architecture on which this application is based will first be described. Figure 1 An exemplary system architecture that can be applied to embodiments of this application is shown, such as Figure 1 As shown, the system architecture may include: user terminals, document processing devices, and a large language model located on the server side.
[0077] The user sends a document processing request to the document processing device located on the server through the user terminal. The document processing device responds to the document processing request, obtains the document to be processed, and performs document processing in accordance with the method provided in the embodiments of this application to obtain a summary result of the document. The summary result is then returned to the user terminal, and / or the summary result is associated with the document and stored.
[0078] The user terminal can input the document information to be processed through application interfaces, web pages, message conversation windows, etc.
[0079] One possible approach is for the document processing device to retrieve the document to be processed from a specific document system based on a document processing request. For example, it could retrieve the document from a target management system, project management system, or service planning system. Alternatively, it could retrieve the document locally from the user's terminal.
[0080] In this embodiment, the document processing device involves calling large language models during document processing. A large language model (LLM) is a deep learning model trained on a large amount of text data, capable of generating natural language text or understanding the meaning of language text. Its characteristics include massive scale and a huge number of parameters (typically exceeding tens of billions), and it is usually based on deep learning architectures such as the Transformer architecture. The difference between an LLM and a regular pre-trained language model lies in the scale of its parameters. When the parameter scale exceeds a certain level, the model achieves significant performance improvements and exhibits capabilities that smaller models lack, such as in-context learning capabilities. It can learn complex patterns in language and perform a wide range of tasks, including text summarization, translation, sentiment analysis, multi-turn dialogue, etc. Therefore, to distinguish it from traditional pre-trained language models, models with a parameter scale exceeding a certain level are called LLMs. In general, language models with a parameter scale exceeding tens of billions implemented based on deep learning architectures can be considered large language models. Common LLMs include: GTP-3 (Generative Pre-trained Transformer 3), T5 (Text-to-Text Transfer Transformer), GTP-4, PaLM (a large language model proposed by Google), LLaMA (Large Language Model Meta AI, a large language model released by Meta AI), and so on.
[0081] The aforementioned document processing device and large language model can be configured on independent servers, server clusters consisting of multiple servers, or cloud servers. Cloud servers, also known as cloud computing servers or cloud hosts, are a host product within the cloud computing service system, designed to address the management difficulties and weak service scalability inherent in traditional physical hosts and Virtual Private Servers (VPS) services. They can also be configured on computer terminals with strong computing capabilities.
[0082] The aforementioned user terminals may include, but are not limited to, smart mobile terminals, smart home devices, wearable devices, and PCs (Personal Computers). Smart mobile devices may include mobile phones, tablets, laptops, PDAs (Personal Digital Assistants), and connected cars. Smart home devices may include smart appliances such as smart TVs and smart refrigerators, as well as other appliances capable of running document processing functions. Wearable devices may include smartwatches, smart glasses, smart bracelets, VR (Virtual Reality) devices, AR (Augmented Reality) devices, and mixed reality devices (i.e., devices that support both virtual and augmented reality), etc.
[0083] It should be understood that Figure 1 The number of user terminals, document processing devices, and large language models shown is merely illustrative. Depending on implementation needs, any number of user terminals, document processing devices, and large language models can be included.
[0084] Figure 2 A flowchart illustrating a document processing method provided in an embodiment of this application, which can be generated by... Figure 1 The document processing device in the system shown is executing. For example... Figure 2 As shown, the method may include the following steps:
[0085] Step 201: Obtain the document to be processed.
[0086] Step 203: Parse the document and construct the document tree corresponding to the document based on the parsing results and the document structure.
[0087] Step 205: Starting from the leaf nodes of the document tree, call the second language model to iteratively summarize layer by layer until the summary result of the root node is obtained; among them, the summary result of the leaf node is obtained by the second language model using the text content of the leaf node, and the summary result of the non-leaf node is obtained by the second language model using the summary result of the child node of the non-leaf node.
[0088] Step 207: Use the summary results of the root node to obtain the summary results of the document.
[0089] As can be seen from the above process, this application constructs a document tree using the parsing results and structure of the document, calls a second-largest language model to iteratively summarize the document tree layer by layer, and fully utilizes the language understanding capabilities of the second-largest language model to first infer the text content of the leaf nodes to obtain the summary results of the leaf nodes, and then iteratively summarizes layer by layer based on the summary results of the leaf nodes, finally using the summary results of the root nodes to obtain the summary result of the document. This method fully utilizes the document's characteristic of organizing information in a structured way, and decomposes the summary task into multi-level tasks based on the document's structure. Compared with the method of inputting the document into the large language model all at once for summarization, the large language model can better understand the semantic content of each part of the document and the structural relationships between the parts, thus achieving better summary results.
[0090] The following describes in detail each step of the above process and the effects that can be further produced, with reference to the embodiments. It should be noted that the terms "first" and "second" involved in this disclosure do not have limitations in terms of size, order, or quantity, but are only used to distinguish them in name. For example, "first large language model" and "second large language model" are used to distinguish the two large language models in name.
[0091] First, the above step 201, namely "obtaining the document to be processed", will be described in detail with reference to the embodiments.
[0092] One possible approach is for the document processing service to provide a service page to the user, which is then displayed on the user's terminal. The user can then provide the document information to be processed to the server-side document processing device through specific components or dialog boxes on this service page. The server-side document processing device can then retrieve the document from the server or database of the corresponding document system based on this document information. This document information can include a document identifier, document name, and the address where the document is stored, among other things.
[0093] As another feasible approach, the document processing service can provide a service page to the user, which is displayed on the user's terminal. Through this service page, the user can directly upload the document to be processed to the document processing device on the server. The document to be processed can be a document stored locally on the user's terminal, a document downloaded from another server, a document obtained from another user's terminal, and so on.
[0094] The embodiments of this application can be applied to any type of document, especially those that organize information in a structured manner. These documents are typically long, have a clear structure, and may contain various forms of content. For example, OKR documents involved in project management systems are usually centered on objectives and record key results information along a timeline. In addition to plain text, they may also contain various types of rich text formats, such as tables, ordered lists, unordered lists, and images.
[0095] The following describes step 203, namely "parse the document and construct the document tree corresponding to the document based on the parsing results and the document structure", in detail with reference to the embodiments.
[0096] If the document to be processed contains only plain text, a document parser can be invoked to parse the document. The document parser can construct a corresponding document tree based on the document's structure. The document parser can be flexibly selected based on the document format. For example, for XML (Extensible Markup Language) or HTML (HyperText Markup Language) documents, parsers such as DOM (Document Object Model) or SAX (Simple API for XML) can be used; and for Word documents, parsers such as Apache POI can be used.
[0097] If the document to be processed includes both plain text and rich text, or only rich text, the rich text type can be identified. First, the primary language model corresponding to the rich text type is called to extract the content of the rich text, obtaining the corresponding plain text. Then, the document parser is called, which constructs the corresponding document tree based on the document's structure. This process essentially converts the rich text in the document into plain text.
[0098] For example, for a rich text document, the type of the rich text is first determined. Then, a prompt instruction is constructed based on the rich text type. This prompt instruction can include the rich text, its type information, and rules for content extraction. Upon receiving the prompt instruction, the first language model extracts the content of the rich text to obtain the corresponding plain text. For image-type rich text, this can include two aspects: text content recognized using OCR (Optical Character Recognition) and text content extracted after semantic analysis using the first language model. For plain text, since documents typically contain headings at various levels, the root node of the generated document tree can be the document title or target, intermediate nodes are headings at various levels, and leaf nodes are segments or plain text extracted from the rich text. These nodes form a hierarchical relationship according to the document's structure, thus constituting the document tree.
[0099] Figure 3 An example of a document tree is shown. In some cases, the text under the lowest-level heading can be directly used as a leaf node, such as text 2. However, in other cases, the text under the lowest-level heading may be quite long. Due to limitations in the text processing length of the first-level language model or considering the inference performance of the first-level language model, the text can be segmented into segments, and each segment can be used as a leaf node. For example, text 1 in the figure is segmented into segment 1, segment 2, and segment 3, each serving as a leaf node. For images, such as image 1, its corresponding OCR result and semantic analysis result can be used as leaf nodes. For the text 1, image 1, and table 1 nodes in the document tree, since they are not leaf nodes, these nodes can be identification information, while all leaf nodes contain the actual document content.
[0100] Furthermore, since some documents reflect clear timelines—for example, OKR documents—the key deliverables for the same goal have clear timelines, which is a crucial factor for OKR documents. Therefore, for such documents, separate document trees can be built for different timeframes, with each node in the same document tree corresponding to the same time information. For instance, the content within the same week in the document can be divided into separate document trees, with different document trees representing the content of different weeks. Similarly, the content within the same month can be divided into separate document trees, with different document trees representing the content of different months. The specific timeframe division can be flexibly set according to the actual scenario and needs.
[0101] The following describes in detail step 205, namely, "starting from the leaf node of the document tree, calling the second largest language model to iteratively summarize layer by layer until the summary result of the root node is obtained," with reference to the embodiments.
[0102] In this step, the summary result of a node is obtained by the second language model using the text content of the leaf node, and the summary result of a non-leaf node is obtained by the second language model using the summary results of the child nodes of that non-leaf node.
[0103] Figure 4 A flowchart of an iterative summary provided for an embodiment of this application, such as Figure 4 As shown, the following steps may be included:
[0104] Step 401: Call the second language model to perform inference based on each leaf node to obtain the summary results of each leaf node.
[0105] In this step, for each leaf node, the second language model can be invoked to obtain the summary result for that leaf node. When invoking the second language model, the text content of the leaf node and the rule information of this summary can be used to construct a prompt instruction. The prompt instruction is then used to invoke the second language model, and the summary result of the leaf node obtained by the second language model based on the prompt instruction is obtained.
[0106] Since leaf nodes, in addition to the semantics contained in their text content, also have path information from their root node that can greatly help large language models understand them, as a more preferred approach, when constructing prompt instructions, in addition to utilizing the text content of the leaf node and the rule information summarized in this paper, the path information from the leaf node to the root node is further combined to construct the prompt instructions.
[0107] Furthermore, if the leaf node corresponds to rich text, that is, the leaf node is plain text extracted from rich text, the prompt instruction can also include the type information of the rich text, thereby helping the second language model to better understand the content of the leaf node and thus more accurately infer the summary result of the leaf node.
[0108] In addition, the prompt instructions can include output format, sample examples, etc.
[0109] Step 403: Set each leaf node as the current layer node.
[0110] Step 405: Call the second language model to perform inference based on the summary results of the current layer node corresponding to the same upper layer node, and obtain the summary results of the upper layer node.
[0111] In this step, a prompt instruction can be constructed using the summary results of all current-level nodes corresponding to the same upper-level node and the rule information of this summary. This prompt instruction is then used to call the second language model to obtain the summary results of the upper-level nodes obtained by the second language model based on the prompt instruction.
[0112] In addition, the prompt instructions can include output format, sample examples, etc.
[0113] Step 407: Determine whether the summary result of the root node has been obtained. If yes, end the process; otherwise, proceed to step 405.
[0114] Step 409: Set the upper-level node as the current-level node and proceed to step 405.
[0115] Summarize layer by layer upwards until the summary result of the root node is obtained.
[0116] like Figure 3 The document tree shown, after obtaining the summary results of each leaf node, shows that for text 1, segment 1, segment 2, and segment 3 correspond to the same parent node, i.e., text 1. Therefore, the second largest language model can be used to infer the summary results of segment 1, segment 2, and segment 3 to obtain the summary result of text 1. For image 1, the OCR result and semantic analysis result correspond to the same parent node, i.e., image 1. Therefore, the second largest language model can be used to infer the summary results of OCR and semantic analysis to obtain the summary result of image 1.
[0117] In the next summary iteration, the second language model is invoked to infer the summary results of text 1, image 1, text 2, and table 1 to obtain the summary result of subheading 1. This process is repeated layer by layer until the summary result of the root node is obtained.
[0118] If multiple document trees corresponding to different time information are obtained in step 203, then in this step, each document tree is iteratively summarized layer by layer to obtain the summary result of each root node.
[0119] The following describes step 207, namely "using the summary results of the root node to obtain the summary results of the document", in detail with reference to the embodiments.
[0120] If a document corresponds to only one document tree, the summary result of the root node can be used as the summary result of the document. Alternatively, the summary result of the root node can be post-processed by rules-based filtering, format conversion, etc., to obtain the summary result of the document.
[0121] If a document corresponds to multiple document trees, the summary results of the root nodes in these multiple document trees can be used to obtain the document's summary result. For example, the summary results of the root nodes in multiple document trees can be merged to obtain the document's summary result. Alternatively, the second largest language model can be invoked to perform further reasoning based on the summary results of the root nodes in multiple document trees to obtain the document's summary result.
[0122] The summary results of the obtained document can be sent to the user terminal, which will then display the summary results on the service page. The display format can be, for example, showing it in a specific area of the service page, or displaying it in a dialog box within the service page.
[0123] The method provided in this application embodiment can be applied to various application scenarios, including but not limited to processing documents in target management systems, project management systems, service planning systems, etc. The following description uses an OKR document in a target management system as an example to illustrate the method; the corresponding method flow is as follows: Figure 5 As shown, the steps include:
[0124] Step 501: Obtain the OKR documents from the target management system.
[0125] The document processing device provided in this application embodiment can interface with the target management system, or be a device in the target management system.
[0126] One possible approach is to embed a "document summary" function into the service page provided by the target management system. Figure 6 This is a schematic diagram of a service page provided by a target management system. When a user selects an OKR document through a component on the service page (such as the "Select OKR" component), relevant information about the OKR document, such as the objectives and titles of each Key Results (KRs), can be displayed in the first area of the service page. Users can edit the OKR document using components in the first and second areas, such as entering new content, modifying the content of the OKR document, deleting content from the OKR document, etc. The OKR document can include various forms of text content, including plain text and rich text such as tables, lists, and images. Users can further trigger the document processing method provided in this application embodiment by triggering a component in the third area. After obtaining the OKR document selected by the user from the target management system, the method begins to summarize the selected OKR document.
[0127] Step 503: Parse the OKR document, and construct the document tree corresponding to the OKR document based on the parsing results and the structure of the OKR document. The root node of the document tree is the target, the leaf nodes are the segmented results of the plain text included in the OKR document or the plain text extracted from the rich text included in the OKR document, and the nodes at each level are the headings at each level.
[0128] Step 505: Starting from the leaf nodes of the document tree, call the second largest language model to iteratively summarize layer by layer until the summary result of the root node is obtained; among them, the summary result of the leaf node is obtained by the second largest language model using the text content of the leaf node, and the summary result of the non-leaf node is obtained by the second largest language model using the summary result of the child node of the non-leaf node.
[0129] Step 507: Use the summary results of the root node to obtain the summary results of the document. The summary results include the summary of the results corresponding to the objectives.
[0130] The specific processing results of each step described above can be found in the relevant descriptions in the previous method embodiments, and will not be repeated here. Since the root node of an OKR document is the target, the summary result of the document is actually a summary of the results corresponding to the target.
[0131] like Figure 7 As shown, the summary results of the document can be displayed in the third area of the service interface.
[0132] To verify the effectiveness of the method provided in this application embodiment, on the same dataset, the method provided in this application embodiment was used to summarize each OKR document in the dataset, and the large language model was directly used to summarize each OKR document in the dataset. The evaluation results of multiple indicators, such as content completeness (including coverage of important content), content repetition, expression rationality (i.e., content conforms to common sense and expression is concise and refined), language fluency, and the structural fit between the summary results and the expected results, are shown in Table 1 below:
[0133] Table 1
[0134]
[0135] It can be seen that, compared with the method of summarizing directly using a large language model, the method provided by the embodiments of this application has significantly improved the evaluation results of various indicators.
[0136] The foregoing has described specific embodiments of this specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in a different order than that shown in the embodiments and may still achieve the desired result. Furthermore, the processes depicted in the drawings do not necessarily require the specific or sequential order shown to achieve the desired result. In some embodiments, multitasking and parallel processing are possible or may be advantageous.
[0137] Figure 8 This is a schematic block diagram of a document processing apparatus provided in an embodiment of this application. Figure 8 As shown, the device 800 may include: a document acquisition unit 801, a document parsing unit 802, an iterative summarization unit 803, and a result determination unit 804. The main functions of each component are as follows:
[0138] The document acquisition unit 801 is configured to acquire documents to be processed.
[0139] The document parsing unit 802 is configured to parse the document and construct the document tree corresponding to the document based on the parsing results and the document structure.
[0140] The iterative summarization unit 803 is configured to start from the leaf node of the document tree, call the second language model to perform iterative summarization layer by layer until the summarization result of the root node is obtained; wherein, the summarization result of the leaf node is obtained by the second language model using the text content of the leaf node, and the summarization result of the non-leaf node is obtained by the second language model using the summarization result of the child node of the non-leaf node.
[0141] Result determination unit 804 is configured to use the summary result of the root node to obtain the summary result of the document.
[0142] As one possible approach, when parsing a document, the document parsing unit 802 can parse the document's text content, which includes plain text and rich text; identify the type of rich text, and call the first language model corresponding to the type of rich text to extract the content of the rich text, thereby obtaining the plain text corresponding to the rich text.
[0143] The leaf nodes of the document tree can include: the plain text corresponding to rich text or the segmented results of the plain text contained in the document; non-leaf nodes include headings at all levels. The plain text corresponding to different types of rich text serves as different leaf nodes, and each leaf node is labeled with its corresponding rich text type.
[0144] As one possible implementation method, the iterative summarization unit 803 can be specifically configured as follows: calling the second largest language model to perform inference based on each leaf node to obtain the summary result of each leaf node; taking each leaf node as the current layer node; calling the second largest language model to perform inference based on the summary result of the current layer node corresponding to the same upper layer node to obtain the summary result of the upper layer node; taking the upper layer node as the current layer node, and proceeding to the step of calling the second largest language model to perform inference based on the summary result of the current layer node corresponding to the same upper layer node, until the summary result of the root node is obtained.
[0145] As one possible approach, when the iterative summarization unit 803 calls the second language model to perform inference based on each leaf node and obtains the summary results of each leaf node, it can construct a prompt instruction using the text content of the leaf node, the path information from the leaf node to the root node, and the rule information of this summary. If the leaf node corresponds to rich text, the prompt instruction also includes the type information of the rich text. The prompt instruction is then used to call the second language model to obtain the summary result of the leaf node obtained by the second language model based on the prompt instruction.
[0146] As one possible approach, when the iterative summarization unit 803 calls the second language model to infer the summary results of the current layer nodes corresponding to the same upper layer node and obtains the summary results of the upper layer nodes, it can construct a prompt instruction using the summary results of all current layer nodes corresponding to the same upper layer node and the rule information of this summary; and use the prompt instruction to call the second language model to obtain the summary results of the upper layer nodes obtained by the second language model based on the prompt instruction.
[0147] As one possible approach, a document can contain text content corresponding to different time information; correspondingly, the document corresponds to multiple document trees, each corresponding to different time information, and all nodes within the same document tree correspond to the same time information. In this case, the result determination unit 804 can be specifically configured to obtain a summary result of the document by utilizing the summary results of the root nodes contained in the multiple document trees corresponding to the document.
[0148] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the device embodiments are basically similar to the method embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions in the method embodiments. The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without creative effort.
[0149] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, use and processing of the relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and corresponding operation portals are provided for users to choose to authorize or refuse.
[0150] In addition, embodiments of this application also provide a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the steps of the method described in any of the foregoing method embodiments.
[0151] And an electronic device, comprising:
[0152] One or more processors; and
[0153] A memory associated with the one or more processors, the memory being used to store program instructions that, when read and executed by the one or more processors, perform the steps of the method described in any of the foregoing method embodiments.
[0154] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the method described in any of the foregoing method embodiments.
[0155] in, Figure 9An exemplary architecture of an electronic device is shown, which may include a processor 910, a video display adapter 911, a disk drive 912, an input / output interface 913, a network interface 914, and a memory 920. The processor 910, video display adapter 911, disk drive 912, input / output interface 913, network interface 914, and memory 920 can communicate with each other via a communication bus 930.
[0156] The processor 910 can be implemented using a general-purpose CPU, microprocessor, application-specific integrated circuit (ASIC), or one or more integrated circuits to execute relevant programs and implement the technical solution provided in this application.
[0157] The memory 920 can be implemented in the form of ROM (Read Only Memory), RAM (Random Access Memory), static storage device, dynamic storage device, etc. The memory 920 can store the operating system 921 for controlling the operation of the electronic device 900, and the basic input / output system (BIOS) 922 for controlling the low-level operations of the electronic device 900. Additionally, it can store a web browser 923, a data storage management system 924, and a document processing device 925, etc. The aforementioned document processing device 925 can be the application program that specifically implements the aforementioned steps in this embodiment. In summary, when the technical solution provided in this application is implemented through software or firmware, the relevant program code is stored in the memory 920 and is called and executed by the processor 910.
[0158] Input / output interface 913 is used to connect input / output modules to realize information input and output. Input / output modules can be configured as components in the device (not shown in the figure) or externally connected to the device to provide corresponding functions. Input devices may include keyboards, mice, touch screens, microphones, various sensors, etc., and output devices may include displays, speakers, vibrators, indicator lights, etc.
[0159] Network interface 914 is used to connect a communication module (not shown in the figure) to enable communication between this device and other devices. The communication module can communicate via wired means (such as USB, Ethernet cable, etc.) or wireless means (such as mobile network, WIFI, Bluetooth, etc.).
[0160] Bus 930 includes a pathway for transmitting information between various components of the device, such as processor 910, video display adapter 911, disk drive 912, input / output interface 913, network interface 914, and memory 920.
[0161] It should be noted that although the above-described device only shows the processor 910, video display adapter 911, disk drive 912, input / output interface 913, network interface 914, memory 920, bus 930, etc., in specific implementations, the device may also include other components necessary for normal operation. Furthermore, those skilled in the art will understand that the above-described device may only include the components necessary for implementing the solution of this application, and does not necessarily include all the components shown in the figures.
[0162] As can be seen from the above description of the embodiments, those skilled in the art can clearly understand that this application can be implemented by means of software plus necessary general-purpose hardware platforms. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a computer program product. This computer program product can be stored in a storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in various embodiments or some parts of the embodiments of this application.
[0163] The technical solutions provided in this application have been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the methods and core ideas of this application. Furthermore, those skilled in the art will recognize that, based on the ideas of this application, there will be changes in the specific implementation methods and application scope. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. A document processing method, characterized in that, The method includes: Obtain the document to be processed, which includes rich text; The document is parsed, and a document tree corresponding to the document is constructed based on the parsing results and the document's structure. Parsing the document includes: identifying the type of the rich text; calling the first major language model corresponding to the rich text type to extract content from the rich text, obtaining the plain text corresponding to the rich text; the root node of the document tree is the document title; the leaf nodes of the document tree include: the plain text corresponding to the rich text or the segmented results of the plain text contained in the document; non-leaf nodes include headings at various levels; each node forms a hierarchical relationship according to the document's structure; the plain text corresponding to different types of rich text serves as different leaf nodes, and each leaf node is labeled with its corresponding rich text type. Starting from the leaf node of the document tree, the second language model is called to iterate and summarize layer by layer until the summary result of the root node is obtained. The summary result of the leaf node is obtained by the second language model using the text content of the leaf node, and the summary result of the non-leaf node is obtained by the second language model using the summary result of the child node of the non-leaf node. The summary result of the document is obtained by using the summary result of the root node.
2. The method according to claim 1, characterized in that, Parsing the document includes: The document's text content is parsed, including both plain text and rich text.
3. The method according to claim 1, characterized in that, Starting from the leaf nodes of the document tree, the second largest language model is invoked to iteratively summarize layer by layer until the summary result of the root node is obtained, including: The second largest language model is invoked to perform inference based on each leaf node, and the summary results of each leaf node are obtained. Each leaf node is used as the current layer node; The second largest language model is invoked to perform inference based on the summary results of the current layer node corresponding to the same upper layer node, so as to obtain the summary results of the upper layer node; The upper-level node is taken as the current-level node, and the process proceeds to the step of calling the second language model to perform inference based on the summary result of the current-level node corresponding to the same upper-level node, until the summary result of the root node is obtained.
4. The method according to claim 3, characterized in that, The invocation of the second largest language model to perform inference based on each leaf node yields the following summary results for each leaf node: The prompt instruction is constructed using the text content of the leaf node, the path information from the leaf node to the root node, and the rule information summarized in this paper. If the leaf node corresponds to rich text, the prompt instruction also includes the type information of the rich text. The second language model is invoked using the prompt instruction, and the summary result of the leaf node obtained by the second language model based on the prompt instruction is obtained.
5. The method according to claim 3, characterized in that, The inference process, which calls the second largest language model based on the summary results of the current layer node corresponding to the same upper-level node, yields the following summary results for the upper-level node: Construct prompt instructions using the summary results of all current-level nodes corresponding to the same upper-level node and the rule information of this summary; The second language model is invoked using the prompt instruction to obtain the summary result of the upper-level node obtained by the second language model based on the prompt instruction.
6. The method according to any one of claims 1 to 5, characterized in that, The document contains text content corresponding to different time information; The document corresponds to multiple document trees, and the multiple document trees correspond to different time information. The nodes contained in the same document tree all correspond to the same time information. The summary result of the document is obtained by using the summary result of the root node. This includes obtaining the summary result of the document by using the summary results of the root nodes contained in the multiple document trees corresponding to the document.
7. A document processing method, characterized in that, The method includes: Obtain the documents from the target management system, including rich text; The document is parsed, and a document tree corresponding to the document is constructed based on the parsing results and the document's structure. Parsing the document includes: identifying the type of rich text; calling the first major language model corresponding to the rich text type to extract content from the rich text, obtaining the plain text corresponding to the rich text; the root node of the document tree is the target, the leaf nodes are the segmented results of the plain text included in the document or the plain text extracted from the rich text included in the document, and the intermediate nodes are various levels of headings; each node forms a hierarchical relationship according to the document's structure; the plain text corresponding to different types of rich text is used as different leaf nodes, and each leaf node is labeled with its corresponding rich text type; Starting from the leaf node of the document tree, the second language model is called to iterate and summarize layer by layer until the summary result of the root node is obtained. The summary result of the leaf node is obtained by the second language model using the text content of the leaf node, and the summary result of the non-leaf node is obtained by the second language model using the summary result of the child node of the non-leaf node. Using the summary results of the root node, the summary results of the document are obtained, and the summary results include the results summary corresponding to the target.
8. The method according to claim 7, characterized in that, The service page corresponding to the target management system contains components that trigger document processing and document information; The step of obtaining documents from the target management system includes: in response to an event triggered by the component, obtaining the document corresponding to the document information from the target management system; The method further includes displaying the summary results of the document on the service page.
9. A document processing method applied to a cloud server, the method comprising: In response to a document processing request sent by a user terminal, a document to be processed is obtained, wherein the document to be processed includes rich text. The document is parsed, and a document tree corresponding to the document is constructed based on the parsing results and the document's structure. Parsing the document includes: identifying the type of the rich text; calling the first major language model corresponding to the rich text type to extract content from the rich text, obtaining the plain text corresponding to the rich text; the root node of the document tree is the document title; the leaf nodes of the document tree include: the plain text corresponding to the rich text or the segmented results of the plain text contained in the document; non-leaf nodes include headings at various levels; each node forms a hierarchical relationship according to the document's structure; the plain text corresponding to different types of rich text serves as different leaf nodes, and each leaf node is labeled with its corresponding rich text type. Starting from the leaf node of the document tree, the second language model is called to iterate and summarize layer by layer until the summary result of the root node is obtained. The summary result of the leaf node is obtained by the second language model using the text content of the leaf node, and the summary result of the non-leaf node is obtained by the second language model using the summary result of the child node of the non-leaf node. Using the summary results of the root node, the summary results of the document are obtained; The summary results of the document are sent to the user terminal.
10. A document processing apparatus, characterized in that, The device includes: The document acquisition unit is configured to acquire a document to be processed, the document to be processed including rich text; The document parsing unit is configured to parse the document and construct a document tree corresponding to the document based on the parsing results and the document's structure. Parsing the document includes: identifying the type of the rich text; calling the first language model corresponding to the rich text type to extract content from the rich text, obtaining the plain text corresponding to the rich text; the root node of the document tree is the document title; the leaf nodes of the document tree include: the plain text corresponding to the rich text or the segmented results of the plain text contained in the document; non-leaf nodes include headings at various levels; each node forms a hierarchical relationship according to the document's structure; wherein the plain text corresponding to different types of rich text serves as different leaf nodes, and each leaf node is labeled with its corresponding rich text type. The iterative summarization unit is configured to start from the leaf node of the document tree, call the second language model to perform iterative summarization layer by layer until the summarization result of the root node is obtained; wherein, the summarization result of the leaf node is obtained by the second language model using the text content of the leaf node, and the summarization result of the non-leaf node is obtained by the second language model using the summarization result of the child node of the non-leaf node. The result determination unit is configured to obtain a summary result of the document using the summary result of the root node.
11. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the steps of the method according to any one of claims 1 to 9.
12. An electronic device, characterized in that, include: One or more processors; as well as A memory associated with the one or more processors, the memory being used to store program instructions that, when read and executed by the one or more processors, perform the steps of the method according to any one of claims 1 to 9.
13. A computer program product, comprising a computer program, characterized in that, When executed by a processor, the computer program implements the steps of the method according to any one of claims 1 to 9.
