Model training method, standard format document generation method and device
By training a deep learning model to recognize and transform document structure features, the problem of document editing tools struggling to handle multiple format types is solved, achieving the effect of generating standard format documents without user intervention.
Patent Information
- Application Number
- CN202310468475.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-04-27
- Publication Date
- 2026-02-13
- Estimated Expiration
- 2043-04-27
AI Technical Summary
In existing technologies, document editing tools struggle to support the standardized processing of various document formats, especially TXT, DOC, DOCX, and PDF. Furthermore, they rely on website servers, requiring users to engage in extensive learning and practice to create standardized documents.
By training a deep learning model, document structural features are identified and format conversion functions are added to generate standard format documents. This includes model training methods and standard format document generation methods, utilizing deep learning models to identify document structural features and perform format conversion.
It enables standardized processing of documents of different formats, and can directly generate standard format documents without requiring users to learn and operate extensively, thus improving document editing efficiency.
Smart Images

Figure CN116484223B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present disclosure relates to the technical field of document editing, the technical field of artificial intelligence, and the technical field of finance, in particular to a model training method, a standard format document generation method, device, equipment, medium and program product. BACKGROUND
[0002] Papers, legal documents, official documents, etc. as a formal document, its writing format and text layout has certain normativity. This requires the document writer to not only be familiar with the professional knowledge of the field, but also need to be familiar with the document format requirements, and be able to use the document editing tool with certain document editing ability skillfully, and direct use of the document editing tool to form the standard format style still needs the document editor to learn and operate a lot. Therefore, developing a quick editing tool specially used for editing papers and other standard format documents on the basis of the document editing tool will provide convenience for paper editors.
[0003] However, in the related art, the generation method for papers and other standard format documents cannot support the standardized processing of multiple format types of documents such as TXT (text file, plain text file), DOC (document), DOCX (document), PDF (Portable Document Format, Portable Document Format), and the like, and the document processing relies on a website server. SUMMARY
[0004] In view of the above problems, the present disclosure provides a model training method, a standard format document generation method, device, equipment, medium and program product.
[0005] According to a first aspect of the present disclosure, a model training method is provided, comprising:
[0006] inputting a standard format training text into an initial deep learning model, and outputting structure features of each standard structure part of the standard format training text, wherein the standard format training text comprises structure labels of each standard structure part;
[0007] adjusting model parameters of the initial deep learning model according to the structure features of each standard structure part of the standard format training text and the structure labels of each standard structure part, to obtain a first deep learning model;
[0008] inputting a non-standard format training text into the first deep learning model, and outputting structure features of each non-standard structure part of the non-standard format training text, wherein the non-standard format training text comprises structure labels of each non-standard structure part, and the text type of the non-standard format training text is the same as that of the standard format training text;
[0009] According to the structural features of each non-standard structure part of the non-standard format training text and the structure labels of each non-standard structure part, the model parameters of the first deep learning model are adjusted to obtain a second deep learning model.
[0010] In a case where the text recognition accuracy of the second deep learning model meets a preset condition, a format conversion function is added to the second deep learning model to obtain a target model.
[0011] According to an embodiment of the present disclosure, the model training method further includes:
[0012] A test text is obtained, wherein the test text includes the non-standard format training text.
[0013] The test text is input into the second deep learning model, and the structural features of each test structure part of the test text are output.
[0014] According to the structural features of each test structure part of the test text and the structure labels of each test structure part, the text recognition accuracy of the second deep learning model is determined.
[0015] According to an embodiment of the present disclosure, the model training method further includes:
[0016] In a case where the text recognition accuracy of the second deep learning model does not meet the preset condition, the standard format training text and the non-standard format training text are merged to obtain a merged training text.
[0017] The merged training text is input into the second deep learning model, and the structural features of each structure part of the merged training text are output.
[0018] According to the structural features of each structure part of the merged training text and the structure labels of each structure part, the model parameters of the second deep learning model are adjusted to obtain a third deep learning model.
[0019] The third deep learning model is added with the format conversion function to obtain a fourth deep learning model.
[0020] According to an embodiment of the present disclosure, the model training method further includes:
[0021] The test text is input into the fourth deep learning model, and a format conversion text is output, wherein the test text includes the non-standard format training text.
[0022] According to the format conversion text, a conversion accuracy of the fourth deep learning model is determined.
[0023] In a case where the conversion accuracy of the fourth deep learning model meets the preset condition, the fourth deep learning model is determined as the target model.
[0024] According to an embodiment of the present disclosure, the outputting the format conversion text by inputting the test text into the fourth deep learning model comprises:
[0025] identifying text content of the test text to obtain paragraph features of each paragraph of the test text;
[0026] identifying each test structure part of the test text to obtain structure features of each test structure part of the test text;
[0027] performing format conversion on the test text according to the paragraph features of each paragraph of the test text and the structure features of each test structure part of the test text by using the format conversion function of the fourth deep learning model to obtain the format conversion text.
[0028] According to an embodiment of the present disclosure, the model training method further comprises:
[0029] In a case where the conversion accuracy of the fourth deep learning model does not meet the preset condition, performing tuning operation on the fourth deep learning model according to the text with format errors in the format conversion text to obtain the target model.
[0030] According to an embodiment of the present disclosure, the performing tuning operation on the fourth deep learning model according to the text with format errors in the format conversion text to obtain the target model comprises repeatedly performing the following operations until the preset condition is met:
[0031] In a case where the conversion accuracy of the fourth deep learning model does not meet the preset condition,
[0032] merging the text with format errors in the format conversion text and the non-standard format training text into new non-standard format training text;
[0033] inputting the new non-standard format training text into the fourth deep learning model to output structure features of each non-standard structure part of the new non-standard format training text;
[0034] adjusting model parameters of the target model according to the structure features of each non-standard structure part of the new non-standard format training text and the structure labels of each non-standard structure part to obtain a new fourth deep learning model;
[0035] obtaining a new test text, wherein the new test text comprises the new non-standard format training text.
[0036] inputting the new test text into the new fourth deep learning model, and outputting a new format conversion text;
[0037] determining a conversion accuracy of the new fourth deep learning model according to the new format conversion text;
[0038] determining the new fourth deep learning model as the target model when the conversion accuracy of the new fourth deep learning model meets the preset condition.
[0039] A second aspect of the present disclosure provides a standard format document generation method, comprising:
[0040] determining a target model corresponding to a text type of an original document according to the text type of the original document;
[0041] inputting the original document into the target model, and outputting a standard format document.
[0042] According to an embodiment of the present disclosure, the inputting of the original document into the target model to obtain a standard format document comprises:
[0043] recognizing text content of the original document to obtain paragraph features of each paragraph of the original document;
[0044] recognizing each structural part of the original document to obtain structural features of each structural part of the original document;
[0045] using the format conversion function of the target model, converting the original document according to the paragraph features of each paragraph and the structural features of each structural part to obtain the standard format document.
[0046] According to an embodiment of the present disclosure, the using of the format conversion function of the target model to convert the original document according to the paragraph features of each paragraph and the structural features of each structural part to obtain the standard format document comprises:
[0047] determining segmentation information of text content in the original document and a positional relationship between each paragraph according to the paragraph features of each paragraph of the original document;
[0048] inserting the text content in the original document into a pure text format document according to the segmentation information of the text content in the original document and the positional relationship between each paragraph;
[0049] determining a standard format corresponding to each structural part of the pure text format document according to the structural features of each structural part of the original document.
[0050] According to the standard format corresponding to each structural part of the pure text format document, the format of each structural part in the pure text format document is converted into the corresponding standard format, and a first standard format document is obtained;
[0051] According to the paragraph features of each paragraph and the structural features of each structural part of the original document, the first standard format document is typeset to obtain the standard format document.
[0052] According to an embodiment of the present disclosure, the typesetting of the first standard format document according to the paragraph features of each paragraph and the structural features of each structural part of the original document to obtain the standard format document comprises:
[0053] According to the paragraph features of each paragraph of the original document, the positional relationship between the non-text content and the text content in the original document is determined;
[0054] According to the positional relationship between the non-text content and the text content, the non-text content is inserted into the corresponding position of the first standard format document to obtain a second standard format document;
[0055] According to the structural features of each structural part of the original document, the structural name of each structural part of the second standard format document is determined;
[0056] Each page of the second standard format document is generated with a corresponding page number to obtain a third standard format document;
[0057] According to the structural name of each structural part and the page number of the third standard format document, a table of contents of the third standard format document is generated;
[0058] The table of contents of the third standard format document and the third standard format document are assembled to obtain the standard format document.
[0059] The third aspect of the present disclosure provides a model training apparatus, comprising a first input module, a first adjustment module, a second input module, a second adjustment module and an adding module. The first input module is configured to input a standard format training text into an initial deep learning model, and output structure features of each standard structure part of the standard format training text, wherein the standard format training text comprises structure labels of each standard structure part. The first adjustment module is configured to adjust model parameters of the initial deep learning model according to the structure features of each standard structure part of the standard format training text and the structure labels of each standard structure part, and obtain a first deep learning model. The second input module is configured to input a non-standard format training text into the first deep learning model, and output structure features of each non-standard structure part of the non-standard format training text, wherein the non-standard format training text comprises structure labels of each non-standard structure part, and the non-standard format training text and the standard format training text are of the same text type. The second adjustment module is configured to adjust the model parameters of the first deep learning model according to the structure features of each non-standard structure part of the non-standard format training text and the structure labels of each non-standard structure part, and obtain a second deep learning model. The adding module is configured to add a format conversion function to the second deep learning model when a text recognition accuracy of the second deep learning model meets a preset condition, and obtain a target model.
[0060] The fourth aspect of the present disclosure provides a standard format document generation apparatus, comprising a determining module and an input module. The determining module is configured to determine a target model corresponding to a text type of an original document according to the text type of the original document. The input module is configured to input the original document into the target model, and output a standard format document.
[0061] The fifth aspect of the present disclosure provides an electronic device, comprising one or more processors; a memory storing one or more programs, wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to perform the above method.
[0062] The sixth aspect of the present disclosure further provides a computer-readable storage medium having stored thereon executable instructions that, when executed by a processor, cause the processor to perform the above method.
[0063] The seventh aspect of the present disclosure further provides a computer program product comprising a computer program, which, when executed by a processor, implements the above method.
[0064] According to the model training method, the standard format document generation method, the device, the equipment, the medium and the program product provided by the present disclosure, the target model obtained by the model training method can accurately identify the structural characteristics of each structural part of the document in the input target model, so as to convert the format of each structural part into the corresponding standard format, and can support the standardization processing of different format documents. Therefore, according to the standard format document generation method implemented by using the target model, the original document can be directly input into the target model corresponding to the text type of the original document, and the standard format document can be obtained without guidance or self-editing, so as to realize the standard format conversion of the original document. BRIEF DESCRIPTION OF DRAWINGS
[0065] The above and other objects, features and advantages of the present disclosure will become more apparent from the following description of embodiments of the present disclosure, taken in conjunction with the accompanying drawings, in which:
[0066] Figure 1 The application scenario diagram of the model training method and the standard format document generation method according to the embodiments of the present disclosure is schematically shown;
[0067] Figure 2 The flowchart of the model training method according to the embodiments of the present disclosure is schematically shown;
[0068] Figure 3 The flowchart of the tuning operation according to the embodiments of the present disclosure is schematically shown;
[0069] Figure 4 The flowchart of the standard format document generation method according to the embodiments of the present disclosure is schematically shown;
[0070] Figure 5 The flowchart of obtaining the standard format document according to the embodiments of the present disclosure is schematically shown;
[0071] Figure 6 The flowchart of converting the original document by using the format conversion function according to the embodiments of the present disclosure is schematically shown;
[0072] Figure 7 The flowchart of typesetting the first standard format document according to the embodiments of the present disclosure is schematically shown;
[0073] Figure 8 The structural block diagram of the model training device according to the embodiments of the present disclosure is schematically shown;
[0074] Figure 9 The structural block diagram of the standard format document generation device according to the embodiments of the present disclosure is schematically shown; and
[0075] Figure 10A block diagram of an electronic device suitable for implementing the model training method and the standard format document generation method according to an embodiment of the disclosure is schematically shown. DETAILED DESCRIPTION
[0076] Hereinafter, embodiments of the disclosure will be described with reference to the accompanying drawings. It should be understood, however, that the description is merely exemplary and is not intended to limit the scope of the disclosure. In the following detailed description of the embodiments of the disclosure, numerous specific details are set forth in order to provide a thorough understanding of the embodiments of the disclosure. However, it would be apparent to one skilled in the art that the embodiments of the disclosure can be practiced without these specific details. In other instances, well-known structures and techniques have not been described in detail in order to avoid obscuring aspects of the disclosure.
[0077] The terms used herein are merely used to describe specific embodiments and are not intended to limit the disclosure. The terms "include", "comprise" and the like used herein indicate the presence of the described features, steps, operations, and / or components, but do not exclude the presence or addition of one or more other features, steps, operations, or components.
[0078] All terms used herein, including technical and scientific terms, have meanings commonly understood by one of ordinary skill in the art unless otherwise defined. It should be noted that the terms used herein should be interpreted as having meanings consistent with the context of the present specification, and should not be interpreted in an idealized or overly formal manner.
[0079] In the case of using expressions similar to "at least one of A, B, and C, etc.", it should be generally interpreted as including one or more of the relevant items (for example, "a system having at least one of A, B, and C" should include but not be limited to a system having A alone, a system having B alone, a system having C alone, a system having both A and B, a system having both A and C, a system having both B and C, and / or a system having A, B, and C together, etc.).
[0080] In the technical solutions of the disclosure, the collection, storage, use, processing, transmission, provision, disclosure, and application of data (such as including but not limited to user personal information) involved in the technical solutions comply with relevant legal regulations, necessary security measures are taken, and do not violate public order and good customs.
[0081] In the process of implementing the present disclosure, it is found that the current mainstream document editing tools such as WPS (Word Processing System), WORD (Microsoft Office Word), etc. provide basic functions for editing thesis documents, but since they are widely used basic document editing tools and are not designed specifically for the special format editing needs of standard documents such as papers, directly using the document editing tools to form the standard format style still requires a lot of learning and operation of the document editor. At the same time, in the related art, there is currently a method of guiding the thesis layout based on web rich text editing tools, but this method has certain limitations, such as not supporting the standardization processing of multiple format type documents (such as TXT, DOC, DOCX, PDF, etc.), and the document processing depends on the website server, etc.
[0082] Figure 1 The application scenario of the model training method and the standard format document generation method according to the embodiments of the present disclosure is schematically shown.
[0083] As shown in Figure 1 The application scenario 100 according to the embodiments can include a first terminal device 101, a second terminal device 102, a third terminal device 103, a network 104 and a server 105. The network 104 is a medium for providing a communication link between the first terminal device 101, the second terminal device 102, the third terminal device 103 and the server 105. The network 104 can include various connection types, such as wired, wireless communication links or optical fiber cables, etc.
[0084] A user can use at least one of the first terminal device 101, the second terminal device 102, and the third terminal device 103 to interact with the server 105 through the network 104 to receive or send messages, etc. Various communication client applications can be installed on the first terminal device 101, the second terminal device 102, and the third terminal device 103, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only as examples).
[0085] The first terminal device 101, the second terminal device 102, and the third terminal device 103 can be various electronic devices with display screens and supporting web browsing, including but not limited to smartphones, tablet computers, laptop computers, desktop computers, etc.
[0086] The server 105 can be a server that provides various services, such as a background management server that provides support for a website browsed by a user using the first terminal device 101, the second terminal device 102, and the third terminal device 103 (only as an example). The background management server can perform analysis and the like on received user requests and the like, and feed back the processing results (such as a web page, information, or data obtained or generated according to a user request, and the like) to the terminal device.
[0087] For example, the standard format training text can be input into the initial deep learning model through the server 105, and the structure features of each standard structure part of the standard format training text can be output, so that the model parameters of the initial deep learning model can be adjusted according to the structure features of each standard structure part of the standard format training text and the structure labels of each standard structure part, to obtain the first deep learning model; the non-standard format training text can be input into the first deep learning model, and the structure features of each non-standard structure part of the non-standard format training text can be output, so that the model parameters of the first deep learning model can be adjusted according to the structure features of each non-standard structure part of the non-standard format training text and the structure labels of each non-standard structure part, to obtain the second deep learning model, and the format conversion function can be added to the second deep learning model in a case where the text recognition accuracy of the second deep learning model meets a preset condition, to obtain the target model.
[0088] It should be noted that the model training method and the standard format document generation method provided in the embodiments of the present disclosure can generally be executed by the server 105. Correspondingly, the model training device and the standard format document generation device provided in the embodiments of the present disclosure can generally be arranged in the server 105. The model training method and the standard format document generation method provided in the embodiments of the present disclosure can also be executed by a server or a server cluster different from the server 105 and capable of communicating with the first terminal device 101, the second terminal device 102, the third terminal device 103, and / or the server 105. Correspondingly, the model training device and the standard format document generation device provided in the embodiments of the present disclosure can also be arranged in a server or a server cluster different from the server 105 and capable of communicating with the first terminal device 101, the second terminal device 102, the third terminal device 103, and / or the server 105.
[0089] It should be understood that Figure 1 The number of terminal devices, networks, and servers in the above-described scenario is only illustrative. According to the implementation needs, there can be any number of terminal devices, networks, and servers.
[0090] The model training method and the standard format document generation method of the disclosed embodiments will be described in detail below based on the Figure 1 scenario described above. Figures 2-7 The model training method and the standard format document generation method of the disclosed embodiments will be described in detail below based on the Figure 1 scenario described above. Figures 2-7
[0091] Figure 2 A flowchart of a model training method according to an embodiment of the present disclosure is shown schematically.
[0092] As shown in Figure 2 The method 200 includes operation S210 to operation S250.
[0093] In operation S210, the standard format training text is input into the initial deep learning model, and the structure features of each standard structure part of the standard format training text are output.
[0094] According to an embodiment of the present disclosure, the standard format training text can include structure labels of each standard structure part. For example, for the standard format training text of the type of paper, the standard format training text can include structure labels of each standard structure part, such as a first-level title label, a second-level title label, an author label, and the like, and the standard format training text can further include a standard format label. The standard format label can be used to confirm that a certain structure label is a label of a certain standard structure part in the standard format training text.
[0095] According to an embodiment of the present disclosure, the standard format training text can include a large number of documents with each structure part being in a standard format with pictures and tables. The standard format can include the standard format of line spacing, font type, font size, and the like of the corresponding structure part of the document under the corresponding type. The corresponding structure part in the standard format training text is given a corresponding structure label, which can be used for the initial deep learning model to learn and recognize the structure features of each standard structure part in the standard format training text.
[0096] According to an embodiment of the present disclosure, the initial deep learning model can include a CNN (Convolutional Neural Network) and can also include a K-means algorithm (K-means clustering algorithm).
[0097] In operation S220, the model parameters of the initial deep learning model are adjusted according to the structure features of each standard structure part of the standard format training text and the structure labels of each standard structure part, and a first deep learning model is obtained.
[0098] According to an embodiment of the present disclosure, the standard format training text is input into the initial deep learning model, the initial deep learning model extracts features of each standard structure part in the standard format training text, and the structure features of each standard structure part in the standard format training text are recognized.
[0099] According to an embodiment of the present disclosure, the structure features of each standard structure part in the standard format training text are determined according to the structure features of each standard structure part in the standard format training text and the structure labels of each standard structure part, so that the structure features of each standard structure part recognized by the initial deep learning model can be determined to be incorrect, and then the model parameters of the initial deep learning model can be adjusted according to the structure labels corresponding to the incorrect structure features, so as to obtain the first deep learning model. For example, the structure feature recognized by the initial deep learning model represents "author", and the structure label of the structure part in the standard format training text is "title", so it can be determined that the structure feature of the initial deep learning model is incorrect, and then the model parameters corresponding to the structure part in the initial deep learning model can be adjusted according to the incorrect structure feature and the structure label corresponding to the incorrect structure feature.
[0100] In operation S230, the non-standard format training text is input into the first deep learning model, and the structure features of each non-standard structure part of the non-standard format training text are output.
[0101] According to an embodiment of the present disclosure, the structure labels of each non-standard structure part can be included in the non-standard format training text. For example, for the non-standard format training text of the type of paper, the structure labels of each non-standard structure part can be included in the non-standard format training text, such as a first title label, a second title label, an author label, and the like, and the non-standard format training text can further include a non-standard format label. The non-standard format label can be used to confirm that a certain structure label is the label of a certain non-standard structure part in the non-standard format training text.
[0102] According to an embodiment of the present disclosure, the text types of the non-standard format training text and the standard format training text are the same. The initial deep learning model is trained by using the standard format training text and the non-standard format training text of the same text type, so that the model obtained by training can be used for format conversion of the document of the same text type, and the difficulty of training can be reduced. For example, the initial deep learning model is trained by using the standard format training text and the non-standard format training text of the type of paper, so that a model for processing the document of the type of paper can be obtained; the initial deep learning model is trained by using the standard format training text and the non-standard format training text of the type of legal documents, so that a model for processing the document of the type of legal documents can be obtained.
[0103] According to an embodiment of the present disclosure, the non-standard format training text can include a large number of documents with pictures and tables in non-standard format of each structural part. The difference between the standard format training text and the non-standard format training text is only that the format of each structural part of the non-standard format training text is non-standard. For example, for the standard format training text and the non-standard format training text of the text type of a paper, the standard format training text can include the paper title, author, abstract, keywords and other basic structural parts of the paper, and the format of each structural part of the standard format training text is standard; the non-standard format training text can also include the paper title, author, abstract, keywords and other basic structural parts of the paper, but the format of each structural part of the non-standard format training text is non-standard.
[0104] According to an embodiment of the present disclosure, the corresponding structural label is given to the corresponding structural part in the non-standard format training text, which can be used to enrich the recognition ability of the first deep learning model for the structural features of each non-standard structural part in the non-standard format training text.
[0105] In operation S240, the model parameters of the first deep learning model are adjusted according to the structural features of each non-standard structural part of the non-standard format training text and the structural label of each non-standard structural part, to obtain a second deep learning model.
[0106] According to an embodiment of the present disclosure, the non-standard format training text is input into the first deep learning model, and the first deep learning model extracts features of each non-standard structural part in the non-standard format training text to recognize the structural features of each non-standard structural part in the non-standard format training text.
[0107] According to an embodiment of the present disclosure, according to the structural features of each non-standard structural part in the non-standard format training text and the structural label of each non-standard structural part, the recognition correctness of the first deep learning model for the structural features of each non-standard structural part in the non-standard format training text can be determined, so that the structural features recognized by the first deep learning model and having errors with the structural label of each non-standard structural part can be obtained, and then the model parameters of the first deep learning model are adjusted according to the structural label corresponding to the structural features with errors, to obtain a second deep learning model. For example, a certain structural feature recognized by the first deep learning model represents "author", and the structural label of the structural part in the non-standard format training text is "title", so it can be determined that the first deep learning model has errors in recognizing the structural features of the structural part, and then the model parameters corresponding to the structural part in the first deep learning model can be adjusted according to the structural features with errors and the structural label corresponding to the structural features with errors.
[0108] In operation S250, in a case where the text recognition accuracy of the second deep learning model meets a preset condition, a format conversion function is added to the second deep learning model to obtain a target model.
[0109] According to an embodiment of the present disclosure, the initial deep learning model is trained by the standard format training text and the non-standard format training text respectively, and the second deep learning model can be obtained. The text recognition accuracy can represent the proportion of the documents in which all the structure parts are correctly recognized by the second deep learning model. The preset condition can represent a threshold of the text recognition accuracy, for example, the preset condition can include that the threshold of the text recognition accuracy is 80%, and the threshold can also be 70%, 75%, 85%, 90%, or 95%.
[0110] According to an embodiment of the present disclosure, in a case where the text recognition accuracy of the second deep learning model meets a preset condition, a format conversion function is added to the second deep learning model to obtain a target model, so that the target model can be used in practical applications. The format conversion function can be used to convert the format of each structure part of the recognized document in the second deep learning model to a standard format.
[0111] According to an embodiment of the present disclosure, the target model obtained by the model training method can accurately recognize the structure characteristics of each structure part of the input document in the target model, so as to convert the format of each structure part to the corresponding standard format, and can support the standardization processing of different format documents.
[0112] According to an embodiment of the present disclosure, the model training method further includes: obtaining a test text; inputting the test text into the second deep learning model to output the structure characteristics of each test structure part of the test text; and determining the text recognition accuracy of the second deep learning model according to the structure characteristics of each test structure part of the test text and the structure label of each test structure part.
[0113] According to an embodiment of the present disclosure, the initial deep learning model is trained by the standard format training text and the non-standard format training text respectively, and the second deep learning model can be obtained. The final purpose of training the model is to make the text recognition accuracy of the obtained target model meet a preset condition, for example, the preset condition can represent that the threshold of the text recognition accuracy is 80%, so that most of the structure parts of the documents can be correctly recognized.
[0114] According to an embodiment of the present disclosure, the test text can include the non-standard format training text, so that the non-standard format training text can be used as the test text to test the obtained second deep learning model, and the text recognition accuracy of the second deep learning model can be calculated.
[0115] According to an embodiment of the present disclosure, the test text is input into the second deep learning model, the second deep learning model performs feature extraction on each test structure part in the test text, and the structure features of each test structure part in the test text can be obtained. According to the structure labels of each test structure part in the test text, it is determined whether the structure features of each test structure part in the test text recognized by the second deep learning model are correct, that is, whether the structure part represented by the structure features of a certain structure part recognized by the second deep learning model is consistent with the structure label of the structure part, so that the proportion of documents in which all structure parts in the test text are correctly recognized, that is, the text recognition accuracy, can be obtained. For example, the structure part represented by the structure features of a certain structure part recognized is "author", and the structure label of the structure part is "title", so the structure features of the structure part recognized by the second deep learning model are incorrect.
[0116] According to an embodiment of the present disclosure, the structure features of each test structure part in the test text can represent the structure features of each non-standard structure part in the non-standard format training text, and the structure labels of each test structure part in the test text can represent the structure labels of each non-standard structure part in the non-standard format training text.
[0117] According to an embodiment of the present disclosure, the text recognition accuracy of the second deep learning model obtained by testing the second deep learning model with the test text can be used to determine whether the text recognition accuracy of the second deep learning model meets a preset condition, so that the second deep learning model can no longer be trained when the text recognition accuracy of the second deep learning model meets the preset condition; and the second deep learning model can continue to be trained until the text recognition accuracy meets the preset condition when the text recognition accuracy of the second deep learning model does not meet the preset condition.
[0118] According to an embodiment of the present disclosure, the model training method further includes: in the case that the text recognition accuracy of the second deep learning model does not meet the preset condition, merging the standard format training text and the non-standard format training text to obtain a merged training text; inputting the merged training text into the second deep learning model to output the structure features of each structure part of the merged training text; adjusting the model parameters of the second deep learning model according to the structure features of each structure part of the merged training text and the structure labels of each structure part to obtain a third deep learning model; adding a format conversion function to the third deep learning model to obtain a fourth deep learning model.
[0119] According to an embodiment of the present disclosure, in a case where the text recognition accuracy of the second deep learning model meets a preset condition, a format conversion function is added to the second deep learning model, and a target model is obtained. In a case where the text recognition accuracy of the second deep learning model does not meet the preset condition, the second deep learning model needs to be continuously trained until the text recognition accuracy meets the preset condition.
[0120] According to an embodiment of the present disclosure, the standard format training text and the non-standard format training text can be processed and merged to obtain a merged training text, and the second deep learning model is trained according to the obtained merged training text, that is, the standard format training text and the non-standard format training text are mixed together and simultaneously used as the training text of the second deep learning model, which can improve the recognition ability of the second deep learning model, wherein the merged training text can include the labels of each standard structure part in the standard format training text, the standard format label, the labels of each non-standard structure part in the non-standard format training text, and the non-standard format label.
[0121] According to an embodiment of the present disclosure, the merged training text is input into the second deep learning model, and the second deep learning model extracts features of each structure part in the merged training text, and the structure features of each structure part in the merged training text can be obtained, wherein the structure features of each structure part in the merged training text can include the structure features of each standard structure part and the structure features of each non-standard structure part.
[0122] According to an embodiment of the present disclosure, according to the structure features of each structure part in the merged training text and the structure labels of each structure part, the recognition accuracy of the first deep learning model for the structure features of each structure part in the merged training text can be determined, so that the structure features with incorrect structure labels of each structure part recognized by the second deep learning model can be obtained, and then the model parameters of the second deep learning model are adjusted according to the structure labels corresponding to the structure features with incorrect recognition, so that a third deep learning model is obtained.
[0123] According to an embodiment of the present disclosure, the third deep learning model is obtained by training an initial deep learning model using the standard format training text, the non-standard format training text, and the merged training text. The format conversion function can be added to the third deep learning model to obtain a fourth deep learning model, and in a case where the text recognition accuracy of the fourth deep learning model does not meet a preset condition, the fourth deep learning model can be subsequently optimized.
[0124] According to an embodiment of the present disclosure, in a case where the text recognition accuracy of the second deep learning model does not satisfy the preset condition, the second deep learning model is trained by using the merged training text obtained by merging the standard format training text and the non-standard format training text, so as to improve the recognition capability of the second deep learning model, and the third deep learning model obtained is added with a format conversion function, so as to obtain a fourth deep learning model, which is used for format conversion of a document.
[0125] According to an embodiment of the present disclosure, the model training method further includes: inputting the test text into the fourth deep learning model, and outputting a format conversion text; determining a conversion accuracy of the fourth deep learning model according to the format conversion text; and in a case where the conversion accuracy of the fourth deep learning model satisfies a preset condition, determining the fourth deep learning model as the target model.
[0126] According to an embodiment of the present disclosure, the test text is input into the fourth deep learning model, and the fourth deep learning model includes the added format conversion function, so as to convert the format of each test structure part in the test text into a corresponding standard format, thereby outputting the format conversion text, wherein the test text can include the non-standard format training text.
[0127] According to an embodiment of the present disclosure, according to the obtained format conversion text, a document in which the format of each structure part in the format conversion text is all converted correctly can be determined, so as to determine the conversion accuracy of the fourth deep learning model.
[0128] According to an embodiment of the present disclosure, the fourth deep learning model is obtained by adding a format conversion function to the third deep learning model, and the difference between the third deep learning model and the fourth deep learning model is the format conversion function, and the format conversion function can represent that, in a case where the structure features of each structure part are recognized, the format of each structure part is converted into a corresponding standard format according to the corresponding structure features, and thus it can be seen that the format conversion function is to convert the format of each structure part into a corresponding standard format on the basis of recognizing the structure features of each structure part. For example, in a case where the structure features of a certain structure part represent an “author”, the format of the structure part can be converted into the standard format of the structure. Therefore, the conversion accuracy of the fourth deep learning model is consistent with the text recognition accuracy of the third deep learning model, and the conversion accuracy of the fourth deep learning model also needs to satisfy the same preset condition.
[0129] According to an embodiment of the present disclosure, in a case where the conversion accuracy of the fourth deep learning model satisfies the preset condition, the fourth deep learning model can be determined as the target model, so that the target model can be used in actual application.
[0130] According to an embodiment of the present disclosure, the fourth deep learning model is tested by using the test text, and the fourth deep learning model is determined as the target model when the conversion accuracy of the fourth deep learning model meets the preset condition, so that the target model can be used for standard conversion of the document format in actual application.
[0131] According to an embodiment of the present disclosure, the test text is input into the fourth deep learning model, and the format conversion text is output, including: recognizing the text content of the test text to obtain the paragraph features of each paragraph of the test text; recognizing each test structure part of the test text to obtain the structure features of each test structure part of the test text; and using the format conversion function of the fourth deep learning model, converting the format of the test text according to the paragraph features of each paragraph of the test text and the structure features of each test structure part to obtain the format conversion text.
[0132] According to an embodiment of the present disclosure, the test text is input into the fourth deep learning model, and the test text can be recognized by the fourth deep learning model to obtain the paragraph features of each paragraph of the test text, and each structure part of the test text can be recognized to obtain the structure features of each test structure part of the test text.
[0133] According to an embodiment of the present disclosure, according to the paragraph features of each paragraph of the test text, the text content of the test text in different file formats can be inserted into the editable format document by using the format conversion function, and the text content in the test text can be ensured to be retained in the editable format document, wherein the test text in different file formats can include documents in different file formats such as PDF, TXT, XML (Extensible Markup Language, Extensible Markup Language) and the like.
[0134] According to an embodiment of the present disclosure, according to the structure features of each test structure part of the test text, the standard format corresponding to each test structure part in the test text can be determined by using the format conversion function, so as to convert the format of each test structure part in the test text into the corresponding standard format.
[0135] According to an embodiment of the present disclosure, the test text is input into the fourth deep learning model, and the text content and each test structure part of the test text are recognized to obtain the paragraph features of each paragraph of the test text and the structure features of each test structure part, and the format conversion function is used, so that the format of the test text can be converted to obtain the format conversion text, and the format conversion of the test text is realized.
[0136] According to an embodiment of the present disclosure, the model training method further includes: in a case where the conversion accuracy of the fourth deep learning model does not satisfy the preset condition, performing an optimization operation on the fourth deep learning model according to the text with format errors in the format conversion text, to obtain a target model.
[0137] According to an embodiment of the present disclosure, in a case where the conversion accuracy of the fourth deep learning model does not satisfy the preset condition, the fourth deep learning model can be optimized according to the text with format errors in the obtained format conversion text and the non-standard format training text as training samples at the same time, until the conversion accuracy satisfies the preset condition, to obtain the target model, so that the target model can guarantee the accuracy of the document format conversion in the application process.
[0138] Figure 3 A flowchart of the optimization operation according to an embodiment of the present disclosure is schematically shown.
[0139] As shown in Figure 3 The method 300 includes operation S310 to operation S380.
[0140] In operation S310, the text with format errors in the format conversion text and the non-standard format training text are merged into new non-standard format training text.
[0141] According to an embodiment of the present disclosure, the text with format errors in the obtained format conversion text and the non-standard format training text are merged into new non-standard format training text, and the fourth deep learning model is continuously trained and optimized by using the obtained new non-standard format training text, so that the structure part with format conversion errors in the text with format errors in the format conversion text can be learned.
[0142] In operation S320, the new non-standard format training text is input into the fourth deep learning model, and the structure features of each non-standard structure part of the new non-standard format training text are output.
[0143] According to an embodiment of the present disclosure, the new non-standard format training text is input into the fourth deep learning model, and the fourth deep learning model extracts features of each structure part in the new non-standard format training text, to obtain the structure features of each non-standard structure part in the new non-standard format training text.
[0144] In operation S330, the model parameters of the target model are adjusted according to the structure features of each non-standard structure part of the new non-standard format training text and the structure labels of each non-standard structure part, to obtain a new fourth deep learning model.
[0145] According to an embodiment of the present disclosure, the fourth deep learning model is determined to be correct in recognizing the structural features of each non-standard structure part in the new non-standard format training text according to the structural features of each non-standard structure part in the new non-standard format training text and the structural labels of each non-standard structure part, so that the structural features of each non-standard structure part recognized by the fourth deep learning model and having errors with the structural labels of each non-standard structure part can be obtained, and then the model parameters of the fourth deep learning model are adjusted according to the structural labels corresponding to the structural features having errors, so that a new fourth deep learning model is obtained.
[0146] In operation S340, a new test text is obtained.
[0147] According to an embodiment of the present disclosure, the new test text can include the new non-standard format training text.
[0148] In operation S350, the new test text is input into the new fourth deep learning model, and a new format conversion text is output.
[0149] According to an embodiment of the present disclosure, the new test text is input into the new fourth deep learning model, and the new fourth deep learning model includes the added format conversion function, so that the format of each test structure part in the new test text can be converted into the corresponding standard format, and the new format conversion text is output.
[0150] In operation S360, the conversion accuracy of the new fourth deep learning model is determined according to the new format conversion text.
[0151] According to an embodiment of the present disclosure, according to the obtained new format conversion text, the documents in which the formats of each structure part in the new format conversion text are all converted correctly can be determined, so that the conversion accuracy of the new fourth deep learning model can be determined.
[0152] In operation S370, it is determined whether the conversion accuracy of the fourth deep learning model meets a preset condition.
[0153] According to an embodiment of the present disclosure, in a case where the conversion accuracy of the fourth deep learning model does not meet the preset condition, operations S310-S360 are performed; and in a case where the conversion accuracy of the fourth deep learning model meets the preset condition, operation S380 is performed.
[0154] In operation S380, the new fourth deep learning model obtained in a case where the conversion accuracy of the new fourth deep learning model meets the preset condition is determined as a target model.
[0155] According to an embodiment of the present disclosure, the text with format errors in the obtained format conversion text and the non-standard format training text are merged into new non-standard format training text, so that the fourth deep learning model is further trained and optimized by using the new non-standard format training text, which can enable the fourth deep learning model to learn the format conversion error structure part in the text with format errors, and improve the accuracy of model recognition.
[0156] Figure 4 A flowchart of a standard format document generation method according to an embodiment of the present disclosure is schematically shown.
[0157] As shown in Figure 4 The method 400 includes operation S410 and operation S420.
[0158] In operation S410, a target model corresponding to the text type of the original document is determined according to the text type of the original document.
[0159] According to an embodiment of the present disclosure, the target model is obtained by training using the above model training method. For each text type, a target model corresponding to the text type can be obtained by training using the above model training method. The original document can represent a document including basic structure parts such as title, author, abstract, keywords, etc., but the format of each structure part is non-standard.
[0160] According to an embodiment of the present disclosure, a target model corresponding to the text type of the original document can be determined according to the text type of the original document. For example, in the case where the text type of the original document is a paper, a target model for format conversion of a document with a text type of a paper can be selected; in the case where the text type of the original document is a legal document, a target model for format conversion of a document with a text type of a legal document can be selected.
[0161] According to an embodiment of the present disclosure, the original document can include documents in DOC, DOCX, PDF, plain text, normal rich text, hypertext, XML, etc. The original document can include normal text, tables, pictures, etc. Content information, and also needs to have a basic document structure, i.e., has basic structures such as title, author, section, chapter, etc.
[0162] In operation S420, the original document is input into the target model, and a standard format document is output.
[0163] According to an embodiment of the present disclosure, the original document is input into the target model corresponding to the text type of the original document, and a standard format document is obtained.
[0164] According to an embodiment of the present disclosure, the original document is format-converted, a target model corresponding to a text type of the original document is clicked, an operation page is popped up, and thus an input path and an output name of the original document and an output path and an output name can be input in the operation page, wherein the output path can be the same as the target model by default and can be modified. After the input path and the output name of the original document and the output path and the output name are input in the operation page, a "conversion" button on the operation page is clicked, and thus a converted standard format document can be automatically generated under the output path.
[0165] According to an embodiment of the present disclosure, the standard format document can include a document in a DOC format or a document in a DOCX format, and thus the obtained standard format document can be edited.
[0166] According to an embodiment of the present disclosure, taking the original document in the text type of a paper as an example, the target model can identify a paper title, an author, a table of contents, an abstract, keywords, an English title, an English abstract, English keywords, a main text, a reference, an appendix, a thank-you note, and other paper specified modules and paper main text section headings, page numbers, standard fonts, character sizes, and document formats. Meanwhile, for the identified document, the target model can convert formats of each structural part into a standard format that meets the format requirements, and finally combine and output a standard format document. The standard format document can be further edited.
[0167] According to an embodiment of the present disclosure, the original document is directly input into the target model, and thus a corresponding standard format document can be obtained. The original document does not need to be guided or self-edited in the format conversion process, and does not need to rely on a website server of a document tool. The document can quickly generate a standard format document, and can support documents in multiple formats.
[0168] Figure 5 A flowchart of obtaining a standard format document according to an embodiment of the present disclosure is schematically shown.
[0169] As shown in FIG. 5, the method 500 includes operation S510 to operation S530. Figure 5
[0170] In operation S510, text content of an original document is identified to obtain paragraph features of each paragraph of the original document.
[0171] In operation S520, each structural part of the original document is identified to obtain structural features of each structural part of the original document.
[0172] In operation S530, a format conversion function of a target model is used to convert the original document according to the paragraph features of each paragraph of the original document and the structural features of each structural part of the original document, and thus a standard format document is obtained.
[0173] According to an embodiment of the present disclosure, according to the paragraph features of each paragraph of the original document, the text content of the original document can be converted into an editable format by using the format conversion function, and the text content and distribution of the original document are ensured unchanged.
[0174] According to an embodiment of the present disclosure, according to the structure features of each structure part in the original document, the standard format corresponding to each structure part in the original document can be determined by using the format conversion function, so as to convert the format of each structure part in the original document into the corresponding standard format, and obtain a standard format document.
[0175] According to an embodiment of the present disclosure, the text content and each structure part of the original document are identified when the original document is input into the target model, the paragraph features of each paragraph of the original document and the structure features of each structure part are obtained, and the format conversion function is used, so that the format conversion of the original document can be performed to obtain a standard format document, and the format conversion of the original document is realized.
[0176] Figure 6 A flowchart of converting the original document by using the format conversion function according to an embodiment of the present disclosure is schematically shown.
[0177] As shown in Figure 6 , the method 600 includes operation S610 to operation S650.
[0178] In operation S610, according to the paragraph features of each paragraph of the original document, the segmentation information of the text content in the original document and the positional relationship between each paragraph are determined.
[0179] According to an embodiment of the present disclosure, according to the paragraph features of each paragraph of the original document, the segmentation information of the text content in the original document and the positional relationship between each paragraph can be determined.
[0180] In operation S620, according to the segmentation information of the text content in the original document and the positional relationship between each paragraph, the text content in the original document is inserted into a pure text format document.
[0181] According to an embodiment of the present disclosure, the text content in the original document is extracted, and according to the segmentation information of the text content in the original document and the positional relationship between each paragraph, the text content of the original document is inserted into a pure text format document, wherein the segmentation information of the text content in the pure text format document and the positional relationship between each paragraph are the same as those in the original document.
[0182] According to an embodiment of the present disclosure, the insertion of the literal content in the original document into the pure text format document is to convert the original document in different formats into the pure text format document for processing, so as to realize the document conversion of the original document in different formats.
[0183] In operation S630, the standard format corresponding to each structural part of the pure text format document is determined according to the structural features of each structural part of the original document.
[0184] According to an embodiment of the present disclosure, the standard format corresponding to each structural part of the pure text format document can be determined according to the structural features of each structural part of the original document. For example, the structural feature of a certain structural part can be characterized as "first-level title", and the standard format corresponding to the structural part can be determined as "Songti, four font size".
[0185] In operation S640, the format of each structural part of the pure text format document is converted into the corresponding standard format according to the standard format corresponding to each structural part of the pure text format document, and a first standard format document is obtained.
[0186] According to an embodiment of the present disclosure, the format of each structural part of the pure text format document can be converted into the corresponding standard format according to the standard format corresponding to each structural part of the pure text format document, so that the first standard format document can be obtained.
[0187] In operation S650, the first standard format document is typeset according to the paragraph features of each paragraph of the original document and the structural features of each structural part, and a standard format document is obtained.
[0188] According to an embodiment of the present disclosure, the position relationship between the non-literal content and the literal content can be obtained according to the paragraph features of each paragraph of the original document and the structural features of each structural part, so as to insert the non-literal content into the corresponding position of the first standard format document, and to typeset the page number and the table of contents, thereby obtaining the standard format document.
[0189] According to an embodiment of the present disclosure, according to the paragraph features of each paragraph of the original document and the structural features of each structural part, the format conversion function in the target model can be used to convert the format of the original document, so that the standard format document can be obtained, and the format conversion of the original document can be realized.
[0190] Figure 7 A flowchart of typesetting the first standard format document according to an embodiment of the present disclosure is schematically shown.
[0191] As shown in Figure 7 the method 700 includes operation S710 to operation S760.
[0192] At operation S710, a location relationship between non-text content and text content in the original document is determined according to the paragraph features of the paragraphs in the original document.
[0193] According to an embodiment of the present disclosure, the location relationship between the non-text content and the text content in the original document can be determined according to the paragraph features of the paragraphs in the original document, where the non-text content can include pictures, tables, and formulas. For example, the location relationship of a certain picture can be determined according to the paragraph features of the paragraphs in the original document, that is, the picture is between the seventh paragraph and the eighth paragraph.
[0194] At operation S720, the non-text content is inserted into a corresponding position of the first standard format document according to the location relationship between the non-text content and the text content, to obtain a second standard format document.
[0195] According to an embodiment of the present disclosure, the non-text content can be inserted into a corresponding position of the first standard format document according to the location relationship between the non-text content and the text content, to obtain a second standard format document. For example, according to the paragraph features of the paragraphs in the original document, it is determined that a certain picture is between the seventh paragraph and the eighth paragraph, and then the picture can be inserted into a position between the seventh paragraph and the eighth paragraph in the first standard format document.
[0196] At operation S730, the structure names of the structural parts of the second standard format document are determined according to the structure features of the structural parts of the original document.
[0197] According to an embodiment of the present disclosure, the structure names of the structural parts of the second standard format document can be determined according to the structure features of the structural parts of the original document. For example, the structure features of a certain structural part can represent a “first-level title”, and then the structure name of the structural part can be obtained as “first-level title”.
[0198] At operation S740, a corresponding page number is generated for each page in the second standard format document, to obtain a third standard format document.
[0199] At operation S750, a table of contents of the third standard format document is generated according to the structure names of the structural parts and the page numbers of the third standard format document.
[0200] According to an embodiment of the present disclosure, the page numbers of the structural parts can be determined according to the page numbers of the third standard format document, and the table of contents of the third standard format document can be generated according to the structure names of the structural parts.
[0201] At operation S760, the table of contents of the third standard format document and the third standard format document are assembled to obtain a standard format document.
[0202] According to an embodiment of the present disclosure, the first standard format document is formatted according to the paragraph features of each paragraph of the original document and the structure features of each structure part, so that the standard format document can be obtained.
[0203] Based on the above model training method, the present disclosure further provides a model training device. The following will be described in detail in combination with Figure 8 The device is described in detail.
[0204] Figure 8 The structural block diagram of the model training device according to an embodiment of the present disclosure is schematically shown.
[0205] As Figure 8 shown, the model training device 800 of the embodiment includes a first input module 810, a first adjustment module 820, a second input module 830, a second adjustment module 840, and an adding module 850.
[0206] The first input module 810 is configured to input the standard format training text into the initial deep learning model, and output the structure features of each standard structure part of the standard format training text, wherein the standard format training text includes the structure labels of each standard structure part. In an embodiment, the first input module 810 can be configured to perform the operation S210 described above, and details are not repeated here.
[0207] The first adjustment module 820 is configured to adjust the model parameters of the initial deep learning model according to the structure features of each standard structure part of the standard format training text and the structure labels of each standard structure part, to obtain a first deep learning model. In an embodiment, the first adjustment module 820 can be configured to perform the operation S220 described above, and details are not repeated here.
[0208] The second input module 830 is configured to input the non-standard format training text into the first deep learning model, and output the structure features of each non-standard structure part of the non-standard format training text, wherein the non-standard format training text includes the structure labels of each non-standard structure part, and the text type of the non-standard format training text is the same as that of the standard format training text. In an embodiment, the second input module 830 can be configured to perform the operation S230 described above, and details are not repeated here.
[0209] The second adjustment module 840 is configured to adjust the model parameters of the first deep learning model according to the structure features of each non-standard structure part of the non-standard format training text and the structure labels of each non-standard structure part, to obtain a second deep learning model. In an embodiment, the second adjustment module 840 can be configured to perform the operation S240 described above, and details are not repeated here.
[0210] The adding module 850 is configured to add a format conversion function to the second deep learning model to obtain a target model, in a case where the text recognition accuracy of the second deep learning model meets a preset condition. In an embodiment, the adding module 850 can be configured to perform operation S250 described above, and details are not described herein again.
[0211] According to an embodiment of the present disclosure, the model training apparatus 800 further includes an obtaining module, a third input module, and a first determining module.
[0212] The obtaining module is configured to obtain test text, wherein the test text includes non-standard format training text.
[0213] The third input module is configured to input the test text into the second deep learning model to output structure features of each test structure part of the test text.
[0214] The first determining module is configured to determine a text recognition accuracy of the second deep learning model according to the structure features of each test structure part of the test text and structure labels of the test structure parts.
[0215] According to an embodiment of the present disclosure, the model training apparatus 800 further includes a merging module, a fourth input module, a third adjusting module, and an obtaining module.
[0216] The merging module is configured to merge the standard format training text and the non-standard format training text to obtain merged training text, in a case where the text recognition accuracy of the second deep learning model does not meet a preset condition.
[0217] The fourth input module is configured to input the merged training text into the second deep learning model to output structure features of each structure part of the merged training text.
[0218] The third adjusting module is configured to adjust model parameters of the second deep learning model according to the structure features of each structure part of the merged training text and structure labels of the structure parts to obtain a third deep learning model.
[0219] The obtaining module is configured to add a format conversion function to the third deep learning model to obtain a fourth deep learning model.
[0220] According to an embodiment of the present disclosure, the model training apparatus 800 further includes a fifth input module, a second determining module, and a third determining module.
[0221] The fifth input module is configured to input the test text into the fourth deep learning model to output format conversion text, wherein the test text includes non-standard format training text.
[0222] The second determining module is configured to determine a conversion accuracy of the fourth deep learning model according to the format conversion text.
[0223] The third determining module is configured to determine the fourth deep learning model as the target model if the conversion accuracy of the fourth deep learning model meets the preset condition.
[0224] According to an embodiment of the present disclosure, the fifth input module comprises a first identifying unit, a second identifying unit and a converting unit.
[0225] The first identifying unit is configured to identify the text content of the test text to obtain the paragraph features of each paragraph of the test text.
[0226] The second identifying unit is configured to identify each test structure part of the test text to obtain the structure features of each test structure part of the test text.
[0227] The converting unit is configured to utilize the format conversion function of the fourth deep learning model to perform format conversion on the test text according to the paragraph features of each paragraph of the test text and the structure features of each test structure part to obtain the format conversion text.
[0228] According to an embodiment of the present disclosure, the model training device 800 further comprises an optimization module.
[0229] The optimization module is configured to, if the conversion accuracy of the fourth deep learning model does not meet the preset condition, perform an optimization operation on the fourth deep learning model according to the text with format errors in the format conversion text to obtain the target model.
[0230] According to an embodiment of the present disclosure, the optimization module comprises a merging unit, a first input unit, an adjusting unit, an obtaining unit, a second input unit, a first determining unit and a second determining unit.
[0231] The merging unit is configured to, if the conversion accuracy of the fourth deep learning model does not meet the preset condition, merge the text with format errors in the format conversion text and the non-standard format training text into a new non-standard format training text.
[0232] The first input unit is configured to input the new non-standard format training text into the fourth deep learning model to output the structure features of each non-standard structure part of the new non-standard format training text.
[0233] The adjusting unit is configured to adjust the model parameters of the target model according to the structure features of each non-standard structure part of the new non-standard format training text and the structure labels of each non-standard structure part to obtain a new fourth deep learning model.
[0234] The obtaining unit is configured to obtain a new test text, wherein the new test text comprises the new non-standard format training text.
[0235] The second input unit is configured to input a new test text into the new fourth deep learning model, and output a new format conversion text.
[0236] The first determination unit is configured to determine a conversion accuracy of the new fourth deep learning model according to the new format conversion text.
[0237] The second determination unit is configured to determine the new fourth deep learning model as the target model when the conversion accuracy of the new fourth deep learning model meets a preset condition.
[0238] According to an embodiment of the present disclosure, any of the first input module 810, the first adjustment module 820, the second input module 830, the second adjustment module 840 and the adding module 850 can be combined in one module, or any of them can be split into multiple modules. Alternatively, at least part of the function of one or more of these modules can be combined with at least part of the function of other modules, and implemented in one module. According to an embodiment of the present disclosure, at least one of the first input module 810, the first adjustment module 820, the second input module 830, the second adjustment module 840 and the adding module 850 can be at least partially implemented as a hardware circuit, such as a field programmable gate array (FPGA), a programmable logic array (PLA), a system on chip, a system on board, a system on package, an application specific integrated circuit (ASIC), or any other reasonable way of hardware or firmware that can be integrated or packaged, or any one of software, hardware and firmware or any appropriate combination of several of them. Alternatively, at least one of the first input module 810, the first adjustment module 820, the second input module 830, the second adjustment module 840 and the adding module 850 can be at least partially implemented as a computer program module which can perform corresponding functions when it is run.
[0239] Based on the above model training method, the present disclosure further provides a standard format document generation device. The following will be described in detail Figure 9 The device is described in detail.
[0240] Figure 9 The structure block diagram of the model training device according to an embodiment of the present disclosure is schematically shown.
[0241] As Figure 9 shown, the standard format document generation device 900 of this embodiment includes a determination module 910 and an input module 920.
[0242] The determining module 910 is configured to determine a target model corresponding to the text type of the original document according to the text type of the original document. In an embodiment, the determining module 910 can be configured to perform operation S410 described above, and details are not repeated here.
[0243] The input module 920 is configured to input the original document into the target model and output a standard format document. In an embodiment, the input module 920 can be configured to perform operation S420 described above, and details are not repeated here.
[0244] According to an embodiment of the present disclosure, the input module 920 includes a first identifying sub-module, a second identifying sub-module, and a converting sub-module.
[0245] The first identifying sub-module is configured to identify the text content of the original document to obtain paragraph features of each paragraph of the original document.
[0246] The second identifying sub-module is configured to identify each structural part of the original document to obtain structural features of each structural part of the original document.
[0247] The converting sub-module is configured to convert the original document according to the paragraph features of each paragraph and the structural features of each structural part of the original document by using the format conversion function of the target model, to obtain a standard format document.
[0248] According to an embodiment of the present disclosure, the converting sub-module includes a first determining unit, a first converting unit, a second determining unit, a second converting unit, and a layout unit.
[0249] The first determining unit is configured to determine segmentation information of the text content and the positional relationship between each paragraph in the original document according to the paragraph features of each paragraph of the original document.
[0250] The first converting unit is configured to insert the text content in the original document into a pure text format document according to the segmentation information of the text content and the positional relationship between each paragraph in the original document.
[0251] The second determining unit is configured to determine a standard format corresponding to each structural part of the pure text format document according to the structural features of each structural part of the original document.
[0252] The second converting unit is configured to convert the format of each structural part in the pure text format document into the corresponding standard format according to the standard format corresponding to each structural part of the pure text format document, to obtain a first standard format document.
[0253] The layout unit is configured to layout the first standard format document according to the paragraph features of each paragraph and the structural features of each structural part of the original document, to obtain a standard format document.
[0254] According to an embodiment of the present disclosure, the layout unit comprises a first determining subunit, a first obtaining subunit, a second determining subunit, a second obtaining subunit, a generating subunit and a third obtaining subunit.
[0255] The first determining subunit is configured to determine the positional relationship between the non-text content and the text content in the original document according to the paragraph features of the paragraphs in the original document.
[0256] The first obtaining subunit is configured to insert the non-text content into the corresponding position of the first standard format document according to the positional relationship between the non-text content and the text content, to obtain a second standard format document.
[0257] The second determining subunit is configured to determine the structure names of the structural parts in the second standard format document according to the structure features of the structural parts in the original document.
[0258] The second obtaining subunit is configured to generate a corresponding page number for each page in the second standard format document, to obtain a third standard format document.
[0259] The generating subunit is configured to generate a table of contents of the third standard format document according to the structure names of the structural parts and the page numbers of the third standard format document.
[0260] The third obtaining subunit is configured to assemble the table of contents of the third standard format document and the third standard format document, to obtain a standard format document.
[0261] According to an embodiment of the present disclosure, any of the modules in the determining module 910 and the input module 920 can be combined in one module, or any of the modules can be split into multiple modules. Alternatively, at least part of the functions of one or more of the modules can be combined with at least part of the functions of other modules, and implemented in one module. According to an embodiment of the present disclosure, at least one of the determining module 910 and the input module 920 can be at least partially implemented as a hardware circuit, such as a field programmable gate array (FPGA), a programmable logic array (PLA), a system on chip, a system on substrate, a system on package, an application specific integrated circuit (ASIC), or any other reasonable manner of hardware or firmware that can be integrated or packaged with a circuit, or implemented in any one of software, hardware and firmware or in a proper combination of any of them. Alternatively, at least one of the determining module 910 and the input module 920 can be at least partially implemented as a computer program module that can perform corresponding functions when the computer program module is run.
[0262] Figure 10 The block diagram schematically shows an electronic device suitable for implementing the model training method and the standard format document generation method according to an embodiment of the present disclosure.
[0263] like Figure 10 As shown, an electronic device 1000 according to an embodiment of the present disclosure includes a processor 1001, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1002 or a program loaded from a storage portion 1008 into a random access memory (RAM) 1003. The processor 1001 may include, for example, a general-purpose microprocessor (e.g., a CPU), an instruction set processor and / or an associated chipset and / or a special-purpose microprocessor (e.g., an application-specific integrated circuit (ASIC)), etc. The processor 1001 may also include onboard memory for caching purposes. The processor 1001 may include a single processing unit or multiple processing units for performing different actions of the method flow according to an embodiment of the present disclosure.
[0264] RAM 1003 stores various programs and data required for the operation of electronic device 1000. Processor 1001, ROM 1002, and RAM 1003 are interconnected via bus 1004. Processor 1001 performs various operations of the method flow according to embodiments of the present disclosure by executing programs in ROM 1002 and / or RAM 1003. It should be noted that the programs may also be stored in one or more memories other than ROM 1002 and RAM 1003. Processor 1001 may also perform various operations of the method flow according to embodiments of the present disclosure by executing programs stored in said one or more memories.
[0265] According to embodiments of this disclosure, the electronic device 1000 may further include an input / output (I / O) interface 1005, which is also connected to a bus 1004. The electronic device 1000 may also include one or more of the following components connected to the input / output (I / O) interface 1005: an input section 1006 including a keyboard, mouse, etc.; an output section 1007 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 1008 including a hard disk, etc.; and a communication section 1009 including a network interface card such as a LAN card, modem, etc. The communication section 1009 performs communication processing via a network such as the Internet. A drive 1010 is also connected to the input / output (I / O) interface 1005 as needed. A removable medium 1011, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on the drive 1010 as needed so that computer programs read from it can be installed into the storage section 1008 as needed.
[0266] The present disclosure also provides a computer readable storage medium, which can be included in the device / apparatus / system described in the above embodiments, or can exist separately without being assembled into the device / apparatus / system. The above computer readable storage medium carries one or more programs, which, when executed, implement the method according to the embodiments of the present disclosure.
[0267] According to an embodiment of the present disclosure, the computer readable storage medium can be a non-volatile computer readable storage medium, which can include, but is not limited to, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any appropriate combination thereof. In the present disclosure, the computer readable storage medium can be any tangible medium that contains or stores a program, which can be used by or in connection with an instruction execution system, apparatus, or device. For example, according to an embodiment of the present disclosure, the computer readable storage medium can include one or more memories, such as the ROM 1002 and / or the RAM 1003 described above, and / or one or more memories other than the ROM 1002 and the RAM 1003.
[0268] The embodiments of the present disclosure also include a computer program product, which includes a computer program containing program codes for executing the methods shown in the flowcharts. When the computer program product is run in a computer system, the program codes are used to make the computer system implement the methods provided by the embodiments of the present disclosure.
[0269] The above functions defined in the system / apparatus of the embodiments of the present disclosure are performed when the computer program is executed by the processor 1001. According to an embodiment of the present disclosure, the above described system, apparatus, module, unit, etc. can be implemented by computer program modules.
[0270] In one embodiment, the computer program can rely on a tangible storage medium, such as an optical storage medium, a magnetic storage medium, etc. In another embodiment, the computer program can also be transmitted, distributed, and downloaded in the form of a signal via a network medium, and be downloaded and installed through the communication part 1009, and / or installed from the detachable medium 1011. The program codes contained in the computer program can be transmitted by any appropriate network medium, including but not limited to wireless, wired, etc., or any appropriate combination thereof.
[0271] In such embodiments, the computer program can be downloaded and installed from the network through the communication section 1009, and / or installed from the removable medium 1011. When the computer program is executed by the processor 1001, the above-described functions defined in the system of the embodiments of the present disclosure are executed. According to the embodiments of the present disclosure, the system, device, apparatus, module, unit, and the like described above can be implemented by computer program modules.
[0272] According to the embodiments of the present disclosure, the program code for executing the computer program provided by the embodiments of the present disclosure can be written in any combination of one or more programming languages, and specifically, these computer programs can be implemented using high-level procedural and / or object-oriented programming language, and / or assembly / machine language. The programming language includes, but is not limited to, such as Java, C++, python, "C" language or similar programming language. The program code can be executed entirely on the user computing device, partially on the user device, partially on a remote computing device, or entirely on a remote computing device or server. In the case involving a remote computing device, the remote computing device can be connected to the user computing device through any kind of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computing device (for example, connected through the Internet by using an Internet service provider).
[0273] The flowcharts and block diagrams in the drawings illustrate the possible architectures, functions, and operations of systems, methods, and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowcharts or block diagrams can represent a module, a program segment, or a portion of code, which contains one or more executable instructions for implementing the specified logical functions. It should also be noted that in some alternative implementations, the functions noted in the blocks can occur in different orders than those noted in the figures. For example, two blocks noted in succession can actually be executed substantially concurrently or in reverse order, depending on the functions involved. Also, it should be noted that each block in the flowcharts or block diagrams, and combinations of blocks in the flowcharts or block diagrams, can be implemented by dedicated hardware-based systems that perform the specified functions or operations, or can be implemented by a combination of dedicated hardware and computer instructions.
[0274] Those skilled in the art can understand that the features described in various embodiments of the present disclosure and / or claims can be combined or / and integrated, even if such combinations or integrations are not explicitly described in the present disclosure. In particular, the features described in various embodiments of the present disclosure and / or claims can be combined and / or integrated in various combinations, without departing from the spirit and teachings of the present disclosure. All these combinations and / or integrations fall within the scope of the present disclosure.
[0275] The above described embodiments of the present disclosure. However, these embodiments are merely for illustrative purposes, and are not intended to limit the scope of the present disclosure. Although each embodiment is described above separately, this does not mean that the measures in each embodiment cannot be advantageously used in combination. The scope of the present disclosure is defined by the appended claims and their equivalents. Those skilled in the art can make various substitutions and modifications without departing from the scope of the present disclosure, and all such substitutions and modifications shall fall within the scope of the present disclosure.
Claims
1. A model training method, comprising: The standard format training text is input into the initial deep learning model, and the structural features of each standard structural part of the standard format training text are output. The standard format training text includes structural labels for each standard structural part. Based on the structural features and structural labels of each standard structural part of the training text according to the standard format, the model parameters of the initial deep learning model are adjusted to obtain the first deep learning model; Input non-standard format training text into the first deep learning model, and output the structural features of each non-standard structural part of the non-standard format training text. The non-standard format training text includes structural labels for each non-standard structural part, and the text type of the non-standard format training text is the same as that of the standard format training text. Based on the structural features and structural labels of each non-standard structural part of the non-standard format training text, the model parameters of the first deep learning model are adjusted to obtain the second deep learning model. If the text recognition accuracy of the second deep learning model meets the preset conditions, add a format conversion function to the second deep learning model to obtain the target model. The model training method further includes: when the text recognition accuracy of the second deep learning model does not meet the preset condition, merging the standard format training text and the non-standard format training text to obtain a merged training text; inputting the merged training text into the second deep learning model and outputting the structural features of each structural part of the merged training text; adjusting the model parameters of the second deep learning model according to the structural features and structural labels of each structural part of the merged training text to obtain a third deep learning model; and adding the format conversion function to the third deep learning model to obtain a fourth deep learning model. The test text is input into the fourth deep learning model, and the output is format-converted text, wherein the test text includes the non-standard format training text; the conversion accuracy of the fourth deep learning model is determined based on the format-converted text; if the conversion accuracy of the fourth deep learning model meets the preset condition, the fourth deep learning model is determined as the target model. If the conversion accuracy of the fourth deep learning model does not meet the preset condition, the text with formatting errors in the format conversion text and the non-standard format training text are merged into a new non-standard format training text. Based on the new non-standard format training text, the fourth deep learning model is tuned to obtain the target model.
2. The method according to claim 1, further comprising: Obtain test text, wherein the test text includes the non-standard format training text; The test text is input into the second deep learning model, and the structural features of each test structure part of the test text are output. Based on the structural features and structural labels of each test structural part of the test text, the text recognition accuracy of the second deep learning model is determined.
3. The method according to claim 1, wherein, The step of inputting the test text into the fourth deep learning model and outputting format-converted text includes: The text content of the test text is identified to obtain the paragraph features of each paragraph of the test text; The structural features of each test structure part of the test text are obtained by identifying the test structure parts of the test text. Using the format conversion function of the fourth deep learning model, the test text is format converted according to the paragraph features of each paragraph and the structural features of each test structural part, to obtain the format-converted text.
4. The method according to claim 1, wherein, The fourth deep learning model is tuned to obtain the target model, including repeatedly performing the following operations until the preset conditions are met: If the conversion accuracy of the fourth deep learning model does not meet the preset condition, The text with formatting errors in the format conversion text and the non-standard format training text are merged into a new non-standard format training text. The new non-standard format training text is input into the fourth deep learning model, and the structural features of each non-standard structural part of the new non-standard format training text are output. Based on the structural features and structural labels of each non-standard structural part of the new non-standard format training text, the model parameters of the fourth deep learning model are adjusted to obtain a new fourth deep learning model. Obtain new test text, wherein the new test text includes the new non-standard format training text; The new test text is input into the new fourth deep learning model, and the new formatted converted text is output. Based on the new format, the conversion accuracy of the new fourth deep learning model is determined. The new fourth deep learning model obtained when the conversion accuracy of the new fourth deep learning model meets the preset conditions is determined as the target model.
5. A method for generating a standard format document, comprising: Based on the text type of the original document, a target model corresponding to the text type of the original document is determined, wherein the target model is trained using the method according to any one of claims 1 to 4; The original document is input into the target model, and a standard format document is output.
6. The method according to claim 5, wherein, The original document is input into the target model, and a standard format document is output, including: The text content of the original document is identified to obtain the paragraph features of each paragraph of the original document; The structural features of each structural part of the original document are obtained by identifying each structural part of the original document. Using the format conversion function of the target model, the original document is converted according to the paragraph features of each paragraph and the structural features of each structural part to obtain the standard format document.
7. The method according to claim 6, wherein, The process of using the format conversion function of the target model to convert the original document according to the paragraph features of each paragraph and the structural features of each structural part to obtain the standard format document includes: Based on the paragraph characteristics of each paragraph in the original document, determine the segmentation information of the text content in the original document and the positional relationship between each paragraph; Based on the segmentation information of the text content in the original document and the positional relationship between each paragraph, the text content in the original document is inserted into a plain text format document; Based on the structural features of each structural part of the original document, determine the standard format corresponding to each structural part of the plain text document; Based on the standard format corresponding to each structural part of the plain text document, the format of each structural part in the plain text document is converted into the corresponding standard format to obtain a first standard format document; Based on the paragraph features of each paragraph and the structural features of each structural part of the original document, the first standard format document is formatted to obtain the standard format document.
8. The method according to claim 7, wherein, The step of formatting the first standard format document according to the paragraph features of each paragraph and the structural features of each structural part of the original document to obtain the standard format document includes: Based on the paragraph characteristics of each paragraph in the original document, determine the positional relationship between non-text content and text content in the original document; Based on the positional relationship between the non-text content and the text content, the non-text content is inserted into the corresponding position in the first standard format document to obtain the second standard format document; Based on the structural characteristics of each structural part of the original document, determine the structural names of each structural part of the second standard format document; Generate corresponding page numbers for each page in the second standard format document to obtain the third standard format document; Based on the structural names of each structural part and the page numbers of the third standard format document, generate the table of contents of the third standard format document; The standard format document is obtained by assembling the directory of the third standard format document and the third standard format document.
9. A model training device, comprising: The first input module is used to input standard format training text into the initial deep learning model and output the structural features of each structural part of the standard format training text, wherein the standard format training text includes structural labels for each structural part; The first adjustment module is used to adjust the model parameters of the initial deep learning model according to the structural features and structural labels of each structural part of the trained text based on the standard format, so as to obtain the first deep learning model. The second input module is used to input non-standard format training text into the first deep learning model and output the structural features of each structural part of the non-standard format training text. The non-standard format training text includes structural labels for each structural part, and the non-standard format training text is of the same type as the standard format training text. The second adjustment module is used to adjust the model parameters of the first deep learning model based on the structural features and structural labels of each structural part of the non-standard format training text, so as to obtain the second deep learning model. An add module is used to add a format conversion function to the second deep learning model to obtain the target model when the recognition accuracy of the second deep learning model meets the preset conditions. The merging module is used to merge the standard format training text and the non-standard format training text when the text recognition accuracy of the second deep learning model does not meet the preset conditions, so as to obtain merged training text. The fourth input module is used to input the merged training text into the second deep learning model and output the structural features of each structural part of the merged training text. The third adjustment module is used to adjust the model parameters of the second deep learning model based on the structural features and structural labels of each structural part of the merged training text, so as to obtain the third deep learning model. The module is used to add the format conversion function to the third deep learning model to obtain the fourth deep learning model. The fifth input module is used to input test text into the fourth deep learning model and output format-converted text, wherein the test text includes the non-standard format training text; The second determining module is used to convert text according to the format and determine the conversion accuracy of the fourth deep learning model; The third determining module is used to determine the fourth deep learning model as the target model when the conversion accuracy of the fourth deep learning model meets the preset condition. The optimization module is used to merge the text with formatting errors in the format conversion text and the non-standard format training text into a new non-standard format training text when the conversion accuracy of the fourth deep learning model does not meet the preset conditions, and to perform optimization operations on the fourth deep learning model based on the new non-standard format training text to obtain the target model.
10. A standard format document generation device, comprising: A determination module is used to determine a target model corresponding to the text type of the original document based on the text type of the original document, wherein the target model is trained using the method according to any one of claims 1 to 4; The input module is used to input the original document into the target model and output a standard format document.
11. An electronic device, comprising: One or more processors; Storage device for storing one or more programs. Wherein, when the one or more programs are executed by the one or more processors, the one or more processors perform the method according to any one of claims 1 to 8.
12. A computer-readable storage medium having stored thereon executable instructions that, when executed by a processor, cause the processor to perform the method according to any one of claims 1 to 8.
13. A computer program product comprising a computer program that, when executed by a processor, implements the method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Handwriting model training method and device, text recognition method and device, apparatus and medium
CN109002461A
Document conversion method and device, electronic equipment and storage medium
CN112507666A