Document processing method and device
By building a document tree and using the second largest language model to iterate overview, the problem of inefficient structured document summary is solved, and efficient document automatic summary is achieved, suitable for various forms of documents.
Patent Information
- Application Number
- CN202411137673.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-16
- Publication Date
- 2024-11-26
- Estimated Expiration
- 2044-08-16
AI Technical Summary
The prior art is difficult to efficiently process documents that organize information in a structured manner, resulting in inefficient document summary, especially long and diverse forms of documents that do not work well for large language model summary.
By building a document tree, using the second largest language model to iterate overview, from leaf nodes to root nodes, inference is carried out in combination with document structure and path information, and it is suitable for different types of rich text and time information to realize automatic document summary.
It improves the efficiency and effectiveness of document summary, makes full use of the characteristics of structured documents, enhances the understanding of document semantics and structural relationships of large language models, and is suitable for various forms of documents.
Smart Images

Figure CN119025613A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and in particular to a document processing method and device. Background Art
[0002] More and more corporate and individual users adopt a structured approach to organize information to form documents, such as OKR (Objectives and Key Results) documents, project management documents, service planning documents, etc. These documents are usually maintained by users for a long time and have complex contents. It is difficult to understand the main contents of the documents, and they need to be sorted and summarized one by one, which is inefficient. Summary of the invention
[0003] In view of this, the present application provides a document processing method and device for automatically summarizing documents that organize information in a structured manner and improve efficiency.
[0004] This application provides the following solutions:
[0005] In a first aspect, a document processing method is provided, the method comprising:
[0006] Get the documents to be processed;
[0007] Parsing the document, and constructing a document tree corresponding to the document according to the parsing result and the structure of the document;
[0008] Starting from the leaf node of the document tree, calling the second largest language model to perform iterative summarization layer by layer until the summary result of the root node is obtained; wherein the summary result of the leaf node is inferred by the second largest language model using the text content of the leaf node, and the summary result of the non-leaf node is inferred by the second largest 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 an achievable method in an embodiment of the present application, parsing the document includes:
[0011] Parsing text content of the document, wherein the text content includes plain text and rich text;
[0012] The type of the rich text is identified, and a first language model corresponding to the type of the rich text is called to extract content from the rich text to obtain a plain text corresponding to the rich text.
[0013] According to an achievable method in an embodiment of the present application, the leaf nodes of the document tree include: the plain text corresponding to the rich text or the segmented result of the plain text contained in the document; the non-leaf nodes include titles at all levels;
[0014] The plain texts corresponding to different types of rich texts are respectively used as different leaf nodes, and each leaf node is marked with the corresponding rich text type.
[0015] According to an achievable method in an embodiment of the present application, starting from the leaf node of the document tree, calling the second largest language model to perform iterative summarization layer by layer until the summary result of the root node is obtained includes:
[0016] The second largest language model is called to perform reasoning based on each leaf node to obtain the summary results of each leaf node;
[0017] Take each leaf node as the current layer node;
[0018] Calling the second largest language model to perform reasoning 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;
[0019] The upper layer node is used as the current layer node, and the step of calling the second largest language model to perform reasoning based on the summary result of the current layer node corresponding to the same upper layer node is executed until the summary result of the root node is obtained.
[0020] According to an achievable method in an embodiment of the present application, the calling of the second largest language model performs reasoning based on each leaf node respectively, and the summary results of each leaf node include:
[0021] Constructing 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 summarized this time, wherein if the leaf node corresponds to a rich text, the prompt instruction also includes the type information of the rich text;
[0022] The second largest language model is called by using the prompt instruction, and a summary result of the leaf node obtained by the second largest language model performing reasoning according to the prompt instruction is obtained.
[0023] According to an achievable method in an embodiment of the present application, the calling of the second largest language model is based on the summary result of the current layer node corresponding to the same upper layer node to perform reasoning, and the summary result of the upper layer node is obtained, including:
[0024] Constructing prompt instructions using summary results of all current-layer nodes corresponding to the same upper-layer node and rule information of this summary;
[0025] The second largest language model is called by using the prompt instruction to obtain a summary result of the upper-level node obtained by the second largest language model through reasoning according to the prompt instruction.
[0026] According to an achievable method in an embodiment of the present application, the document includes text content corresponding to different time information;
[0027] The document corresponds to a plurality of document trees, the plurality of document trees correspond to different time information, and the nodes contained in the same document tree all correspond to the same time information;
[0028] Using the summary result of the root node to obtain the summary result of the document includes: using the summary results of the root nodes included in multiple document trees corresponding to the document to obtain the summary result of the document.
[0029] In a second aspect, a document processing method is provided, the method comprising:
[0030] Obtain documentation for the target management system;
[0031] Parse the document, and construct a document tree corresponding to the document according to the parsing result and the structure of the document, wherein the root node of the document tree is the target, the leaf nodes are the segmentation 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 the titles of each level;
[0032] Starting from the leaf node of the document tree, calling the second largest language model to perform iterative summarization layer by layer until the summary result of the root node is obtained; wherein the summary result of the leaf node is inferred by the second largest language model using the text content of the leaf node, and the summary result of the non-leaf node is inferred by the second largest language model using the summary result of the child node of the non-leaf node;
[0033] The summary result of the root node is used to obtain the summary result of the document, wherein the summary result includes a summary of achievements corresponding to the target.
[0034] According to an achievable method in the embodiment of the present application, the service page corresponding to the target management system includes a component that triggers document processing and document information;
[0035] The acquiring of the document of the target management system comprises: in response to the event that the component is triggered, acquiring the document corresponding to the document information from the target management system;
[0036] The method further includes: displaying the summary result of the document on the service page.
[0037] In a third aspect, a document processing method is provided, which is applied to a cloud server, and the method includes:
[0038] Responding to a document processing request sent by a user terminal, obtaining a document to be processed;
[0039] Parsing the document, and constructing a document tree corresponding to the document according to the parsing result and the structure of the document;
[0040] Starting from the leaf node of the document tree, calling the second largest language model to perform iterative summarization layer by layer until the summary result of the root node is obtained; wherein the summary result of the leaf node is inferred by the second largest language model using the text content of the leaf node, and the summary result of the non-leaf node is inferred by the second largest language model using the summary result of the child node of the non-leaf node;
[0041] Using the summary result of the root node, obtaining the summary result of the document;
[0042] The summary result of the document is sent to the user terminal.
[0043] In a fourth aspect, a document processing device is provided, the device comprising:
[0044] A document acquisition unit, configured to acquire a document to be processed;
[0045] A document parsing unit, configured to parse the document and construct a document tree corresponding to the document according to the parsing result and the structure of the document;
[0046] The iterative summarization unit is configured to start from the leaf node of the document tree and call the second largest language model to perform iterative summarization layer by layer until the summary result of the root node is obtained; wherein the summary result of the leaf node is inferred by the second largest language model using the text content of the leaf node, and the summary result of the non-leaf node is inferred by the second largest language model using the summary result of the child node of the non-leaf node;
[0047] The result determination unit is configured to obtain the summary result of the document by 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, and when the program is executed by a processor, the steps of the method described in any one of the first to third aspects are implemented.
[0049] According to a sixth aspect, there is provided an electronic device, 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, wherein the program instructions, when read and executed by the one or more processors, execute the steps of the method described in any one of the first to third aspects above.
[0052] According to a seventh aspect, a computer program product is provided, comprising a computer program, wherein a processor executes 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, this application discloses the following technical effects:
[0054] 1) This application uses the parsing results of the document and the structure of the document to construct a document tree, calls the second largest language model to iteratively summarize the document tree layer by layer, and makes full use of the language understanding ability of the second largest language model to first infer the text content of the leaf node to obtain the summary result of the leaf node, and then iteratively summarize layer by layer based on the summary result of the leaf node, and finally uses the summary result of the root node to obtain the summary result of the document. This method realizes automatic document summarization and improves efficiency for documents that use a structured method to organize information. It also makes full use of the characteristics of documents that use a structured method to organize information, and decomposes the summary task into multi-level tasks based on the structure of the document. Compared with the method of summarizing by inputting the document into a large language model at one time, the large language model can better understand the semantic content of each part of the document and the structural relationship between the parts, so the summary effect is better.
[0055] 2) For rich text in a document, this application calls the first language model corresponding to the type of rich text to extract content from the rich text and converts the rich text into plain text, thereby retaining the core content of the rich text, so that the document summary can be 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, the titles at each level are respectively used as non-leaf nodes, and the plain texts corresponding to different types of rich texts are respectively used as different leaf nodes, so that when the second largest language model is called for iterative reasoning, each leaf node can be summarized more accurately, thereby accurately obtaining the summary result of the document.
[0057] 4) In the process of calling the second largest language model for iterative summarization in this application, reasoning starts from the leaf node, and the summary results of the nodes corresponding to the same upper-level nodes are inferred to obtain the summary results of the upper-level nodes, and the summary results are summarized layer by layer until the root node. This method follows the structure of the document and is very consistent with the document characteristics of organizing information in a structured form, so that the summary results of the document can achieve better results.
[0058] 5) In this application, when calling the second largest language model to summarize the leaf node, the path information from the leaf node to the root node is used in the prompt instruction, so that the second largest language model fully considers the structural position of the leaf node in the document when summarizing, so that the summary of the leaf node is more accurate. If the leaf node corresponds to rich text, the prompt instruction further includes the type information of the rich text, so that the second largest language model can fully understand the characteristics of the 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, and the multiple document trees correspond to different time information. After obtaining the summary results of each root node for each document tree, the summary results of the document are obtained comprehensively. This method can fully consider the influence of time information for documents with significant time progression characteristics, thereby obtaining a higher quality summary result.
[0060] Of course, any product implementing the present application does not necessarily need to achieve all of the advantages described above at the same time. BRIEF DESCRIPTION OF THE DRAWINGS
[0061] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0062] Figure 1 is a system architecture diagram applicable to the embodiments of the present application;
[0063] Figure 2 A flowchart of a document processing method provided in an embodiment of the present application;
[0064] Figure 3 A schematic diagram of a document tree provided for an embodiment of the present application;
[0065] Figure 4 A flowchart of an iterative summary provided for an embodiment of the present application;
[0066] Figure 5 A flow chart of a method for processing an OKR document in a target management system provided in an embodiment of the present application;
[0067] Figure 6 A schematic diagram of a service page provided in an embodiment of the present application;
[0068] Figure 7 A schematic diagram of displaying summary results on a service page provided in an embodiment of the present application;
[0069] Figure 8 A schematic block diagram of a document processing device provided in an embodiment of the present application;
[0070] Fig. 9 A schematic block diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0071] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments in the present application belong to the scope of protection of this application.
[0072] The terms used in the embodiments of the present invention are only for the purpose of describing specific embodiments, and are not intended to limit the present invention. The singular forms "a", "said" and "the" used in the embodiments of the present invention and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings.
[0073] It should be understood that the term "and / or" used in this article is only a description of the association relationship of 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.
[0074] The word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrases "if it is determined" or "if (stated condition or event) is detected" may be interpreted as "when it is determined" or "in response to determining" or "when detecting (stated condition or event)" or "in response to detecting (stated condition or event)", depending on the context.
[0075] With the introduction and continuous development of large language model technology, there are currently some technologies that directly input documents that organize information in a structured manner into large language models for summarization. However, since such documents are usually long in length and diverse in form, the large language model is not very effective in directly summarizing such documents.
[0076] In view of this, the present application provides a new idea. In order to facilitate the understanding of the present application, the system architecture on which the present application is based is first described. Figure 1 An exemplary system architecture to which the embodiments of the present application can be applied is shown. Figure 1 As shown in , the system architecture may include: a user terminal and a document processing device and a large language model located at the server end.
[0077] The user sends a document processing request to a document processing device located on the server side through a user terminal. The document processing device responds to the document processing request, obtains the document to be processed, and processes the document in the manner provided in the embodiment of the present application to obtain a summary result of the document, and returns the summary result to the user terminal, and / or stores the summary result in association with the document.
[0078] The user terminal may input the document information to be processed by using an application program interface, a web page, a message session window, or the like.
[0079] As one of the achievable ways, the document processing device can obtain the document to be processed from a specific document system according to the document processing request. For example, the document to be processed can be obtained from a target management system, a project management system, a service planning system, etc. The document to be processed can also be obtained locally from a user terminal.
[0080] In the embodiment of the present application, the document processing device involves the call of a large language model during the process of document processing. A large language model, namely LLM (Large Language Model), refers to a deep learning model trained with a large amount of text data, which can generate natural language text or understand the meaning of language text. It is characterized by large scale and huge number of parameters (usually reaching more than 10 billion levels), and is usually based on a deep learning architecture such as a Transformer architecture. The difference between LLM and an ordinary pre-trained language model lies in the parameter scale. When the parameter scale exceeds a certain level, the model achieves significant performance improvement and exhibits capabilities that do not exist in small models, such as in-context learning capabilities, which can learn complex patterns in language and perform a wide range of tasks, including text summarization, translation, sentiment analysis, multi-round dialogue, etc. Therefore, in order to distinguish it from a traditional pre-trained language model, this type of model with a parameter scale exceeding a certain level is called LLM. In general, a language model with a parameter scale of more than 10 billion based on a deep learning architecture can be considered a large language model. 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 document processing device and the large language model can be respectively set on an independent server, or on a server group consisting of multiple servers, or on a cloud server. A cloud server, also known as a cloud computing server or cloud host, is a host product in a cloud computing service system to solve the defects of difficult management and weak service scalability in traditional physical hosts and virtual private servers (VPS) services. It can also be set on a computer terminal with strong computing power.
[0082] The user terminals mentioned above may include, but are not limited to, smart mobile terminals, smart home devices, wearable devices, PCs (Personal Computers), etc. Smart mobile devices may include, for example, mobile phones, tablet computers, laptop computers, PDAs (Personal Digital Assistants), Internet cars, etc. Smart home devices may include smart home appliances, such as smart TVs, smart refrigerators, and other home appliances that can run document processing devices. Wearable devices may include, for example, smart watches, smart glasses, smart bracelets, VR (Virtual Reality) devices, AR (Augmented Reality), mixed reality devices (i.e., devices that can support both virtual reality and augmented reality), and the like.
[0083] It should be understood that Figure 1 The number of user terminals, document processing devices, and large language models in the embodiment is only illustrative. Any number of user terminals, document processing devices, and large language models may be provided according to implementation requirements.
[0084] Figure 2 A flowchart of a document processing method provided in an embodiment of the present application, which method can be Figure 1 The document processing device in the system shown in the figure executes. Figure 2 As shown in , the method may include the following steps:
[0085] Step 201: Obtain the document to be processed.
[0086] Step 203: Parse the document and construct a document tree corresponding to the document based on the parsing result and the structure of the document.
[0087] Step 205: Starting from the leaf node of the document tree, call the second largest language model to perform iterative summarization layer by layer until the summary result of the root node is obtained; wherein, the summary result of the leaf node is inferred by the second largest language model using the text content of the leaf node, and the summary result of the non-leaf node is inferred by the second largest language model using the summary result of the child node of the non-leaf node.
[0088] Step 207: Using the summary result of the root node, obtain the summary result of the document.
[0089] It can be seen from the above process that this application uses the parsing results of the document and the structure of the document to construct a document tree, calls the second largest language model to iteratively summarize the document tree layer by layer, and makes full use of the language understanding ability of the second largest language model to first infer the text content of the leaf node to obtain the summary result of the leaf node, and then iterates and summarizes layer by layer based on the summary result of the leaf node, and finally uses the summary result of the root node to obtain the summary result of the document. This method makes full use of the document characteristics of organizing information in a structured way, and decomposes the summary task into multi-level tasks based on the structure of the document. Compared with the method of summarizing by inputting the document into a large language model at one time, the large language model can better understand the semantic content of each part of the document and the structural relationship between the parts, so the summary effect is better.
[0090] The following is a detailed description of each step in the above process and the effects that can be further produced in conjunction with the embodiments. It should be noted that the "first" and "second" limitations involved in the present disclosure do not have limitations in terms of size, order, and quantity, and are only used to distinguish them in name. For example, "the first large language model" and "the second large language model" are used to distinguish two large language models in name.
[0091] First, the above step 201, namely "obtaining the document to be processed", is described in detail in conjunction with the embodiment.
[0092] As one of the possible implementation methods, the document processing service may provide a service page for the user, and the user terminal may display the service page to the user. The user may provide the document information to be processed to the document processing device on the server side through a specific component or dialog box on the service page. The document processing device on the server side may obtain the document to be processed from the server or database where the corresponding file system is located based on the document information. The document information to be processed may be a document identifier, a document name, an address where the document is stored, and the like.
[0093] As another achievable method, the document processing service may provide a service page for the user, and the user terminal may display the service page to the user. The user may directly upload the document to be processed to the document processing device on the server side through the service page. The document to be processed may be a document stored locally on the user terminal, a document downloaded from other servers by the user terminal, a document obtained from other user terminals by the user terminal, and so on.
[0094] The embodiments of the present application can be applied to any type of document, especially to documents that organize information in a structured manner. Such documents are usually long, have a clear document structure, and may be accompanied by content in various forms. For example, the OKR file involved in the project management system is usually centered on objectives and records key results information in a time-based manner. In addition to plain text, it is also accompanied by various types of rich text forms, such as tables, ordered lists, unordered lists, pictures, etc.
[0095] The above step 203, namely "parsing the document and constructing a document tree corresponding to the document according to the parsing result and the structure of the document" is described in detail below in conjunction with an embodiment.
[0096] If the document to be processed only includes plain text, a document parser can be called to parse the document, and the document parser can build a corresponding document tree according to the structure of the document. The document parser can be flexibly selected according to the document format. For example, for documents in XML (Extensible Markup Language) or HTML (HyperTextMarkup Language) format, parsers such as DOM (Document Object Model) or SAX (Simple API for XML) can be used; for documents in Word format, parsers such as Apache POI can be used.
[0097] If the document to be processed includes plain text and rich text, or only contains rich text, the type of rich text can be identified, and the first language model corresponding to the type of rich text is first called to extract the content of the rich text to obtain the plain text corresponding to the rich text; then the document parser is called, and the document parser constructs the corresponding document tree according to the structure of the document. This process is actually the process of converting the rich text in the document into plain text.
[0098] For example, for one of the rich texts, the type of the rich text is first determined, and then a prompt instruction is constructed according to the type of the rich text. The prompt instruction may include the rich text, the type information of the rich text, and the rule information indicating the content extraction of the rich text. After the first language model receives the prompt instruction, it extracts the content of the rich text according to the prompt instruction to obtain the plain text corresponding to the rich text. For the rich text of the picture type, two aspects of content may be included. On the one hand, the text content is recognized by OCR (Optical Character Recognition), and on the other hand, the text content is extracted after semantic analysis using the first language model. For plain text, since the document usually contains titles at all levels, the root node of the generated document tree can be the document title or target, the intermediate node is the title at all levels, and the leaf node is the plain text extracted from the segment or the rich text. Each node forms a hierarchical relationship according to the structure of the document, thereby forming a document tree.
[0099] Figure 3 An example of a document tree is shown. In some cases, the text under the lowest level title can be directly used as a leaf node, such as Text 2. However, in some cases, the text under the lowest level title may be longer. Due to the limitation of the text processing length of the first language model or considering the reasoning effect of the first language model, the text can be segmented into segments, and each segment can be used as a leaf node. For example, the text 1 in the figure is divided into segment 1, segment 2 and segment 3, which are respectively used as 3 leaf nodes. For pictures, such as Picture 1, its corresponding OCR results and semantic analysis results can be used as leaf nodes respectively. For the Text 1, Picture 1, and Table 1 nodes in the document tree, since they are not leaf nodes, these nodes can be identification information, and all leaf nodes contain actual document content.
[0100] Furthermore, since the content in some documents can reflect a clear time progression, for example, for the OKR document, corresponding to the same goal, each key result information has a clear time progression, and this time progression is an important factor for the OKR document. Then for such documents, document trees can be constructed separately for different time information, and the nodes contained in the same document tree all correspond to the same time information. For example, the content of the same week in the document is constructed into the same document tree, and different document trees represent the content of different weeks. For another example, the content of the same month in the document is constructed into the same document tree, and different document trees represent the content of different months. The specific division of time information can be flexibly set according to actual scenarios and needs.
[0101] The above step 205, i.e., "starting from the leaf nodes of the document tree, calling the second largest language model to perform iterative summarization layer by layer until the summary result of the root node is obtained" is described in detail below in conjunction with the embodiments.
[0102] In this step, the summary result of the node is inferred by the second largest language model using the text content of the leaf node, and the summary result of the non-leaf node is inferred by the second largest language model using the summary results of the child nodes of the non-leaf node.
[0103] Figure 4 A flowchart of an iterative summary provided in an embodiment of the present application, such as Figure 4 As shown in , the following steps may be included:
[0104] Step 401: Call the second largest language model to perform reasoning based on each leaf node to obtain a summary result of each leaf node.
[0105] In this step, the second largest language model can be called for each leaf node to obtain the summary result of the leaf node. When calling the second largest language model, the text content of the leaf node and the rule information of this summary can be used to construct a prompt instruction, and the prompt instruction is used to call the second largest language model to obtain the summary result of the leaf node obtained by the second largest language model based on the prompt instruction.
[0106] In addition to the semantics contained in the text content of the leaf node itself, the path information from the leaf node to the root node can also help the large language model understand the leaf node to a great extent. Therefore, as one of the more preferred methods, when constructing prompt instructions, in addition to using the text content of the leaf node and the rule information summarized this time, 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 a plain text extracted from the rich text, the prompt instruction can also include type information of the rich text, thereby helping the second largest 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 instruction may further include output format, sample instances, etc.
[0109] Step 403: Take each leaf node as the current layer node.
[0110] Step 405: Call the second largest language model to perform reasoning 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.
[0111] In this step, the summary results of all current-layer nodes corresponding to the same upper-layer node and the rule information of this summary can be used to construct a prompt instruction, and the second largest language model can be called using the prompt instruction to obtain the summary results of the upper-layer node obtained by the second largest language model through reasoning based on the prompt instruction.
[0112] In addition, the prompt instruction may further include output format, sample instances, etc.
[0113] Step 407: Determine whether the summary result of the root node is obtained. If yes, end the process; if not, execute step 405.
[0114] Step 409: Use the upper-layer node as the current-layer node and go to step 405.
[0115] Summarize upwards layer by layer until the summary result of the root node is obtained.
[0116] like Figure 3 In the document tree shown in , after obtaining the summary results of each leaf node, for text 1, segment 1, segment 2, and segment 3 correspond to the same upper node, i.e., text 1. Therefore, the second largest language model can be called to perform reasoning based on 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 the semantic analysis result correspond to the same upper node, i.e., image 1. Therefore, the second largest language model can be called to perform reasoning based on the summary results of the OCR result and the semantic analysis result to obtain the summary result of image 1.
[0117] In the next summary iteration, the second largest language model is called to perform reasoning based on the summary results of text 1, image 1, text 2, and table 1 to obtain the summary result of level 2 title 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 a summary result of each root node.
[0119] The above step 207, ie, "obtaining a summary result of the document using the summary result of the root node", is described in detail below in conjunction with an embodiment.
[0120] If the document corresponds to only one document tree, the summary result of the root node can be used as the summary result of the document, or the summary result of the root node can be post-processed by rule-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 the multiple document trees can be used to obtain the summary results of the document. For example, the summary results of the root nodes in multiple document trees can be merged to obtain the summary results of the document. For another example, the second largest language model can be called to perform further reasoning based on the summary results of the root nodes in multiple document trees to obtain the summary results of the document.
[0122] The summary result of the obtained document can be sent to the user terminal, and the user terminal displays the summary result of the document on the service page. The display form can be, for example, displayed in a specific area of the service page, or displayed in a dialog box of the service page.
[0123] The above method provided in the embodiment of the present application can be applied to a variety of application scenarios, including but not limited to processing documents of a target management system, documents of a project management system, documents of a service planning system, etc. The following is an example of describing the above method using the OKR document in the target management system as an example. The corresponding method flow can be as follows: Figure 5 As shown in , the following steps are included:
[0124] Step 501: Obtain the OKR document of the goal management system.
[0125] The document processing device provided in the embodiment of the present application can be connected to the target management system, or serve as a device in the target management system.
[0126] As one of the feasible ways, a "document summary" function may be embedded in the service page provided by the target management system. Figure 6 A schematic diagram of a service page provided for a target management system. When a user selects an OKR document through a component on the service page (e.g., a "Select OKR" component), relevant information of the OKR document, such as the target, the title of each key result (KR), etc., can be displayed in the first area of the service page. The user can edit the OKR document through the components in the first area and the second area, such as entering new content, modifying the content of the OKR document, deleting the content in the OKR document, and so on. The OKR document may include text content in various forms, which may be plain text or rich text such as tables, lists, and pictures. The user can further trigger the execution of the document processing method provided in the embodiment of the present application by triggering the component in the third area, and after obtaining the OKR document selected by the user from the target management system, start summarizing the OKR document selected by the user.
[0127] Step 503: Parse the OKR document, and build a 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 intermediate nodes are titles of various levels.
[0128] Step 505: Starting from the leaf node of the document tree, call the second largest language model to perform iterative summarization layer by layer until the summary result of the root node is obtained; wherein the summary result of the leaf node is inferred by the second largest language model using the text content of the leaf node, and the summary result of the non-leaf node is inferred by the second largest language model using the summary result of the child node of the non-leaf node.
[0129] Step 507: Using the summary result of the root node, obtain the summary result of the document, where the summary result includes the achievement summary corresponding to the target.
[0130] The specific processing results in the above steps can be found in the relevant records in the previous method embodiments, which will not be repeated here. Since the root node of the OKR document is the goal, the summary result of the document obtained is actually the summary of the results corresponding to the goal.
[0131] like Figure 7 As shown in , the summary results of the document can be displayed in the third area on the service interface.
[0132] In order to verify the effect of the method provided in the embodiment of the present application, on the same data set, the method provided in the embodiment of the present application is used to summarize each OKR document in the data set, and the large language model is directly used to summarize each OKR document in the data set. The evaluation results of multiple indicators such as content completeness (including coverage of important content), content repetition, expression rationality (that is, the content conforms to common sense and the 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 the method provided by the embodiment of the present application has greatly improved the evaluation results of various indicators compared with the method of directly summarizing using a large language model.
[0136] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0137] Figure 8 A schematic block diagram of a document processing device provided in an embodiment of the present application. Figure 8 As shown, the device 800 may include: a document acquisition unit 801, a document parsing unit 802, an iteration summary unit 803 and a result determination unit 804. The main functions of each component unit are as follows:
[0138] The document acquisition unit 801 is configured to acquire a document to be processed.
[0139] The document parsing unit 802 is configured to parse the document and construct a document tree corresponding to the document according to the parsing result and the structure of the document.
[0140] The iterative summarizing unit 803 is configured to start from the leaf node of the document tree and call the second largest language model to perform iterative summarization layer by layer until the summary result of the root node is obtained; wherein the summary result of the leaf node is inferred by the second largest language model using the text content of the leaf node, and the summary result of the non-leaf node is inferred by the second largest language model using the summary result of the child node of the non-leaf node.
[0141] The result determination unit 804 is configured to obtain a summary result of the document using the summary result of the root node.
[0142] As one of the feasible ways, when parsing a document, the document parsing unit 802 can parse the text content of the document, which includes plain text and rich text; identify the type of the rich text, call the first language model corresponding to the type of the rich text to extract the content of the rich text, and obtain the plain text corresponding to the rich text.
[0143] The leaf nodes of the document tree may 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 titles at all levels. The plain text corresponding to different types of rich text are respectively used as different leaf nodes, and each leaf node is marked with the corresponding rich text type.
[0144] As one of the achievable methods, the iterative summary unit 803 can be specifically configured as follows: calling the second largest language model to perform reasoning based on each leaf node respectively to obtain a summary result of each leaf node; taking each leaf node as the current layer node; calling the second largest language model to perform reasoning based on the summary result of the current layer node corresponding to the same upper layer node to obtain a summary result of the upper layer node; taking the upper layer node as the current layer node, and proceeding to execute the step of calling the second largest language model to perform reasoning 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 of the feasible ways, when the iterative summary unit 803 calls the second largest language model to perform reasoning based on each leaf node and obtains the summary result 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, wherein if the leaf node corresponds to rich text, the prompt instruction also includes the type information of the rich text; the second largest language model is called using the prompt instruction, and the summary result of the leaf node is obtained by the second largest language model performing reasoning based on the prompt instruction.
[0146] As one of the feasible ways, when the iterative summarizing unit 803 calls 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, 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 largest language model to obtain the summary result of the upper layer node obtained by the second largest language model through inference based on the prompt instruction.
[0147] As one of the implementable ways, the document may contain text content corresponding to different time information; accordingly, the document corresponds to multiple document trees, the multiple document trees correspond to different time information, and the nodes contained in the same document tree all correspond to the same time information. In this case, the result determination unit 804 may be specifically configured to obtain 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.
[0148] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment. The device embodiment described above is only schematic, wherein the unit described as a separate component may or may not be physically separated, and the component displayed as a unit may or may not be a physical unit, that is, it may be located in one place, or it may be distributed on multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative work.
[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, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0150] In addition, an embodiment of the present application further provides a computer-readable storage medium on which a computer program is stored, and when the program is executed by a processor, the steps of any one of the methods in the aforementioned method embodiments are implemented.
[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, wherein the program instructions, when read and executed by the one or more processors, execute the steps of the method described in any one of the aforementioned method embodiments.
[0154] The present application also provides a computer program product, including a computer program, which implements the steps of any one of the methods in the aforementioned method embodiments when executed by a processor.
[0155] in, Fig. 9The architecture of the electronic device is shown as an example, 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, the video display adapter 911, the disk drive 912, the input / output interface 913, the network interface 914, and the memory 920 may be communicatively connected via a communication bus 930.
[0156] Among them, the processor 910 can be implemented by a general-purpose CPU, a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, etc., to execute relevant programs to 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 an operating system 921 for controlling the operation of the electronic device 900, and a basic input and output system (BIOS) 922 for controlling the low-level operation of the electronic device 900. In addition, a web browser 923, a data storage management system 924, and a document processing device 925, etc. can also be stored. The above-mentioned document processing device 925 can be an application program that specifically implements the operations of the aforementioned steps in the embodiment of the present application. In short, when the technical solution provided by the present application is implemented by software or firmware, the relevant program code is stored in the memory 920 and is called and executed by the processor 910.
[0158] The input / output interface 913 is used to connect the input / output module to realize information input and output. The input / output module can be configured in the device as a component (not shown in the figure), or it can be externally connected to the device to provide corresponding functions. The input device may include a keyboard, a mouse, a touch screen, a microphone, various sensors, etc., and the output device may include a display, a speaker, a vibrator, an indicator light, etc.
[0159] The network interface 914 is used to connect to a communication module (not shown) to realize communication interaction between the device and other devices. The communication module can realize communication through a wired mode (such as USB, network cable, etc.) or a wireless mode (such as mobile network, WIFI, Bluetooth, etc.).
[0160] The bus 930 comprises a pathway for transmitting information between the various components of the device (eg, the processor 910, the video display adapter 911, the disk drive 912, the input / output interface 913, the network interface 914, and the memory 920).
[0161] It should be noted that, although the above device only shows a processor 910, a video display adapter 911, a disk drive 912, an input / output interface 913, a network interface 914, a memory 920, a bus 930, etc., in the specific implementation process, the device may also include other components necessary for normal operation. In addition, it can be understood by those skilled in the art that the above device may also only include components necessary for implementing the solution of the present application, and does not necessarily include all the components shown in the figure.
[0162] It can be known from the description of the above implementation methods that those skilled in the art can clearly understand that the present application can be implemented by means of software plus a necessary general hardware platform. Based on such an understanding, the technical solution of the present application can be essentially or partly contributed to the prior art in the form of a computer program product, which can be stored in a storage medium such as ROM / RAM, a magnetic disk, an optical disk, etc., and includes several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in the various embodiments of the present application or certain parts of the embodiments.
[0163] The technical solution provided by the present application is described in detail above. The principle and implementation method of the present application are described in detail using specific examples. The description of the above embodiments is only used to help understand the method and core idea of the present application. At the same time, for those skilled in the art, according to the idea of the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as limiting the present application.
Claims
1. A document processing method, It is characterized in that The method comprises: Get the documents to be processed; Parsing the document, and constructing a document tree corresponding to the document according to the parsing result and the structure of the document; Starting from the leaf node of the document tree, calling the second largest language model to perform iterative summarization layer by layer until the summary result of the root node is obtained; wherein the summary result of the leaf node is inferred by the second largest language model using the text content of the leaf node, and the summary result of the non-leaf node is inferred by the second largest 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, It is characterized in that Parsing the document includes: Parsing text content of the document, wherein the text content includes plain text and rich text; The type of the rich text is identified, and a first language model corresponding to the type of the rich text is called to extract content from the rich text to obtain a plain text corresponding to the rich text.
3. The method according to claim 2, It is characterized in that 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; the non-leaf nodes include titles at all levels; The plain texts corresponding to different types of rich texts are respectively used as different leaf nodes, and each leaf node is marked with the corresponding rich text type.
4. The method according to claim 1, It is characterized in that Starting from the leaf node 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: The second largest language model is called to perform reasoning based on each leaf node to obtain the summary results of each leaf node; Take each leaf node as the current layer node; Calling the second largest language model to perform reasoning 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; The upper layer node is used as the current layer node, and the step of calling the second largest language model to perform reasoning based on the summary result of the current layer node corresponding to the same upper layer node is executed until the summary result of the root node is obtained.
5. The method according to claim 4, It is characterized in that The calling of the second largest language model performs reasoning based on each leaf node, and the summary results of each leaf node include: Constructing 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 summarized this time, wherein if the leaf node corresponds to a rich text, the prompt instruction also includes the type information of the rich text; The second largest language model is called by using the prompt instruction, and a summary result of the leaf node obtained by the second largest language model performing reasoning according to the prompt instruction is obtained.
6. The method according to claim 4, It is characterized in that The calling of the second largest language model to perform reasoning based on the summary result of the current layer node corresponding to the same upper layer node, and obtaining the summary result of the upper layer node includes: Constructing prompt instructions using summary results of all current-layer nodes corresponding to the same upper-layer node and rule information of this summary; The second largest language model is called by using the prompt instruction to obtain a summary result of the upper-level node obtained by the second largest language model through reasoning according to the prompt instruction.
7. The method according to any one of claims 1 to 6, It is characterized in that The document contains text content corresponding to different time information; The document corresponds to a plurality of document trees, the plurality of document trees correspond to different time information, and the nodes contained in the same document tree all correspond to the same time information; Using the summary result of the root node to obtain the summary result of the document includes: using the summary results of the root nodes included in multiple document trees corresponding to the document to obtain the summary result of the document.
8. A document processing method, It is characterized in that The method comprises: Obtain documentation for the target management system; Parse the document, and construct a document tree corresponding to the document according to the parsing result and the structure of the document, wherein the root node of the document tree is the target, the leaf nodes are the segmentation 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 the titles of each level; Starting from the leaf node of the document tree, calling the second largest language model to perform iterative summarization layer by layer until the summary result of the root node is obtained; wherein the summary result of the leaf node is inferred by the second largest language model using the text content of the leaf node, and the summary result of the non-leaf node is inferred by the second largest language model using the summary result of the child node of the non-leaf node; The summary result of the root node is used to obtain the summary result of the document, wherein the summary result includes a summary of achievements corresponding to the target.
9. The method according to claim 8, It is characterized in that The service page corresponding to the target management system includes components that trigger document processing and document information; The acquiring of the document of the target management system comprises: in response to the event that the component is triggered, acquiring the document corresponding to the document information from the target management system; The method further includes: displaying the summary result of the document on the service page.
10. A document processing method, applied to a cloud server, the method include: Responding to a document processing request sent by a user terminal, obtaining a document to be processed; Parsing the document, and constructing a document tree corresponding to the document according to the parsing result and the structure of the document; Starting from the leaf node of the document tree, calling the second largest language model to perform iterative summarization layer by layer until the summary result of the root node is obtained; wherein the summary result of the leaf node is inferred by the second largest language model using the text content of the leaf node, and the summary result of the non-leaf node is inferred by the second largest language model using the summary result of the child node of the non-leaf node; Using the summary result of the root node, obtaining the summary result of the document; The summary result of the document is sent to the user terminal.
11. A document processing device, It is characterized in that The device comprises: A document acquisition unit, configured to acquire a document to be processed; A document parsing unit, configured to parse the document and construct a document tree corresponding to the document according to the parsing result and the structure of the document; The iterative summarization unit is configured to start from the leaf node of the document tree and call the second largest language model to perform iterative summarization layer by layer until the summary result of the root node is obtained; wherein the summary result of the leaf node is inferred by the second largest language model using the text content of the leaf node, and the summary result of the non-leaf node is inferred by the second largest language model using the summary result of the child node of the non-leaf node; The result determination unit is configured to obtain the summary result of the document by using the summary result of the root node.
12. A computer-readable storage medium having a computer program stored thereon, It is characterized in that When the program is executed by a processor, the steps of the method according to any one of claims 1 to 10 are implemented.
13. An electronic device, It is 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, wherein the program instructions, when read and executed by the one or more processors, execute the steps of the method described in any one of claims 1 to 10.
14. A computer program product comprising a computer program, It is characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 10 are implemented.
Citation Information
Patent Citations
Method and system for cross-label processing of html rich text data with format
CN103530430A
Document analysis method and device, storage medium and processor
CN114564938A
Rich text summarization method and system based on large language model, medium and equipment
CN118152556A
Composition of electronic document layout
US20080288526A1
Artificial intelligence-enabled system and method for authoring a scientific document
US20240086647A1
Cited By
Tree document retrieval method and device, equipment and storage medium
CN121166842A
