Document processing method and apparatus, and computer program product
By automatically identifying and matching the layout information of document objects, and adding them from the first document to the target page of the second document, the problems of complex operation and low efficiency in the existing technology are solved, and efficient and visually consistent information entry of documents of different formats is achieved.
Patent Information
- Application Number
- PCT/CN2025/136136
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2024-11-20
- Filing Date
- 2025-11-19
- Publication Date
- 2026-05-28
Smart Images

Figure CN2025136136_28052026_PF_FP_ABST
Abstract
Description
Document processing methods, devices and computer programs
[0001] This application claims priority to Chinese Patent Application No. 202411666273.X, filed on November 20, 2024, entitled "Document Processing Method, Apparatus and Computer Program Product", the entire contents of which are incorporated herein by reference. Technical Field
[0002] This disclosure relates to the field of document processing technology, and in particular to a document processing method, apparatus, and computer program product. Background Technology
[0003] Electronic documents, as carriers of information, can contain various forms of content, including text, images, audio, and video. Electronic documents can include, but are not limited to, text documents, presentation documents, and spreadsheet documents. Presentation documents can include PowerPoint documents and PDFs; text documents can include Word documents; and spreadsheet documents can include Excel spreadsheets.
[0004] When users need to create documents on the same theme for different scenarios, they must manually layout and input information based on the requirements of each scenario to obtain documents suitable for each. For example, during graduation, in addition to creating a graduation thesis, users also need to create a PPT file for the thesis defense. This requires a lot of time and effort for layout and information input, is complex and inefficient, and makes it difficult to guarantee visual quality. Summary of the Invention
[0005] To overcome the problems existing in related technologies, this disclosure provides a document processing method, apparatus, and computer program product. It not only simplifies operation and improves the efficiency of information entry, but also ensures visual consistency while maintaining the integrity of the second document.
[0006] According to a first aspect of the present disclosure, a document processing method is provided, comprising:
[0007] In response to a trigger operation on a first document, a target object is determined from the first document, and the layout information of the target object in the first document is obtained;
[0008] Based on the layout information of the target object in the first document, the target object is added to the target page in the second document that matches the target object, thus obtaining the target document;
[0009] The first document and the second document have different document formats.
[0010] According to a second aspect of the present disclosure, a document processing apparatus is provided, comprising:
[0011] The first determining module is configured to determine a target object from the first document in response to a triggering operation on the first document, and obtain the layout information of the target object in the first document;
[0012] The generation module is configured to add the target object to a target page in a second document that matches the target object, based on the layout information of the target object in the first document, to obtain the target document;
[0013] The first document and the second document have different document formats.
[0014] According to a third aspect of the present disclosure, an electronic device is provided, comprising:
[0015] processor;
[0016] Memory used to store computer programs or instructions;
[0017] The processor executes the computer program or instructions to implement the steps of the method described in any one of the first aspects above.
[0018] According to a fourth aspect of the present disclosure, a non-transitory computer-readable storage medium is provided, the storage medium storing a computer program or instructions that, when executed by a processor, implement the steps of the method described in any one of the first aspects.
[0019] According to a fifth aspect of the present disclosure, a computer program product is provided, including a computer program or instructions, which, when executed by a processor, implement the steps of the method described in any one of the first aspects.
[0020] The technical solutions provided by the embodiments of this disclosure may include the following beneficial effects:
[0021] In this embodiment of the disclosure, the target object and its layout information in the first document can be automatically identified from the first document, the target page matching the target object can be determined from the second document, and the target object can be added to the target page based on its layout information in the first document to obtain the target document.
[0022] Firstly, it can automatically match target objects from a first document to target pages in a second document, enabling automatic content entry for documents of different formats without additional steps and improving data entry efficiency. Secondly, based on the layout information of the target object in the first document, it adds the target object to the target page, enhancing the visual appeal of the second document after adding it to a document with a different format.
[0023] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description
[0024] The accompanying drawings, which are incorporated in and form a part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure.
[0025] Figure 1 is a flowchart illustrating a document processing method according to an exemplary embodiment.
[0026] Figure 2 is a flowchart of a document processing method according to an exemplary embodiment.
[0027] Figure 3 is a flowchart illustrating the determination of a target object according to an exemplary embodiment.
[0028] Figure 4 is a flowchart illustrating the process of obtaining a target document according to an exemplary embodiment.
[0029] Figure 5 is a schematic diagram of the hierarchical structure of a document according to an exemplary embodiment.
[0030] Figure 6 is a flowchart illustrating the process of obtaining a target document according to an exemplary embodiment.
[0031] Figure 7 is a flowchart illustrating the determination of a target page according to an exemplary embodiment.
[0032] Figure 8 is a flowchart illustrating the process of obtaining first text content according to an exemplary embodiment.
[0033] Figure 9 is a flowchart illustrating the process of obtaining analysis results according to an exemplary embodiment.
[0034] Figure 10 is a flowchart illustrating the determination of a target page according to an exemplary embodiment.
[0035] Figure 11 is a flowchart illustrating the process of obtaining first text content according to an exemplary embodiment.
[0036] Figure 12 is a flowchart illustrating the process of determining the associated objects of a target object according to an exemplary embodiment.
[0037] Figure 13 is a flowchart illustrating the process of determining the associated objects of a target object according to an exemplary embodiment.
[0038] Figure 14 is a flowchart illustrating the establishment of an association between a target object and a target page according to an exemplary embodiment.
[0039] Figure 15 is a flowchart illustrating the process of obtaining a target document according to an exemplary embodiment.
[0040] Figure 16 is a schematic diagram illustrating the first text content according to an exemplary embodiment.
[0041] Figure 17 is a schematic diagram illustrating a second text content according to an exemplary embodiment.
[0042] Figure 18 is a schematic diagram illustrating the association between a target object and a target page according to an exemplary embodiment.
[0043] Figure 19 is a flowchart illustrating the addition of a target object to a target page according to an exemplary embodiment.
[0044] Figure 20 is a flowchart illustrating the process of obtaining a target document according to an exemplary embodiment.
[0045] Figure 21 is a flowchart illustrating the process of obtaining a target document according to an exemplary embodiment.
[0046] Figure 22 is a schematic diagram of a target page for inserting a target object, according to an exemplary embodiment.
[0047] Figure 23 is a schematic diagram of a target page for inserting a target object, according to an exemplary embodiment.
[0048] Figure 24 is a flowchart illustrating the insertion of each group of target objects into the target page and associated page according to an exemplary embodiment.
[0049] Figure 25 is a schematic diagram of a target page for inserting a target object, according to an exemplary embodiment.
[0050] Figure 26 is a schematic diagram of a target page for inserting a target object, according to an exemplary embodiment.
[0051] Figure 27 is a flowchart illustrating the determination of layout information of each target object in a second document according to an exemplary embodiment.
[0052] Figure 28 is a flowchart illustrating the process of obtaining a target document according to an exemplary embodiment.
[0053] Figure 29 is a flowchart illustrating the determination of a target text box according to an exemplary embodiment.
[0054] Figure 30 is a flowchart of a document processing method according to an exemplary embodiment.
[0055] Figure 31 is a block diagram of a document processing apparatus according to an exemplary embodiment.
[0056] Figure 32 is a schematic diagram of the structure of an electronic device according to an exemplary embodiment. Detailed Implementation
[0057] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numerals in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this disclosure. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this disclosure as detailed in the appended claims.
[0058] Figure 1 is a flowchart illustrating a document processing method according to an exemplary embodiment. As shown in Figure 1, the method mainly includes the following steps:
[0059] In step 101, in response to the triggering operation on the first document, the target object is determined from the first document, and the layout information of the target object in the first document is obtained;
[0060] In step 102, based on the layout information of the target object in the first document, the target object is added to the target page in the second document that matches the target object, thus obtaining the target document;
[0061] The first and second documents have different document formats.
[0062] It should be noted that the document processing method proposed in this disclosure can be applied to electronic devices or servers. Here, electronic devices can include terminal devices, such as mobile terminals or fixed terminals. Mobile terminals can include mobile phones, tablets, laptops, etc. Fixed terminals can include desktop computers, smart TVs, etc. A server, as a type of computer, can provide computing or application services to other client machines (such as computers, smartphones, and even large equipment like train systems) on a network.
[0063] The document processing method in this embodiment can be configured in a document processing device, which can be located in a server or in an electronic device. This embodiment does not limit this.
[0064] It should be noted that the execution entity of the embodiments disclosed herein may be, in hardware, a central processing unit (CPU) in a server or electronic device, and in software, a related background service in a server or electronic device, without limitation.
[0065] In this embodiment of the disclosure, the first document and the second document have different document formats. For example, the first document is a text document and the second document is a presentation document; or, the first document is a presentation document and the second document is a text document, etc.; or the first document is a text document and the second document is a table document, etc.
[0066] It should be noted that presentation documents can include documents or software applications used to display information, data, and tutorials. Presentation documents typically contain visual elements and convey these visual elements to the user in the form of pages. These visual elements can include charts, images, videos, and text. For example, the presentation documents provided in this disclosure can include: PowerPoint presentations (PPT documents, also known as PPT files), Portable Document Format (PDF) documents, interactive presentation documents (e.g., application files for web pages), Keynote presentations, etc.
[0067] Text documents are primarily text-based and used to record and transmit information, focusing mainly on the expression of textual content. For example, the text documents provided in this disclosure may include documents in formats such as .doc, .docx, and .txt, and for instance, may be Word documents.
[0068] Tabular documents primarily organize data in tabular form for data processing and analysis. For example, the tabular documents provided in this disclosure may include documents in formats such as .xls, .xlsx, and .csv; for instance, tabular documents may include Excel spreadsheets.
[0069] In this embodiment of the disclosure, the triggering operation for the first document can be an operation that instructs the insertion of the target object in the first document into the target page of the second document.
[0070] In some embodiments, the triggering operation can be a selection operation initiated based on a first document. For example, by selecting a second document from the first document into which the target object needs to be inserted.
[0071] For example, a first control can be displayed in a first document, and a trigger operation can be performed based on the first control. For instance, if an operation on the first control is detected, it is determined that a trigger operation has been detected, and a second document can be selected based on the operation on the first control. In other embodiments, the trigger operation can also be a set of operations performed on the first document. For example, after a selection operation on the first document is detected, at least one second control can be displayed based on the selection operation. If an operation on a first target control among the at least one second control is detected, it is determined that a trigger operation has been detected, and a second document is selected based on the first target control. For example, each second control can be associated with a different document, wherein the first target control can be a control corresponding to a second document.
[0072] In other embodiments, the first document to be used can be selected in the second document by adding or modifying content, and then the target object selected from the first document can be added to the target page of the second document.
[0073] For example, a third control can be displayed in the second document, and a trigger operation can be performed based on the third control. For instance, if an operation on the third control is detected, it is determined that a trigger operation has been detected, and a first document can be selected based on the operation on the third control. In other embodiments, the trigger operation can also be a set of operations performed on the second document. For example, after a selection operation on the second document is detected, at least one fourth control can be displayed based on the selection operation. If an operation on a second target control within the at least one fourth control is detected, it is determined that a trigger operation has been detected, and a first document is selected based on the second target control. For example, each fourth control can be associated with a different document, wherein the second target control can be a control corresponding to the first document.
[0074] In other embodiments, a preset interface may be displayed on the current interface, and a trigger operation may be performed based on the preset interface.
[0075] For example, the triggering operation can be the import of a first document and a second document through a preset interface. After detecting the import of the first and second documents through the preset interface, a target object can be determined from the first document, and the target object can be automatically inserted into the target page of the second document. In some embodiments, the preset interface can be an operation window displayed on the current interface, and at least one fifth control can be displayed in the operation window for importing the first and second documents. For example, the preset interface can be displayed floating on the current interface.
[0076] In this embodiment of the disclosure, when a triggering operation on the first document is detected, the target object can be determined from the first document, and the layout information of the target object in the first document can be obtained.
[0077] It should be noted that the target object can be an object in the first document that needs to be inserted into the second document. For example, the target object can be an object in the first document that includes image content and / or table content. The image content can be content that includes at least some image elements, and the table content can be content that includes at least some table elements.
[0078] In some embodiments, the target object can be determined from the first document through a traversal approach. For example, all objects containing image content can be determined from the first document through a traversal approach; and / or, all objects containing table content can be determined from the first document through a traversal approach. Wherein, if the target object only includes images, the target object is an image; if the target object only includes tables, the target object is a table. The target object can also be determined through a retrieval approach.
[0079] In some embodiments, after the target object is determined, the target object can be identified and stored in a preset cache space. The layout information of the target object in the first document can also be obtained.
[0080] It should be noted that the layout information of the target object in the first document may include at least one of the following: the target object's position in the first document, the target object's attribute information, and the target object's style information. Different target objects with different attributes may obtain different layout information. For example, if the target object includes an image, its layout information may include at least one of the following: the image's position in the first document, the image's height, and the image's width. Similarly, if the target object includes a table, its layout information may include at least one of the following: the table's position in the first document, the table's size, and the table's content.
[0081] Taking a text document as an example and a PowerPoint presentation as an example, you can use the Application Programming Interface (API) to iterate through the target objects in the first document.
[0082] For example, using the API of an office application, images and composite objects containing images are traversed in the first document. After traversing to the target object containing the image content, the image name can be determined, and the image name and the target object can be stored as temporary files in a preset cache space. The layout information of the image in the first document can also be obtained, where the layout information may include at least one of the following: the image's position in the entire document (gcpStart), the image's height information, and the image's width information.
[0083] For example, using the API of an office application, the table content in the first document can be traversed. After identifying the target object containing the table content, the table name can be determined, and the table name and target object can be stored as temporary files in a preset cache space. Alternatively, the table content can be converted into image content, and the table name and the converted image content can be stored as target objects in a preset cache space. The layout information of the table in the first document can also be obtained, whereby the layout information may include at least one of the following: the table's position in the full text (gcpStart), the table's height information, and the table's width information.
[0084] In this embodiment of the disclosure, by acquiring and saving the layout information of the target object in the first document, when it is necessary to insert the target object, the layout information of the target object in the first document can be directly obtained from the preset cache space, so as to insert the target object into the target page of the second document (PPT) more accurately.
[0085] It should be noted that, as shown in Figure 2, the target page in the second document that matches the target object can be a page determined based on the attribute information of the target object. The attribute information can be used to indicate the characteristics of the target object.
[0086] For example, if the target object is an object containing image content, the target page can be determined from the second document based on the image's caption information. As another example, if the target object is an object containing table content, the target page can be determined from the second document based on the table's name, and so on.
[0087] After identifying the target page, the target object can be added to the target page of the second document based on the layout information of the target object in the first document, thus obtaining the target document.
[0088] It should be noted that the first document and the target document have different document formats, and the document style, attribute information, and layout style of the first document are also different from those of the target document. The content included in the first document will also be different from that included in the target document.
[0089] In some embodiments, before adding the target object to the target page of the second document, it can be determined whether the target object needs to be adjusted based on the layout information of the target page and / or the layout information of the target object in the first document. If it is determined that the target object needs to be adjusted, the target object can be processed, and the processed target object can be added to the target page.
[0090] For example, if the size of the target object and the size of the target page do not match, the size of the target object can be adjusted, and the adjusted target object can be added to the target page. For instance, if the target object is an image, the image can be processed to obtain multiple consecutive images, and these multiple images can be inserted into the target page to better match the layout of the target page.
[0091] For example, after the target object is identified, the background style of the target page can be adjusted based on the content of the target object, and the target object can be added to the adjusted target page.
[0092] For example, the layout information of the target object in the first document includes: the position information of the target object in the first document. This disclosure can insert the target object into the corresponding position on the target page based on the position information of the target object in the first document. When there are multiple target objects, the arrangement of each target object in the first document and the arrangement in the second document can be the same or different, as long as the target object and the target page match.
[0093] In this embodiment of the disclosure, after the target object is determined, the target object can be adjusted based on the layout information of the target object in the first document and / or the layout information of the target page, and the adjusted target object can be inserted into the target page of the second document.
[0094] Here, adjusting the target object can be done by adjusting its content and / or its arrangement. The target object is the object in the first document into which the second document needs to be inserted.
[0095] In this embodiment of the disclosure, the target object and its layout information in the first document can be automatically identified from the first document, the target page matching the target object can be determined from the second document, and the target object can be added to the target page based on its layout information in the first document to obtain the target document.
[0096] Firstly, it can automatically match target objects from a first document to target pages in a second document, enabling automatic content entry for documents of different formats and improving data entry efficiency. Secondly, based on the layout information of the target object in the first document, it adds the target object to the target page, ensuring visual consistency while maintaining the integrity of the second document after adding the target object to the second document with different formats.
[0097] In some embodiments, in response to a triggering operation on a first document, determining a target object from the first document includes the following steps, as shown in Figure 3:
[0098] In step 301, in response to the triggering operation, the target object is determined from the body portion of the first document;
[0099] Based on the layout information of the target object in the first document, the target object is added to the target page that matches the target object in the second document to obtain the target document. This includes the following steps, as shown in Figure 4:
[0100] In step 401, based on the layout information of the target object in the first document, the target object is added to the target page located in the body part of the second document to obtain the target document.
[0101] It should be noted that the first document includes: text documents; the second document includes: presentation documents; and the target objects include: image content and / or table content.
[0102] This disclosure allows for the determination of a target object from the body of a first document after a triggering operation is detected. The body of the document can be the portion containing the core information and detailed content of the first document.
[0103] Taking a text document as an example, the main body of the first document can include all text areas except for headings, headers, footers, tables of contents, appendices, and other supplementary content. The main body can have a clear structure, including an introduction, body, and conclusion, to facilitate reading. It should have a predefined format, including font, font size, line spacing, and paragraph indentation, to improve readability. The main body contains the core content of the first document, such as analysis, discussion, data, arguments, and evidence. It can include multi-level headings: organizing the document content through multi-level headings makes the document structure clearer. The main body can also include visual elements such as charts, illustrations, and pictures to aid in explaining the text. It can also include citations and footnotes to explain specific content.
[0104] Taking a text document, specifically a thesis, as an example, a thesis formatting recognition module can be used to collect the content of the main text. Similarly, if the target object includes an image, the document can identify objects containing images from the main text and save them as images.
[0105] Taking an object containing table content as an example, the object containing table content can be identified from the body of the first document and saved as an image. For example, the object containing table content can be converted into an image format, which can ensure the integrity of the table content and avoid the table size and font from being deformed due to document format incompatibility.
[0106] Taking a thesis as an example, the main body of the thesis can be a section that does not include a cover page or other content. For example, the main body of the thesis does not include: cover page, abstract, introduction, references, etc. In some embodiments, the encoded expression of the main body can be represented as: mainDocRange = [starting position of the main body in the full text, ending position of the main body in the full text].
[0107] It should be noted that the first document can include: cover, table of contents, abstract, introduction, main text, conclusion, summary, acknowledgments, references, and appendices. If the above categories are defined as sub-documents of the paper, then the key sub-documents of the main text can include: first-level headings, second-level headings, third-level headings, fourth-level headings, main text content, captions, images, and table placeholders. The target object can be the main text section (mainDocRange), including objects containing image content and / or objects containing table content.
[0108] After identifying the main text (mainDocRange) using the paper formatting recognition module, the content of the main text can be identified. For example, sub-documents within the main text can be identified. These sub-documents may include: headings at all levels, content, captions, images, tables, the position of images on the current page, and their position within the entire text. The headings in the main text may include: first-level headings, second-level headings, third-level headings, etc.
[0109] In other embodiments, the first document may be preprocessed before its main body is determined. For example, data cleaning may be performed on the main body of the first document, removing numbers, punctuation marks, and symbols. Taking a thesis as an example, data cleaning may be performed on the headings and main body of the thesis, removing numbers, punctuation marks, and symbols.
[0110] Figure 5 is a schematic diagram of the hierarchical structure of a document according to an exemplary embodiment. As shown in Figure 5, the main body of the document may include: first-level heading 501, second-level heading 502, third-level heading 503, fourth-level heading 504, content 505, captions 506, images 507, and tables 508.
[0111] In other embodiments, after determining the document content to be matched, i.e., the target object, placeholders for the target object in the first document can also be obtained. For example, image placeholders and / or table placeholders to be matched can be extracted.
[0112] Taking a presentation document as an example, the presentation document can include various types of pages. For instance, different types of pages can include: cover pages, body pages, table of contents pages, end pages, decorative pages, data pages, and image pages, etc. The body of the second document refers to its body pages, and the target page matching the target object can be one or more of the body pages of the second document.
[0113] In other embodiments, the first document may also be a presentation document, and the second document may be a text document, as long as the document formats of the first document and the second document are different, which will not be listed here.
[0114] In some embodiments, adding the target object to a target page that matches the target object in a second document to obtain a target document includes the following steps, as shown in Figure 6: In step 601, if the target object includes table content, the table content in the target object is converted into image content to obtain a converted target object; the converted target object is then inserted into the target page to obtain the target document. Converting the target object containing table content into an image format ensures the integrity of the table content and avoids distortion of table size and font due to document format incompatibility.
[0115] In this embodiment, in response to a triggering operation, a target object is determined from the body of a first document; based on the layout information of the target object in the first document, the target object is added to a target page located in the body of a second document, thus obtaining a target document. This allows for the insertion of a target object from the body of a first document into a target page of the body of a second document. By automatically matching the target object from the first document to the target page of the second document, the content of documents with different formats can be automatically entered without additional operations, improving the efficiency of information entry. Furthermore, processing the content of the body reduces noise generated by other non-core content, improving the accuracy of the target document.
[0116] In some embodiments, the method further includes the following steps, as shown in FIG7:
[0117] In step 701, the first text content is obtained based on the target object and its association information in the first document;
[0118] In step 702, the first text content and the second text content of the second document are analyzed to obtain the analysis results;
[0119] In step 703, the target page is determined from the various pages of the second document based on the analysis results.
[0120] Here, after identifying the target object, the first text content can be obtained based on the association information of the target object in the first document, and the first document to be processed can be determined based on the first text content. The first document to be processed can be a collection of first text content. In some embodiments, first index information can be configured for each piece of first text content, and each piece of first text content can be identified based on the first index information to obtain the first document to be processed.
[0121] In other embodiments, a second document to be processed can be determined based on the second text content of the second document. The second document to be processed can be a collection of second text content. In some embodiments, second index information can be configured for each piece of second text content, and each piece of second text content can be identified based on the second index information to obtain the second document to be processed. Analyzing the first and second text content can include analyzing the first and second documents to be processed.
[0122] In some embodiments, each piece of second text content may correspond to a page in the second document, meaning each piece of second text content may correspond to a page in the second document. For example, each piece of second text content may correspond to a main text page in the second document.
[0123] It should be noted that after identifying the target object, its associated information within the first document can be determined. This associated information can include the target object's contextual information within the first document, which may be text information related to the target object within the first document. For example, if the target object includes image content, its associated information could be the text information of the paragraph containing the image content and / or the text information of paragraphs adjacent to the image content.
[0124] In some embodiments, as shown in FIG8, in step 801, the first document can be semantically understood based on a pre-trained semantic analysis model to determine the contextual information of the target object in the first document, and the first text content can be obtained based on the contextual information of the target object in the first document. The semantic analysis model is, for example, a Generative Pre-trained Transformer (GPT) model based on the Transformer architecture.
[0125] After obtaining the first text content, semantic analysis can be performed on the first text content and the second text content of the second document based on a semantic analysis model to obtain the analysis results. It should be noted that the first text content corresponding to a target object can be one or more; the second text content corresponding to a page in the second document can be one or more.
[0126] The analysis results obtained from analyzing the first text content and the second text content can indicate the correlation between the first text content and the second text content. The greater the correlation between the first text content and the second text content, the higher the matching degree between the target object corresponding to the first text content and the page corresponding to the second text content.
[0127] In this embodiment, first text content can be obtained based on the target object and its association information in a first document. Then, based on the analysis results obtained from analyzing the first text content and the second text content of the second document, the target page can be determined from each page of the second document. Determining the first text content jointly using the target object and its association information increases the amount of information in the first text content, making the determined analysis results more comprehensive and accurate, thereby improving the matching degree between the target object and the target page.
[0128] In some embodiments, the analysis of the first text content and the second text content of the second document is performed to obtain the analysis results, including the following steps, as shown in Figure 9:
[0129] In step 901, the first text content and the second text content are analyzed to obtain the similarity between the first text content and the second text content;
[0130] The target page is determined from each page of the second document based on the analysis results, including the following steps, as shown in Figure 10:
[0131] In step 1001, the page containing the second text content, which has a similarity to the first text content greater than a preset threshold, is determined as the target page.
[0132] In some embodiments, semantic analysis can be performed on the first text content and the second text content based on a pre-trained semantic analysis model to obtain the similarity between the first text content and the second text content. The semantic analysis model may include a Generative Pre-trained Transformer (GPT) model based on the Transformer architecture. For example, the first text content and the second text content can be input into the GPT model, and the similarity between the first text content and the second text content can be output.
[0133] After obtaining the similarity between the first text content and the second text content, it can be determined whether the similarity between the first text content and the second text content is greater than a preset threshold. If the similarity between the first text content and the second text content is less than or equal to the first threshold, it is determined that the page containing the second text content is not the target page. If the semantic similarity between the first text content and the second text content is greater than the first threshold, it is determined that the page containing the second text content is the target page.
[0134] The similarity between the first text content and the second text content can be considered as the semantic similarity between the two text contents. That is, semantic understanding can be performed on both the first and second text contents, and then the semantic similarity between the first and second text contents can be obtained based on the results of the semantic understanding.
[0135] In this embodiment of the disclosure, by performing semantic analysis on the first text content and the second text content, the similarity between the first text content and the second text content is determined, and the page containing the second text content whose similarity to the first text content is greater than a preset threshold is determined as the target page. This can make the determined target page match the target object more accurately, thereby improving the accuracy of the determined target document.
[0136] In some embodiments, the first text content is obtained based on the target object and its association information in the first document, including the following steps, as shown in Figure 11:
[0137] In step 1101, based on the association information of the target object in the first document, the associated objects of the target object are determined from the first document;
[0138] In step 1102, the text content in the associated object is determined as the first text content.
[0139] Taking the context information of the target object in the first document as an example, as shown in Figure 12, in step 1201, the associated objects of the target object can be determined from the first document based on the context information of the target object in the first document. The associated objects may include: the target paragraph where the target object is located and / or the paragraph adjacent to the target paragraph.
[0140] In some embodiments, determining the associated objects of the target object from the first document based on the association information of the target object in the first document includes the following steps, as shown in Figure 13:
[0141] In step 1301, if the number of target objects is less than or equal to a first preset number, a first number of associated objects are determined from the first document based on the association information;
[0142] In step 1302, if the number of target objects is greater than the first preset number, a second number of associated objects are determined from the first document based on the association information.
[0143] The first quantity is greater than the second quantity.
[0144] In this embodiment of the disclosure, after identifying the target objects, the number of identified target objects can be counted, and the number of associated objects can be determined based on the number of target objects. Different numbers of identified target objects will result in different numbers of associated objects. For example, the number of target objects and the number of associated objects are negatively correlated; that is, the fewer the number of target objects, the more associated objects there are, and vice versa.
[0145] In this embodiment of the disclosure, when the number of target objects is less than or equal to a first preset number, a first number of associated objects are determined from a first document based on the association relationship; and when the number of target objects is greater than the first preset number, a second number of associated objects are determined from the first document based on the association relationship, wherein the first number is greater than the second number. The first preset number can be determined as needed; for example, the first preset number can be 30.
[0146] For example, if the target objects are the images and tables in the first document, then the number of target objects is the total number of images and tables. If the total number of images and tables is greater than 30, then the non-blank paragraphs above and below the target objects, as well as the paragraphs containing the images and tables with captions, are identified as associated objects.
[0147] If the total number of images and tables is less than or equal to 30, then the third-level headings containing images and tables, the entire body text of the third-level headings, captions, placeholders for images and tables, the second-level headings corresponding to the third-level headings, and the paragraphs containing the first-level headings will be identified as associated objects.
[0148] After identifying the associated objects, the text content in the associated objects can be designated as the first text content, and each first text content can be sorted according to the document order. For example, the first text content is identified by the first index information (P), the caption is displayed in the original text, the table placeholder is identified by [^T1], and the image placeholder is identified by [^S1].
[0149] In this embodiment of the disclosure, by associating the number of target objects with the number of associated objects, the number of associated objects to be determined can be dynamically determined based on the number of target objects. When the number of target objects is large, the number of associated objects to be determined is small, which reduces the amount of data to be analyzed and improves data processing efficiency; when the number of target objects is small, the number of associated objects to be determined is large, which improves the accuracy of the first text content.
[0150] After identifying the associated object, the text content within the associated object can be designated as the first text content.
[0151] For example, after determining the target paragraph containing the target object and / or the paragraphs adjacent to the target paragraph, the text content in the target paragraph containing the target object and / or the paragraphs adjacent to the target paragraph can be determined as the first text content.
[0152] In some embodiments, each first text content can be stored in the form of paragraphs. For example, one paragraph corresponds to one first text content. Exemplarily, a target paragraph corresponds to one text content, a first paragraph adjacent to the target paragraph corresponds to one first text content, and a second paragraph adjacent to the target paragraph corresponds to one first text content.
[0153] By mapping each piece of first text to a paragraph, it becomes easier to analyze the text content.
[0154] In this embodiment of the disclosure, the associated objects of the target object can be determined from the first document based on the association information of the target object in the first document. Since the associated objects include the target paragraph where the target object is located and / or the paragraphs adjacent to the target paragraph, the text content in the associated objects is determined as the first text content. By fully understanding the association information and obtaining the first text content, the accuracy of the analysis can be improved, thereby improving the matching degree between the target object and the target page, and improving the accuracy of the obtained target document.
[0155] In some embodiments, the first text content has first index information, and the second text content has second index information; when the target page is determined, the method further includes the following steps, as shown in Figure 14:
[0156] In step 1401, the association between the target object and the target page is established based on the first index information and the second index information;
[0157] Add the target object to the target page that matches the target object in the second document to obtain the target document. This includes the following steps, as shown in Figure 15:
[0158] In step 1501, based on the association relationship, the target object is added to the target page in the second document that matches the target object, thus obtaining the target document.
[0159] It should be noted that index information is used to indicate the position of text content within a document. For example, first index information indicates the position of first text content in the first document, and second index information indicates the position of second text content in the second document.
[0160] Figure 16 shows the first text content identified by the first index information P3; Figure 17 shows the second text content identified by the second index information DG21. In Figure 16, P3 corresponds to the target object, while P1 and P2 correspond to the associated objects of the target object. In Figure 17, the pages corresponding to DG19, DG20, and DG22 are adjacent to or separated from the page corresponding to DG21, respectively.
[0161] If a second text content (DG21) with a similarity greater than a preset threshold to the first text content (P3) is identified, the association between the first index information of the target object ([^T2]) corresponding to the first text content (P3) and the second text content (DG21) can be established, as shown in the first row of Figure 18.
[0162] The relationships in this disclosure can be represented as shown in Figure 18. Here, "src" represents a placeholder for the target object, such as a placeholder for an image or table; "id" represents the caption of the target object; "name" represents the name of the target object, such as the name of an image or table; "paraId" represents the first index information of the first text content corresponding to the target object; and "level" represents the second index information of the second text content.
[0163] In this embodiment of the disclosure, by configuring first index information for the first text content, configuring second index information for the second text content, and establishing an association between the target object and the target page based on the first index information and the second index information, and then adding the target object to the target page that matches the target object in the second document based on the association, the target document is obtained, which can improve the matching efficiency between the target object and the target page.
[0164] In some embodiments, the target object is added to the target page based on the layout information of the target object in the first document, including the following steps, as shown in Figure 19:
[0165] In step 1901, based on the layout information of the target object in the first document and / or the layout information of the target page, the target object is adjusted to obtain the adjusted target object, and the adjusted target object is inserted into the target page; and / or,
[0166] In step 1902, based on the layout information of the target object in the first document and / or the layout information of the target page, the layout style of the target page is adjusted to obtain the adjusted target page, and the target object is inserted into the adjusted target page.
[0167] It should be noted that the layout information of the target object in the first document may include at least one of the following: the target object's position in the first document, the target object's size information, and the target object's style information. Taking an object that includes image content as an example, the layout information of the target object may include at least one of the following: the image's layout position in the first document, the image's height information, and the image's width information.
[0168] The layout information of the target page may include at least one of the following: the layout style of the target page, the layout size of the target page, the background style of the target page, the template of the target page, etc.
[0169] Adjustments to the target object include at least one of the following: adjusting the size of the target object; adjusting the content of the target object; adjusting the layout style of the target object; adjusting the format of the target object, etc.
[0170] Adjustments to the target page include at least one of the following: adjusting the layout style of the target page; adjusting the displayed content of the target page; adjusting the background style of the target page, etc.
[0171] For example, if it is determined that the size of the target object and the size of the target page do not match based on the layout information of the target object in the first document and / or the layout information of the target page, the size of the target object can be adjusted to obtain an adjusted target object, and the adjusted target object can be inserted into the target page. For example, if the initial size of the target object is larger than the display size of the target page, the target object can be shrunk, and the shrunk target object can be inserted into the target page.
[0172] For example, if the target position of the target object is determined based on the layout information of the target object in the first document and / or the layout information of the target page, the content located at the target position in the target page can be moved to a non-target position to obtain an adjusted target page, and the target object can be inserted at the target position of the target page.
[0173] In this embodiment of the disclosure, by adjusting the layout style of the target object and / or the target page, the matching degree between the target object and the target page can be improved, making the determined target document more in line with user needs.
[0174] In some embodiments, based on the layout information of the target object in the first document, the target object is added to the target page in the second document that matches the target object to obtain the target document, including the following steps, as shown in Figure 20:
[0175] In step 2001, if the number of target objects corresponding to the same target page is less than or equal to the second preset number, based on the layout information of the target objects in the first document, each target object is inserted into the same target page to obtain the target document;
[0176] In step 2002, if the number of target objects corresponding to the same target page is greater than the second preset number, the target objects are grouped and inserted into the target page and the associated page of the target page based on the layout information of the target objects in the first document.
[0177] The associated pages include: pages created based on the target page and / or pages in the second document that are related to the target page.
[0178] In some embodiments, each target object can be scaled down or enlarged, and the scaled-down or enlarged target object can be inserted into the target page.
[0179] In some embodiments, based on the layout information of the target object in the first document, the target object is added to the target page in the second document that matches the target object to obtain the target document. This includes the following steps, as shown in Figure 21: In step 2101, based on the layout information of the target object in the first document, the target object and its annotation information are added to the target page in the second document that matches the target object to obtain the target document. The annotation information of the target object includes: the target object's caption.
[0180] It should be noted that each target page can correspond to one or more target objects. As shown in Figure 18, target objects [^T5], [^S2], and [^S3] all correspond to the target page where the second text content DG31 is located, meaning that the same target page corresponds to three target objects.
[0181] In some embodiments, the second preset quantity can be determined based on the layout information of the target page, for example, it can be determined based on the maximum number of layout objects that can be placed on the target page. In other embodiments, the second preset quantity can also be customized; for example, it can be two, which can be automatically adjusted by the user as needed.
[0182] In this embodiment of the disclosure, when the number of target objects corresponding to the same target page is less than or equal to a second preset number, each target object can be inserted into the same target page based on the layout information of the target objects in the first document. For example, when there is only one target object, it can be inserted into the middle position of the target page based on its position information in the first document.
[0183] When there are two target objects, both target objects are positioned in the center of the target page, and their respective positions on the target page are determined according to their positions in the first document. For example, if the first target object is located before the second target object in the first document, then if the two target objects are arranged horizontally, the first target object will be to the left of the second target object on the target page; if the two target objects are arranged vertically, the first target object will be above the second target object.
[0184] As shown in Figures 22 and 23, when there are two target objects, the two target objects are of the same type. As shown in Figure 22, the target objects may include the first table image 601 and the second table image 602. The two target objects may also be of different types. As shown in Figure 23, the target objects may include table images 701 and 702.
[0185] If the number of target objects corresponding to the same target page is greater than the second preset number, the target objects can be grouped and inserted into the target page and the associated pages of the target page based on the layout information of the target objects in the first document; wherein, the associated pages include: pages created based on the target page and / or pages in the second document that have a relationship with the target page.
[0186] Here, the associated page can be a page created based on the target page. In this case, the layout of the associated page is the same as that of the target page. The associated page can also be a page that has a relationship with the target page; for example, it can be a page adjacent to the target page.
[0187] In this embodiment of the disclosure, target objects can be inserted into the second document in different ways based on the number of target objects corresponding to the same target page. When the number of target objects corresponding to the same target page is relatively small, the target objects can be inserted into the same target page in a unified layout manner, which can achieve visual uniformity. When the number of target objects corresponding to the same target page is relatively large, the target objects can be grouped and inserted into the target page and the associated pages of the target page, which can ensure the clarity and categorized display of each target object while achieving visual uniformity.
[0188] In some embodiments, when the number of target objects corresponding to the same target page is greater than a second preset number, based on the layout information of the target objects in the first document, each target object is grouped and inserted into the target page and the associated page of the target page, including the following steps, as shown in Figure 24:
[0189] In step 2401, if the number of target objects corresponding to the same target page is greater than the second preset number, the target objects are grouped based on the type of the target objects and the preset reference number.
[0190] In step 2402, based on the layout information of the target objects in the first document, each group of target objects is inserted into the target page and the associated page respectively.
[0191] In some embodiments, the preset reference number can be determined based on the layout information of the target page, for example, based on the maximum number of layout objects that can be placed on the target page. In other embodiments, the preset reference number can also be customized; for example, it can be three, which can be automatically adjusted by the user as needed.
[0192] In this embodiment of the disclosure, when the number of target objects corresponding to the same target page is greater than a second preset number, the target objects can be grouped based on the type of the target objects and a preset reference number. For example, target objects of the same type can be grouped together, and the number of target objects in each group is equal to the preset reference number. For example, target objects including image content can be grouped together, and target objects including table content can be grouped together.
[0193] Once the target objects for each group are obtained, they can be inserted into the target page and related page respectively, based on the layout information of the target objects in the first document.
[0194] As shown in Figures 25 and 26, when the target objects include table content and image content, three target objects including table content can be inserted into the target page 801, and three target objects including image content can be inserted into the associated page 901 of the target page 801. The associated page 901 is the next page of the target page 801.
[0195] In some embodiments, after grouping the target objects, as shown in FIG27, in step 2701, the layout information of each target object in the second document can be determined based on the layout information of each target object in the first document. For example, the arrangement order of each target object in the second document can be determined based on the position information of each target object in the first document.
[0196] When inserting the target object into the target page and / or related pages, the target object's annotation information (caption) is also inserted into the target page and / or related pages.
[0197] In this embodiment of the disclosure, when there are a large number of target objects, the target objects can be grouped based on their type and a preset reference quantity. Based on the layout information of the target objects in the first document, each group of target objects can be inserted into the target page and the associated page respectively. This allows target objects of the same type to be inserted into the same page, making the visual format of each page in the target document more uniform.
[0198] In some embodiments, the target object is added to the target page in the second document that matches the target object to obtain the target document, including the following steps, as shown in Figure 28:
[0199] In step 2801, in response to adding the target object to the target page, non-target objects except for the target text box are deleted from the target page to obtain the target document.
[0200] Here, the target text box can be the first text box on the target page.
[0201] In this embodiment of the disclosure, after adding the target object to the target page, non-target objects (excluding the target text box) can be deleted from the target page to obtain the target document. This highlights the target object and reduces interference from non-target objects in the display of the target object. Since the target text box is likely the title of the target page, retaining the target text box improves the readability of the target document.
[0202] In other embodiments, as shown in FIG29, in step 2901, a target text box can be determined from the target page based on the first text content corresponding to the target object and the second text content corresponding to the target page. For example, the text box containing the text with the highest similarity to the first text content corresponding to the target object can be determined as the target text box.
[0203] Figure 30 is a flowchart of a document processing method according to an exemplary embodiment. As shown in Figure 30, the method mainly includes the following steps:
[0204] In step 3001, the main body of the first document is determined;
[0205] In step 3002, the target object is determined from the body of the first document;
[0206] In step 3003, the layout information of the target object in the first document is obtained;
[0207] In step 3004, it is determined whether the number of target objects is greater than the first preset number. If the number of target objects is greater than the first preset number, step 3005 is executed; otherwise, step 3006 is executed.
[0208] In step 3005, a second number of associated objects are determined from the first document;
[0209] In step 3006, a first number of associated objects are determined from the first document;
[0210] In step 3007, the text content in the associated object is determined as the first text content;
[0211] In step 3008, the first text content and the second text content in the second document are analyzed to obtain the analysis results. Based on the analysis results, the target page is determined from the pages of the second document. Based on the first index information of the first text content and the second index information of the second text content, the association between the target object and the target page is established.
[0212] In step 3009, based on the association and the current scenario, the target object is added to the target page in the second document that matches the target object;
[0213] In step 3010, if the number of target objects corresponding to the same target page is less than or equal to the second preset number, the target objects are inserted into the same target page based on the layout information of the target objects in the first document.
[0214] In step 3011, if the number of target objects corresponding to the same target page is greater than the second preset number, the target objects are grouped and inserted into the target page and the associated page of the target page based on the layout information of the target objects in the first document.
[0215] In step 3012, the target document is obtained.
[0216] Figure 31 is a block diagram of a document processing apparatus according to an exemplary embodiment. As shown in Figure 31, the apparatus 3100 mainly includes:
[0217] The first determining module 3101 is configured to determine a target object from the first document in response to a triggering operation on the first document, and obtain the layout information of the target object in the first document;
[0218] The generation module 3102 is configured to add the target object to a target page in a second document that matches the target object based on the layout information of the target object in the first document, thereby obtaining a target document;
[0219] The first document and the second document have different document formats.
[0220] In some embodiments, the device 3100 further includes:
[0221] The second determining module is configured to obtain the first text content based on the target object and the association information of the target object in the first document;
[0222] The analysis module is configured to analyze the first text content and the second text content of the second document to obtain analysis results;
[0223] The third determining module is configured to determine the target page from the pages of the second document based on the analysis results.
[0224] In some embodiments, the analysis module is configured to:
[0225] The first text content and the second text content are analyzed to obtain the similarity between the first text content and the second text content;
[0226] The third determining module is configured as follows:
[0227] The page containing the second text content, whose similarity to the first text content is greater than a preset threshold, is determined as the target page.
[0228] In some embodiments, the first text content has first index information, and the second text content has second index information; when the target page is determined, the device 3100 further includes:
[0229] The building module is configured to establish an association between the target object and the target page based on the first index information and the second index information;
[0230] The generation module 3102 is configured as follows:
[0231] Based on the aforementioned association, the target object is added to the target page in the second document that matches the target object, thus obtaining the target document.
[0232] In some embodiments, the second determining module is configured to:
[0233] Based on the association information of the target object in the first document, determine the associated object of the target object from the first document;
[0234] The text content in the associated object is determined to be the first text content.
[0235] In some embodiments, the second determining module is configured to:
[0236] If the number of target objects is less than or equal to a first preset number, a first number of associated objects are determined from the first document based on the association information.
[0237] If the number of target objects is greater than the first preset number, a second number of associated objects are determined from the first document based on the association information.
[0238] In some embodiments, the generation module 3102 is configured to:
[0239] Based on the layout information of the target object in the first document and / or the layout information of the target page, the target object is adjusted to obtain an adjusted target object, and the adjusted target object is inserted into the target page; and / or,
[0240] Based on the layout information of the target object in the first document and / or the layout information of the target page, the layout style of the target page is adjusted to obtain the adjusted target page, and the target object is inserted into the adjusted target page.
[0241] In some embodiments, the generation module 3102 is configured to:
[0242] If the number of target objects corresponding to the same target page is less than or equal to the second preset number, based on the layout information of the target objects in the first document, each target object is inserted into the same target page to obtain the target document;
[0243] If the number of target objects corresponding to the same target page is greater than the second preset number, based on the layout information of the target objects in the first document, each target object is grouped and inserted into the target page and the associated page of the target page;
[0244] The associated pages include: pages created based on the target page and / or pages in the second document that are associated with the target page.
[0245] In some embodiments, the generation module 3102 is configured to:
[0246] If the number of target objects corresponding to the same target page is greater than the second preset number, the target objects are grouped based on the type of the target objects and the preset reference number;
[0247] Based on the layout information of the target object in the first document, each group of the target objects is inserted into the target page and the associated page respectively.
[0248] In some embodiments, the first determining module 3101 is configured to:
[0249] In response to the triggering operation, the target object is determined from the body portion of the first document;
[0250] The step of adding the target object to a target page in a second document that matches the target object based on the layout information of the target object in the first document, thereby obtaining a target document, includes:
[0251] Based on the layout information of the target object in the first document, the target object is added to the target page located in the body of the second document to obtain the target document.
[0252] In some embodiments, the generation module 3102 is configured to:
[0253] In response to adding the target object to the target page, delete the non-target objects in the target page except for the target text box, and obtain the target document.
[0254] Regarding the apparatus in the above embodiments, the specific manner in which each module performs its operation has been described in detail in the embodiments related to the method, and will not be elaborated upon here.
[0255] Based on the same inventive concept, this disclosure provides an electronic device, which can be a computer or terminal as described in one or more of the above embodiments. Figure 32 is a schematic diagram of the structure of an electronic device according to an exemplary embodiment. As shown in Figure 32, the electronic device 3200 adopts general-purpose computer hardware and includes a processor 3201, a memory 3202, a bus 3203, an input device 3204, and an output device 3205.
[0256] In some possible implementations, memory 3202 may include computer storage media in the form of volatile and / or non-volatile memory, such as read-only memory and / or random access memory. Memory 3202 may store operating system, application programs, other program modules, executable code, program data, user data, etc.
[0257] Input device 3204 can be used to input commands and information into electronic devices. Input device 3204 may be a keyboard or pointing device such as a mouse, trackball, touchpad, microphone, joystick, gamepad, satellite TV antenna, scanner, or similar device. Input device 3204 can be connected to processor 3201 via bus 3203.
[0258] Output device 3205 can be used by electronic device 3200 to output information. In addition to monitors, output device 3205 can also be used as other peripheral output devices, such as speakers and / or printing devices. Output device 3205 can also be connected to processor 3201 via bus 3203.
[0259] Electronic device 3200 can be connected to a network, such as a local area network (LAN), via antenna 3206. In a networked environment, executable instructions can be stored in a remote storage device, not just in local storage.
[0260] When the processor 3201 in the electronic device 3200 executes the executable code or application stored in the memory 3202, the electronic device 3200 can implement the file processing method in the above embodiments. For the specific execution process, please refer to the above embodiments, which will not be repeated here.
[0261] The aforementioned memory 3202 may store executable instructions for implementing the functions of the first determining module 3101 and the generating module 3102 in FIG31. The functions / implementation processes of the first determining module 3101 and the generating module 3102 in FIG31 can be implemented by the processor 3201 in FIG32 calling the executable instructions stored in the memory 3202. For specific implementation processes and functions, please refer to the above-mentioned related embodiments.
[0262] Based on the same inventive concept, this disclosure also provides a storage medium. This storage medium stores instructions. When the instructions are executed on a computer, they are used to perform the document processing methods described in one or more of the above embodiments.
[0263] Based on the same inventive concept, this disclosure also provides a computer program or computer program product. When the computer program product is executed on a computer, it causes the computer to implement the document processing method in one or more of the above embodiments.
[0264] Other embodiments of the invention will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This disclosure is intended to cover any variations, uses, or adaptations of the invention that follow the general principles of the invention and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of the invention are indicated by the following claims.
[0265] It should be understood that the present invention is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of the invention is limited only by the appended claims.
Claims
1. A document processing method, characterized in that, include: In response to a trigger operation on a first document, a target object is determined from the first document, and the layout information of the target object in the first document is obtained; Based on the layout information of the target object in the first document, the target object is added to the target page in the second document that matches the target object, thus obtaining the target document; The first document and the second document have different document formats.
2. The method according to claim 1, characterized in that, The target page in the second document that matches the target object is a page determined based on the attribute information of the target object, which is used to indicate the characteristics of the target object.
3. The method according to claim 1, characterized in that, The method further includes: Based on the target object and its association information in the first document, the first text content is obtained; The analysis results are obtained by analyzing the first text content and the second text content of the second document; The target page is determined from the pages of the second document based on the analysis results.
4. The method according to claim 3, characterized in that, The first text content is obtained based on the target object and its association information in the first document, including: The first document is semantically understood based on a pre-trained semantic analysis model, the contextual information of the target object in the first document is determined, and the first text content is obtained based on the contextual information of the target object in the first document.
5. The method according to claim 3, characterized in that, The analysis of the first text content and the second text content of the second document to obtain the analysis results includes: The first text content and the second text content are analyzed to obtain the similarity between the first text content and the second text content; Determining the target page from the pages of the second document based on the analysis results includes: The page containing the second text content, whose similarity to the first text content is greater than a preset threshold, is determined as the target page.
6. The method according to claim 3, characterized in that, The first text content has first index information, and the second text content has second index information; If the target page is determined, the method further includes: Based on the first index information and the second index information, an association relationship is established between the target object and the target page; The step of adding the target object to the target page in the second document that matches the target object to obtain the target document includes: Based on the aforementioned association, the target object is added to the target page in the second document that matches the target object, thus obtaining the target document.
7. The method according to claim 3, characterized in that, The first text content is obtained based on the target object and its association information in the first document, including: Based on the association information of the target object in the first document, determine the associated object of the target object from the first document; The text content in the associated object is determined to be the first text content.
8. The method according to claim 7, characterized in that, The association information is the context information of the target object in the first document. The step of determining the associated object of the target object from the first document based on the association information of the target object in the first document includes: The associated objects of the target object are determined from the first document based on the context information of the target object in the first document, wherein the associated objects include the target paragraph in which the target object is located and / or the paragraphs adjacent to the target paragraph.
9. The method according to claim 7, characterized in that, The step of determining the associated objects of the target object from the first document based on the association information of the target object in the first document includes: If the number of target objects is less than or equal to a first preset number, a first number of associated objects are determined from the first document based on the association information. If the number of target objects is greater than the first preset number, a second number of associated objects are determined from the first document based on the association information.
10. The method according to claim 1, characterized in that, The step of adding the target object to a target page in a second document that matches the target object based on the layout information of the target object in the first document includes: Based on the layout information of the target object in the first document and / or the layout information of the target page, the target object is adjusted to obtain an adjusted target object, and the adjusted target object is inserted into the target page; and / or, Based on the layout information of the target object in the first document and / or the layout information of the target page, the layout style of the target page is adjusted to obtain the adjusted target page, and the target object is inserted into the adjusted target page.
11. The method according to claim 1, characterized in that, The step of adding the target object to a target page in a second document that matches the target object, based on the layout information of the target object in the first document, to obtain the target document, includes: If the number of target objects corresponding to the same target page is less than or equal to the second preset number, based on the layout information of the target objects in the first document, each target object is inserted into the same target page to obtain the target document; If the number of target objects corresponding to the same target page is greater than the second preset number, based on the layout information of the target objects in the first document, each target object is grouped and inserted into the target page and the associated page of the target page; The associated pages include: pages created based on the target page and / or pages in the second document that are associated with the target page.
12. The method according to claim 11, characterized in that, When the number of target objects corresponding to the same target page is greater than the second preset number, based on the layout information of the target objects in the first document, each target object is grouped and inserted into the target page and the associated page of the target page, including: If the number of target objects corresponding to the same target page is greater than the second preset number, the target objects are grouped based on the type of the target objects and the preset reference number; Based on the layout information of the target object in the first document, each group of the target objects is inserted into the target page and the associated page respectively.
13. The method according to claim 12, characterized in that, After grouping the target objects, the method further includes: Based on the layout information of each target object in the first document, the layout information of each target object in the second document is determined.
14. The method according to any one of claims 1 to 13, characterized in that, The step of determining the target object from the first document in response to a triggering operation on the first document includes: In response to the triggering operation, the target object is determined from the body portion of the first document; The step of adding the target object to a target page in a second document that matches the target object, based on the layout information of the target object in the first document, to obtain the target document, includes: Based on the layout information of the target object in the first document, the target object is added to the target page located in the body of the second document to obtain the target document.
15. The method according to claim 1, characterized in that, The step of adding the target object to a target page in a second document that matches the target object, based on the layout information of the target object in the first document, to obtain the target document, includes: Based on the layout information of the target object in the first document, the target object and its annotation information are added to the target page in the second document that matches the target object to obtain the target document. The annotation information for the target object includes: the caption for the target object.
16. The method according to any one of claims 1 to 13, characterized in that, The step of adding the target object to the target page in the second document that matches the target object to obtain the target document includes: In response to adding the target object to the target page, delete the non-target objects in the target page except for the target text box, and obtain the target document.
17. The method according to any one of claims 1 to 13, characterized in that, The step of adding the target object to the target page in the second document that matches the target object to obtain the target document includes: If the target object includes table content, convert the table content in the target object into image content to obtain the converted target object; insert the converted target object into the target page to obtain the target document.
18. The method according to claim 3, characterized in that, The method further includes: The target text box is determined from the target page based on the first text content corresponding to the target object and the second text content corresponding to the target page.
19. A document processing apparatus, characterized in that, include: The determination module is configured to, in response to a trigger operation on a first document, determine a target object from the first document and obtain the layout information of the target object in the first document; The generation module is configured to add the target object to a target page in a second document that matches the target object, based on the layout information of the target object in the first document, to obtain the target document; The first document and the second document have different document formats.
20. A computer program product comprising a computer program or instructions, characterized in that, When the computer program or instructions are executed by a processor, they implement the steps of the method according to any one of claims 1 to 18.
Citation Information
Patent Citations
Document processing method and device and electronic equipment
CN113238686A
Document processing method and device, electronic equipment and storage medium
CN114912420A
Document insertion method and device, computer equipment and storage medium
CN117494667A
Document processing method and device and computer program product
CN119598966A
Automated document layout design
US20070208996A1