Document processing method and device, electronic equipment and storage medium

By combining the identification results of the document element identification model and the credibility verification of paragraph format attributes, the problem of model identification errors is solved, and the accuracy and reliability of document element identification is improved.

CN119886115APending Publication Date: 2025-04-25ZHUHAI KINGSOFT OFFICE SOFTWARE +2
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411974201.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-30
Publication Date
2025-04-25

AI Technical Summary

Technical Problem

In the prior art, model identification errors lead to errors in the identification results of document element types by relying on the model.

Method used

The final identification result is determined by using the document element identification model to determine the model identification result of the paragraph in the original document and verify the credibility based on the format attributes of the paragraph to determine the final identification result.

Benefits of technology

It significantly improves the accuracy and reliability of document element identification results, providing a more solid foundation for subsequent document processing tasks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119886115A_ABST
    Figure CN119886115A_ABST
Patent Text Reader

Abstract

The invention relates to a document processing method and device, electronic equipment and a storage medium, and the method comprises the steps: determining a model recognition result of a paragraph in an original document through a document element recognition model, and the model recognition result comprises an element type of the paragraph determined through the document element recognition model; according to a model identification result of a paragraph in the original document, determining a suspected text paragraph from the original document, the suspected text paragraph being a paragraph whose model identification result is a text; and according to the paragraph format attribute of the suspected text paragraph in the original document, carrying out credibility verification on a model identification result of the suspected text paragraph, and determining a final identification result of the suspected text paragraph according to a credibility verification result. Therefore, the accuracy and the reliability of a document element recognition result can be remarkably improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computers, and in particular to a document processing method, device, electronic device and storage medium. Background Art

[0002] With the rapid development of information technology, the application scope of electronic documents is becoming more and more extensive. At the same time, in order to efficiently process electronic documents, it has become a common practice to use models (such as machine learning models, deep learning models, etc.) to identify and analyze documents.

[0003] In related technologies, before sending a document to a model for recognition and analysis, some processing work is usually performed on the document. For example, information in the document that is useless or unhelpful for the model to identify the element type is removed to improve the recognition efficiency of the model and reduce its computational burden. For another example, the document is segmented and model recognition is performed on each segment, aiming to find the best balance between recognition efficiency and recognition accuracy, and to ensure that the document element recognition model can perform at its best with limited computing resources. Although processing work such as these is intended to improve the recognition efficiency of the model and reduce the burden on the model, it may also introduce some potential problems, such as model recognition errors. Summary of the invention

[0004] The present application provides a document processing method, device, electronic device and storage medium to solve the technical problem that model recognition errors may exist in the prior art, thereby causing errors in the recognition results of document element types that rely on the model.

[0005] In a first aspect, the present application provides a document processing method, the method comprising:

[0006] Determine a model recognition result of a paragraph in the original document by using the document element recognition model, wherein the model recognition result includes: an element type of the paragraph determined by the document element recognition model;

[0007] According to the model recognition result of the paragraph in the original document, a suspected text paragraph is determined from the original document, wherein the suspected text paragraph refers to a paragraph whose model recognition result is the text;

[0008] According to the paragraph format attributes of the suspected body paragraph in the original document, the credibility of the model recognition result of the suspected body paragraph is verified, and the final recognition result of the suspected body paragraph is determined according to the credibility verification result.

[0009] In a possible implementation, the performing credibility verification on the model recognition result of the suspected body paragraph according to the paragraph format attribute of the suspected body paragraph in the original document includes:

[0010] According to the paragraph format attribute of the suspected body paragraph in the original document, identifying whether the suspected body paragraph has at least one set special format feature;

[0011] When it is identified that the suspected text paragraph has at least one of the special format features, it is determined that the model recognition result of the suspected text paragraph is questionable; or, when it is identified that the suspected text paragraph does not have any of the special format features, it is determined that the model recognition result of the suspected text paragraph is credible.

[0012] In a possible implementation manner, the special format feature includes one or more of the following format features:

[0013] Paragraph composition structural features, alignment features, character style features, and page layout features.

[0014] In a possible implementation manner, determining the final recognition result of the suspected text paragraph according to the credibility verification result includes:

[0015] When it is determined that the model recognition result of the suspected text paragraph is doubtful, performing secondary recognition on the suspected text paragraph using a preset model;

[0016] The final recognition result of the suspected text paragraph is determined according to the model recognition result of the secondary recognition of the suspected text paragraph.

[0017] In a possible implementation, the secondary recognition of the suspected text paragraph using a preset model includes:

[0018] Obtaining the context interval of the suspected text paragraph;

[0019] The context interval is input into the document element recognition model, so as to perform secondary recognition on the suspected text paragraph by using the document element recognition model.

[0020] In a possible implementation, the secondary recognition of the suspected text paragraph using a preset model includes:

[0021] Determining a target recognition model according to at least one of the special format features existing in the suspected text paragraph;

[0022] The suspected text paragraph is input into the target recognition model, so as to perform secondary recognition on the suspected text paragraph by using the target recognition model.

[0023] In a possible implementation, it further includes:

[0024] When it is determined according to the final recognition result of the suspected text paragraph that the suspected text paragraph belongs to a set recall target, recall processing of the recall target is performed in the original document according to a recall rule corresponding to the recall target;

[0025] The final recognition result of the paragraph in the original document is determined according to the recall processing result of the recall target, the final recognition result of the suspected text paragraph, and the model recognition result of the paragraph in the original document.

[0026] In a possible implementation manner, the step of determining a model recognition result of a paragraph in an original document by using a document element recognition model includes:

[0027] Creating a copy document of the original document, and preprocessing the copy document according to a set preprocessing method to obtain a preprocessed document;

[0028] Using the preprocessed document and the document element recognition model, obtaining a model recognition result of a paragraph in the preprocessed document, wherein the model recognition result includes an element type of the paragraph;

[0029] Based on the paragraph mapping relationship between the original document and the preprocessed document, and the model recognition result of the paragraph in the preprocessed document, the model recognition result of the paragraph in the original document is determined.

[0030] In a second aspect, the present application provides a document processing device, the device comprising:

[0031] A model recognition module, used to determine a model recognition result of a paragraph in an original document using a document element recognition model, wherein the model recognition result includes: an element type of the paragraph determined by the document element recognition model;

[0032] A text screening module, used to determine suspected text paragraphs from the original document according to the model recognition results of the paragraphs in the original document, wherein the suspected text paragraphs refer to the paragraphs whose model recognition results are text;

[0033] A questioning module, configured to verify the credibility of a model recognition result of the suspected text paragraph according to a paragraph format attribute of the suspected text paragraph in the original document;

[0034] The result determination module is used to determine the final recognition result of the suspected text paragraph according to the credibility verification result.

[0035] In a possible implementation, the query module is specifically used to:

[0036] According to the paragraph format attribute of the suspected body paragraph in the original document, identifying whether the suspected body paragraph has at least one set special format feature;

[0037] When it is identified that the suspected text paragraph has at least one of the special format features, it is determined that the model recognition result of the suspected text paragraph is questionable; or, when it is identified that the suspected text paragraph does not have any of the special format features, it is determined that the model recognition result of the suspected text paragraph is credible.

[0038] In a possible implementation manner, the special format feature includes one or more of the following format features:

[0039] Paragraph composition structural features, alignment features, character style features, and page layout features.

[0040] In a possible implementation, the result determination module includes:

[0041] A secondary recognition unit, configured to perform secondary recognition on the suspected text paragraph using a preset model when it is determined that the model recognition result of the suspected text paragraph is in doubt;

[0042] The final recognition result of the suspected text paragraph is determined according to the model recognition result of the secondary recognition of the suspected text paragraph.

[0043] In a possible implementation manner, the secondary identification unit is specifically used to:

[0044] Obtaining the context interval of the suspected text paragraph;

[0045] The context interval is input into the document element recognition model, so as to perform secondary recognition on the suspected text paragraph by using the document element recognition model.

[0046] In a possible implementation manner, the secondary identification unit is specifically used to:

[0047] Determining a target recognition model according to at least one of the special format features existing in the suspected text paragraph;

[0048] The suspected text paragraph is input into the target recognition model, so as to perform secondary recognition on the suspected text paragraph by using the target recognition model.

[0049] In a possible implementation, it further includes:

[0050] A recall module, configured to, when it is determined according to the final recognition result of the suspected body paragraph that the suspected body paragraph belongs to a set recall target, perform a recall process on the recall target in the original document according to a recall rule corresponding to the recall target;

[0051] The result determination module is further used to determine the final recognition result of the paragraph in the original document according to the recall processing result of the recall target, the final recognition result of the suspected text paragraph, and the model recognition result of the paragraph in the original document.

[0052] In a possible implementation, the model identification module includes:

[0053] A copy processing unit, used to create a copy document of the original document, and preprocess the copy document according to a set preprocessing method to obtain a preprocessed document;

[0054] A copy recognition unit, used to obtain a model recognition result of a paragraph in the preprocessed document using the preprocessed document and the document element recognition model, wherein the model recognition result includes an element type of the paragraph;

[0055] A mapping unit is used to determine the model recognition result of the paragraph in the original document based on the paragraph mapping relationship between the original document and the preprocessed document and the model recognition result of the paragraph in the preprocessed document.

[0056] In a third aspect, the present application provides an electronic device, comprising: a processor and a memory, wherein the processor is used to execute a document processing program stored in the memory to implement the document processing method described in any one of the first aspects.

[0057] In a fourth aspect, the present application provides a storage medium storing one or more programs, wherein the one or more programs can be executed by one or more processors to implement the document processing method described in any one of the first aspects.

[0058] The above technical solution provided by the embodiment of the present application has the following advantages over the prior art: the method provided by the embodiment of the present application uses a document element recognition model to determine the model recognition results of paragraphs in the original document, and determines suspected body paragraphs from the original document based on the model recognition results of the paragraphs in the original document. Suspected body paragraphs refer to paragraphs whose model recognition results are body text. The model recognition results of the suspected body paragraphs are verified for credibility based on the paragraph format attributes of the suspected body paragraphs in the original document, and the final recognition results of the suspected body paragraphs are determined based on the credibility verification results. This solution not only relies on the model's recognition results of the paragraph element types in the document, but also combines the paragraph format attributes to further analyze and verify the model's recognition results. This method can significantly improve the accuracy and reliability of the document element recognition results, and provide a more solid foundation for subsequent document processing, such as editing, typesetting and other processing tasks. BRIEF DESCRIPTION OF THE DRAWINGS

[0059] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0060] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0061] One or more embodiments are exemplarily described by pictures in the corresponding drawings, and these exemplified descriptions do not constitute limitations on the embodiments. Elements with the same reference numerals in the drawings represent similar elements, and unless otherwise stated, the figures in the drawings do not constitute proportional limitations.

[0062] Figure 1 A schematic diagram of a system architecture involved in an embodiment of the present application;

[0063] Figure 2 A flowchart of an embodiment of a document processing method provided in an embodiment of the present application;

[0064] Figure 3 A flowchart of another document processing method provided in an embodiment of the present application;

[0065] Figure 4 A flowchart of an embodiment of the present application for preprocessing a copy document of an original document according to a set preprocessing method, and determining a model recognition result of a paragraph in the original document using the preprocessed document;

[0066] Figure 5A diagram comparing the effects of using soft and hard carriage returns for text content;

[0067] Figure 6 A diagram showing the attachment of separators to content and the correct segmentation structure;

[0068] Figure 7 This is a schematic diagram of the segmentation effect of a space character or a tab character;

[0069] Figure 8 This is a schematic diagram showing the effect of text content not being segmented correctly;

[0070] Fig. 9 A schematic diagram of using consecutive blank lines to achieve paging effect;

[0071] Fig.10 A block diagram of an embodiment of a document processing device provided in an embodiment of the present application;

[0072] Fig.11 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0073] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.

[0074] The disclosure below provides many different embodiments or examples to realize the different structures of the present application. In order to simplify the disclosure of the present application, the parts and settings of specific examples are described below. Of course, they are only examples, and the purpose is not to limit the present application. In addition, the present application can repeat reference numbers and / or letters in different examples. This repetition is for the purpose of simplification and clarity, and does not itself indicate the relationship between the various embodiments and / or settings discussed.

[0075] In order to solve the technical problem that model recognition errors may exist in the prior art, thereby causing erroneous recognition results of document element types that rely on the model, the present application provides a document processing method, device, electronic device and storage medium, which can significantly improve the accuracy and reliability of document element recognition results, and provide a more solid foundation for subsequent document processing, such as editing, typesetting and other processing tasks.

[0076] Figure 1 Schematic diagram of a system architecture involved in an embodiment of the present application. Figure 1As shown, the system architecture 100 may include: a client 101, a server 102, a model 103, and a network 104. The network 104 is used to provide a communication link between the client 101, the server 102, and the model 103, and may include a wireless link, a wired link, or an optical fiber cable, etc., which is not limited in this application.

[0077] The client 101 may be a hardware device or software that supports network connection to provide document editing services and other network services. When the device is hardware, it may support various electronic devices with display screens, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, servers, etc. When the device is software, it may be installed in the electronic devices listed above.

[0078] The server 102 is the core processing unit of the entire system architecture 100, and can be deployed with a variety of algorithms and relatively powerful computing resources. Among them, the algorithm may involve multiple fields such as data processing, machine learning, and deep learning, and is used to process the data uploaded or the request sent by the client 101, and perform specific computing tasks, such as document content processing, document content analysis, etc. The computing resources may include high-performance computing clusters, GPU accelerator cards, etc., which are used to support the rapid execution and efficient processing of algorithms.

[0079] The model end 103 is a server or device deployed with one or more models, which are used to process specific computing tasks or provide specific services. For example, a document element recognition model, a natural language processing model, etc. are deployed on the model end 103. Among them, the document element recognition model is used to identify the element type (such as abstract, title, text, etc.) of the paragraph in the input document. When the server end 102 receives the request from the client 101 and needs to call the model, it forwards the request to the model end 103, and the model end 103 uses the deployed model to perform reasoning calculations and outputs the corresponding results. In addition, with the continuous advancement of algorithms and the continuous accumulation of data, the models deployed on the model end 103 can be updated or optimized regularly. Exemplarily, the model end 103 supports automatic updating and version control of the model to ensure that the model can always maintain the latest performance and accuracy. Exemplarily, the server end 102 is responsible for managing the model on the model end 103, including uploading, updating, deleting and version control of the model.

[0080] Understandably, Figure 1 The number of networks and devices in the system architecture 100 is only for illustration. According to actual needs, the system architecture 100 may include any number of networks and devices, which is not limited in the embodiment of the present application.

[0081] In some examples, at least two of the client 101, the server 102, and the model 103 may be the same device, and different terminals in the same device may also transmit data to each other via wireless or wired connections.

[0082] based on Figure 1 In the illustrated system architecture, in an exemplary application scenario, the client 101 sends a document automatic typesetting request to the server 102 and attaches the document to be typeset. The server 102 receives the request and document from the client 101, forwards the document to the model 103, and requests the model 103 to call the deployed document element recognition model to analyze and recognize the document. After receiving the document, the model 103 calls the deployed document element recognition model to analyze and recognize the document, determine the element type of the paragraph in the document, and then returns the recognition result to the server 102.

[0083] Furthermore, after receiving the model recognition result returned by the model end 103, the server end 102 can also use its own algorithms and computing resources to further analyze and verify the model recognition result returned by the model end 103. For example, the server end can check the accuracy of the model recognition result, or further adjust and optimize the model recognition result based on the document's typesetting style, paragraph format and other features. Finally, the server end 103 determines the element type of the paragraph in the document based on the model recognition result and the results of further analysis. Finally, the server end 103 automatically typesets the document according to the determined element type of the paragraph in the document, and returns the typeset document to the client end 101. Alternatively, the server end 103 sends the determined element type of the paragraph in the document to the client end 101, and the client end 101 automatically typesets the document according to the determined element type of the paragraph in the document to obtain the typeset document.

[0084] Through the above process, the server 102 and the model 103 work together. On the one hand, it can efficiently process the automatic typesetting request of the document. On the other hand, the server 102 can make up for the lack of capabilities of the model 103 in certain aspects, thereby improving the accuracy of the final element type recognition result, and further ensuring that the typesetting of the document meets specific standards or requirements.

[0085] In the above exemplary application scenario, the reason why the server 102 uses its own algorithm and computing resources to further analyze and verify the model recognition results returned by the model end 103 after receiving the model recognition results returned by the model end 103 is that: before sending the document to the model end for analysis and recognition, the server 102 usually performs some processing on the document, such as removing useless or unhelpful information in the document for the model to identify the element type, so as to improve the recognition efficiency of the model and reduce its computational burden. Such useless or unhelpful information usually includes the format attributes of the paragraphs in the document, such as font, font size, bold, italic, underline, alignment and other format attributes. The document element recognition model usually does not pay attention to the format attributes of the paragraph when identifying the element type of the paragraph. This is because the main goal of the document element recognition model is to understand and classify the information content in the document from a semantic level, rather than the visual presentation of the document content. For another example, documents (which can be the documents after some information is removed) are segmented and model recognition is performed on the segments, aiming to find the best balance between recognition efficiency and recognition accuracy, and to ensure that the document element recognition model can perform at its best under limited computing resources. Although such processing work is aimed at improving the recognition efficiency of the model and reducing the model burden, it may also introduce some potential problems, such as model recognition errors.

[0086] In view of this, an embodiment of the present application provides a document processing method, which aims to provide a mechanism for the server to further analyze and verify the model recognition results returned by the model side to improve the accuracy of the final recognition results.

[0087] It should be noted that the above division of the client 101, the server 102 and the model 103, as well as the functional division of the execution of each end, is only an example, and some functions can be executed by any end, and the embodiments of the present application do not limit this. For example, the above-mentioned typesetting function can be executed on the server 102, or on the client 101; for another example, the above-mentioned filtering, streamlining and other operations on the document content can be executed on the server 102, or on the model 103, or partially on the server 102 and partially on the model 103. In order to briefly explain and clarify, the embodiments of the present application only use some examples to illustrate the functional division of the execution of each end, but the embodiments of the present application do not limit this.

[0088] Figure 2 The flowchart of an embodiment of a document processing method provided in the embodiment of the present application is shown in FIG. In one embodiment, the method is applied to a server, for example Figure 1 The server 102 shown in the example. Figure 2 As shown, the process includes the following steps:

[0089] Step 201: Determine a model recognition result of a paragraph in an original document using a document element recognition model. The model recognition result includes: an element type of the paragraph determined by the document element recognition model.

[0090] The document element recognition model is a model used to identify the element types of paragraphs in a document (such as abstract, title, body, etc.). Figure 1 In the system architecture shown, the document element recognition model is deployed on the model end 103. Exemplarily, the document element recognition model is a deep learning model or a neural network model.

[0091] In step 201, the server uploads the original document or the processed document to the model side, so that the model side calls the document element recognition model to recognize the element type of the paragraph. The recognition result here is recognized by the document element recognition model, so it is called the model recognition result.

[0092] In one embodiment, the specific implementation of determining the model recognition result of the paragraph in the original document using the document element recognition model includes: creating a copy document of the original document, preprocessing the copy document according to a set preprocessing method to obtain a preprocessed document; using the preprocessed document and the document element recognition model to obtain the model recognition result of the paragraph in the preprocessed document; based on the paragraph mapping relationship between the original document and the preprocessed document, and the model recognition result of the paragraph in the preprocessed document, determine the model recognition result of the paragraph in the original document. As for the specific implementation of this embodiment, it is explained below and will not be described in detail here.

[0093] Step 202: According to the model recognition results of the paragraphs in the original document, the suspected body paragraphs are determined from the original document, where the suspected body paragraphs refer to the paragraphs whose model recognition results are body paragraphs.

[0094] Step 203: According to the paragraph format attributes of the suspected body paragraph in the original document, the credibility of the model recognition result of the suspected body paragraph is verified, and the final recognition result of the suspected body paragraph is determined according to the credibility verification result.

[0095] For ease of understanding, step 202 and step 203 are described in a unified manner as follows:

[0096] It can be seen from the description of step 202 and step 203 that further analysis and verification are performed on the part of the original document that is identified as the main text by the model. The reason for this processing is that the document element recognition model has certain particularities in its operating mechanism. Specifically, the document element model adopts a forward recognition method for other element types other than the main text, such as abstracts, directories and other element types. That is, these elements are directly identified and divided according to features and information. However, for the main text, the document element recognition model adopts a reverse recognition strategy. The so-called reverse recognition means that the document element recognition model determines the content in the document other than the target content (other clearly identified element types other than the main text) as the main text. Although this recognition method simplifies the processing flow to a certain extent, it may also bring problems with recognition accuracy, especially in some complex or structured documents, the main text part may be difficult to accurately divide from other elements directly through reverse recognition. In order to ensure the reliability and accuracy of the recognition results, the embodiment of the present application proposes to regard the text paragraphs identified by the document element recognition model as suspected text paragraphs. That is to say, the server does not directly adopt the model recognition results for the text paragraphs identified by the document element recognition model, but refers to the model recognition results and regards the text paragraphs identified by the document element recognition model as suspected text paragraphs. Subsequently, the server further conducts in-depth analysis based on the paragraph format attributes of these suspected text paragraphs in the original document, aiming to verify the credibility of the model recognition results of the suspected text paragraphs, and determine the final recognition results of the suspected text paragraphs based on the credibility verification results.

[0097] Among them, the credibility verification result includes two possible results: one is credible, and the other is doubtful. If the suspected text paragraph is judged to be credible after the credibility verification, then the server can determine the suspected text paragraph as the text paragraph, and then assign the corresponding text style to the confirmed text paragraph in the automatic typesetting process. However, if the suspected text paragraph is judged to be doubtful after the credibility verification, the server can consider that there is uncertainty in the text identity of the suspected text paragraph. In this case, the suspected text paragraph can be re-identified in order to obtain a more accurate identification result. As for how to perform secondary identification on the suspected text paragraph in doubt, it will be explained through specific embodiments in the following text, which will not be described in detail here.

[0098] So why is the credibility of the model recognition result of the suspected body paragraph verified based on the paragraph format attributes of the suspected body paragraph in the original document? The reasons include the following two aspects: On the one hand, as can be seen from the above description, before sending the document to the document element recognition model for analysis and recognition, the server usually performs some processing on the document, such as removing useless or unhelpful information in the document for the model to identify the element type, so as to improve the recognition efficiency of the model and reduce its computational burden. This part of useless or unhelpful information usually includes the format attributes of the paragraph in the document. Then, the document element recognition model does not use the format attributes of the paragraph in the document during the process of element type recognition. On the other hand, in the actual application of documents, the paragraph format attributes are not only a visual presentation method, but also an important part of the document structure. For the body paragraph, the body paragraph usually has consistent paragraph format attributes, such as uniform font, font size and alignment, etc., while the paragraphs of other element types other than the body paragraph often have their own unique characteristics in paragraph format attributes. For example, the title paragraph is usually short and may use a larger font size and bold font. Another example is that the paragraph on the cover may be right-aligned or centered and arranged vertically. It can be seen that from the perspective of paragraph format attributes, it is possible to better distinguish the main content from other types of content.

[0099] Accordingly, in the technical solution provided in the embodiment of the present application, the credibility of the model recognition result of the suspected body text paragraph is verified according to the paragraph format attributes of the suspected body text paragraph in the original document.

[0100] The technical solution provided by the embodiment of the present application uses a document element recognition model to determine the model recognition results of paragraphs in the original document, and determines suspected body paragraphs from the original document based on the model recognition results of the paragraphs in the original document. Suspected body paragraphs refer to paragraphs whose model recognition results are body text. The model recognition results of the suspected body paragraphs are verified for credibility based on the paragraph format attributes of the suspected body paragraphs in the original document, and the final recognition results of the suspected body paragraphs are determined based on the credibility verification results. This solution not only relies on the model's recognition results of the paragraph element types in the document, but also combines the paragraph format attributes to further analyze and verify the model's recognition results. This method can significantly improve the accuracy and reliability of the document element recognition results, and provide a more solid foundation for subsequent document processing, such as editing, typesetting and other processing tasks.

[0101] Figure 2The illustrated embodiment explains the ins and outs and the overall framework of the technical solution provided by the embodiment of the present application. The following describes through a specific embodiment how to verify the credibility of the model recognition results of the suspected text paragraphs based on the paragraph format attributes of the suspected text paragraphs in the original document.

[0102] In one embodiment, the credibility of the model recognition result of the suspected body paragraph is verified according to the paragraph format attributes of the suspected body paragraph in the original document, including: according to the paragraph format attributes of the suspected body paragraph in the original document, identifying whether the suspected body paragraph has at least one set special format feature. Exemplarily, the special format feature includes but is not limited to one or more of the following format features: paragraph composition structure features, alignment features, character style features, page layout features, etc.

[0103] When it is identified that the suspected body paragraph has at least one special format feature, the model recognition result of the suspected body paragraph is determined to be questionable; or, when it is identified that the suspected body paragraph does not have any special format feature, the model recognition result of the suspected body paragraph is determined to be credible.

[0104] The following is an explanation of the four format feature dimensions: paragraph structure, alignment, character style, and page layout:

[0105] The paragraph composition structural features mainly focus on the content layout and element composition within the paragraph. For example, the body paragraph usually contains coherent sentences and paragraphs, with closely related content and clear logic. If the suspected body paragraph is composed of a single word, a small number of words (especially those with numbers), a large number of spaces, tabs, empty underscores, etc., these features may indicate that the paragraph is not a body paragraph or is not an ordinary body paragraph (that is, a special body paragraph). For example, a paragraph composed of a single word may be used to emphasize a certain character, a small number of numbered fields may be part of a list item or title, a large number of spaces may indicate notes or separations, and tabs and empty underscores may be used for alignment or filling in blanks. Therefore, if a suspected body paragraph has any of the above-mentioned structural features of non-body paragraphs in its paragraph composition structure, it can be considered that the model recognition result of the suspected body paragraph is questionable.

[0106] From the perspective of alignment features, the body paragraphs in most documents are usually left-aligned to keep the content neat and easy to read. If a suspected body paragraph shows a different alignment effect, it means that the paragraph may not be a body paragraph. In other words, the model recognition result of the suspected body paragraph is questionable. Among them, the alignment effect may be achieved by directly setting the alignment attribute, adding a space at the beginning of the paragraph, setting the indentation attribute, etc.

[0107] For example, a suspected text paragraph is centered, that is, centered relative to the page center, which means that the paragraph is likely to be a title paragraph rather than a text paragraph. This means that the model recognition result of the suspected text paragraph is questionable.

[0108] For example, a suspected body paragraph is right-aligned, that is, it is right-aligned relative to the page center, which means that the paragraph may not be an ordinary body paragraph. This can be divided into two meanings. One is that the paragraph does not belong to the body paragraph at all, such as elements such as footers, sidebars, or special notes. The second is that the paragraph may be a special body paragraph, such as some legal documents or clauses in contracts. These clauses are often aligned to the right to contrast or supplement the main text on the left. In either case, it can be considered that the model recognition result of the suspected body paragraph is questionable.

[0109] Page layout features focus on the distribution and arrangement of elements on the page. Text paragraphs are usually arranged on the page according to certain rules and formats to keep the document neat and readable. If the layout of a suspected text paragraph on the page is significantly different from the surrounding text paragraphs, such as occupying a separate page, or being located away from the regular text area, this may indicate that the paragraph has special properties or uses. These features can also be used as a basis for judging the reliability of model recognition results. Therefore, if a suspected text paragraph has any of the above-mentioned non-text paragraph structural features in the page layout structure, the model recognition result of the suspected text paragraph can be considered questionable.

[0110] From the perspective of character style features, the body paragraphs in a document usually follow certain font and font size specifications to maintain the overall consistency and readability of the document. For example, body paragraphs usually use standard fonts preset in the document, such as Songti, Heiti, Microsoft Yahei, etc., and in the body paragraphs, the fonts usually remain consistent without frequent font changes. So, if a suspected body paragraph uses a different font from the surrounding body paragraphs, especially a non-standard or special font, this may indicate that the paragraph is not the body content, or is a special kind of body content. Alternatively, if the font in a suspected body paragraph changes frequently, this may also mean that the paragraph is not the body content or is a special kind of body content. In either case, the model recognition result of the suspected body paragraph can be considered questionable.

[0111] In practical applications, by comprehensively considering the format features of four dimensions, namely, paragraph composition structure features, alignment features, character style features, and page layout features, the credibility of the model recognition results of suspected text paragraphs can be judged more accurately.

[0112] From the description of the above embodiments, it can be seen that when processing the target document, some content that is classified as body text but belongs to special body text paragraphs may be encountered. The special nature of such content is usually reflected in the different styles from general body text paragraphs. Therefore, when typesetting the target document, for such special body text paragraphs, the style rules of general body text cannot be simply applied, but need to be processed separately.

[0113] In the technical solution provided in the embodiment of the present application, the separate processing of special text paragraphs can be divided into the following situations:

[0114] The first situation is: if there are clear typesetting specifications, typesetting should be carried out according to the clear typesetting specifications. For example, the recipients of official documents, abstracts, keywords and other paragraphs in papers will have clear font, font size, font shape, font color, font effect, font spacing and other font attribute requirements, as well as alignment, indentation, paragraph spacing, line spacing and other paragraph attribute requirements.

[0115] The second situation is that multiple text paragraphs belong to a table structure interval, and cannot be typed through a single segment attribute setting. For example: signature information, contract information, communication information, appendix description, notes, test questions, roster, etc. This type of text paragraph interval belonging to a table structure needs to be typed separately. Furthermore, for this type of text paragraph interval, according to the number of structural entities contained in the interval, it can be divided into a single body structure and a multi-body structure, or, according to the number of fields appearing in a paragraph, it can be divided into a single column structure and a multi-column structure. These two types can appear in cross-combination.

[0116] For this type of text paragraph interval, when typesetting, first, ensure the layout relationship between this interval and the context, and treat it as a whole for typesetting; secondly, ensure the paragraph structure relationship within this interval, and use tabs to reconstruct the table structure.

[0117] The third situation is: for unplanned or unknown special format text paragraphs or intervals, a conservative strategy of "no processing" is adopted, that is, the format and layout of the original text are retained, and the original overall style and style are maintained as much as possible.

[0118] In addition, if there are some structural features inside, such as continuous symbol separation, alignment processing can be performed within the interval to ensure the consistency and neatness of the entire interval.

[0119] The above embodiment can identify special text paragraphs and then perform typeset processing on the special text paragraphs separately, thereby ensuring the consistency of the document format and the clarity of the content after the reformatting, and improving the overall quality of the document.

[0120] Figure 3 A flowchart of another document processing method provided in an embodiment of the present application. Figure 3 The process shown in Figure 2 Based on the process shown, the following steps are included:

[0121] Step 301: Determine a model recognition result of a paragraph in an original document using a document element recognition model. The model recognition result includes: an element type of the paragraph determined by the document element recognition model.

[0122] Step 302: According to the model recognition results of the paragraphs in the original document, the suspected body paragraphs are determined from the original document, and the suspected body paragraphs refer to the paragraphs whose model recognition results are body paragraphs.

[0123] Step 303: Verify the credibility of the model recognition result of the suspected body paragraph according to the paragraph format attributes of the suspected body paragraph in the original document. If the model recognition result of the suspected body paragraph is determined to be credible, execute step 304; if the model recognition result of the suspected body paragraph is determined to be doubtful, execute step 305.

[0124] Step 304: determine the model recognition result of the suspected text paragraph as its final recognition result.

[0125] The detailed description of steps 301 to 304 can be found in the relevant description of the above embodiment, which will not be repeated here.

[0126] Step 305: perform secondary recognition on the suspected text paragraph using a preset model; determine the final recognition result of the suspected text paragraph based on the model recognition result of the secondary recognition of the suspected text paragraph.

[0127] If the model recognition result of the suspected text paragraph is determined to be doubtful in the above steps, the suspected text paragraph is re-recognized using a preset model to obtain a more accurate recognition result. Exemplarily, the model recognition result of the secondary recognition is determined as the final recognition result of the suspected text paragraph.

[0128] In one embodiment, the specific implementation of secondary recognition of suspected text paragraphs using a preset model includes: obtaining a context interval of the suspected text paragraph; inputting the context interval into a document element recognition model to perform secondary recognition of the suspected text paragraph using the document element recognition model.

[0129] The context interval of the suspected body paragraph includes the suspected body paragraph itself and the context content closely related to it. The context interval of the suspected body paragraph is input into the pre-trained document element recognition model, aiming to consider more context information to obtain a more accurate recognition result. Exemplarily, the context interval of the suspected body paragraph includes all paragraphs in the page where the suspected body paragraph is located.

[0130] In one embodiment, the specific implementation of performing secondary recognition on suspected text paragraphs using a preset model includes: determining a target recognition model based on at least one special format feature existing in the suspected text paragraph; inputting the suspected text paragraph into the target recognition model to perform secondary recognition on the suspected text paragraph using the target recognition model.

[0131] In the process of using the model for the first time to identify, at least one special format feature of the suspected text paragraph has been identified, and these special format features may include features such as paragraph composition structure, alignment, character style, page layout, etc. This embodiment proposes that, based on these special format features, one or more more suitable target recognition models are selected to perform secondary recognition on the suspected text paragraph. The target recognition model can be a model that is optimized specifically for the recognition of a certain type of special format feature, so it can provide more accurate recognition results. For example, if there are a large number of tabs in the suspected text paragraph, it means that the suspected text paragraph may be a test question, so a special test question recognition model can be used to perform secondary recognition on the suspected text paragraph. In addition, if the features of the suspected text paragraph are more complex, multiple models can also be combined to jointly identify to improve the accuracy and reliability of the final recognition result.

[0132] Figure 3 The process shown can improve the accuracy and reliability of the final recognition result of the suspected text paragraph in the target document by using a preset model to perform a secondary recognition on the suspected text paragraph when the model recognition result of the suspected text paragraph is doubtful.

[0133] Based on any of the above embodiments, the present application also provides the following embodiments:

[0134] In one embodiment, when it is determined that the suspected body text paragraph belongs to a set recall target based on the final recognition result of the suspected body text paragraph, recall processing of the recall target is performed in the original document according to the recall rule corresponding to the recall target; the final recognition result of the paragraph in the original document is determined based on the recall processing result of the recall target, the final recognition result of the suspected body text paragraph, and the model recognition result of the paragraph in the original document.

[0135] Based on any of the above embodiments, the present application also provides the following embodiments:

[0136] In one embodiment, when it is determined that the suspected body text paragraph belongs to a set recall target based on the final recognition result of the suspected body text paragraph, recall processing of the recall target is performed in the original document according to the recall rule corresponding to the recall target; the final recognition result of the paragraph in the original document is determined based on the recall processing result of the recall target, the final recognition result of the suspected body text paragraph, and the model recognition result of the paragraph in the original document.

[0137] Recall targets refer to objects that need to be recalled by the server. In actual applications, these objects may not be accurately identified due to the limitations of the model. Recall targets can be specific document areas, such as embedded sub-document areas, chapter preamble areas, appendix areas, directory areas, etc. At the same time, recall targets can also include specific types of elements, such as the "main recipient" in official documents, "keywords" and "conclusion" in papers, etc.

[0138] Recall rules are rules formulated according to the specific needs of recall target identification. These rules may be formulated based on the structural characteristics of the recall target (such as paragraph position, format, etc.), content characteristics (such as keywords, specific sentence patterns, etc.) or comprehensive consideration of contextual information.

[0139] Recall processing of recall targets in the target document means: combining the model recognition results of the paragraphs in the target document, applying the recall rules corresponding to the recall targets, and recalling the recall targets that the document element recognition model fails to accurately identify. This may involve reclassifying the misclassified recall targets to the correct element type, or identifying the recall targets that were missed by the document element recognition model and classifying them into the correct element type recognition results.

[0140] Generally, different recall targets correspond to different recall rules. Therefore, for different recall targets, the specific recall processing procedures are also different. We will not go into details here. We will discuss the specific recall processing procedures for different recall targets in the following text.

[0141] By applying the technical solution provided in the embodiment of the present application, the element type of the paragraph determined in the recall processing result is combined with the model recognition result to form the final element type recognition result of the paragraph in the target document.

[0142] In one embodiment, for paragraphs that are set as recall targets and obtain accurate element types through recall processing, the results of the recall processing are adopted as the final element types of these paragraphs. For paragraphs that are not set as recall targets, or are set as recall targets but fail to provide clear element types through recall processing, the final element types of these paragraphs are determined based on the model recognition results.

[0143] The above-mentioned embodiment provides a scheme for identifying paragraph element types in a document by combining the recognition capability of a document element recognition model and a rule-based recall strategy. This scheme realizes the complementary advantages between the recognition capability of a document element recognition model and a rule-based recall strategy, and can recall element types that the model cannot recognize or cannot accurately recognize from the target document, thereby improving the accuracy and completeness of document element type recognition.

[0144] Finally, through Figure 4 The illustrated embodiment describes how to preprocess a copy of an original document according to a set preprocessing method, and use the preprocessed document to determine the model recognition result of a paragraph in the original document. Figure 4 As shown, the following steps are included:

[0145] Step 401: Create a copy document of the original document, and preprocess the copy document according to a set preprocessing method to obtain a preprocessed document.

[0146] Step 402: Using the preprocessed document and the document element recognition model, obtain a model recognition result of the paragraphs in the preprocessed document.

[0147] Step 403: Determine the model recognition result of the paragraph in the original document based on the paragraph mapping relationship between the original document and the preprocessed document, and the model recognition result of the paragraph in the preprocessed document.

[0148] For ease of understanding and description, steps 401 to 403 are explained uniformly below:

[0149] The original document is the client (for example Figure 1 The client 101 shown in the example sends a document automatic typesetting request to the server and attaches the document that needs typesetting.

[0150] It can be seen from the description of step 401 and step 402 that when the server receives the original document from the client and the automatic typesetting request for the original document, it first creates a copy of the original document, namely the copy document, and then pre-processes and analyzes and identifies the copy document. In other words, the copy document is created for subsequent pre-processing and analysis and identification to ensure that the content and format of the original document will not be directly modified or destroyed during the entire processing process, thereby protecting the security and integrity of the original document. On the one hand, this allows the server to process documents more flexibly without worrying about irreversible changes to the original document. On the other hand, the server can subsequently further analyze and verify, adjust and optimize the model recognition results of the model end based on the original content and format in the original document, so as to improve the accuracy of the element type recognition results of the paragraphs in the original document that are finally determined.

[0151] In the technical solution of the embodiment of the present application, the key purpose of preprocessing the copy document of the original document is to ensure that the content in the document can be correctly segmented, because correct segmentation is an important prerequisite for the subsequent model end to identify the element type of the paragraph in the document. On this basis, as described in steps 401 and 402, by preprocessing the copy document, a preprocessed document in which the content is correctly segmented is obtained, and then the preprocessed document is used to identify the paragraph element type. This processing method can improve the accuracy of the paragraph element type recognition result.

[0152] In one embodiment, the copy document is preprocessed according to a set preprocessing method to obtain a preprocessed document. The set preprocessing method includes a set of document processing operations, and these document processing operations are intended to ensure that the content in the document can be correctly segmented. As for how to preprocess the copy document according to the set preprocessing method to obtain the preprocessed document, it will be explained below and will not be described in detail here.

[0153] In the process of pre-processing the copy document, a paragraph mapping relationship between the original document and the pre-processed document can also be established. Specifically, in the original document, a unique identifier (such as a paragraph number, a paragraph ID, etc.) is assigned to each paragraph. In the process of pre-processing the copy document of the original document, the original position and the modified position of each paragraph are recorded to establish a mapping relationship between the paragraph in the original document and the corresponding paragraph in the pre-processed document. In step 403, through the paragraph mapping relationship, the model recognition result of the paragraph in the pre-processed document can be corresponded back to the corresponding paragraph in the original document, thereby determining the model recognition result of the paragraph in the original document.

[0154] In one embodiment, the copy document is preprocessed according to a set preprocessing method, and the specific implementation of obtaining the preprocessed document includes: identifying non-standard typesetting styles related to segmentation or paging from the copy document, converting the non-standard typesetting styles into a set standard typesetting style, and obtaining the preprocessed document.

[0155] Among them, non-standard typesetting styles refer to segmentation or paging operations that do not meet the model recognition requirements. These operations may be due to the document creator using specific tools or specific habits. For example, the segmentation operation required by the model recognition can be based on the hard return character in the document data to determine the segmentation. Non-standard typesetting styles usually cause the model to be unable to accurately recognize the paragraph structure of the document, thereby affecting subsequent feature type recognition tasks. For example, the document creator uses space characters to achieve a segmentation effect in a certain paragraph of the document. Although this can achieve the segmentation effect visually, the document feature recognition model deployed on the model side cannot understand this segmentation achieved by space characters. Therefore, this segmentation operation is regarded as a non-standard typesetting style.

[0156] The standard typesetting style refers to the segmentation operation that meets the model recognition requirements. Such segmentation operation is usually based on the general specifications or standards in the document processing field, such as specific paragraph markers.

[0157] It can be seen that by identifying non-standard typesetting styles related to paragraphing or paging from the copy document, converting the non-standard typesetting styles into the set standard typesetting styles, and obtaining the pre-processed document, it can ensure that the non-standard typesetting styles in the copy document are corrected and converted into standard typesetting styles that the model can accurately recognize. This helps the model accurately recognize the paragraph structure of the document, thereby supporting the subsequent feature type recognition task.

[0158] The standardization of the paragraphing style used in the document (the standardization here refers to the recognition ability of the model) will directly affect the model's recognition of paragraphs in the document. In addition, the separation style used in the document is also crucial to the coherence of the model's paragraph recognition. Therefore, the following discusses the specific implementation of identifying non-standard typesetting styles related to paragraphing or paging from the copy document from the two dimensions of paragraphing style and separation style, and converting non-standard typesetting styles into the set standard typesetting style.

[0159] Among them, from the perspective of segmentation style, as an optional implementation method, non-standard typesetting styles related to segmentation or paging are identified from the copy document, and the specific implementation of converting the non-standard typesetting style into a set standard typesetting style includes: identifying non-standard segmentation styles from the copy document, and converting the non-standard segmentation styles into a set standard segmentation style.

[0160] Exemplarily, the standard segmentation style is a paragraph marker (also known as a hard return), that is, the paragraph marker is used as a standard separation mark between document paragraphs, and the document element recognition model can accurately recognize the standard separation mark as the basis for paragraph recognition.

[0161] In this embodiment, based on the recognition rules corresponding to the preset non-standard typesetting styles, the non-standard typesetting styles can be identified from the copy document based on the recognition rules; in addition, the conversion rules for converting different non-standard typesetting styles into standard typesetting styles can also be determined, and standardized conversion can be performed based on the conversion rules.

[0162] The following examples describe the following non-standard segmentation styles that may exist in the copy document and their corresponding conversion rules:

[0163] The first type: soft return segmentation

[0164] In document editing scenarios, soft returns are often used to wrap lines within the same paragraph, rather than to create new paragraphs. However, due to the user's specific editing habits or insufficient understanding of document typesetting specifications, soft returns may be mistakenly used to try to visually create a segmentation effect.

[0165] In view of this situation, the non-standard segmentation style is identified from the copy document, and the specific implementation of converting the non-standard segmentation style into the set standard segmentation style includes: identifying the soft carriage return from the copy document, and converting the soft carriage return into a paragraph marker. By converting the soft carriage return into a paragraph marker, it is helpful to restore the correct paragraph structure of the document, thereby helping the subsequent model to accurately identify the paragraphs in the copy document and then identify the element type of the paragraph.

[0166] For example, see Figure 5 , which is a diagram comparing the effects of using soft carriage returns and hard carriage returns in text content.

[0167] The second type: the separator is glued to the content paragraph

[0168] In document editing scenarios, separators (such as page breaks and section breaks) are usually used to visually or logically separate document content, and can usually also achieve segmentation in visual effects. For example, Figure 6 The string "I am a free paragraph at the top of the page" on page 2 and the string "I am a glued paragraph at the top of the page, I am part of the paragraph on the previous page" on page 3 are visually displayed as two paragraphs due to the existence of page breaks. However, if the hard return character is used as the paragraph separation criterion, the string "I am a free paragraph at the top of the page" on page 2 and the string "I am a glued paragraph at the top of the page, I am part of the paragraph on the previous page" on page 3 will still be recognized as the same paragraph (see Figure 6 , there is no hard return after the string in page 2), resulting in a difference between the segmentation based on document data and the visual effect segmentation that conforms to user intent.

[0169] That is to say, due to the user's editing habits or specific needs, these separators are sometimes attached to the paragraph content, making it look like two paragraphs visually. However, if the hard return character is used as the segmentation standard, the actual segmentation result will not be correctly separated in the document structure, that is, the two paragraphs separated by the separator will still be divided into the same paragraph.

[0170] In view of this situation, the non-standard paragraphing style is identified from the copy document, and the specific implementation of converting the non-standard paragraphing style to the set standard paragraphing style includes: identifying the separators attached to the paragraph content from the copy document, inserting paragraph markers between the separators and the attached paragraph content, so as to restore the correct paragraph structure of the document. Figure 6 , where page 1 is an example of correct paragraph structure. Figure 6 As shown on page 1 of the text, the string "I am a free paragraph at the top of the page" is followed by a page break, and there is also a hard return after the page break. Based on the hard return as the segmentation standard, the string "I am a free paragraph at the top of the page" in page 1 and the string "I am a free paragraph at the top of the page" in page 2 are identified as two paragraphs. In addition, there is another correct paragraph structure: the delimiter is at the beginning of the paragraph, that is, the delimiter is after the hard return. For example, suppose Figure 6 The content of page 1 is "I am a free paragraph hard return at the top of the page", and the content of page 2 is "Separator I am a free paragraph hard return at the top of the page", which is also the correct paragraph structure and can be used to Figure 6 The string in page 1 and the string in page 2 are correctly identified as two paragraphs.

[0171] Based on this, firstly, the separator mark (such as the specific code of the page break, the identifier of the section break, etc., which vary depending on the document format) is identified from the copy document, and then, for the identified separator, it is analyzed whether it is attached to the paragraph content. Here, the attachment of the separator mark to the paragraph content is manifested as the absence of a paragraph mark between the separator and the paragraph content. For example, see Figure 6 In the example on page 2 of the article, the delimiter tag is attached to the string "I am a free paragraph at the top of the page". Another case is that there is no paragraph tag after the delimiter tag. In other words, if there is no paragraph tag before or after the delimiter tag, it can be considered that the delimiter tag is attached to the paragraph content. In this case, insert a paragraph tag (such as a hard return) between the delimiter tag and the attached paragraph content to ensure that the paragraphs can be separated correctly. For example, Figure 6 Change page 2 in to "I am a free paragraph hard return section break at the top of the page (next page)".

[0172] The third type: space or tab segment

[0173] In a document editing context, users may use spaces or tabs to try to visually separate paragraphs, but these characters do not actually form true paragraph breaks in the document structure. For example, see Figure 7 , which is a schematic diagram of the segmentation effect of space or tab characters.

[0174] In view of this situation, the specific implementation of identifying the non-standard segmentation style from the copy document and converting the non-standard segmentation style into the set standard segmentation style includes: identifying the line ending with multiple continuous spaces or tabs from the copy document, deleting the multiple continuous spaces or tabs at the end of the line, and inserting a paragraph mark at the end of the line. Exemplarily, the copy document content is traversed line by line, and it is checked whether the end of each line contains multiple continuous spaces or tabs. If continuous spaces or tabs are found, these characters are deleted and a paragraph mark is inserted at the end of the line. Specifically, when typesetting, the copy document content is traversed line by line. For example, if a line can display 20 characters, 20 characters are read from the copy document content as a line to be traversed. For the line currently traversed, if the last character position of the current line is a space character or a tab character when traversing to it, it means that the current line ends with a space character or a tab character. Then, delete the continuous spaces or tabs at the end of the line, and insert a paragraph mark at the end of the current line. Continue to read the content of the copy document that can be typeset into a line as the new current traversed line. In this way, the lines between the current line and the previous paragraph mark will be separated into a paragraph, and the next line of the current line will become the starting line of a new paragraph.

[0175] The fourth case: the text content is not segmented

[0176] In document editing scenarios, users may fail to divide text content into multiple paragraphs correctly due to negligence or specific editing habits, resulting in multiple paragraphs being merged into one paragraph. This merging is particularly obvious when the document contains numbered lists, because each numbered item should usually be considered an independent paragraph. For example, see Figure 8 , which is a schematic diagram of the effect of not correctly segmenting text content.

[0177] In view of this situation, the specific implementation of identifying the non-standard paragraphing style from the copy document and converting the non-standard paragraphing style into the set standard paragraphing style includes: identifying a paragraph including at least two numbers from the copy document, and inserting a paragraph marker before the non-first number in the paragraph. Exemplarily, the document content is traversed line by line or paragraph by paragraph to find the paragraphs containing numbers, and for each paragraph containing at least two numbers, the position of the non-first number is found. A paragraph marker is inserted before each non-first number to ensure that after the paragraph marker is inserted, each numbered item is located in a new paragraph.

[0178] In addition, when the text content is not segmented and does not contain a numbered list, the model can also be used to segment the text content. For example, the model segments the text content using contextual semantic recognition technology. This is not limited here.

[0179] From the perspective of separation style, as an optional implementation method, non-standard typesetting styles related to paragraphing or paging are identified from the copy document, and the specific implementation of converting the non-standard typesetting styles into the set standard typesetting styles includes: identifying non-standard separation styles from the copy document, and converting the non-standard separation styles into the set standard separation styles.

[0180] For example, the following non-standard separation styles may exist in the copy document:

[0181] The first type: Section / page break paging

[0182] In a document editing scenario, users may use different paging or sectioning methods to organize content, such as directly inserting page breaks or inserting blank pages (which usually introduce section breaks) to achieve paging effects. However, these different paging or sectioning methods may lead to inconsistent document structures, thus affecting the readability of the document and the efficiency and accuracy of document analysis and recognition.

[0183] In response to this situation, a non-standard separation style is identified from the copy document. The specific implementation of converting the non-standard separation style to the set standard separation style includes: identifying a section break or page break at the end of a line from the copy document, and moving the section break or page break at the end of a line to the beginning of the next line of the line to ensure consistency of the paging or sectioning method in the copy document.

[0184] The second type: paragraph break and line break

[0185] In a document editing scenario, users may sometimes achieve page breaks by simply pressing Enter to add a blank line, but this is not recommended because it will become ineffective as the document layout is adjusted. For example, see Fig. 9 , a schematic diagram of using consecutive blank lines to achieve paging effect

[0186] In response to this situation, a non-standard separation style is identified from the copy document. The specific implementation of converting the non-standard separation style to the set standard separation style includes: identifying a page ending with continuous blank lines from the copy document, inserting a page break at the beginning of the first line of the next page of the page, and deleting the continuous blank lines at the end of the page to ensure the consistency and stability of the paging method in the copy document.

[0187] Specifically, for each page of the copy document, traverse line by line. For the current traversed line, if it is found that there are no valid characters in the line, for example, all are space characters or tab characters, then continue to traverse the next line. If there are valid characters in the traversed line, stop traversing the current page and continue to traverse the next line by line. If it is traversed to the last line of the current page and it is found that there are still no valid characters in the last line, it means that the current page ends with continuous blank lines. Then, insert a page break at the beginning of the first line of the next page of the page, and delete the continuous blank lines at the end of the page. Through this processing method, page redundancy caused by continuous blank lines can be avoided, and the page division of the document can also be made clearer and more reasonable.

[0188] The third type: paragraph attribute paging

[0189] In a document editing scenario, users may use paragraph properties (such as "page break before" or "page break after") to achieve paging effects. This method is more common for professional users such as Office, but it may also be inadvertently introduced into the document due to operations such as copying and pasting, causing other users to be unaware or overwhelmed.

[0190] In view of this situation, the specific implementation of identifying the non-standard delimiting style from the copy document and converting the non-standard delimiting style into the set standard delimiting style includes: identifying the paragraphs with paragraph attributes set from the copy document, determining the first paragraph of the next page according to the paragraph attributes set for the paragraph, and inserting a page break at the beginning of the first paragraph of the next page to ensure the consistency and readability of the paging method of the copy document. Exemplarily, the copy document is traversed line by line or paragraph by paragraph to identify the paragraphs with specific paragraph attributes (such as page break before paragraph, page break after paragraph, etc.). After determining the first paragraph of the next page, a page break is inserted at the beginning of the paragraph, and the paragraph attributes originally used for paging are cleared.

[0191] By deeply analyzing the paragraph and separation styles in the copy documents, identifying the non-standard typesetting styles formed by the document creator's use of specific tools or habits, and converting these non-standard typesetting styles into the set standard typesetting styles, it can ensure that the model can accurately recognize and understand the paragraph structure of the copy documents.

[0192] The consistency and standardization of numbering are also crucial for the model to understand the logical structure of the document. In the document editing scenario, users may use a variety of numbering methods, including manual numbering, single-level automatic numbering, multi-level automatic numbering, etc., and these numbering styles may involve numbers, Chinese characters, special symbols, etc. In addition, the complex relationship between numbering and paragraphs, such as indentation and spacing, may also cause the typesetting to not meet user expectations. Therefore, unifying the numbering method and achieving controllability and consistency of typesetting is an important task in document processing.

[0193] Based on this, as an optional implementation, the specific implementation of identifying the non-standard typesetting style related to paragraphing or paging from the copy document and converting the non-standard typesetting style to the set standard typesetting style includes: identifying the non-standard numbering style from the copy document and converting the non-standard numbering style to the set standard numbering style. Exemplarily, the specific implementation of identifying the non-standard numbering style from the copy document and converting the non-standard numbering style to the set standard numbering style includes: identifying the number set with the automatic numbering style from the copy document and canceling the automatic numbering style setting for the number.

[0194] It can be seen that manual numbering is used in the copy documents to avoid the complexity brought by automatic numbering, thereby improving the reliability and consistency of the copy document layout and laying the foundation for the subsequent model to accurately understand the logical structure of the document.

[0195] In addition, there will be some non-standard content in the document. The non-standard content here refers to the content form in the document that does not conform to the set standard specifications. The set standard specifications are, for example, customized by document processing software, industry practices or users, and are intended to ensure the consistency and readability of the document. Exemplary, non-standard content includes: domain elements, revision marks, etc. Domain elements are used to insert dynamic content into the document, such as page numbers, dates, etc. In the final layout of the document, domain elements should be replaced with domain results. Modification marks indicate that the document has been modified, such as strikethroughs, underlines, texts of different colors, etc. In the final layout of the document, revision marks should be replaced with revised content. It can also be seen from this that non-standard content usually refers to the intermediate form of content generated during the document editing process, while standard content refers to the content presented in the final layout of the document.

[0196] Due to the limited computing power of the model, non-standard content may interfere with the model's paragraph recognition. In this regard, as an optional implementation method, non-standard typesetting styles related to segmentation or paging are identified from the copy document, and the specific implementation of converting the non-standard typesetting styles to the set standard typesetting styles includes: identifying non-standard content styles from the copy document, and converting the non-standard content styles to the set standard content styles. By normalizing the non-standard content styles in the copy document, it can be ensured that they will not interfere with the model's recognition.

[0197] Exemplarily, the specific implementation of identifying non-standard content styles from the copy document and converting the non-standard content styles into the set standard content styles includes: identifying domain elements from the copy document, determining domain results of the domain elements, and using the domain results to replace the domain elements in the copy document.

[0198] Exemplarily, the specific implementation of identifying non-standard content styles from a copy document and converting the non-standard content styles into a set standard content style includes: identifying revised content with revision marks from the copy document, determining the revised content of the revised content, and replacing the revised content with the revised content in the copy document.

[0199] In addition to domain elements and revision content, there may be other types of non-standard content, such as hidden text, footnotes / endnotes, comments, etc. For these contents, corresponding identification and conversion strategies can be formulated according to specific needs, and the embodiments of the present application do not limit this.

[0200] Figure 4 The process shown, by creating a copy of the original document, preprocessing the copy document according to the set preprocessing method, obtaining a preprocessed document, and using the preprocessed document and the document element recognition model to obtain the model recognition result of the paragraph in the preprocessed document, can ensure that the content in the document can be correctly segmented, thereby improving the accuracy of the recognition result of the subsequent use of the model to identify the paragraph element type. At the same time, during the document processing process, the content and format of the original document are retained to the greatest extent, which provides a basis for the subsequent server to further analyze and verify, adjust and optimize the model recognition results based on the original content and format in the original document, so as to improve the accuracy of the final recognition result of the element type of the paragraph in the original document.

[0201] Fig.10 This is a block diagram of an embodiment of a document processing device provided in an embodiment of the present application. Fig.10 As shown, the device comprises:

[0202] The model recognition module 101 is used to determine the model recognition result of the paragraph in the original document by using the document element recognition model, and the model recognition result includes: the element type of the paragraph determined by the document element recognition model;

[0203] A text screening module 102, for determining suspected text paragraphs from the original document according to the model recognition results of the paragraphs in the original document, wherein the suspected text paragraphs refer to the paragraphs whose model recognition results are text;

[0204] A questioning module 103, configured to verify the credibility of the model recognition result of the suspected text paragraph according to the paragraph format attribute of the suspected text paragraph in the original document;

[0205] The result determination module 104 is used to determine the final recognition result of the suspected text paragraph according to the credibility verification result.

[0206] In a possible implementation, the query module 103 is specifically configured to:

[0207] According to the paragraph format attribute of the suspected body paragraph in the original document, identifying whether the suspected body paragraph has at least one set special format feature;

[0208] When it is identified that the suspected text paragraph has at least one of the special format features, it is determined that the model recognition result of the suspected text paragraph is questionable; or, when it is identified that the suspected text paragraph does not have any of the special format features, it is determined that the model recognition result of the suspected text paragraph is credible.

[0209] In a possible implementation manner, the special format feature includes one or more of the following format features:

[0210] Paragraph composition structural features, alignment features, character style features, and page layout features.

[0211] In a possible implementation, the result determination module 104 includes:

[0212] A secondary recognition unit, configured to perform secondary recognition on the suspected text paragraph using a preset model when it is determined that the model recognition result of the suspected text paragraph is in doubt;

[0213] The final recognition result of the suspected text paragraph is determined according to the model recognition result of the secondary recognition of the suspected text paragraph.

[0214] In a possible implementation manner, the secondary identification unit is specifically used to:

[0215] Obtaining the context interval of the suspected text paragraph;

[0216] The context interval is input into the document element recognition model, so as to perform secondary recognition on the suspected text paragraph by using the document element recognition model.

[0217] In a possible implementation manner, the secondary identification unit is specifically used to:

[0218] Determining a target recognition model according to at least one of the special format features existing in the suspected text paragraph;

[0219] The suspected text paragraph is input into the target recognition model, so as to perform secondary recognition on the suspected text paragraph by using the target recognition model.

[0220] In a possible implementation, it further includes:

[0221] A recall module, configured to, when it is determined according to the final recognition result of the suspected body paragraph that the suspected body paragraph belongs to a set recall target, perform a recall process on the recall target in the original document according to a recall rule corresponding to the recall target;

[0222] The result determination module is further used to determine the final recognition result of the paragraph in the original document according to the recall processing result of the recall target, the final recognition result of the suspected text paragraph, and the model recognition result of the paragraph in the original document.

[0223] In a possible implementation, the model identification module 101 includes:

[0224] A copy processing unit, used for creating a copy document of the original document, preprocessing the copy document according to a set preprocessing method to obtain a preprocessed document;

[0225] A copy recognition unit, used to obtain a model recognition result of a paragraph in the preprocessed document using the preprocessed document and the document element recognition model, wherein the model recognition result includes an element type of the paragraph;

[0226] A mapping unit is used to determine the model recognition result of the paragraph in the original document based on the paragraph mapping relationship between the original document and the preprocessed document and the model recognition result of the paragraph in the preprocessed document.

[0227] like Fig.11 As shown, an embodiment of the present application provides an electronic device, including a processor 111, a communication interface 112, a memory 113 and a communication bus 114, wherein the processor 111, the communication interface 112, and the memory 113 communicate with each other through the communication bus 114.

[0228] Memory 113, used for storing computer programs;

[0229] In one embodiment of the present application, the processor 111 is used to execute the program stored in the memory 113 to implement the document processing method provided by any of the above method embodiments, including:

[0230] Determine a model recognition result of a paragraph in the original document by using the document element recognition model, wherein the model recognition result includes: an element type of the paragraph determined by the document element recognition model;

[0231] According to the model recognition result of the paragraph in the original document, a suspected text paragraph is determined from the original document, wherein the suspected text paragraph refers to a paragraph whose model recognition result is the text;

[0232] According to the paragraph format attributes of the suspected body paragraph in the original document, the credibility of the model recognition result of the suspected body paragraph is verified, and the final recognition result of the suspected body paragraph is determined according to the credibility verification result.

[0233] An embodiment of the present application further provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of the document processing method provided in any of the aforementioned method embodiments are implemented.

[0234] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0235] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a general hardware platform, and of course, by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the relevant technology can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0236] It should be understood that the terms used herein are only for the purpose of describing specific example embodiments and are not intended to be limiting. Unless the context clearly indicates otherwise, the singular forms "one", "an" and "said" as used herein may also be meant to include plural forms. The terms "include", "comprise", "contain", and "have" are inclusive, and therefore specify the existence of stated features, steps, operations, elements and / or parts, but do not exclude the existence or addition of one or more other features, steps, operations, elements, parts, and / or combinations thereof. The method steps, processes, and operations described herein are not interpreted as necessarily requiring them to be performed in the specific order described or illustrated, unless the execution order is clearly indicated. It should also be understood that additional or alternative steps may be used.

[0237] The above description is only a specific implementation of the present application, so that those skilled in the art can understand or implement the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest range consistent with the principles and novel features applied for herein.

Claims

1. A document processing method, characterized in that: The method comprises: Determine a model recognition result of a paragraph in the original document by using the document element recognition model, wherein the model recognition result includes: an element type of the paragraph determined by the document element recognition model; According to the model recognition result of the paragraph in the original document, a suspected text paragraph is determined from the original document, wherein the suspected text paragraph refers to a paragraph whose model recognition result is the text; According to the paragraph format attributes of the suspected body paragraph in the original document, the credibility of the model recognition result of the suspected body paragraph is verified, and the final recognition result of the suspected body paragraph is determined according to the credibility verification result.

2. The method according to claim 1, characterized in that The verifying the credibility of the model recognition result of the suspected text paragraph according to the paragraph format attribute of the suspected text paragraph in the original document includes: According to the paragraph format attribute of the suspected body paragraph in the original document, identifying whether the suspected body paragraph has at least one set special format feature; When it is identified that the suspected text paragraph has at least one of the special format features, it is determined that the model recognition result of the suspected text paragraph is questionable; or, when it is identified that the suspected text paragraph does not have any of the special format features, it is determined that the model recognition result of the suspected text paragraph is credible.

3. The method according to claim 2, characterized in that The special format features include one or more of the following format features: Paragraph composition structural features, alignment features, character style features, and page layout features.

4. The method according to claim 2, characterized in that: The determining of the final recognition result of the suspected text paragraph according to the credibility verification result includes: When it is determined that the model recognition result of the suspected text paragraph is doubtful, performing secondary recognition on the suspected text paragraph using a preset model; The final recognition result of the suspected text paragraph is determined according to the model recognition result of the secondary recognition of the suspected text paragraph.

5. The method according to claim 4, characterized in that The second recognition of the suspected text paragraph by using a preset model includes: Obtaining the context interval of the suspected text paragraph; The context interval is input into the document element recognition model, so as to perform secondary recognition on the suspected text paragraph by using the document element recognition model.

6. The method according to claim 4, characterized in that The second recognition of the suspected text paragraph by using a preset model includes: Determining a target recognition model according to at least one of the special format features existing in the suspected text paragraph; The suspected text paragraph is input into the target recognition model, so as to perform secondary recognition on the suspected text paragraph by using the target recognition model.

7. The method according to claim 1, characterized in that Also includes: When it is determined according to the final recognition result of the suspected text paragraph that the suspected text paragraph belongs to a set recall target, recall processing of the recall target is performed in the original document according to a recall rule corresponding to the recall target; The final recognition result of the paragraph in the original document is determined according to the recall processing result of the recall target, the final recognition result of the suspected text paragraph, and the model recognition result of the paragraph in the original document.

8. The method according to claim 1, characterized in that The method of using the document element recognition model to determine the model recognition result of the paragraph in the original document includes: Creating a copy document of the original document, and preprocessing the copy document according to a set preprocessing method to obtain a preprocessed document; Using the preprocessed document and the document element recognition model, obtaining a model recognition result of a paragraph in the preprocessed document, wherein the model recognition result includes an element type of the paragraph; Based on the paragraph mapping relationship between the original document and the preprocessed document, and the model recognition result of the paragraph in the preprocessed document, the model recognition result of the paragraph in the original document is determined.

9. A document processing device, characterized in that: The device comprises: A model recognition module, used to determine a model recognition result of a paragraph in an original document using a document element recognition model, wherein the model recognition result includes: an element type of the paragraph determined by the document element recognition model; A text screening module, used to determine suspected text paragraphs from the original document according to the model recognition results of the paragraphs in the original document, wherein the suspected text paragraphs refer to the paragraphs whose model recognition results are text; A questioning module, configured to verify the credibility of a model recognition result of the suspected text paragraph according to a paragraph format attribute of the suspected text paragraph in the original document; The result determination module is used to determine the final recognition result of the suspected text paragraph according to the credibility verification result.

10. An electronic device, characterized in that: include: A processor and a memory, wherein the processor is used to execute a document processing program stored in the memory to implement the document processing method according to any one of claims 1 to 8.

11. A storage medium, characterized in that: The storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the document processing method according to any one of claims 1 to 8.