Document generation method and apparatus, electronic device, and computer-readable storage medium

By constructing a graph structure to parse the page element attributes and relationships of the presentation, the problem of low generation efficiency in traditional methods is solved, and efficient cross-format document conversion and intelligent editing are achieved.

CN120493904BActive Publication Date: 2025-10-24BEIJING SANSAN SMART EDUCATION TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510589603.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-05-08
Publication Date
2025-10-24
Estimated Expiration
2045-05-08

AI Technical Summary

Technical Problem

Traditional methods struggle to effectively represent the complex relationships between elements in a presentation, resulting in low generation efficiency and a high susceptibility to errors, and failing to achieve in-depth content retrieval, intelligent editing, and cross-format processing.

Method used

By building a graph structure and using artificial intelligence models to analyze the page element attributes and relationships of the document to be processed, the initial graph structure is constructed and operated based on user needs to generate the target document.

Benefits of technology

It enables accurate and rich representation of documents such as presentations, improves the efficiency of cross-format content integration and conversion, and reduces errors and inefficiencies caused by manual operations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120493904B_ABST
    Figure CN120493904B_ABST
Patent Text Reader

Abstract

The present disclosure provides a document generation method and device, and relates to the technical fields of document processing, artificial intelligence, natural language processing, computer vision and the like. The specific implementation scheme is as follows: obtaining a to-be-processed document; performing page element attribute and page element relationship analysis on the to-be-processed document to obtain a page element analysis result; constructing an initial graph structure based on the page element analysis result; performing operation on the initial graph structure based on a document generation requirement input by a user to obtain an operation graph structure; and obtaining a target document based on the operation graph structure, thereby improving the generation efficiency of the target document.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present disclosure belongs to the technical field of computer, and particularly relates to the technical field of natural language processing, operations research, decision science, etc. In particular, a document generation method and device, an electronic device, and a computer readable storage medium. BACKGROUND

[0002] A presentation is a widely used information display and communication tool in modern work and study. However, in order to obtain a new presentation with other display styles, the traditional method is to first perform document parsing on the presentation, and based on the result of the document parsing, the parsed result is edited manually and converted into a new presentation, wherein the document parsing method includes parsing the underlying XML (Extensible Markup Language) structure of the presentation or simply mapping the content of the presentation to a general data structure such as JSON (JavaScript Object Notation). Although this document parsing method can extract the basic content, it is difficult to effectively express the complex structure and relationship inside the PPT, and it also lacks comprehensive understanding of the content semantics and visual layout of the presentation. Although this manual editing method can convert the parsed content into a presentation with other styles, it requires manual operation and is prone to errors, and the generation efficiency of the new presentation is low. SUMMARY

[0003] The present disclosure provides a document generation method and device, an electronic device, and a computer readable storage medium.

[0004] According to a first aspect, a document generation method is provided, the method comprising: obtaining a to-be-processed document; performing page element attribute and page element relationship parsing on the to-be-processed document to obtain a page element parsing result; constructing an initial graph structure based on the page element parsing result; performing operation on the initial graph structure based on a document generation requirement input by a user to obtain an operation graph structure; and obtaining a target document based on the operation graph structure.

[0005] According to a second aspect, a document generation device is provided, the device comprising: an obtaining unit configured to obtain a to-be-processed document; a parsing unit configured to perform page element attribute and page element relationship parsing on the to-be-processed document to obtain a page element parsing result; a constructing unit configured to construct an initial graph structure based on the page element parsing result; an operating unit configured to perform operation on the initial graph structure based on a document generation requirement input by a user to obtain an operation graph structure; and an obtaining unit configured to obtain a target document based on the operation graph structure.

[0006] According to a third aspect, an electronic device is provided, comprising at least one processor; and a memory connected with the at least one processor in communication, wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any implementation of the first aspect.

[0007] According to a fourth aspect, a non-transitory computer-readable storage medium storing computer instructions is provided, and the computer instructions are used to enable a computer to perform the method according to any implementation of the first aspect.

[0008] The document generation method and device provided by the embodiments of the present disclosure first acquire a to-be-processed document; secondly, page element attributes and page element relationship of the to-be-processed document are parsed to obtain a page element parsing result; thirdly, an initial graph structure is constructed based on the page element parsing result; fourthly, the initial graph structure is operated based on a document generation requirement input by a user to obtain an operation graph structure; and finally, a target document is obtained based on the operation graph structure. Thus, the page elements and relationship of the to-be-processed document are parsed by an artificial intelligence model, and a graph structure is constructed, the content, attributes and complex spatial, logical and semantic relationship between page elements in the to-be-processed document can be accurately and richly represented based on the capability of the graph structure, the initial graph structure is operated to be converted into an operation graph structure of the target document, and the target document is converted based on the operation graph structure, which can automatically make the graph structure as a general intermediate representation, realize cross-format content integration and conversion, and improve the target document generation efficiency relative to manual operation of other data structures.

[0009] It should be understood that the content described in this part is not intended to identify key or important features of the embodiments of the present disclosure, nor is it used to limit the scope of the present disclosure. Other features of the present disclosure will become apparent from the following description. BRIEF DESCRIPTION OF DRAWINGS

[0010] The accompanying drawings are used to better understand the present scheme and do not limit the present disclosure. Among them:

[0011] Figure 1 is a flowchart of one embodiment of the document generation method according to the present disclosure;

[0012] Figure 2 is a structural schematic diagram of an initial graph structure in the present disclosure;

[0013] Figure 3 is a structural schematic diagram of one embodiment of the document generation device according to the present disclosure;

[0014] Figure 4is a block diagram of an electronic device for implementing the document generation method of the embodiments of the present disclosure. DETAILED DESCRIPTION

[0015] Unless otherwise clearly indicated, throughout the specification and the claims, the terms "comprise", "comprising", "include", "including", "contain", "containing", or variations thereof, shall be understood to imply the inclusion of a stated element or group of elements but not the exclusion of any other element or group of elements.

[0016] The technical solutions of the present disclosure are described below through specific embodiments. It should be understood that the one or more steps mentioned in the present disclosure do not exclude other methods and steps before and after the combination steps, or other methods and steps can be inserted between the explicitly mentioned steps. It should also be understood that these examples are only used to illustrate the present disclosure and not to limit the scope of the present disclosure. Unless otherwise stated, the numbering of the steps of each method is only for the purpose of identifying the steps of each method, and not to limit the arrangement order of each method or to limit the implementation scope of the present disclosure. Changes or adjustments of the relative relationship can also be considered as the scope of the present disclosure that can be implemented without substantial technical content changes.

[0017] The raw materials and instruments used in the embodiments are not specifically limited in source, and can be purchased on the market or prepared according to the conventional methods well known to those skilled in the art.

[0018] Traditional document parsing methods, such as directly parsing the underlying XML structure of a presentation document, or simply mapping its content to a general data structure such as JSON, or based on a specific format API library, the API library provides access to the basic structure of the document (such as pages, shapes, text boxes). Although the above document parsing methods can extract the basic content, they are difficult to effectively express the complex structure and relationship inside the presentation document. Specifically, as a lightweight data exchange format, the inherent tree or key / value pair structure of JSON has limited ability in representing the rich spatial layout relationships (such as overlapping, alignment, combination) between page elements of a presentation document, logical relationships (such as animation sequences, hyperlink jumps), semantic associations, and style inheritance. Such a simple data structure cannot support deep, relationship-based queries, intelligent modifications, or complex generation tasks on the content of a presentation document. For example, it is difficult to accurately answer "find all pages containing'market analysis' with a growth trend chart next to it", or to implement "replace the font style of all titles uniformly with the style of the template page".

[0019] Further, existing tools generally lack comprehensive understanding of the semantic and visual layout of the content of a presentation document, making it difficult to implement intelligent content queries, modifications, style migration, and automated generation. Users often need to perform manual operations, which is inefficient and prone to errors.

[0020] In the prior art, when the content of a presentation document is parsed, the data structure has insufficient expression capability, and it is difficult to effectively and intuitively represent the complex element relationships between elements, for example: spatial layout relationship: relative position (up, down, left, right, overlap, alignment) and distance between elements. Visual style association: multiple elements share font, color, fill, and other style attributes. Content semantic association: logical connection between different text boxes and charts in content. Interaction / animation relationship: jump logic, animation trigger sequence, and dependency relationship between elements. Low efficiency of query and modification: based on simple data structures, complex queries (such as "find all text boxes containing 'core technology' and located on the right side of the page") or structural modifications (such as "replace all title fonts and adjust the position of the first picture below them") often require complex traversal and judgment logic, which is inefficient and prone to errors. Difficulties in cross-format processing: different document formats have different representation methods for parsing results, making it difficult to form a unified intermediate representation, hindering cross-format content migration and style application.

[0021] Therefore, the prior art (especially solutions relying on simple data structures such as JSON) cannot effectively represent the complex relationships (such as spatial, style, semantic, and interaction relationships) between elements within a document, making it difficult to implement advanced applications such as deep content queries, intelligent editing, style migration, and cross-format processing.

[0022] To address the deficiencies in the prior art, the present disclosure proposes a document generation method that converts a to-be-processed document into a target document by utilizing the capabilities of a graph structure, thereby improving the efficiency of target document conversion. Figure 1 An embodiment of a document generation method according to the present disclosure is shown in flowchart 100, which includes the following steps:

[0023] Step 101: Obtain a to-be-processed document.

[0024] In this embodiment, the to-be-processed document is a document to be processed. The to-be-processed document can include at least one page sorted in a certain order, and each page can have corresponding page elements. By dividing the to-be-processed document into two levels of page as a whole and page elements, the to-be-processed document can be converted into a graph structure. The document type of the to-be-processed document can be one of a variety of types such as a presentation document, an electronic spreadsheet software document, a word processing software document, and a Portable Document Format (‌Portable Document Format, hereinafter referred to as PDF). In actual applications, the to-be-processed document can be any of PPT, Word, PDF, and Excel.

[0025] In this embodiment, the obtaining manner of the to-be-processed document can be various. For example, the to-be-processed document is a document obtained by an execution subject on which the document generation method runs from the server through real-time communication with the server; the to-be-processed document can also be a document extracted by the execution subject from the database. Alternatively, the to-be-processed document can also be a document uploaded by a user. Through processing of the to-be-processed document by the method of the present disclosure, the target document required by the user can be obtained.

[0026] In step 102, the page element attributes and the page element relationship of the to-be-processed document are parsed to obtain a page element parsing result.

[0027] In this embodiment, the to-be-processed document has multiple pages, and each page has corresponding page elements. The page element is a basic unit of a page and can be a button, display content, an image, etc. Each page or the page elements between pages have corresponding relationships, such as a button of a first page used to control the display of a second page. The page elements and the page element relationship are parsed to effectively identify the to-be-processed document.

[0028] In this embodiment, the step 102 includes: performing deep parsing on the to-be-processed document by using an artificial intelligence model integrating natural language processing and computer vision to obtain a page element parsing result, wherein the page element parsing result includes: all pages of the to-be-processed document, page order, master pages, and layout, etc.; page elements of each page, including but not limited to: a text box (TextBox), an image (Picture), a shape (Shape), a table (Table), a chart (Chart), a SmartArt graphic, a multimedia object (video / audio), a group object (Group), etc.; and attributes of each page element, including: content attributes, such as text content, picture content (or its description / label), table data, chart data series and categories, etc.; position and geometry attributes, such as accurate coordinates (x, y) of the page element on the page, size (width, height), rotation angle, etc.; visual style attributes, such as font (name, size, color, bold, italic, etc.), fill color, border style, shape type, transparency, shadow effect, etc.; structure and relationship attributes, such as the page to which the page element belongs, Z-order, combination relationship (whether it belongs to a combination), hyperlink target, animation effect (type, order, trigger mode), notes, etc. The page element relationship includes: implicit relationships between page elements, such as spatial proximity relationship, alignment relationship, content correlation (for example, text description related to chart data next to it), style similarity / inheritance, etc.

[0029] In this embodiment, when the document to be processed is a document in PPT, Word, PDF, Excel, PPT, Word, PDF are generated and sequentially connected according to the physical order when the tool is designed and laid out, and Excel is sequentially generated and connected according to the sheet (table displayed in the workbook window) read.

[0030] In step 103, an initial graph structure is constructed based on the page element analysis result.

[0031] In this embodiment, the execution subject on which the document generation method runs can put the summary, the label and the physical sequence number of the page summarized in the page content analysis result into the virtual graph node associated with the page node in the initial graph structure, which facilitates the user to perform deep semantic retrieval and operation.

[0032] In this embodiment, based on the page element analysis result, an initial graph structure is constructed, which is a graph data structure and is used to represent the entire document to be processed. The initial graph structure is the core intermediate representation of the present disclosure. As shown in Figure 2 A~F are nodes representing pages or page elements of the document to be processed, and the edges between A~F are used to represent the relationship between the nodes. In Figure 2 , node E has corresponding relationships with node B, node D and node F. Node A only has relationships with node B and node F, and node C only has relationships with node B and node D.

[0033] In this embodiment, the page element analysis result includes all pages and page attributes (such as page order, layout, etc.), page elements, page element attributes, and page element relationships. The page element attributes include element attributes and structure and relationship attributes, which are used to represent the relationship between the element and the page, such as which page the page element belongs to. The above step 103 includes: determining the nodes based on all pages and page elements in the page element analysis result; determining the edges based on the page element relationships and the structure and relationship attributes in the page element analysis result; connecting the nodes with the edges; adding corresponding attribute information to the edges and nodes based on the attributes of the page elements in the page element analysis result, to obtain the initial graph structure.

[0034] In this embodiment, the graph structure can naturally and richly represent the complex relationships (space, style, semantics, interaction, etc.) between the elements in the document, overcoming the limitations of simple structures such as JSON. When the document to be processed is various types of documents, step 103 can realize the conversion of the supported input document formats (such as PPT, Word, Excel, PDF, etc.) to a unified intermediate graph structure, and can generate any supported output format from the graph structure, realizing seamless migration and format conversion of the content.

[0035] At step 104, based on the document generation requirement input by the user, the initial graph structure is operated to obtain an operation graph structure.

[0036] In this embodiment, the document generation requirement is a design requirement for the target document. Since the initial graph structure supports efficient addition, deletion, modification, and query operations, the document generation requirement can include: addition information for adding a page or a page element of the to-be-processed document, deletion information for deleting a page or a page element of the to-be-processed document, change information for changing a page or a page element in the to-be-processed document, and query information for querying a page or a page element in the to-be-processed document.

[0037] In this embodiment, the operation on the initial graph structure includes: a query operation on the initial graph structure, a modification operation on the initial graph structure, an addition operation on the initial graph structure, and a deletion operation on the initial graph structure.

[0038] The query operation on the initial graph structure includes: an attribute-based query operation, such as finding all text box nodes with the font of "Microsoft Yahei"; a content-based query operation, such as finding a text node containing a specific keyword / synonym (which can use text matching or vector similarity); a relationship-based query operation, such as finding a text node spatially adjacent to a certain picture node, or finding all element nodes linked to page 5; a complex graph pattern query, such as finding a page node "containing title A and chart B, and chart B being below title A"; and a natural language query interface, in which the user can ask questions in natural language (such as "what does page 3 talk about?" and "which pages mention 'user growth'?" ), and the system converts the question into a graph query statement for execution.

[0039] The modification operation on the initial graph structure includes: a node attribute modification operation, such as modifying the text content, font size, or color of a certain text node; and a picture node position modification operation. The edge modification operation includes: changing the page order (modifying the `NextPage` edge) and changing the hyperlink target (modifying the `HyperlinkTo` edge). The addition operation on the initial graph structure includes: adding a new node, such as adding a new text box node or a picture node under a specified page node; and adding a new edge to establish a relationship edge between a new element and a page or other elements.

[0040] The deletion operation on the initial graph structure includes: a node deletion operation, such as deleting a certain page node or a certain element node on a page (while processing the associated edges); and an edge deletion operation, such as removing a certain relationship between elements.

[0041] Optionally, for some complex requirements of the user, the document generation requirement can be a combination of the above-mentioned multiple aspects of information, and for each aspect of the document generation requirement, an operation mode of the aspect can be determined.

[0042] In this embodiment, the step 104 includes: determining the modification information of the to-be-processed document based on the document generation requirement input by the user; determining the modification content of the initial graph structure based on the modification information, modifying the initial graph structure according to the modification content, and obtaining the operation graph structure.

[0043] In step 105, the target document is obtained based on the operation graph structure.

[0044] In this embodiment, after the initial graph structure is operated to obtain the operation graph structure, the operation graph structure or new content generated based on the operation graph structure can be re-rendered into a document in a target format. The type of the target document can be the same as that of the to-be-processed document, or can be different from that of the to-be-processed document. When the type of the target document is different from that of the to-be-processed document, the target document generated from the to-be-processed document is a document that has undergone style conversion. In a specific example, the to-be-processed document is a PPT, and the graph structure information is converted into a target document in a PPT file format, while the content, layout, style and relationship are preserved.

[0045] In this embodiment, the target document can be a document obtained after any one of text replacement, content query and filtering, and style migration on the to-be-processed document. In a specific example of text replacement, the document generation requirement provided by the user is a replacement rule for the existing to-be-processed document. The system parses the PPT into a graph structure, queries all text nodes containing “Company A”, and modifies the content attribute of the text nodes to “Company B”. Then, the modified graph structure is rendered back into a new PPT file.

[0046] In a specific example of content query and filtering, the user's document generation requirement is to ask “What is the main content on page 5?” or “Which pages discuss “marketing strategy”?” The system parses the PPT into a graph structure, performs corresponding graph queries (queries the main content nodes under the 5th page node, or queries the nodes containing “marketing strategy” related content and traces back to the page nodes), and returns the results (text description or page list and sorting). In a specific example of style migration, the user uploads a PPT (as a style template) and new content (such as Markdown text). The system parses the template PPT, extracts the layout pattern (relative position relationship), font style (node attribute), color scheme, etc. in the graph structure of the template PPT. Then, a preliminary graph structure is created based on the new content, and the extracted style information is applied to the corresponding nodes and relationships of the new graph. Finally, a new PPT conforming to the template style is generated.

[0047] The document generation method provided by the embodiments of the present disclosure first acquires a to-be-processed document; secondly, performs page element attribute and page element relationship analysis on the to-be-processed document to obtain a page element analysis result; thirdly, constructs an initial graph structure based on the page element analysis result; fourthly, performs operation on the initial graph structure based on a document generation requirement input by a user to obtain an operation graph structure; and finally, obtains a target document based on the operation graph structure. In this way, the page element and relationship analysis on the to-be-processed document by the artificial intelligence model and the construction of the graph structure can accurately and richly represent the content, attributes of the page elements in the to-be-processed document and the complex spatial, logical and semantic relationships between the page elements. The operation on the initial graph structure to transform it into the operation graph structure of the target document and the transformation of the target document based on the operation graph structure can automatically make the graph structure serve as a general intermediate representation, realize cross-format content integration and conversion, and improve the target document generation efficiency relative to manual operation on other data structures.

[0048] In some optional implementations of the present disclosure, the above-mentioned page element attribute and page element relationship analysis on the to-be-processed document to obtain a page element analysis result comprises: performing page layout analysis on the to-be-processed document by using an artificial intelligence model to obtain element analysis results and relationship analysis results; identifying page elements and key attributes of the page elements in each page based on the element analysis results; determining the association relationships of all page elements in the to-be-processed document based on the relationship analysis results; and taking the page elements, the key attributes and the association relationships as the page element analysis results.

[0049] In the optional implementation, the artificial intelligence model can be a model integrated with natural language processing and computer vision, that is, the artificial intelligence model can identify the text content and image content of the to-be-processed document, thereby comprehensively identifying the to-be-processed document. In combination with artificial intelligence technology, the visual layout, content semantics and implicit structure of the document can be more accurately and comprehensively understood.

[0050] In the optional implementation, the above-mentioned page element attribute and page element relationship analysis on the to-be-processed document to obtain a page element analysis result comprises: analyzing the page information of all pages of the to-be-processed document and the page relationship between any two pages, analyzing the layout information of the page elements in each page in all pages; determining the element information of the page elements and the element relationship between any two page elements based on the layout information; taking the page information of all pages and the element information of the page elements on each page as the element analysis results, and taking the page relationship and the element relationship as the relationship analysis results.

[0051] In the optional implementation, the identifying the page elements in the pages and the key attributes of the page elements based on the element analysis result includes: extracting page information of each page from the element analysis result, determining, for each page information, a page element belonging to the page; and extracting, based on element information of the page elements in the element analysis result, key information of other pages and page elements as the key attributes.

[0052] In the optional implementation, the determining the association relationships of all the page elements in the to-be-processed document based on the relationship analysis result includes: clustering relationships belonging to the same page to obtain a clustering type of the page; determining, based on the clustering type, related pages in the page, and establishing a first association relationship related to the clustering type between the page and the related pages; clustering relationships belonging to the same element to obtain a clustering type of the element; determining, based on the clustering type, related elements in the element, and establishing a second association relationship related to the clustering type between the element and the related elements; and taking the first association relationship and the second association relationship as the association relationships of all the page elements.

[0053] The method for obtaining the page element analysis result provided in the optional implementation can perform page layout analysis on the to-be-processed document, can perform in-depth analysis on the to-be-processed document from the content and the external layout, and improves the accuracy of the analysis on the to-be-processed document. The key attributes and the association relationships are respectively determined based on the element analysis result and the relationship analysis result analyzed by the artificial intelligence model, and the reliability of the page element analysis result is improved.

[0054] In some optional implementations of the present disclosure, the performing page element attribute and page element relationship analysis on the to-be-processed document to obtain the page element analysis result includes: determining, based on the to-be-processed document, task information of different agents in all the agents; sending the task information to corresponding agents in all the agents, so that each agent performs analysis on the respective page element; and obtaining and merging analysis results of all the agents to obtain the page element analysis result.

[0055] In the optional implementation, the page element analysis result can be information analyzed after actual content and relationship recognition on the to-be-processed document, and the page element analysis result can also be summary information obtained after intelligent summarization by the agent. The summary information can facilitate generation of virtual graph nodes in the initial graph structure.

[0056] In this optional implementation, an agent refers to an agent that can perceive the environment and take actions to achieve a specific goal. Agents have autonomy, adaptability and interaction ability, and can perceive the environment, make decisions and perform tasks. They can perceive changes in the environment, make judgments and decisions based on their learned knowledge and algorithms, and then perform actions to influence the environment or achieve predetermined goals.

[0057] In this optional implementation, for a large target document generation task, the task can be decomposed to obtain task information and assigned to different agents. For example, agent A is responsible for generating text content according to the outline (operating text nodes), agent B is responsible for generating pictures according to the text description (operating picture nodes), and agent C is responsible for overall layout and style (operating position, style attributes and relationships). They can operate different parts of the graph structure or page range in parallel, and finally combine the results to significantly improve the generation efficiency and quality, and can utilize the expertise of different agents.

[0058] The method for obtaining a page element analysis result provided by the optional implementation can realize the analysis of the page elements of the to-be-processed document by multiple agents, utilize the expertise of each agent, and improve the reliability of the page element analysis result.

[0059] Optionally, the operation graph structure can also be a graph structure generated by multiple agents. In one specific example, a user provides a PPT outline containing 100 pages of content. The system assigns tasks to multiple agents according to the outline structure and content type (for example, a text agent processes pages 1-30, a text-image agent processes pages 31-70, and a data visualization agent processes pages 71-100 involving charts). Each agent performs content generation and editing on the initial graph structure within the range of the graph structure it is responsible for, and finally a coordination agent combines the partial graph structures to obtain the operation graph structure.

[0060] In some embodiments of the present disclosure, the above constructing an initial graph structure based on the page element analysis result includes: determining a node based on a page element in the page element analysis result; determining an edge based on an association relationship in the page element analysis result; adding a key attribute in the page element analysis result to an attribute of the node, and connecting the nodes according to the association relationship to obtain the initial graph structure.

[0061] In this optional implementation, for a to-be-processed document with only one page, the page element analysis result can include all page elements in the page, and the page elements are taken as nodes of the initial graph structure; when the to-be-processed document has only one page, the relationship between any two page elements on the page is an association relationship, and the nodes related to the association relationship are connected to determine an edge.

[0062] In this optional implementation, the key attribute is an attribute of a page or a page element, and adding the attribute to the attribute of a node in the initial graph structure can effectively interpret the node in the initial graph structure.

[0063] The method for constructing a graph structure provided by this optional implementation determines a node based on a page element in a page element analysis result, determines an edge based on an association relationship in the page element analysis result, adds a key attribute in the page element analysis result to an attribute of the node, and connects the nodes according to the association relationship to obtain an initial graph structure, thereby providing a reliable implementation for obtaining an initial graph structure.

[0064] Optionally, for a document to be processed having multiple pages, the page element analysis result includes: multiple pages, a page attribute of a page, page elements on each page, an element attribute of each page element, and an association relationship; the association relationship in the page element analysis result includes a relationship between any two pages in the document to be processed and a relationship between any two page elements, and the page attribute and the element attribute constitute a key attribute. The above method for constructing an initial graph structure based on a page element analysis result includes: determining a node based on a page and a page element in the page element analysis result; determining an edge corresponding to each page and page element based on an association relationship in the page element analysis result; adding a key attribute in the page element analysis result to an attribute of the node, and connecting the nodes according to the association relationship to obtain an initial graph structure.

[0065] In some embodiments of the present disclosure, the above method for operating the initial graph structure based on the document generation requirement input by the user to obtain an operation graph structure includes: determining a target element of a target document, an association relationship of the target element, and an attribute of the target element based on the document generation requirement input by the user; and modifying the initial graph structure based on the target element of the target document, the association relationship of the target element, and the attribute of the target element to obtain the operation graph structure.

[0066] In this optional implementation, the target document is a document that the document to be processed needs to be converted into, and the target element is a page element that the user's document generation requirement expects to be generated in the target document. The above method for determining a target element of a target document, an association relationship of the target element, and an attribute of the target element based on a document generation requirement input by a user includes: performing keyword recognition on the document generation requirement input by the user to determine the target element in the document generation requirement; and using a deep learning model to determine the association relationship and the attribute of each target element based on the requirement of each target element in the document generation requirement.

[0067] In the optional implementation, the modifying the initial graph structure based on the target element of the target document, the association relationship of the target element, and the attribute of the target element comprises: querying a node in the initial graph structure based on the target element of the target document, the association relationship of the target element, and the attribute of the target element to obtain a node query result; generating new node information or new node attributes of the target node based on the node query result; replacing node information of the target node in the initial graph structure with the new node information, and replacing node attributes of the target node in the initial graph structure with the new node attributes to obtain the operation graph structure.

[0068] The method for obtaining the operation graph structure provided in the optional implementation first determines the target element of the target document, the association relationship of the target element, and the attribute of the target element based on the document generation requirement input by the user, and then modifies the initial graph structure based on the target element of the target document, the association relationship of the target element, and the attribute of the target element to obtain the operation graph structure. Thus, the initial graph structure is modified based on the requirement of the user to obtain the operation graph structure, which can make the operation graph structure more suitable for the requirement of the user and improve the accuracy of the generation of the operation graph structure.

[0069] Optionally, the operation on the initial graph structure based on the document generation requirement input by the user to obtain the operation graph structure comprises: determining a requirement node and a requirement edge based on the document generation requirement input by the user; detecting whether the initial graph structure has the requirement node and the requirement edge; and in response to detecting that the initial graph structure does not have the requirement node and the requirement edge, modifying the initial graph structure so that the modified initial graph structure has the requirement node and the requirement edge, and taking the modified initial graph structure as the operation graph structure.

[0070] In some embodiments of the present disclosure, the method further comprises: obtaining new translation node information; determining a node to be operated in the initial graph structure based on the new translation node information; translating the node to be operated by using a translation module to obtain an updated node, and adding the updated node to the initial graph structure.

[0071] In the optional implementation, the new translation node information is information for prompting to add a translation node, and the node to be operated can be determined by using the new translation node.

[0072] In the optional implementation, the translation module is a module for optimizing or interpreting the to-be-operated node, and the updated node obtained through the translation module can better interpret the to-be-operated node. The translation module can be a tool or an API (Application Programming Interface), and the node in the graph structure can be used as an anchor point for interacting with the external tool / API. For example, a text node is selected, and a translation API is called to update the node content after translation. The tool can be a built-in or dynamically accessed tool, which is used as a function acting on the graph node / edge to realize arbitrary modification, enhancement and generation of the graph content.

[0073] The document generation method provided in the optional implementation obtains new translation node information, determines a to-be-operated node in an initial graph structure based on the new translation node information, translates the to-be-operated node by using a translation module to obtain an updated node, and adds the updated node to the initial graph structure, thereby providing a reliable implementation means for improving and enhancing the initial graph structure and improving the reliability and accuracy of the initial graph structure.

[0074] In some embodiments of the present disclosure, the above method further includes: obtaining new picture node information; determining a target node region in the initial graph structure based on the new picture node information; and generating a picture node by using a picture generation module and inserting the picture node in the target node region.

[0075] In the optional implementation, the new picture node information is information for prompting to add a picture node. The new picture node information can be used to determine a region in which an additional picture node needs to be added, that is, a target node region. The target node region can include one or more nodes related to the new picture node.

[0076] In the optional implementation, the picture generation module is a module for directly generating a new picture node. The picture generation module can be a tool or an API. The picture node obtained through the picture generation module can better interpret the nodes in the target node region. A region node is selected, a picture generation API is called to generate a picture and insert the picture as a new picture node, and the initial graph structure can be effectively expanded. The tool can be a built-in or dynamically accessed tool, which is used as a function acting on the graph node / edge to realize arbitrary modification, enhancement and generation of the graph content.

[0077] The document generation method provided in the optional implementation obtains new picture node information, determines a target node region in an initial graph structure based on the new picture node information, generates a picture node by using a picture generation module, and inserts the picture node in the target node region, thereby providing another reliable implementation means for improving and enhancing the initial graph structure and improving the reliability and accuracy of the initial graph structure.

[0078] Optionally, the above method also includes: receiving content enhancement and processing content, processing the operation graph structure based on the content enhancement and processing content to obtain a new operation graph structure, and obtaining the target document based on the new operation graph structure. The content enhancement and processing content can be information obtained from an external interface based on user operations. The specific example is as follows: the user uploads PPT (Input.pptx), and the system generates an operation graph structure Graph_A. The content enhancement and processing content is: a text box node N on page 3 selected by the user, and an external "text summary" API service is selected. The system extracts the content attributes (text) of node N. Call the external API and send the text to the summary service. Receive the summary text returned by the API. Choose to update the content of node N to summary text, or add a new text node whose content is a summary, and establish its relationship with node N or the page it is on in the operation graph structure.

[0079] Further references Figure 3 As an implementation of the methods shown in the above figures, the present disclosure provides an embodiment of a document generation device, which is similar to Figure 1 Corresponding to the method embodiment shown, the device can be specifically applied to various electronic devices.

[0080] like Figure 3 As shown, the document generation device 300 provided in this embodiment includes: an acquisition unit 301, a parsing unit 302, a construction unit 303, an operation unit 304, and a obtaining unit 305. Among them, the above-mentioned acquisition unit 301 can be configured to obtain the document to be processed. The above-mentioned parsing unit 302 can be configured to parse the page element attributes and page element relationships of the document to be processed to obtain the page element parsing results. The above-mentioned construction unit 303 can be configured to construct an initial graph structure based on the page element parsing results. The above-mentioned operation unit 304 can be configured to operate on the initial graph structure based on the document generation requirements input by the user to obtain an operation graph structure. The above-mentioned obtaining unit can be configured to obtain the target document based on the operation graph structure.

[0081] In this embodiment, the document generation device 300 includes the acquisition unit 301, the parsing unit 302, the construction unit 303, the operation unit 304, and the obtaining unit 305. The specific processing and technical effects thereof can be referred to in the respective Figure 1 The relevant descriptions of step 101, step 102, step 103, step 104 and step 105 in the corresponding embodiment are not repeated here.

[0082] In some embodiments of the present disclosure, the parsing unit 302 is configured to: perform page layout analysis on the to-be-processed document by using an artificial intelligence model to obtain element analysis results and relationship analysis results; identify, based on the element analysis results, page elements in each page and key attributes of the page elements; determine, based on the relationship analysis results, a correlation relationship of all the page elements in the to-be-processed document; and take the page elements, the key attributes, and the correlation relationship as the page element analysis results.

[0083] In some embodiments of the present disclosure, the parsing unit 302 is configured to: determine, based on the to-be-processed document, task information of different agents in all the agents; send the task information to corresponding agents in all the agents to enable each agent to analyze a respective page element; and obtain and merge analysis results of all the agents to obtain the page element analysis results.

[0084] In some embodiments of the present disclosure, the construction unit 303 is configured to: determine a node based on a page element in the page element analysis results; determine an edge based on a correlation relationship in the page element analysis results; add a key attribute in the page element analysis results to an attribute of the node, and connect the nodes according to the correlation relationship to obtain an initial graph structure.

[0085] In some embodiments of the present disclosure, the operation unit 304 is configured to: determine a target element of a target document, a correlation relationship of the target element, and an attribute of the target element based on a document generation requirement input by a user; and modify the initial graph structure based on the target element of the target document, the correlation relationship of the target element, and the attribute of the target element to obtain an operation graph structure.

[0086] In some embodiments of the present disclosure, the apparatus 300 further includes a translation unit (not shown in the figure), which is configured to: obtain new translation node information; determine a to-be-operated node in the initial graph structure based on the new translation node information; translate the to-be-operated node by using a translation module to obtain an updated node, and add the updated node to the initial graph structure.

[0087] In some embodiments of the present disclosure, the apparatus 300 further includes an image adding unit (not shown in the figure), which is configured to: obtain new image node information; determine a target node region in the initial graph structure based on the new image node information; and generate an image node by using an image generation module, and insert the image node into the target node region.

[0088] The document generation apparatus provided by the embodiments of the present disclosure first acquires a to-be-processed document by the acquisition unit 301; secondly, the analysis unit 302 analyzes the page element attributes and the page element relationships of the to-be-processed document to obtain a page element analysis result; thirdly, the construction unit 303 constructs an initial graph structure based on the page element analysis result; fourthly, the operation unit 304 operates the initial graph structure based on the document generation requirement input by a user to obtain an operation graph structure; and finally, the obtaining unit 305 obtains a target document based on the operation graph structure. Thus, the page elements and the relationships of the to-be-processed document are analyzed by the artificial intelligence model, and the graph structure is constructed, the content, the attributes of the page elements in the to-be-processed document, and the complex spatial, logical and semantic relationships between the page elements can be accurately and richly represented based on the capability of the graph structure; the initial graph structure is operated to be converted into the operation graph structure of the target document, and the target document is converted based on the operation graph structure, the graph structure can be automatically used as a general intermediate representation to realize cross-format content integration and conversion, and the target document generation efficiency is improved relative to manual operation of other data structures.

[0089] According to the embodiments of the present disclosure, the present disclosure further provides an electronic device, a readable storage medium and a computer program product.

[0090] Figure 4 A schematic block diagram of an example electronic device 400 that can be used to implement embodiments of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptops, desktops, tablets, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device can also represent various forms of mobile devices, such as personal digital assistants, cellular telephones, smartphones, wearable devices, and other similar computing devices. The components shown here, their connections and relationships, and their modes of operation, are meant to be examples only, and are not intended to limit the implementations of the present disclosure described and / or claimed in this document.

[0091] As shown in Figure 4 The device 400 includes a computing unit 401 that can perform various appropriate actions and processes in accordance with a computer program stored in a read-only memory (ROM) 402 or a computer program loaded from a storage unit 408 into a random access memory (RAM) 403. Various programs and data required for the operation of the device 400 can also be stored in the RAM 403. The computing unit 401, the ROM 402, and the RAM 403 are connected to each other through a bus 404. An input / output (I / O) interface 405 is also connected to the bus 404.

[0092] A plurality of components in the device 400 are connected to the I / O interface 405, including: an input unit 406, such as a keyboard, a mouse, etc.; an output unit 407, such as various types of displays, speakers, etc.; a storage unit 408, such as a magnetic disk, an optical disk, etc.; and a communication unit 409, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 409 allows the device 400 to exchange information / data with other devices through a computer network, such as the Internet, and / or various telecommunication networks.

[0093] The computing unit 401 can be various general and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 401 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The computing unit 401 performs various methods and processes described above, such as the document generation method. For example, in some embodiments, the document generation method can be implemented as a computer software program, which is tangibly embodied in a machine-readable medium, such as the storage unit 408. In some embodiments, part or all of the computer program can be loaded and / or installed onto the device 400 via the ROM 402 and / or the communication unit 409. When the computer program is loaded onto the RAM 403 and executed by the computing unit 401, one or more steps of the document generation method described above can be performed. Alternatively, in other embodiments, the computing unit 401 can be configured to perform the document generation method by any other appropriate means, such as by means of firmware.

[0094] Various implementations of the systems and techniques described above herein can be realized in digital electronic circuitry, integrated circuitry, a field programmable gate array (FPGA), an application-specific integrated circuit (ASIC), a system on a chip (SOC), a programmable logic device (CPLD), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include implementation in one or more computer programs that are executable and / or interpretable on a programmable system including at least one programmable processor, which can be special or general purpose, coupled to receive data and instructions from, and to transmit data and instructions to, a storage system, at least one input device, and at least one output device.

[0095] Program code for carrying out methods of the present disclosure can be written in any combination of one or more programming languages. The program code can be provided to a processor or controller of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the program code, when executed by the processor or controller, produces the modes / operations specified in the flowcharts and / or block diagrams. The program code can be executed entirely on a machine, partially on a machine, partially on a machine as a stand-alone software package, or entirely on a remote machine or server.

[0096] In the context of the present disclosure, a machine-readable medium can be a tangible medium that contains or stores a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include but is not limited to an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of the machine-readable storage medium will include one or more lines of electrical connections, portable computer disks, hard disk drives, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or Flash memory), optical fibers, portable compact disc read-only memories (CD-ROMs), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0097] To provide for interaction with a user, the systems and techniques described here can be implemented on a computer having a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user and a keyboard and a pointing device (e.g., a mouse or a trackball) by which the user can provide input to the computer. Other kinds of devices can be used to provide for interaction with a user as well; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form, including acoustic, speech, or tactile input.

[0098] The systems and techniques described here can be implemented in a computing system that includes a back end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front end component (e.g., a user computer having a graphical user interface or a Web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back end, middleware, or front end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network (LAN), a wide area network (WAN), and the Internet.

[0099] It should be understood that various forms of flow shown above can be used, with steps reordered, added, or removed. For example, steps recited in the present disclosure can be performed in parallel, in series, or in a different order, without limitation herein, so long as the desired results of the technology disclosed in the present disclosure are achieved.

[0100] The foregoing description of specific exemplary embodiments of the disclosure has been presented for the purposes of illustration and description. It is not intended to be a limitation on the broad concepts disclosed herein. Numerous changes, alterations, and modifications to the specific embodiments disclosed herein will be apparent to others skilled in the art in light of the above teachings. The specific exemplary embodiments disclosed herein are illustrative only and other than the limits of the patent and language expressly recited in the claims set forth below. The scope of the disclosure is intended to be limited only by the claims set forth below.

Claims

1. A method for generating a document, the method comprising: obtaining a document to be processed; performing page element attribute and page element relationship analysis on the document to be processed to obtain a page element analysis result; constructing an initial graph structure based on the page element analysis result; the constructing of the initial graph structure based on the page element analysis result comprises: determining a node based on a page element in the page element analysis result; determining an edge based on a relationship in the page element analysis result; adding a key attribute in the page element analysis result to an attribute of the node, and connecting the nodes according to the relationship to obtain the initial graph structure; performing an operation on the initial graph structure based on a document generation requirement input by a user to obtain an operation graph structure; the performing of the operation on the initial graph structure based on the document generation requirement input by the user to obtain the operation graph structure comprises: determining a target element of a target document, a relationship of the target element, and an attribute of the target element based on the document generation requirement input by the user; modifying the initial graph structure based on the target element of the target document, the relationship of the target element, and the attribute of the target element to obtain the operation graph structure; obtaining the target document based on the operation graph structure.

2. The method of claim 1, wherein, the performing of the page element attribute and page element relationship analysis on the document to be processed to obtain the page element analysis result comprises: performing page layout analysis on the document to be processed by using an artificial intelligence model to obtain an element analysis result and a relationship analysis result; identifying a page element and a key attribute of the page element in each page based on the element analysis result; determining a relationship of all page elements in the document to be processed based on the relationship analysis result; taking the page element, the key attribute, and the relationship as the page element analysis result.

3. The method of claim 1, wherein, the performing of the page element attribute and page element relationship analysis on the document to be processed to obtain the page element analysis result comprises: determining task information of different agents in all agents based on the document to be processed; sending the task information to corresponding agents in all agents to enable each agent to analyze a respective page element; obtaining and merging analysis results of all agents to obtain the page element analysis result. 4.The method according to any one of claims 1-3, further comprising: obtaining new translation node information; determining a node to be operated in the initial graph structure based on the new translation node information; translating the node to be operated by using a translation module to obtain an updated node, and adding the updated node to the initial graph structure. 5.The method according to any one of claims 1-3, further comprising: obtaining new picture node information; determining a target node region in the initial graph structure based on the new picture node information; generating a picture node by using a picture generation module, and inserting the picture node into the target node region. 6.A device for generating a document, the device comprising: an obtaining unit configured to obtain a document to be processed; An analyzing unit configured to perform page element attribute and page element relationship analysis on the document to be processed to obtain a page element analysis result; A constructing unit configured to construct an initial graph structure based on the page element analysis result; The constructing unit is configured to determine a node based on a page element in the page element analysis result; determine an edge based on a relationship in the page element analysis result; add a key attribute in the page element analysis result to an attribute of the node, and connect the nodes according to the relationship to obtain an initial graph structure; An operating unit configured to operate the initial graph structure based on a document generation requirement input by a user to obtain an operating graph structure; the operating unit is configured to determine a target element of a target document, a relationship of the target element, and an attribute of the target element based on the document generation requirement input by the user; modify the initial graph structure based on the target element of the target document, the relationship of the target element, and the attribute of the target element to obtain the operating graph structure; A obtaining unit configured to obtain a target document based on the operating graph structure.

7. An electronic device, comprising: comprise: at least one processor; and a memory connected in communication with the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-5.

8. A non-transitory computer-readable storage medium having stored thereon computer instructions, wherein, The computer instructions are used to enable the computer to perform the method of any one of claims 1-5.

Citation Information

Patent Citations

  • Method and device for abstracting document structure

    CN102982010A

  • Page layout method and device, equipment and medium

    CN114579912A