Document processing method and device
By performing format conversion and standardization on the document content, the compatibility issues between the document and the model were resolved, ensuring the accuracy of the processing results and the user experience.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-30
- Publication Date
- 2026-04-07
AI Technical Summary
Poor data compatibility between documents and models leads to inaccurate processing results and affects the user experience.
By acquiring the element content from the document, converting it according to the preset format specification information, adapting it to the format of the preset model, and processing it based on the preset model and format specification information, the consistency of format and semantic accuracy are ensured.
It improves the compatibility of data interaction between documents and models, ensures the accuracy of processing results, and enhances the user experience.
Smart Images

Figure CN121809438A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] Embodiments of the present application relate to the technical field of computer, and particularly, to a document processing method and device. BACKGROUND
[0002] With the rapid development of digitalization and informatization technology, as the core carrier of information bearing and transmission, documents have been widely used in office collaboration, education and scientific research, enterprise management, government services and other multi-scene, and become the key hub of data flow. Among them, the intelligent processing of document data has become the core means to improve information utilization efficiency, which usually needs to analyze, identify or modify the document content by means of model, to meet the diversified needs of users.
[0003] In the related art, after the document data is input into the model, the processing result can be output. However, due to the data format limitation of the model itself, the compatibility of data interaction between the document and the model is poor, which leads to inaccurate processing result and affects the user experience. SUMMARY
[0004] Embodiments of the present application provide a document processing method and device, which solves the problem of poor data compatibility between the document and the model in the related art, which leads to information loss or abnormal display effect of the processing result, and affects the user experience. The document content can be standardized format converted, and the format specification information can be provided to the preset model, which improves the compatibility of data interaction between the document and the model, ensures the accuracy of the processing result, and improves the user experience.
[0005] In a first aspect, embodiments of the present application provide a document processing method, which comprises: obtaining a first document, determining first element content from the first document, the first element content being a first document format; converting the first element content according to first preset format specification information to obtain second element content, the second element content being a second document format adapted to a preset model; processing the second element content based on the preset model and the first preset format specification information to obtain a target processing result.
[0006] In a second aspect, embodiments of the present application also provide a document processing device, which comprises: an element content determination module configured to obtain a first document, and determine first element content from the first document, the first element content being a first document format; a content format conversion module configured to convert the first element content according to first preset format specification information to obtain second element content, the second element content being a second document format adapted to a preset model; The model processing module is configured to process the second element content based on the preset model and the first preset format specification information to obtain a target processing result.
[0007] In a third aspect, the embodiments of the present application further provide an electronic device, which comprises: one or more processors; a storage device configured to store one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the document processing method provided by the embodiments of the present application.
[0008] In a fourth aspect, the embodiments of the present application further provide a nonvolatile storage medium storing computer executable instructions, which, when executed by a computer processor, are configured to perform the document processing method provided by the embodiments of the present application.
[0009] In the embodiments of the present application, the first element content is determined from the first document, which can provide a content object to be processed in subsequent steps. The first element content is converted according to the first preset format specification information to obtain the second element content, which can eliminate the mismatch between the first document format and the preset model input format through format conversion, so that the preset model can accurately understand and process, and the semantic consistency is maintained. The second element content is processed based on the preset model and the first preset format specification information to obtain the target processing result, which can avoid processing errors caused by format confusion or semantic deviation, and ensure that the result meets the user's expectation. The above-mentioned scheme can perform standardized format conversion on the document content, and provide format specification information to the preset model, thereby improving the compatibility of data interaction between the document and the model, ensuring the accuracy of the processing result, and improving the user experience. BRIEF DESCRIPTION OF DRAWINGS
[0010] Figure 1 A flowchart of a document processing method provided by the embodiments of the present application is provided. Figure 2 A flowchart of a document processing method provided by the embodiments of the present application is provided. Figure 3 A flowchart of a document processing method provided by the embodiments of the present application is provided. Figure 4 A flowchart of a document processing method provided by the embodiments of the present application is provided. Figure 5 A flowchart of a document processing method provided by the embodiments of the present application is provided. Figure 6A flow chart of a document processing method including an element content conversion process provided by an embodiment of the present application is shown in FIG. 1. Figure 7 A structural block diagram of a document processing apparatus provided by an embodiment of the present application is shown in FIG. 2. Figure 8 A structural schematic diagram of an electronic device provided by an embodiment of the present application is shown in FIG. 3. DETAILED DESCRIPTION
[0011] The embodiments of the present application will be further described below in conjunction with the accompanying drawings and embodiments. It can be understood that the specific embodiments described herein are only used to explain the embodiments of the present application, but not to limit the embodiments of the present application. In addition, it should be noted that, for the convenience of description, only the parts related to the embodiments of the present application are shown in the drawings, but not all the structures.
[0012] The terms "first", "second", and the like in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be exchanged under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than that illustrated or described herein, and the objects distinguished by "first", "second", etc. are generally a class, and do not limit the number of objects, for example, the first object can be one or more. In addition, the specification and claims "and / or" means at least one of the connected objects, and the character " / ", generally indicates that the front and rear associated objects are in a "or" relationship.
[0013] The document processing method provided by the embodiments of the present application, the execution subject of each step can be a computer device, which refers to any electronic device with data computing, processing and storage capabilities, such as mobile phones, PC (Personal Computer), tablet computers and other terminal devices, which are not limited by the embodiments of the present application.
[0014] Figure 1 A flow chart of a document processing method provided by an embodiment of the present application is shown in FIG. 1. Figure 1 As shown in FIG. 1, the document processing method includes the following steps: Step S101, acquiring a first document, determining a first element content from the first document, the first element content being a first document format.
[0015] The first document can be an original document that needs to be intelligently processed by the user, and the document format can be.doc,.wps,.ppt,.pdf, or other online document formats, which are not limited herein. The first element content can be a text paragraph, table, picture, formula, or other content in the first document. In an embodiment, the first element content is determined from the first document, specifically, the first element content is extracted from the first document according to an element content range selected by the user selection operation. In an embodiment, the first element content is determined from the first document, specifically, user input information is received and the element content range is determined by identifying the user input information. For example, the user input information is a natural language description of the content range, the intent is identified from the natural language description, and the element content range is determined in the document based on the intent. The element content range can be a certain page range, a certain number of paragraphs on a page, a certain element, etc. For example, the natural language description can be "modify the formal style of the title XXX and its subordinate content", and the element content range is the title XXX and its subordinate content. The first document format can be the original data format of the first document, which determines the initial storage and organization form of the first element content.
[0016] In step S102, the first element content is converted according to the first preset format specification information to obtain second element content, and the second element content is in a second document format adapted to a preset model.
[0017] The first preset format specification information can be a format conversion rule set prepared in advance to adapt to the data processing requirements of the preset model, including a tag mapping relationship, etc. It can be regarded as a data specification between the document and the model, realizing lossless conversion of data between the document and the model, and can be adaptively adjusted according to the model type and processing scene. In an embodiment, the first document supports a first format standard, the preset model supports a second format standard, and the first preset format specification information can be a one-to-one correspondence between the general format tags defined by the first format standard and the general format tags defined by the second format standard. Specifically, it can be applied to directly mapping the format tag corresponding to the first element content to the format tag corresponding to the second document format according to the specific conversion rule, for example, the first document format is WPS standard format, and the second document format is HTML standard format. The WPS tag of the first element content in the WPS standard format can be directly mapped and converted to the HTIML tag of the HTML standard format based on the first preset format specification information. In an embodiment, the first document supports a first format standard, the preset model supports a second format standard, and the first format standard can be provided with a special format tag unique to the first document, which needs to be converted to a new format tag different from the general format tag defined by the second format standard. Although the preset model supports the second format standard, the new format tag is still beyond the understanding range of the preset model. The first preset format specification information can include a one-to-one correspondence between the special format tag defined by the first format standard and the new format tag applicable to the second format standard. Specifically, it can be applied to converting the special format tag corresponding to the first element content to the new format tag corresponding to the second document format according to the specific conversion rule. For example, the first document format is WPS standard format, and the second document format is HTML standard format. The first element content includes a unique format tag, which can be converted to a new format tag supported by the HTML standard format through the first preset format specification information. Although the preset model supports the HTML standard format input, it cannot understand the new format tag, so the first preset format specification information is needed to assist the preset model to process the second element content.
[0018] In step S103, the second element content is processed based on the preset model and the first preset format specification information to obtain a target processing result.
[0019] The preset model can be an artificial intelligence model for realizing intelligent processing of a document, for example, a large language model, a multi-modal large model, etc., which is not limited herein. In an embodiment, the first preset format specification information can include a one-to-one correspondence between a general format tag defined by the first format standard and a general format tag defined by the second format standard, so that the preset model can completely understand the format tag of the second element content and directly process the second element content. In an embodiment, the first preset format specification information can include a one-to-one correspondence between a special format tag defined by the first format standard and a new format tag applicable to the second format standard, so that the preset model cannot completely understand the format tag of the second element content. Therefore, by inputting the first preset format specification information as input information of the preset model, the preset model can learn the first preset format specification information to understand the format tag of the second element content and accurately process the second element content. In addition, the preset model can process the second element content to obtain a target processing result according to different intent requirements of the user, and perform corresponding result feedback. For example, if the user's intent is to translate, summarize, or search the first element content, etc., the target processing result generated by the preset model after processing can be directly displayed. For example, if the user's intent is to rewrite, polish, correct, or typeset the first element content, etc., the target processing result generated by the preset model after processing needs to be converted into the first document format and replace the first element content. For example, if the user's intent is to continue writing, accompanying writing, or imitating writing the first element content, etc., the target processing result generated by the preset model after processing needs to be converted into the first document format and inserted after the first element content or inserted into a specific document. For example, if the user's intent is to continue writing, accompanying writing, or imitating writing the content in the target document based on the first element content, etc., the target processing result generated by the preset model after processing needs to be converted into the document format of the target document and inserted into the target document.
[0020] In an embodiment, processing the second element content based on the preset model and the first preset format specification information to obtain a target processing result includes: constructing prompt word information based on the first preset format specification information and the second element content; inputting the prompt word information into the preset model to obtain the target processing result.
[0021] The prompt word information can be a set of instructive information generated by structurally integrating the first preset format specification information and the second element content, which is adapted to the input requirements of the preset model and is used to explicitly indicate the processing object, processing rule and processing constraint of the preset model to avoid understanding ambiguity of the model. Optionally, the first preset format specification information and the second element content can be integrated according to a preset instruction structure to obtain the prompt word information. The preset instruction structure can be a standardized information integration framework designed and fixed in advance, for example, an organization rule or a fixed template, which can include a pre-set standardized guide word. The preset model can perform analysis processing based on the prompt word information and output a target processing result meeting the user's demand.
[0022] The first element content is determined from the first document, which can provide a content object to be processed in subsequent steps. The first element content is converted according to the first preset format specification information to obtain the second element content, which can eliminate the format mismatch between the first document format and the preset model input format through format conversion, so that the preset model can accurately understand and process, and the semantic consistency is maintained. The second element content is processed based on the preset model and the first preset format specification information to obtain the target processing result, which can avoid processing errors caused by format confusion or semantic deviation and ensure that the result meets the user's expectation. The above scheme can perform standardized format conversion on the document content and provide format specification information to the preset model, improve the compatibility of data interaction between the document and the model, ensure the accuracy of the processing result, and improve the user experience.
[0023] Figure 2 A flowchart of a document processing method including a process of determining a target processing result is provided for the embodiments of the present application, as shown in Figure 2 The document processing method includes the following steps: Step S201, a first document is acquired, and a first element content is determined from the first document. The first element content is in a first document format.
[0024] Step S202, the first element content is converted according to first preset format specification information to obtain second element content. The second element content is in a second document format adapted to a preset model.
[0025] Step S203, first auxiliary information is acquired.
[0026] The first auxiliary information can be additional supplementary information obtained from user input, existing document data, etc. In an embodiment, the first auxiliary information can include a user-triggered task type, such as translation, summarization, search, rewriting, polishing, correction, typesetting, continuation, accompaniment, imitation, etc., to indicate the processing operation to be performed by the preset model. It should be noted that for task types such as translation, summarization, and search, the corresponding target processing result is directly displayed to the user, and the user does not need to edit the target processing result again. Therefore, the target processing result does not need to be adjusted to adapt to secondary editing. For task types such as rewriting, polishing, correction, typesetting, continuation, accompaniment, and imitation, the corresponding target processing result needs to be integrated into the original document or a new document, and the user needs to edit the target processing result again. Therefore, the target processing result needs to be adjusted to adapt to secondary editing. In an embodiment, in addition to the aforementioned user-triggered task type, the first auxiliary information can also include content information about the insertion position of the target processing result in the document. For task types such as rewriting, polishing, correction, and typesetting, the insertion position of the target processing result can be the original position of the first element content in the first document. For task types such as continuation, accompaniment, and imitation, the insertion position of the target processing result can be after the first element content in the first document or a specific position in another document. If the insertion position is the original position of the first element content or after the first element content, the aforementioned content information can be information related to the first element content in the first document. For example, when the first element content is a title, the related content information can be the directory where the first element content is located, to provide structural information of the first element content in the first document. Since the second element content is converted from the first element content, the related content information can be used to deepen the understanding of the preset model about the structural level of the second element content, to facilitate accurate processing, and can also be used to adjust the directory structure part related to the target processing result to adapt to secondary editing after the preset model processes the target processing result. For example, when the first element content is part of a table-like content (e.g., part of a key-value pair), the related content information can be all key-value pair information in the context where the first element content is located, to provide structural information of the first element content in the first document. Since the second element content is converted from the first element content, the related content information can be used to deepen the understanding of the preset model about the structural level of the second element content, to facilitate accurate processing, and can also be used to adjust the table-like content part related to the target processing result to adapt to secondary editing after the preset model processes the target processing result.Similarly, in the case of the to-be-inserted position being a specific position of another document, the first auxiliary information can further include context information of the to-be-inserted position, context information related to the second element content in the to-be-inserted position, and document information of the document to which the to-be-inserted position belongs. The document information can include a collaborative user, a document format type, a document content type, a document style, and the like.
[0027] In step S204, the second element content is processed based on the first auxiliary information, the preset model, and the first preset format specification information to obtain a target processing result.
[0028] The first auxiliary information and the first preset format specification information can be reference information for the preset model to process the second element content. The first auxiliary information can provide specific processing targets and supplementary information for the model, and the first preset format specification information can provide mapping relationship information between different format standards between the first document and the preset model. In an embodiment, the specific implementation process of processing the second element content based on the first auxiliary information, the preset model, and the first preset format specification information to obtain the target processing result is as follows: Construct prompt word information based on the first auxiliary information, the first preset format specification information, and the second element content; Input the prompt word information into the preset model to obtain the target processing result.
[0029] The prompt word information can be a set of instructive information generated by structurally integrating the first auxiliary information, the first preset format specification information, and the second element content to adapt to the input requirements of the preset model. Optionally, the first auxiliary information, the first preset format specification information, and the second element content can be integrated according to a preset instruction structure to obtain the prompt word information. The preset model can perform analysis and processing based on the prompt word information and output a target processing result that meets the user's demand.
[0030] By combining the first auxiliary information, the accuracy of the preset model in processing the second element content can be improved, and the processing of the second element content can be adapted to different user needs in actual application scenarios, thereby improving the model processing effect.
[0031] Figure 3 A flowchart of a document processing method including a process of feeding back a target processing result provided by an embodiment of the present application is shown in FIG. 8. Figure 3 The document processing method includes the following steps: In step S301, a first document is obtained, and first element content is determined from the first document. The first element content is in a first document format.
[0032] In step S302, the first element content is converted according to the first preset format specification information to obtain second element content, and the second element content is a second document format adapted to the preset model.
[0033] In step S303, the first auxiliary information is obtained.
[0034] In step S304, the second element content is processed based on the first auxiliary information, the preset model, and the first preset format specification information to obtain a target processing result.
[0035] In step S305, the current task type is identified based on the first auxiliary information.
[0036] For example, the first auxiliary information can include a user-triggered task type, such as translation, summarization, search, rewriting, polishing, error correction, typesetting, continuation, accompaniment, imitation, etc., and different task types correspond to different processing manners after being processed by the preset model. For example, for the task types of translation, summarization, search, etc., corresponding to the "first task type" in this embodiment, the target processing result obtained therefrom is directly displayed to the user, and thus, in the case where the current task type is the first task type, the target processing result can be directly fed back. For example, for the task types of rewriting, polishing, error correction, typesetting, continuation, accompaniment, imitation, etc., the target processing result obtained therefrom needs to be integrated into the original document or a new document, and thus, the target processing result needs to be further processed in other steps to meet the processing requirements of the corresponding task type.
[0037] In step S306, in the case where the current task type is the first task type, the target processing result is fed back.
[0038] For example, if the current task type is the first task type, it can be considered that the target processing result does not need to be further processed, and the target processing result can be fed back through a pop-up window, a comment, or a preset display area.
[0039] The current task type is identified based on the first auxiliary information, and the corresponding requirements of the first task type can be accurately responded to for result feedback.
[0040] Figure 4 A flowchart of a document processing method provided by an embodiment of the present application is shown in FIG. 1, and the document processing method includes the following steps: Figure 4 In step S401, a first document is obtained, and first element content is determined from the first document, and the first element content is in a first document format.
[0041] In step S402, the first element content is converted according to the first preset format specification information to obtain second element content, and the second element content is a second document format adapted to the preset model.
[0042] In step S403, the second element content is processed based on the preset model and the first preset format specification information to obtain a target processing result.
[0043] In step S404, the target processing result is format-converted to obtain a final processing result, and the final processing result is in the first document format.
[0044] For rewriting, polishing, correcting, typesetting, continuing, accompanying, and imitating tasks, the target processing result needs to be integrated into the original document or a new document, and thus, the target processing result needs to be further processed to meet the processing requirements of the corresponding task type. Specifically, the input information of the preset model needs to be in the second document format, and the output target processing result also needs to be in the second document format. Therefore, the target processing result needs to be format-converted to the first document format to meet the format requirements of the document.
[0045] In one embodiment, the specific implementation process of format-converting the target processing result to obtain the final processing result is as follows: The second auxiliary information is obtained from the second document, and the second auxiliary information includes a part of the second document related to the target processing result. The target processing result and / or the second auxiliary information are format-converted according to the second preset format specification information to obtain the final processing result.
[0046] The second document is in a third document format, and the second document is the same as or different from the first document. The third document format is the same as or different from the first document format. The second auxiliary information includes a part of the second document related to the target processing result. It needs to be noted that the related part can be related to the document structure or related to semantics, and the present application does not limit the related part.
[0047] In one embodiment, the type and acquisition method of the second auxiliary information are similar to those of the first auxiliary information.
[0048] When the second document is identical to the first document, for task types such as rewriting, polishing, correcting errors, and formatting, the insertion position of the target processing result can be the original position of the first element content in the second document. For task types such as continuation writing, accompanying writing, and imitation writing, the insertion position of the target processing result can be after the first element content in the first document. For both of these cases, the part related to the target processing result can be information in the second document related to the first element content. For example, if the first element content is a title, the second auxiliary information can include the table of contents where the first element content is located to provide structural information about the first element content in the first document, and adjustments can be made to the table structure related to the target processing result to adapt to secondary editing. As another example, if the first element content is part of a table-like content (e.g., some key-value pairs), the second auxiliary information can include all key-value pair information in the context of the first element content to provide structural information about the first element content in the first document, and adjustments can be made to the table-like content related to the target processing result to adapt to secondary editing. The second auxiliary information may include context information of the insertion location, context information related to the content of the first element in the insertion location, and document information of the second document. This document information may include collaborating users, document format type, document content type, and document writing style.
[0049] When the second document differs from the first document, for tasks such as rewriting, polishing, correcting errors, and formatting, the insertion position of the target processing result can be a specific position within the second document containing a specific element. For tasks such as continuation writing, supplementary writing, and imitation writing, the insertion position can be a specific position after the location of the specific element within the second document. In both cases, the part related to the target processing result can be information within the second document related to the specific element. For example, if the specific element is a title, the second auxiliary information can include the table of contents containing the specific element to provide structural information about the specific element within the second document, and adjustments can be made to the table structure related to the target processing result to accommodate secondary editing. As another example, if the specific element is part of a table-like content (e.g., some key-value pairs), the second auxiliary information can include all key-value pairs within the context of the specific element to provide structural information about the specific element within the second document, and adjustments can be made to the table-like content related to the target processing result to accommodate secondary editing. Therefore, the second document differs from the first document. The insertion position of the target processing result can be a specific position related to the content of a specific element in the second document. The second auxiliary information can include the context information of that specific position, the context information related to the content of that specific element in that specific position, and the document information of the second document. This document information can include collaborating users, document format type, document content type, document writing style, etc.
[0050] When the second auxiliary information is empty or requires no additional auxiliary information, the target processing result can be directly converted according to the second preset format specification information to obtain the final processing result. It should be noted that since the formats of the second document and the first document may not be the same, if the third document format used by the second document is the same as the first document format, then the second preset format specification information is the same as the first preset format specification information; if the third document format used by the second document is different from the first document format, then the second preset format specification information is different from the first preset format specification information. However, when supplementing auxiliary information or making global adjustments to related information is required, the target processing result and the second auxiliary information must be combined and converted according to the second preset format specification information to obtain the final processing result. For example, the first element content can be the entire content of a document. This first element content is in WPS format. After being converted according to the first preset format specification information, the second element content is obtained. This second element content is in HTML format. According to the preset processing requirements, the preset model processes and outputs the target processing result in HTML format, such as the table of contents. This needs to be re-inserted into the table of contents of the document. And associated with it is the title information in the document. Therefore, in addition to converting the table of contents output by the preset model into HTML format, it is also necessary to process its title information to adapt to the changes in the table of contents.
[0051] In one embodiment, since the target processing result is obtained through a preset model, it can maintain a display effect consistent with the original document format after format conversion. However, users may need to edit the final processing result. Directly inserting the format-converted final processing result as document content may cause problems such as abnormal text alignment and abnormal title jumps after secondary editing. Therefore, content adjustment processing needs to be introduced to ensure that users can perform normal secondary editing later. Specifically, content adjustment processing is performed before performing format conversion processing, and format conversion processing is performed based on the content after content adjustment processing to obtain the final processing result; or, content adjustment processing is performed after performing format conversion processing to obtain the final processing result. It should be noted that content adjustment processing can be performed before or after the aforementioned format conversion processing, and this application does not limit it here. Specifically, the content adjustment processing includes: The content of the third element is determined from the first processing result, wherein the content of the third element is the content of an element corresponding to at least one preset content structure; The content of the third element in the first processing result is adjusted to the content of the fourth element to obtain the second processing result.
[0052] The first processing result can be the target processing result and / or the second auxiliary information, or it can be the output result of the format conversion process. If the first processing result is the target processing result and / or the second auxiliary information, the second processing result is the input of the format conversion process. If the first processing result is the output result of the format conversion process, the second processing result is the final processing result. It should be noted that the third element content is the content of at least one element corresponding to a preset content structure, which needs to be adjusted to adapt to secondary editing requirements to ensure that subsequent secondary editing can proceed normally. For example, the preset content structure may include a key-value pair structure. It should be noted that in the HTML format corresponding to the preset model, the spacing layout of the key-value pair structure is controlled by the padding tag to align the text in rows and columns. If the padding tag is simply converted to a space or tab in the WPS format, its display effect in the document can remain consistent with the result generated by the preset model. However, after secondary editing, the document layout will show an misalignment effect. Therefore, the relevant content of the key-value pair structure needs to be adjusted to adapt to the requirements of secondary editing. For example, the preset content structure may include a directory structure. It's important to note that while the HTML format corresponding to the preset model can use the `href` tag for heading navigation, simply parsing the `href` tag as a hyperlink will not actually work in WPS format, causing problems when using the document. Furthermore, once the user edits a heading, the associated directory will not be updated. Therefore, the relevant content of the directory structure needs to be adjusted to accommodate secondary editing requirements.
[0053] In one embodiment, at least one preset content structure includes a key-value pair structure, and correspondingly, adjusting the content of the third element in the first processing result to the content of the fourth element includes: Extract the key and value from the content of the third element; Set table element tags for keys and values, and set the corresponding table display attributes to obtain the content of the fourth element.
[0054] Since key-value pair structures are prone to alignment issues after secondary editing, adjustments can be made to the key-value pair structure. Specifically, a borderless table can be used for layout control, ensuring the second-processed result retains its automatic alignment in the document. Furthermore, keys and values can be extracted from the third element content. These keys and values can be labeled with table elements, such as their row or column, to assign them to different cells. The table can then be displayed without borders to maintain the same display effect as the original output of the preset model.
[0055] In one embodiment, at least one preset content structure includes a directory structure, and correspondingly, adjusting the content of the third element in the first processing result to the content of the fourth element includes: Determine the titles corresponding to the table of contents and table of contents entries from the content of the third element; Set field labels for the table of contents and hidden labels for the headings.
[0056] Since the directory structure is prone to errors such as inability to navigate after secondary editing, adjustments can be made to the relevant content of the directory structure. Specifically, the content of the third element originates from the target processing result output by the preset model and / or the second auxiliary information. Before format conversion, the headings corresponding to the directory and its entries can be determined from the content of the third element, and a navigation relationship exists between the directory and the headings corresponding to its target entries. By setting field tags for the target and hidden tags for the headings, navigation and automatic updates of the directory can be implemented in the document after format conversion.
[0057] Optionally, after format conversion, the directory item information and anchor point position information corresponding to the local element content of the directory structure can be extracted from the third element content. Based on the directory item information, anchor point position information, and preset target styles, preset field codes and hidden bookmarks are generated. The preset field codes are added to preset positions within the third element content, and hidden bookmarks are inserted into the third element content based on the anchor point position information. For example, in HTML, the directory is implemented using TOC styles and href links, while in text documents, the directory is implemented using TOC fields and hidden bookmarks. The TOC field controls the rendering effect and automatic updates of the directory, and the hidden bookmarks are used for navigation. If the target item information and anchor point position information are extracted, the corresponding TOC field code can be generated according to the TOC style, and hidden bookmarks can be inserted based on the anchor point position information.
[0058] Step S405: Write the final processing result into a second document. The second document adopts a third document format. The second document is the same as or different from the first document, and the third document format is the same as or different from the first document format.
[0059] The final processing result can be written to an existing document or another newly created or existing specific document, depending on the user's needs in the actual application scenario. Therefore, the second document can be the same as or different from the first document, and the format of the third document can be the same as or different from the format of the first document.
[0060] In one embodiment, the specific implementation process of writing the final processing result into the second document is as follows: Write the final processing result after the target location in the second document; or, Replace the content corresponding to the target location in the second document with the final processing result.
[0061] For tasks such as continuation writing, supplementary writing, and imitation writing, when the second document and the first document are the same document, the target position can be a related position after the current position of the first element's content, such as adjacent to the current position, or a specific position. When the second document and the first document are different documents, the target position can be a specific position in the second document, with the first document serving as reference material for writing the final processing result at that specific position. For tasks such as rewriting, polishing, error correction, and typesetting, when the second document and the first document are the same document, the target position can be the location of the first element's content, where the final processing result can replace the first element's content, or it can be a specific area associated with the first element's content. For example, if the first element's content is a title, it can be associated with a table of contents area, where the final processing result can replace the table of contents area. This application does not impose any limitations on this. Similarly, when the second document and the first document are different documents, the target position can be a specific position in the second document, with the first document serving as reference material for writing the final processing result at that specific position. Optionally, there are multiple ways to write the aforementioned data. It can be written into the document content, such as the main text data or comments, or into active components such as floating windows. This application does not limit the methods used.
[0062] The above describes how the target processing result is converted to a new format to obtain the final processing result. It can be converted in reverse according to the original specification of the first document format to match the format requirements of the target processing result when re-importing the document. The final processing result is written into the second document, which can adapt to various usage scenarios and support different result import paths.
[0063] Figure 5 A flowchart of a document processing method including a document disk writing process is provided for embodiments of this application, as shown below. Figure 5 As shown, this document processing method includes the following steps: Step S501: Obtain the first document, and determine the content of the first element from the first document. The content of the first element is in the format of the first document.
[0064] Step S502: Convert the content of the first element according to the first preset format specification information to obtain the content of the second element. The content of the second element is a second document format adapted to the preset model.
[0065] Step S503: Process the content of the second element based on the preset model and the first preset format specification information to obtain the target processing result.
[0066] Step S504: Perform format conversion on the target processing result to obtain the final processing result, wherein the final processing result is the first document format.
[0067] Step S505: Write the final processing result into a second document. The second document adopts a third document format. The second document is the same as or different from the first document, and the third document format is the same as or different from the first document format.
[0068] Step S506: Obtain the compatibility format specification information corresponding to the compatible document format.
[0069] Since the third document format may be the same as or different from the first document format, and the third document format may not be compatible with documents from other software, it is necessary to obtain the compatibility specification information corresponding to the compatible document format. For example, if the third document format is .wps, to improve compatibility after the document is saved to disk, the compatibility specification information corresponding to the compatible document format .docx can be obtained to adjust the compatibility of the second document. This compatibility specification information can be a set of pre-defined standardized rules for converting the second document to the compatible document format.
[0070] Step S507: Identify and determine the incompatible element content in the second document, and convert the incompatible element content into compatible element content according to the compatible format specification information.
[0071] The incompatible element content can be elements existing in the second document that cannot be displayed across platforms or software. These elements need to undergo format mapping conversion based on compatibility format specification information to be converted into compatible element content. This compatible element content can then be displayed correctly across platforms or software. Specifically, this may involve format tag conversion, object conversion, etc., which are not limited to this application.
[0072] Step S508: Replace the incompatible element content in the second document with compatible element content, and then save it as a compatible document format.
[0073] After replacing the incompatible element content with compatible element content, the second document can be saved to disk in the compatible document format.
[0074] As described above, by replacing incompatible element content with compatible element content, the document's cross-platform or software compatibility requirements can be met, ensuring that the overall layout and content logic of the document after compatibility conversion are consistent with the original second document, optimizing only the incompatible parts and improving the document's applicability.
[0075] Figure 6 A flowchart illustrating a document processing method including an element content conversion process, provided as an embodiment of this application, is shown below. Figure 6As shown, this document processing method includes the following steps: Step S601: Obtain the first document, and determine the content of the first element from the first document. The content of the first element is in the format of the first document.
[0076] Step S602: Parse the content of the first element to obtain the element position and the first element tag. The first element tag is in the first document format.
[0077] The element position can be the physical location or hierarchical relationship of the element, and the first element tag can be an attribute tag that classifies and identifies the content of the first element based on the native rules of the first document format, and is used to define the type, function or format characteristics of the element.
[0078] Step S603: Map and convert the first element tag according to the first preset format specification information to obtain the second element tag, and the second element tag is the second document format.
[0079] Based on the first preset format specification information, the first element tag can be mapped and transformed to fit the preset model, so as to accurately convey the element content to the preset model. For example, the first element tag belonging to WPS format can be converted into the second element tag belonging to HTML format.
[0080] Step S604: Replace the first element label with the second element label based on the element position.
[0081] Step S605: Process the content of the second element based on the preset model and the first preset format specification information to obtain the target processing result.
[0082] As described above, by accurately replacing element tags, the format conversion from the content of the first element to the content of the second element can be achieved, meeting the input requirements of the preset model.
[0083] Figure 7 This is a structural block diagram of a document processing apparatus provided in an embodiment of this application. The apparatus is configured to execute the document processing method provided in the above embodiments, and has corresponding functional modules and beneficial effects for executing the method. For example... Figure 7 As shown, the device specifically includes: The element content determination module 701 is configured to obtain the first document and determine the content of the first element from the first document. The content of the first element is in the format of the first document. The content format conversion module 702 is configured to convert the content of the first element according to the first preset format specification information to obtain the content of the second element, wherein the content of the second element is a second document format adapted to the preset model; The model processing module 703 is configured to process the content of the second element based on a preset model and the first preset format specification information to obtain the target processing result.
[0084] As described above, determining the first element content from the first document provides the content object to be processed in subsequent steps. Converting the first element content according to the first preset format specification information yields the second element content. This format conversion eliminates the mismatch between the first document's format and the preset model's input format, ensuring the preset model can accurately understand and process the content, maintaining semantic consistency. Processing the second element content based on the preset model and the first preset format specification information yields the target processing result, avoiding processing errors caused by formatting issues or semantic deviations, and ensuring the result meets user expectations. This solution can perform standardized format conversion of document content and provide format specification information to the preset model, improving the compatibility of data interaction between the document and the model, ensuring the accuracy of the processing results, and enhancing the user experience.
[0085] In one possible embodiment, the model processing module 703 is further configured to: Obtain first auxiliary information; The target processing result is obtained by processing the content of the second element based on the first auxiliary information, the preset model, and the first preset format specification information.
[0086] In one possible embodiment, the model processing module 703 is further configured to: Prompt word information is constructed based on the first auxiliary information, the first preset format specification information, and the content of the second element; Input the prompt word information into the preset model to obtain the target processing result.
[0087] In one possible embodiment, a result feedback module is also included, configured as follows: The current task type is determined based on the first auxiliary information. If the current task type is the first task type, the result of the target processing will be fed back.
[0088] In one possible embodiment, a result writing module is also included, configured as follows: The target processing result is converted to a new format to obtain the final processing result, which is in the first document format. The final processing result is written to a second document, which adopts a third document format. The second document may be the same as or different from the first document, and the third document may be in the same or different format as the first document.
[0089] In one possible embodiment, the result writing module is further configured as follows: Write the final processing result after the target location in the second document; or, Replace the content corresponding to the target location in the second document with the final processing result.
[0090] In one possible embodiment, the result writing module is further configured as follows: Obtain second auxiliary information from the second document, wherein the second auxiliary information includes the portion of the second document related to the target processing result; The target processing result and / or the second auxiliary information are converted according to the second preset format specification information to obtain the final processing result.
[0091] In one possible embodiment, a content adjustment module is also included, configured as follows: Before performing format conversion, perform content adjustment; then, based on the content adjusted by the content adjustment, perform format conversion to obtain the final result; or... After performing format conversion, content adjustment is performed to obtain the final result.
[0092] In one possible embodiment, the content adjustment module is further configured to: The content of the third element is determined from the first processing result, wherein the content of the third element is the content of an element corresponding to at least one preset content structure; The content of the third element in the first processing result is adjusted to the content of the fourth element to obtain the second processing result.
[0093] In one possible embodiment, at least one preset content structure includes a key-value pair structure; The content adjustment module is also configured as follows: Extract the key and value from the content of the third element; Set table element tags for keys and values, and set the corresponding table display attributes to obtain the content of the fourth element.
[0094] In one possible embodiment, at least one preset content structure includes a directory structure; The content adjustment module is also configured as follows: Determine the titles corresponding to the table of contents and table of contents entries from the content of the third element; Set field labels for the table of contents and hidden labels for the headings.
[0095] In one possible embodiment, a document storage module is also included, configured as follows: Obtain the compatibility format specification information corresponding to the compatible document format; The second document is identified to determine incompatible element content, and the incompatible element content is converted into compatible element content according to the compatible format specification information; After replacing the incompatible element content in the second document with compatible element content, save it as a compatible document format.
[0096] In one possible embodiment, the content format conversion module 702 is further configured to: The content of the first element is parsed to obtain the element position and the first element tag. The first element tag is the first document format. The first element tag is mapped and converted according to the first preset format specification information to obtain the second element tag, and the second element tag is the second document format; Replace the first element tag with the second element tag based on the element's position.
[0097] Figure 8 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application, such as... Figure 8 As shown, the device includes a processor 801, a memory 802, an input device 803, and an output device 804; the number of processors 801 in the device can be one or more. Figure 8 Taking a processor 801 as an example; the processor 801, memory 802, input device 803, and output device 804 in the device can be connected via a bus or other means. Figure 8 Taking a bus connection as an example, the memory 802, as a computer-readable storage medium, can be configured to store software programs, computer-executable programs, and modules, such as the program instructions / modules corresponding to the document processing method in this embodiment. The processor 801 executes various functional applications and data processing of the device by running the software programs, instructions, and modules stored in the memory 802, thereby implementing the aforementioned document processing method. The input device 803 can be configured to receive input digital or character information and generate key signal inputs related to user settings and function control of the device. The output device 804 may include a display screen or other display device.
[0098] The electronic device provided above can be used to execute the document processing method provided in any of the above embodiments, and has the corresponding functions and beneficial effects.
[0099] This application also provides a non-volatile storage medium containing computer-executable instructions. When executed by a computer processor, the computer-executable instructions are configured to perform a document processing method described in the above embodiments, comprising: obtaining a first document; determining first element content from the first document, the first element content being a first document format; converting the first element content according to first preset format specification information to obtain second element content, the second element content being a second document format adapted to a preset model; and processing the second element content based on the preset model and the first preset format specification information to obtain a target processing result.
[0100] Storage medium – any type of memory device or storage device. The term “storage medium” is intended to include: mounting media, such as CD-ROMs, floppy disks, or magnetic tape devices; computer system memory or random access memory, such as DRAM, DDR RAM, SRAM, EDO RAM, Rambus RAM, etc.; non-volatile memory, such as flash memory, magnetic media, optical storage; registers or other similar types of memory elements, etc. Storage media may also include other types of memory or combinations thereof. Furthermore, storage media may reside in a first computer system in which the program is executed, or may reside in a different second computer system connected to the first computer system via a network (such as the Internet). The second computer system can provide program instructions to the first computer for execution. The term “storage medium” can include two or more storage media residing in different locations (e.g., in different computer systems connected via a network). Storage media may store program instructions (e.g., specifically implemented as a computer program) executable by one or more processors.
[0101] Of course, the computer-executable instructions provided in the embodiments of this application are not limited to the document processing method described above, but can also perform related operations in the document processing method provided in any embodiment of this application.
[0102] It should be noted that the numbering of each step in this solution is only used to describe the overall design framework of this solution and does not indicate a necessary sequential relationship between the steps. As long as the overall implementation process conforms to the overall design framework of this solution, it falls within the protection scope of this solution. The literal order in the description is not an exclusive limitation on the specific implementation process of this solution. Those skilled in the art should understand that the embodiments of this application can be provided as methods, systems, or computer program products. In a typical configuration, a computing device includes one or more processors (CPUs), input / output interfaces, network interfaces, and memory. Memory may include non-persistent memory in computer-readable media, random access memory (RAM), and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.
[0103] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
[0104] Note that the above description is merely a preferred embodiment of the present invention and the technical principles employed. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and various obvious changes, readjustments, and substitutions can be made without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in detail through the above embodiments, the present invention is not limited to the above embodiments, and may include many other equivalent embodiments without departing from the concept of the present invention, the scope of which is determined by the scope of the appended claims.
Claims
1. A document processing method, characterized in that, include: Obtain the first document, determine the content of the first element from the first document, wherein the content of the first element is in the format of the first document; The content of the first element is converted according to the first preset format specification information to obtain the content of the second element, and the content of the second element is a second document format adapted to the preset model; The target processing result is obtained by processing the content of the second element based on the preset model and the first preset format specification information.
2. The document processing method according to claim 1, characterized in that, The process of processing the content of the second element based on the preset model and the first preset format specification information to obtain the target processing result includes: Obtain first auxiliary information; The target processing result is obtained by processing the content of the second element based on the first auxiliary information, the preset model, and the first preset format specification information.
3. The document processing method according to claim 2, characterized in that, The process of processing the content of the second element based on the first auxiliary information, the preset model, and the first preset format specification information to obtain the target processing result includes: Based on the first auxiliary information, the first preset format specification information, and the content of the second element, prompt word information is constructed; The prompt word information is input into the preset model to obtain the target processing result.
4. The document processing method according to claim 2, characterized in that, After processing the content of the second element based on the first auxiliary information, the preset model, and the first preset format specification information to obtain the target processing result, the method further includes: The current task type is determined based on the first auxiliary information; If the current task type is the first task type, the target processing result is fed back.
5. The document processing method according to claim 1, characterized in that, After processing the content of the second element based on the preset model and the first preset format specification information to obtain the target processing result, the method further includes: The target processing result is converted to obtain the final processing result, wherein the final processing result is a first document format; The final processing result is written into a second document, which adopts a third document format. The second document may be the same as or different from the first document, and the third document format may be the same as or different from the first document format.
6. The document processing method according to claim 5, characterized in that, The step of writing the final processing result into the second document includes: Write the final processing result after the target location in the second document; or... Use the final processing result to replace the content corresponding to the target position in the second document.
7. The document processing method according to claim 5, characterized in that, The target processing result is then converted to a new format to obtain the final processing result, including: Obtain second auxiliary information from the second document, wherein the second auxiliary information includes the portion of the second document related to the target processing result; The target processing result and / or the second auxiliary information are converted according to the second preset format specification information to obtain the final processing result.
8. The document processing method according to claim 5 or 7, characterized in that, Also includes: Before performing the format conversion process, a content adjustment process is performed. The format conversion process is then performed based on the content after the content adjustment process to obtain the final processing result. or, After performing the format conversion process, the content adjustment process is performed to obtain the final processing result.
9. The document processing method according to claim 8, characterized in that, The content adjustment process includes: The third element content is determined from the first processing result, wherein the third element content is the element content corresponding to at least one preset content structure; The content of the third element in the first processing result is adjusted to the content of the fourth element to obtain the second processing result.
10. The document processing method according to claim 9, characterized in that, The at least one preset content structure includes a key-value pair structure; adjusting the content of the third element in the first processing result to the content of the fourth element includes: Extract the key and value from the content of the third element; Set table element labels for the key and the value, and set the corresponding table display attributes to obtain the content of the fourth element.
11. The document processing method according to claim 9, characterized in that, The at least one preset content structure includes a directory structure; The step of adjusting the content of the third element in the first processing result to the content of the fourth element includes: Determine the titles corresponding to the directory and the directory entry information from the content of the third element; Set a field label for the directory and a hidden label for the title.
12. The document processing method according to claim 5, characterized in that, After writing the final processing result into the second document, the process further includes: Obtain the compatibility format specification information corresponding to the compatible document format; The second document is identified to determine incompatible element content, and the incompatible element content is converted into compatible element content according to the compatible format specification information; After replacing the incompatible element content in the second document with the compatible element content, save it as the compatible document format.
13. The document processing method according to claim 1, characterized in that, The step of converting the content of the first element according to the first preset format specification information to obtain the content of the second element includes: The content of the first element is parsed to obtain the element position and the first element tag, where the first element tag is a first document format; The first element tag is mapped and converted according to the first preset format specification information to obtain the second element tag, and the second element tag is the second document format; The first element label is replaced with the second element label based on the element position.
14. A document processing apparatus, characterized in that, include: The element content determination module is configured to obtain a first document and determine the content of a first element from the first document, wherein the content of the first element is in the format of the first document; The content format conversion module is configured to convert the content of the first element according to the first preset format specification information to obtain the content of the second element, wherein the content of the second element is a second document format adapted to the preset model; The model processing module is configured to process the content of the second element based on the preset model and the first preset format specification information to obtain the target processing result.