A text format audit method, model and storage medium
By building a text format audit model, using convolutional calculation and full-connection layer calculation, the problem of difficult automatic text format audit in the existing technology is solved, and efficient and accurate text format audit is achieved.
Patent Information
- Application Number
- CN202111665454.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-31
- Publication Date
- 2025-02-14
- Estimated Expiration
- 2041-12-31
AI Technical Summary
In the prior art, automatic review of text formats is difficult to implement, resulting in low efficiency of manual review and prone to errors and omissions.
By setting and initializing the hyperparameters of the text format audit model, importing training text, and constructing format vectors based on different format features for convolutional calculation and excitation calculation. Finally, using the full connection layer to calculate and cross-entropy loss calculation to construct text format audit Model.
Automatic review of text formats is realized, which improves review efficiency and accuracy and saves labor costs.
Smart Images

Figure CN114282492B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence, and in particular to a text format review method, model and storage medium. Background Art
[0002] As we all know, the format of some standards, papers, and books must comply with national standards, industry standards, or relevant international standards. In the prior art, when reviewing the text format, professionals who are familiar with the text format requirements are required to review it, which takes a lot of time and effort. Usually, due to the length of the aforementioned text, manual review is not only inefficient but also prone to errors and omissions.
[0003] How to achieve automatic text format review through artificial intelligence has become an urgent problem to be solved. Summary of the invention
[0004] The purpose of the present invention is to overcome the deficiencies of the prior art and to provide a text format review method, model and storage medium.
[0005] The present invention provides a text format review method, comprising the following steps:
[0006] Step 1: setting hyperparameters of a text format audit model, initializing the text format audit model according to the set hyperparameters, and importing training text into the text format audit model;
[0007] Step 2, determining the training format of the training text, if it is a suspended paragraph format, executing step 2-1; if it is a legend format, executing step 2-2; if it is a text title format, executing step 2-3; if it is a number list format, executing step 2-4;
[0008] Step 2-1: Set a suspended segment format feature list of the training text, construct a format vector of the training text paragraph according to the suspended segment format feature list of the training text, obtain tensor type data of the training text paragraph, use the tensor type data of the training text paragraph as input data of the text format audit model, and execute step 3;
[0009] Step 2-2: Set the legend format feature list of the training text, construct the format vector of the training text paragraph according to the legend format feature list of the text, obtain the tensor type data of the training text paragraph, use the tensor type data of the training text paragraph as the input data of the text format audit model, and execute step 8;
[0010] Step 2-3: Set a text font format feature list of the training text, construct a format vector of the training text paragraph according to the text font format feature list of the training text, obtain tensor type data of the training text paragraph, use the tensor type data of the training text paragraph as input data of the text format audit model, and execute step 8;
[0011] Step 2-4: Set a digital column item format feature list of the training text, construct a format vector of the training text paragraph according to the digital column item format feature list of the training text, obtain tensor type data of the training text paragraph, use the tensor type data of the training text paragraph as input data of the text format audit model, and execute step 3;
[0012] Step 3: Retrieve the data parameters in the hyperparameters, perform convolution calculation on the tensor type data of the training text paragraph, and obtain the convolution data of the training text paragraph;
[0013] Step 4: call the function in the hyperparameter, perform excitation calculation on the convolution data of the training text paragraph, and obtain the excitation data of the training text paragraph;
[0014] Step 5: performing a pooling operation on the training text paragraph stimulus data to obtain a pooling operation result;
[0015] Step 6: Determine whether there is a convolutional layer to be operated. If so, use the pooling operation result as the tensor type data of the training text and return to step 3; if not, execute step 7;
[0016] Step 7: Update the tensor type data of the training text paragraph according to the pooling operation result;
[0017] Step 8: Calculate the weights and biases of the nodes of each layer of the fully connected layer in the audit model layer by layer using the tensor type data of the training text paragraph, and construct the final layer tensor type data of the training text paragraph according to the result of calculating the weights and biases of the nodes of the last layer;
[0018] Step 9: Calculate the cross entropy of the final layer tensor type data and labels of the training text paragraph;
[0019] Step 10: Calculate the loss rate using the cross entropy, compare the loss rate with the hyperparameters, and determine whether the audit model is successfully constructed. If successful, execute step 12; otherwise, execute step 11:
[0020] Step 11, calculating the adjustment vector of each layer node of the fully connected layer by back propagation algorithm, adjusting the weight and bias of each layer node of the fully connected layer according to the adjustment vector, and returning to step 3;
[0021] Step 12: input the text to be tested into the successfully constructed text format review model, output the review result tensor type data of the text to be tested based on the text format review model, determine whether the format review is passed according to the review result tensor type data, and annotate the format error for the text to be tested that fails the format review.
[0022] The present invention also provides a text format audit model, including:
[0023] A data acquisition interface, used to acquire training text, text to be reviewed, and training set, wherein the training set includes: labels obtained after format review and annotation of the training text;
[0024] A trainer extracts format feature information of a training text paragraph, obtains tensor type data of the training text paragraph, uses the tensor type data as input value, inputs the data into a model constructed based on a hyperparameter for repeated training, and obtains the trained text format review model after the training effect reaches a threshold set in the hyperparameter;
[0025] The text format classifier is used to output the paragraph format review annotation category of the text to be detected.
[0026] The present invention also provides an electronic device, comprising a processor and a memory; wherein the memory is used to store a computer program, and the computer program is loaded and executed by the processor to implement the text format review method as described above.
[0027] The present invention also provides a computer-readable storage medium for storing computer-executable instructions, which, when loaded and executed by a processor, implement the audit method in the text format described above.
[0028] By utilizing the technical solution provided by the present invention, it is possible to construct an automatic text format review model. Without the need for reviewers to learn text format requirements, the model can be used to achieve automatic review of text formats, greatly improving review efficiency and accuracy and saving labor costs. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] Figure 1 A flow chart of a text format review method provided in Example 1 of the present invention;
[0030] Figure 2 A flow chart of a text format review method provided in Example 2 of the present invention;
[0031] Figure 3 A flow chart of a text format review method provided in Example 3 of the present invention;
[0032] Figure 4 A flow chart of a text format review method provided in Example 4 of the present invention;
[0033] Figure 5 A text format review model structure diagram provided for Example 5 of the present invention. DETAILED DESCRIPTION
[0034] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0035] Example 1
[0036] This embodiment 1 provides a text format review method. In this embodiment, the training format of the training text is a suspended segment format, such as Figure 1 As shown, the method comprises the following steps:
[0037] Step 101: setting hyperparameters of a text format audit model, initializing the text format audit model according to the set hyperparameters, and importing training text into the text format audit model;
[0038] Preferably, in this embodiment, the hyperparameters specifically include: the learning rate that determines the speed of change of the loss function in the audit model, the dimension, step size, padding strategy, preset value, and number of convolution kernels, the number of convolution layers constructed by the construction parameters of the convolution kernel, the number of nodes in each layer of the audit model, the weights and biases of the nodes, and the preset values.
[0039] Step 102: setting a suspended segment format feature list of the training text, constructing a format vector of the training text paragraph according to the suspended segment format feature list of the training text, obtaining tensor type data of the training text paragraph, and using the tensor type data of the training text paragraph as input data of a text format audit model;
[0040] Preferably, in this embodiment, the list of format features of the suspended paragraph of the training text specifically includes: paragraph font name, paragraph font size, paragraph title type, paragraph title, paragraph title font name, paragraph front distance, paragraph typesetting position, paragraph indent, paragraph left indent distance, and line spacing of the training text;
[0041] The tensor type data is a vector set constructed by the suspended segment format vectors of the training text paragraph.
[0042] Step 103: retrieve the construction parameters of the convolution kernel in the hyperparameters, construct a convolution kernel according to the construction parameters of the convolution kernel, and use the convolution kernel to perform convolution calculation on the tensor type data of the training text paragraph to obtain the convolution data of the training text paragraph;
[0043] Step 104: ReLU excitation function in the hyperparameter is retrieved to perform excitation calculation on the convolution data of the training text paragraph to obtain excitation data of the training text paragraph;
[0044] Step 105: performing a pooling operation on the training text paragraph excitation data to obtain a pooling operation result;
[0045] Step 106: Determine whether there is a convolutional layer to be operated. If so, use the pooling operation result as the tensor type data of the training text and return to step 103; if not, execute step 107;
[0046] Step 107: updating the tensor type data of the training text paragraph according to the pooling operation result;
[0047] Step 108: Calculate the weights and biases of the nodes of each layer of the fully connected layer in the audit model layer by layer using the tensor type data of the training text paragraph, and construct the final layer tensor type data of the training text paragraph according to the result of calculating the weights and biases of the nodes of the last layer;
[0048] Step 109: Calculate the cross entropy of the final layer tensor type data and the label of the training text paragraph;
[0049] In this embodiment, the label is specifically: a target format vector obtained after the suspended segment format review and annotation of the training text.
[0050] Step 110: Calculate the loss rate using the cross entropy, compare the loss rate with the hyperparameter, and determine whether the audit model is successfully constructed. If yes, execute step 112; otherwise, execute step 111;
[0051] Step 111: select a node of the fully connected layer as the current node, the layer where the current node is located is the current layer, use the output of the convolution layer and the weights and biases of each layer to calculate the node values of the nodes of each layer and the first-order partial derivatives of the node values of the ReLU excitation function at the nodes of each layer layer by layer, use the first-order partial derivative of the node value of the ReLU excitation function at the current node, the loss rate, the learning rate, the weights and biases of the nodes in the next layer of the current layer, calculate the adjustment vector of the current node through the back propagation algorithm, adjust the weights and biases of the nodes in each layer of the fully connected layer layer by layer according to the adjustment vector, and return to step 103;
[0052] Preferably, in this embodiment, all weights w are initialized with random decimals. ij and bias b i ; Use the weights, biases, and the output values of the nodes in the previous layer of the current layer and the activation function to gradually calculate the values of the nodes in each layer. The calculation formula is as follows:
[0053] formula:
[0054] Preferably, in this embodiment, the weight and bias of the current node and the values of each node in the previous layer of the current node are used to calculate the first-order partial derivative of the node value of the activation function at the current node, as follows:
[0055]
[0056]
[0057] Step 112: Input the text to be tested into the successfully constructed text format review model, output the text review result tensor type data based on the text format review model, determine whether the text to be tested has passed the format review based on the text review result tensor type data, and annotate the text to be tested that has not passed the format review with a suspended segment format error.
[0058] Example 2
[0059] This embodiment 2 provides a text format review method. In this embodiment, the training format of the training text is a legend format, such as Figure 2 As shown, the method comprises the following steps:
[0060] Step 201: setting hyperparameters of a text format audit model, initializing the text format audit model according to the set hyperparameters, and importing training text into the text format audit model;
[0061] Preferably, in this embodiment, the hyperparameters specifically include: the learning rate that determines the speed of change of the loss function in the audit model, the dimension, step size, padding strategy, preset value, and number of convolution kernels, the number of convolution layers constructed by the construction parameters of the convolution kernel, the number of nodes in each layer of the audit model, the weights and biases of the nodes, and the preset values.
[0062] Step 202: setting a legend format feature list of the training text, constructing a format vector of the training text paragraph according to the legend format feature list of the training text, obtaining tensor type data of the training text paragraph, and using the tensor type data of the training text paragraph as input data of the text format audit model;
[0063] Preferably, in this embodiment, the legend format feature list of the training text specifically includes: the number of full-width spaces before paragraphs of the training text, the number of full-width spaces in paragraphs, the number of half-width spaces before paragraphs, the number of half-width spaces in paragraphs, paragraph title type, paragraph title, paragraph title font name, and figure title logo.
[0064] The tensor type data is a vector set constructed by the legend format vectors of the training text paragraph.
[0065] Step 203: using the tensor type data of the training text paragraph, calculating the weights and biases of the nodes of each layer of the fully connected layer in the audit model layer by layer, and constructing the final layer tensor type data of the training text paragraph according to the result of calculating the weights and biases of the nodes of the last layer;
[0066] Step 204: Calculate the cross entropy of the final layer tensor type data and labels of the training text paragraph;
[0067] In this embodiment, the label is specifically: a target format vector obtained after the legend format is reviewed and annotated on the training text.
[0068] Step 205: Calculate the loss rate using the cross entropy, compare the loss rate with the hyperparameter, and determine whether the audit model is successfully constructed. If yes, execute step 207; otherwise, execute step 206;
[0069] Step 206: Select a node of the fully connected layer as the current node, and the layer where the current node is located is the current layer. Calculate the node values of the nodes of each layer and the first-order partial derivatives of the node values of the ReLU excitation function at the nodes of each layer layer by layer using the output of the tensor type data of the training text paragraph and the weights and biases of each layer. Calculate the adjustment vector of the current node by the back propagation algorithm using the first-order partial derivative of the node value of the ReLU excitation function at the current node, the loss rate, the learning rate, and the weights and biases of the nodes in the next layer of the current layer. Adjust the weights and biases of the nodes in each layer of the fully connected layer layer by layer according to the adjustment vector, and return to step 203;
[0070] Preferably, in this embodiment, all weights w are initialized with random decimals. ij and bias b i ; Use the weights, biases, and the output values of the nodes in the previous layer of the current layer and the activation function to gradually calculate the values of the nodes in each layer. The calculation formula is as follows:
[0071] formula:
[0072] Preferably, in this embodiment, the weight and bias of the current node and the values of each node in the previous layer of the current node are used to calculate the first-order partial derivative of the node value of the activation function at the current node, as follows:
[0073]
[0074]
[0075] Step 207: Input the text to be detected into the successfully constructed text format review model, output the text to be detected review result tensor type data based on the text format review model, determine whether the format review has been passed according to the text to be detected review result tensor type data, and annotate the text to be detected that has not passed the format review with a legend format error.
[0076] Example 3
[0077] This embodiment 3 provides a text format review method. In this embodiment, the training format of the training text is a text font format, such as Figure 3 As shown, the method comprises the following steps:
[0078] Step 301: setting hyperparameters of a text format audit model, initializing the text format audit model according to the set hyperparameters, and importing training text into the text format audit model;
[0079] Preferably, in this embodiment, the hyperparameters specifically include: the learning rate that determines the speed of change of the loss function in the audit model, the dimension, step size, padding strategy, preset value, and number of convolution kernels, the number of convolution layers constructed by the construction parameters of the convolution kernel, the number of nodes in each layer of the audit model, the weights and biases of the nodes, and the preset values.
[0080] Step 302: setting a text font format feature list of the training text, constructing a format vector of the training text paragraph according to the text font format feature list of the training text, obtaining tensor type data of the training text paragraph, and using the tensor type data of the training text paragraph as input data of the text format audit model;
[0081] Preferably, in this embodiment, the list of body font format features of the training text specifically includes: text in the table, paragraph font name, paragraph font size, paragraph title type, paragraph title, paragraph title font name, distance before the paragraph, paragraph typesetting position, paragraph indentation, paragraph left indentation distance, line spacing, and whether there is paragraph content.
[0082] The tensor type data is a vector set constructed from the text font format vectors of the training text paragraph.
[0083] Step 303: using the tensor type data of the training text paragraph, calculating the weights and biases of the nodes of each layer of the fully connected layer in the audit model layer by layer, and constructing the final layer tensor type data of the training text paragraph according to the result of calculating the weights and biases of the nodes of the last layer;
[0084] Step 304: Calculate the cross entropy of the final layer tensor type data and labels of the training text paragraph;
[0085] In this embodiment, the label is specifically: a target format vector obtained after the training text is audited and annotated with respect to the text font format.
[0086] Step 305: Calculate the loss rate using the cross entropy, compare the loss rate with the hyperparameter, and determine whether the audit model is successfully constructed. If yes, execute step 307; otherwise, execute step 306;
[0087] Step 306: Select a node of the fully connected layer as the current node, and the layer where the current node is located is the current layer. Calculate the node values of the nodes of each layer layer by layer using the output of the tensor type data of the training text paragraph and the weights and biases of each layer, and the first-order partial derivatives of the node values of the ReLU excitation function at the nodes of each layer. Calculate the adjustment vector of the current node by the back propagation algorithm using the first-order partial derivative of the node value of the ReLU excitation function at the current node, the loss rate, the learning rate, and the weights and biases of the nodes in the next layer of the current layer. Adjust the weights and biases of the nodes in each layer of the fully connected layer layer by layer according to the adjustment vector, and return to step 303;
[0088] Preferably, in this embodiment, all weights w are initialized with random decimals. ij and bias b i ; Use the weights, biases, and the output values of the nodes in the previous layer of the current layer and the activation function to gradually calculate the values of the nodes in each layer. The calculation formula is as follows:
[0089] formula:
[0090] Preferably, in this embodiment, the weight and bias of the current node and the values of each node in the previous layer of the current node are used to calculate the first-order partial derivative of the node value of the activation function at the current node, as follows:
[0091]
[0092]
[0093] Step 307: Input the text to be tested into the successfully constructed text format review model, output the review result tensor type data of the text to be tested based on the text format review model, determine whether the format review has been passed according to the review result tensor type data, and annotate the text font format errors for the text to be tested that has not passed the format review.
[0094] Example 4
[0095] This embodiment 4 provides a text format review method. In this embodiment, the training format of the training text is a digital item format, such as Figure 4 As shown, the method comprises the following steps:
[0096] Step 401: setting hyperparameters of a text format audit model, initializing the text format audit model according to the set hyperparameters, and importing training text into the text format audit model;
[0097] Preferably, in this embodiment, the hyperparameters specifically include: the learning rate that determines the speed of change of the loss function in the audit model, the dimension, step size, padding strategy, preset value, and number of convolution kernels, the number of convolution layers constructed by the construction parameters of the convolution kernel, the number of nodes in each layer of the audit model, the weights and biases of the nodes, and the preset values.
[0098] Step 402: setting a digital column item format feature list of the training text, constructing a format vector of the training text paragraph according to the digital column item format feature list of the training text, obtaining tensor type data of the training text paragraph, and using the tensor type data of the training text paragraph as input data of the text format audit model;
[0099] Preferably, in this embodiment, the list of format features of the suspended paragraph of the training text specifically includes: paragraph font name, paragraph font size, paragraph title type, paragraph title, paragraph title font name, paragraph front distance, paragraph typesetting position, paragraph indent, paragraph left indent distance, and line spacing of the training text;
[0100] The tensor type data is a vector set constructed by the digital column item format vectors of the training text paragraph.
[0101] Step 403: Retrieving the construction parameters of the convolution kernel in the hyperparameters, constructing the convolution kernel according to the construction parameters of the convolution kernel, and performing convolution calculation on the tensor type data of the training text paragraph using the convolution kernel to obtain the convolution data of the training text paragraph;
[0102] Step 404: ReLU excitation function in the hyperparameter is retrieved to perform excitation calculation on the convolution data of the training text paragraph to obtain excitation data of the training text paragraph;
[0103] Step 405: performing a pooling operation on the training text paragraph excitation data to obtain a pooling operation result;
[0104] Step 406: Determine whether there is a convolutional layer to be operated. If so, use the pooling operation result as the tensor type data of the training text and return to step 403; if not, execute step 407;
[0105] Step 407: updating the tensor type data of the training text paragraph according to the pooling operation result;
[0106] Step 408: Calculate the weights and biases of the nodes of each layer of the fully connected layer in the audit model layer by layer using the tensor type data of the training text paragraph, and construct the final layer tensor type data of the training text paragraph according to the result of calculating the weights and biases of the nodes of the last layer;
[0107] Step 409: Calculate the cross entropy of the final layer tensor type data and labels of the training text paragraph;
[0108] In this embodiment, the label is specifically: a target format vector obtained after the suspended segment format review and annotation of the training text.
[0109] Step 410: Calculate the loss rate using the cross entropy, compare the loss rate with the hyperparameter, and determine whether the audit model is successfully constructed. If yes, execute step 412; otherwise, execute step 411;
[0110] Step 411: select a node of the fully connected layer as the current node, the layer where the current node is located is the current layer, use the output of the convolution layer and the weights and biases of each layer to calculate the node values of the nodes of each layer and the first-order partial derivatives of the node values of the ReLU excitation function at the nodes of each layer layer by layer, use the first-order partial derivative of the node value of the ReLU excitation function at the current node, the loss rate, the learning rate, the weights and biases of the nodes in the next layer of the current layer, calculate the adjustment vector of the current node through the back propagation algorithm, adjust the weights and biases of the nodes in each layer of the fully connected layer layer by layer according to the adjustment vector, and return to step 403;
[0111] Preferably, in this embodiment, all weights w are initialized with random decimals. ij and bias b i ; Use the weights, biases, and the output values of the nodes in the previous layer of the current layer and the activation function to gradually calculate the values of the nodes in each layer. The calculation formula is as follows:
[0112] formula:
[0113] Preferably, in this embodiment, the weight and bias of the current node and the values of each node in the previous layer of the current node are used to calculate the first-order partial derivative of the node value of the activation function at the current node, as follows:
[0114]
[0115]
[0116] Step 412: Input the text to be detected into the successfully constructed text format review model, output the text to be detected review result tensor type data based on the text format review model, determine whether the text to be detected has passed the format review based on the text to be detected review result tensor type data, and annotate the text to be detected that has not passed the format review with a suspended segment format error.
[0117] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0118] Example 5
[0119] This embodiment provides a text format review model, such as Figure 5 As shown, including:
[0120] The data acquisition interface 510 is used to acquire training text, text to be reviewed, and training set, wherein the training set includes: labels obtained after format review and annotation of the training text;
[0121] The trainer 520 is used to extract the format feature information of the training text paragraph, obtain the tensor type data of the training text paragraph, use it as an input value, input it into the model built based on the hyperparameter for repeated training, and obtain the trained text format review model after the training effect reaches the threshold set in the hyperparameter;
[0122] The text format classifier 530 is used to output the paragraph format review annotation category of the text to be detected.
[0123] Example 6
[0124] An electronic device, the utilization of which lies in that the electronic device comprises a processor and a memory; wherein the memory is used to store a computer program, and the computer program is loaded and executed by the processor to implement the text format review method described in any of the above embodiments.
[0125] In the embodiment of the present application, the processor is the control center of the computer system, which can be the processor of a physical machine or the processor of a virtual machine. The processor may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor may be implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). The processor may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a CPU (Central Processing Unit); the coprocessor is a low-power processor for processing data in the standby state.
[0126] The memory may include one or more computer-readable storage media, which may be non-transitory. The memory may also include high-speed random access memory, and non-volatile memory, such as one or more disk storage devices, flash memory storage devices. In some embodiments of the present application, the non-transitory computer-readable storage medium in the memory is used to store at least one instruction, which is used to be executed by the processor to implement the text format review method in the embodiment of the present application.
[0127] In some embodiments, the device further comprises: a peripheral device interface and at least one peripheral device. The processor, the memory and the peripheral device interface may be connected via a bus or a signal line. Each peripheral device may be connected to the peripheral device interface via a bus, a signal line or a circuit board. Specifically, the peripheral device comprises: at least one of a display screen, a camera and an audio circuit.
[0128] The peripheral device interface can be used to connect at least one peripheral device related to I / O (Input / Output) to the processor and the memory. In some embodiments of the present application, the processor, the memory, and the peripheral device interface are integrated on the same chip or circuit board; in some other embodiments of the present application, any one or two of the processor, the memory, and the peripheral device interface can be implemented on a separate chip or circuit board. The embodiments of the present application are not specifically limited to this.
[0129] Example 7
[0130] This embodiment provides a computer-readable storage medium, on which a computer program is stored, and when the program is executed by a processor, the text format audit method described in any of the above embodiments is implemented. The computer-readable storage medium may include, but is not limited to, any type of disk, including a floppy disk, an optical disk, a DVD, a CD-ROM, a micro drive, and a magneto-optical disk, a ROM, a RAM, an EPROM, an EEPROM, a DRAM, a VRAM, a flash memory device, a magnetic card or an optical card, a nanosystem (including a molecular memory IC), or any type of medium or device suitable for storing instructions and / or data.
[0131] The above is only a preferred implementation of the present application, but the protection scope of the present application is not limited thereto. The training format types for the training text are not limited to the contents recorded in the embodiments of the present invention. The embodiments of the present invention are only the more common format types in text format review. In addition, there are also such as: English space format in the title, font format in the table, line spacing format of the reference, font format of the appendix text, etc. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in this application, which should be covered by the protection scope of this application. Therefore, equivalent changes made according to the claims of this application are still within the scope covered by this application.
Claims
1. A text format review method, characterized in that: The steps include: Step 1: setting hyperparameters of a text format audit model, initializing the text format audit model according to the set hyperparameters, and importing training text into the text format audit model; Step 2, determining the training format of the training text, if it is a suspended paragraph format, executing step 2-1; if it is a legend format, executing step 2-2; if it is a text title format, executing step 2-3; if it is a number list format, executing step 2-4; Step 2-1: setting a suspended segment format feature list of the training text, constructing a format vector of a paragraph of the training text according to the suspended segment format feature list of the training text, obtaining tensor type data of the paragraph of the training text, using the tensor type data of the paragraph of the training text as input data of the text format audit model, and executing step 3; Step 2-2: setting a legend format feature list of the training text, constructing a format vector of a paragraph of the training text according to the legend format feature list of the training text, obtaining tensor type data of the paragraph of the training text, using the tensor type data of the paragraph of the training text as input data of the text format audit model, and executing step 8; Step 2-3: Set a text font format feature list of the training text, construct a format vector of a paragraph of the training text according to the text font format feature list of the training text, obtain tensor type data of the paragraph of the training text, use the tensor type data of the paragraph of the training text as input data of the text format audit model, and execute step 8; Step 2-4: Set a digital column item format feature list of the training text, construct a format vector of the paragraph of the training text according to the digital column item format feature list of the training text, obtain the tensor type data of the paragraph of the training text, use the tensor type data of the paragraph of the training text as input data of the text format audit model, and execute step 3; Step 3: Retrieve the data parameters in the hyperparameters, perform convolution calculation on the tensor type data of the paragraph of the training text, and obtain the convolution data of the paragraph of the training text; Step 4: call the function in the hyperparameter, perform excitation calculation on the convolution data of the paragraph of the training text, and obtain the paragraph excitation data of the training text; Step 5: performing a pooling operation on the paragraph excitation data of the training text to obtain a pooling operation result; Step 6: Determine whether there is a convolutional layer to be operated. If so, use the pooling operation result as the tensor type data of the training text and return to step 3; if not, execute step 7; Step 7: updating the tensor type data of the paragraph of the training text according to the pooling operation result; Step 8: Calculate the weights and biases of the nodes of each layer of the fully connected layer in the audit model layer by layer using the tensor type data of the paragraphs of the training text, and construct the final layer tensor type data of the paragraphs of the training text according to the result of calculating the weights and biases of the nodes of the last layer; Step 9: Calculate the cross entropy of the final layer tensor type data and labels of the paragraphs of the training text; Step 10, using the cross entropy to calculate the loss rate, comparing the loss rate with the hyperparameters, and determining whether the audit model is successfully constructed. If successful, proceed to step 12, otherwise proceed to step 11; Step 11, calculating the adjustment vector of each layer node of the fully connected layer by back propagation algorithm, adjusting the weight and bias of each layer node of the fully connected layer according to the adjustment vector, and returning to step 3; Step 12: input the text to be tested into the successfully constructed text format review model, output the review result tensor type data of the text to be tested based on the text format review model, judge whether the text to be tested has passed the format review according to the review result tensor type data, and annotate the format error for the text to be tested that has not passed the format review.
2. The method according to claim 1, characterized in that: The hyperparameters specifically include: the learning rate that determines the speed of change of the loss function in the audit model, the dimension, step size, filling strategy, preset value, and number of convolution kernels, the number of convolution layers constructed by the construction parameters of the convolution kernel, the number of nodes in each layer of the audit model, the weights and biases of the nodes, and the preset values.
3. The method according to claim 2, characterized in that The step of calling the data parameters in the hyperparameters and performing convolution calculation on the tensor type data of the paragraphs of the training text to obtain the convolution data of the paragraphs of the training text is specifically as follows: calling the construction parameters of the convolution kernel in the hyperparameters, constructing a convolution kernel according to the construction parameters of the convolution kernel, and performing convolution calculation on the tensor type data of the paragraphs of the training text with the convolution kernel to obtain the convolution data of the paragraphs of the training text.
4. The method according to claim 3, characterized in that The function in the hyperparameter is called, and the convolution data of the paragraph of the training text is excitation calculated to obtain the excitation data of the training text. Specifically, the ReLU excitation function in the hyperparameter is called, and the convolution data of the paragraph of the training text is excitation calculated to obtain the excitation data of the paragraph of the training text.
5. The method according to claim 1, characterized in that The suspended paragraph format feature list of the training text specifically includes: paragraph font name, paragraph font size, paragraph title type, paragraph title, paragraph title font name, paragraph front distance, paragraph typesetting position, paragraph indent, paragraph left indent distance, and line spacing of the training text.
6. The method according to claim 1, characterized in that The legend format feature list of the training text specifically includes: the number of full-width spaces before paragraphs of the training text, the number of full-width spaces in paragraphs, the number of half-width spaces before paragraphs, the number of half-width spaces in paragraphs, paragraph title type, paragraph title, paragraph title font name, and figure title logo.
7. The method according to claim 1, characterized in that The list of body font format features of the training text specifically includes: text in tables, paragraph font name, paragraph font size, paragraph title type, paragraph title, paragraph title font name, distance before paragraph, paragraph typesetting position, paragraph indentation, paragraph left indentation distance, line spacing, and whether there is paragraph content.
8. The method according to claim 1, characterized in that The digital column item format feature list of the training text specifically includes: the end symbol of each paragraph, paragraph font name, paragraph font size, paragraph title type, paragraph title, paragraph title font name, distance before the paragraph, paragraph typesetting position, paragraph indentation, paragraph left indentation distance, line spacing, first-level column item identifier, and second-level column item identifier.
9. The method according to claim 1, characterized in that The tensor type data is a vector set constructed by format vectors of paragraphs of the training text.
10. The method according to claim 1, characterized in that The label is specifically: a target format vector obtained after format review and annotation of the training text.
11. The method according to claim 1, characterized in that The method of calculating the weights and biases of the nodes at each layer of the fully connected layer in the audit model using the tensor type data of the paragraphs of the training text also includes: calculating the values of the nodes at each layer and the first-order partial derivatives of the ReLU excitation function at the nodes at each layer.
12. The method according to claim 11, characterized in that The adjustment vectors of the nodes of each layer of the fully connected layer are calculated by the back propagation algorithm, specifically: any node of the fully connected layer is selected as the current node, the layer where the current node is located is the current layer, and the first-order partial derivative of the ReLU excitation function at the current layer node, the loss rate, the learning rate, the weights and bias of each node in the next layer of the current layer are used to calculate the adjustment vector of the current node by the back propagation algorithm.
13. The method according to claim 11, characterized in that The training format of the training text also includes: English space format in the title, font format in the table, line spacing format of the references, and font format of the appendix text.
14. A text format audit model, characterized in that: Used to implement the text format audit method according to any one of claims 1 to 13, the text format audit model includes: A data acquisition interface, used to acquire training text, text to be reviewed, and training set, wherein the training set includes: labels obtained after format review and annotation of the training text; A trainer is used to extract format feature information of a training text paragraph, obtain tensor type data of the training text paragraph, use it as an input value, input it into a model built based on a hyperparameter for repeated training, and obtain the trained text format review model after the training effect reaches a threshold set in the hyperparameter; The text format classifier is used to output the paragraph format review annotation category of the text to be detected.
15. An electronic device, wherein the electronic device comprises a processor and a memory; wherein the memory is used to store a computer program, and the computer program is loaded and executed by the processor to implement the text format review method as described in any one of claims 1-13.
16. A computer-readable storage medium, characterized in that: Used to store computer executable instructions, which, when loaded and executed by a processor, implement the text format review method as described in any one of claims 1-13.
Citation Information
Patent Citations
Text auditing method, text auditing model, equipment and storage medium
CN112487149A