Document style self-repairing method and device, storage medium and electronic equipment
By converting documents into structured arrays and matching them with preset styles, the document style is automatically repaired, which solves the problem of inefficient document style repair in the existing technology, and achieves fast and accurate document style repair.
Patent Information
- Application Number
- CN202411336198.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-24
- Publication Date
- 2025-01-14
AI Technical Summary
In the prior art, document style repair is relatively inefficient, lack of effective automation solutions, and relying on manual operations leads to time-consuming and costly.
Automatically repair page styles, paragraph styles, and text block styles by converting the document to be repaired into a structured array, determining the content type and matching the preset style, and automatically repairing page styles, paragraph styles, and text block styles, record repair history for fast and precise document style repairs.
It improves the efficiency and accuracy of document style repair, reduces manual intervention, and realizes automated document style detection and repair, suitable for various document types such as text, titles and tables.
Smart Images

Figure CN119312773A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of information technology, and in particular to a document style self-repair method, device, computer-readable storage medium and electronic device. Background Art
[0002] As enterprises, universities and other institutions have increasingly standardized their document requirements, document styles are becoming more and more important. How to quickly modify the document to be repaired into the target style has become a research direction.
[0003] Currently, the main method used to repair document styles is to manually adjust the entire text according to the standard style, which is time-consuming and costly. Other methods take the approach of detecting the document style to be repaired, quickly locating and marking it based on the detection results, and performing partial manual repairs. This method is more suitable for final draft inspection.
[0004] The existing technical solutions for document style repair all require manual repair of the style, which has the problem of low efficiency.
[0005] To address the above-mentioned problems, no effective solution has been proposed yet. Summary of the invention
[0006] Embodiments of the present invention provide a document style self-repair method, device, computer-readable storage medium and electronic device to at least solve the technical problem that the technical solutions for document style repair in the prior art are inefficient.
[0007] According to one aspect of an embodiment of the present invention, a document style self-repair method is provided, comprising: obtaining a document to be repaired, and converting the document to be repaired into a structured array; determining whether content in the structured array is text content, and if the content is text content, determining whether the type of the content is a text body type; if the type of the content is the text body type, matching the style of the content with a preset text style, determining whether the style of the content is consistent with the preset text style, and if the style of the content is inconsistent with the preset text style, repairing the style of the content to the preset text style.
[0008] Optionally, the style includes a page style, a paragraph style and a text block style, wherein determining whether the style of the content is consistent with the preset text style and, if the style of the content is inconsistent with the preset text style, repairing the style of the content to the preset text style includes: determining whether the page style of the content is consistent with the preset page style; if the page style of the content is consistent with the preset page style, determining whether the paragraph style of the content is consistent with the preset paragraph style; if the paragraph style of the content is consistent with the preset paragraph style, determining whether the text block style of the content is consistent with the preset text block style; if the text block style of the content is inconsistent with the preset text block style, repairing the text block style of the content to the preset text block style.
[0009] Optionally, after determining whether the page style of the content is consistent with the preset page style, the document style self-repair method further includes: when the page style of the content is inconsistent with the preset page style, repairing the page style of the content to the preset page style; after determining whether the paragraph style of the content is consistent with the preset paragraph style, the document style self-repair method further includes: when the paragraph style of the content is inconsistent with the preset paragraph style, repairing the paragraph style of the content to the preset paragraph style.
[0010] Optionally, before determining whether the paragraph style of the content is consistent with a preset paragraph style, the document style self-repair method further includes: determining whether the page style number of the content is accurate; if it is determined that the page style number of the content is inaccurate, modifying the page style number of the content to obtain a modified page style number.
[0011] Optionally, after determining whether the content in the structured array belongs to text content, the document style self-repair method also includes: when it is determined that the content in the structured array belongs to a table, determining whether the page style of the content is consistent with a preset page style; when the page style of the content is consistent with the preset page style, determining whether the table style of the content is consistent with the preset table style; when the table style of the content is inconsistent with the preset table style, repairing the table style of the content to the preset table style.
[0012] Optionally, after repairing the table style of the content to the preset table style, the document style self-repair method further includes: determining whether the paragraph style of the content is consistent with the preset paragraph style; if the paragraph style of the content is consistent with the preset paragraph style, determining whether the text block style of the content is consistent with the preset text block style; if the text block style of the content is inconsistent with the preset text block style, repairing the text block style of the content to the preset text block style.
[0013] Optionally, after determining whether the type of the content is a text body type, the document style self-repair method further includes: when the content is a title type, determining the title level of the content; matching the style of the content with a preset title style according to the title level, wherein the preset title style includes a title page style, a title paragraph style, and a title text block style.
[0014] According to another aspect of an embodiment of the present invention, a document style self-repair device is also provided, including: an acquisition unit, used to acquire a document to be repaired and convert the document to be repaired into a structured array; a first determination unit, used to determine whether the content in the structured array belongs to text content, and when the content belongs to the text content, determine whether the type of the content is a text body type; a first modification unit, used to match the style of the content with a preset text style if the type of the content is the text body type, determine whether the style of the content is consistent with the preset text style, and when the style of the content is inconsistent with the preset text style, repair the style of the content to the preset text style.
[0015] Optionally, the first modification unit includes: a first determination subunit, used to determine whether the page style of the content is consistent with a preset page style; a second determination subunit, used to determine whether the paragraph style of the content is consistent with a preset paragraph style when the page style of the content is consistent with the preset page style; a third determination subunit, used to determine whether the text block style of the content is consistent with a preset text block style when the paragraph style of the content is consistent with the preset paragraph style; the first modification subunit is used to repair the text block style of the content to the preset text block style when the text block style of the content is inconsistent with the preset text block style.
[0016] Optionally, the document style self-repair device also includes: a second modification sub-unit, which is used to repair the page style of the content to the preset page style after determining whether the page style of the content is consistent with the preset page style and if the page style of the content is inconsistent with the preset page style; and a third modification sub-unit, which is used to repair the paragraph style of the content to the preset paragraph style after determining whether the paragraph style of the content is consistent with the preset paragraph style and if the paragraph style of the content is inconsistent with the preset paragraph style.
[0017] Optionally, the document style self-repair device also includes: a fourth determination subunit, used to determine whether the page style number of the content is accurate before determining whether the paragraph style of the content is consistent with a preset paragraph style; if it is determined that the page style number of the content is inaccurate, modify the page style number of the content to obtain a modified page style number.
[0018] Optionally, the document style self-repair device also includes: a second determination unit, used to determine whether the page style of the content is consistent with the preset page style after determining whether the content in the structured array belongs to text content and when it is determined that the content in the structured array belongs to a table; a third determination unit, used to determine whether the table style of the content is consistent with the preset table style when the page style of the content is consistent with the preset page style; and a second modification unit, used to repair the table style of the content to the preset table style when the table style of the content is inconsistent with the preset table style.
[0019] Optionally, the document style self-repair device also includes: a fourth determination unit, used to determine whether the paragraph style of the content is consistent with the preset paragraph style after the table style of the content is repaired to the preset table style; a fifth determination unit, used to determine whether the text block style of the content is consistent with the preset text block style when the paragraph style of the content is consistent with the preset paragraph style; and a third modification unit, used to repair the text block style of the content to the preset text block style when the text block style of the content is inconsistent with the preset text block style.
[0020] Optionally, the document style self-repair device also includes: a sixth determination unit, used to determine the title level of the content after determining whether the type of the content is a text body type and if the content is a title type; a matching unit, used to match the style of the content with a preset title style according to the title level, wherein the preset title style includes a title page style, a title paragraph style, and a title text block style.
[0021] According to another aspect of an embodiment of the present invention, a computer-readable storage medium is also provided, wherein the computer-readable storage medium includes a stored program, wherein when the program is running, the device where the computer-readable storage medium is located is controlled to execute any one of the document style self-repair methods described above.
[0022] According to another aspect of an embodiment of the present invention, there is also provided an electronic device, comprising: one or more processors, a memory, and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by the one or more processors, and the one or more programs include a method for executing any one of the document style self-repair methods described above.
[0023] According to another aspect of an embodiment of the present invention, a processor is further provided, the processor being used to run a program, wherein the program executes any one of the document style self-repairing methods described above when running.
[0024] According to another aspect of an embodiment of the present invention, a computer program product is provided, comprising computer instructions, wherein when the computer instructions are executed by a processor, any one of the document style self-repairing methods described above is executed.
[0025] In an embodiment of the present invention, a document to be repaired is obtained and converted into a structured array; it is determined whether the content in the structured array is text content, and if the content is text content, it is determined whether the type of the content is a text body type; if the type of the content is a text body type, the style of the content is matched with a preset text style to determine whether the style of the content is consistent with the preset text style, and if the style of the content is inconsistent with the preset text style, the style of the content is repaired to the preset text style. Through the technical solution provided by the present invention, the purpose of extracting the document style into structured data according to the content characteristics in layers, and adopting a multi-layer nested comparison method based on the style, and at the same time, recording the document style repair history, thereby achieving the technical effect of quickly extracting or customizing the standard document style and automatically detecting and repairing the document style, improving the efficiency and accuracy of the repair, and thus solving the technical problem of low efficiency in the technical solution for document style repair in the prior art. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0027] Figure 1 It is a hardware structure block diagram of a mobile terminal of a document style self-repair method according to an embodiment of the present invention;
[0028] Figure 2 is a flowchart of a document style self-repair method according to an embodiment of the present invention;
[0029] Figure 3 is a structural diagram of document style self-repair according to an embodiment of the present invention;
[0030] Figure 4 is a flow chart of a template specification style extraction module according to an embodiment of the present invention;
[0031] Figure 5 is a flow chart of another document style self-repair method according to an embodiment of the present invention;
[0032] Figure 6 is a schematic diagram of a document style self-repairing method according to an embodiment of the present invention;
[0033] Figure 7 is a schematic diagram of a document style structure according to an embodiment of the present invention;
[0034] Figure 8 is a schematic diagram of a document style self-repairing device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0035] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings 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 should fall within the scope of protection of the present invention.
[0036] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0037] As introduced in the background technology, the technical solutions for document style repair in the prior art are inefficient. In view of the above defects, a document style self-repair method, device, computer-readable storage medium and electronic device are provided in the embodiments of the present invention.
[0038] The technical solutions in the embodiments of the present invention will be described clearly and completely below in conjunction with the accompanying drawings in the embodiments of the present invention.
[0039] The method embodiments provided in the embodiments of the present invention can be executed in a mobile terminal, a computer terminal or a similar computing device. Taking running on a mobile terminal as an example, Figure 1 FIG. 1 is a hardware structure block diagram of a mobile terminal of a document style self-repair method according to an embodiment of the present invention. Figure 1 As shown, the mobile terminal may include one or more ( Figure 1 Only one is shown in the figure) a processor 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data, wherein the mobile terminal may also include a transmission device 106 and an input / output device 108 for communication functions. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the mobile terminal. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations shown.
[0040] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the document style self-repair method in the embodiment of the present invention. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, the above method is implemented. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories can be connected to the mobile terminal via a network. Examples of the above-mentioned network include but are not limited to the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof. The transmission device 106 is used to receive or send data via a network. The above-mentioned specific network example may include a wireless network provided by a communication provider of the mobile terminal. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 may be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0041] According to an embodiment of the present invention, a method embodiment of a document style self-repair method is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0042] Figure 2 is a flowchart of a document style self-repair method according to an embodiment of the present invention. Figure 2 As shown, the method comprises the following steps:
[0043] Step S202, obtaining the document to be repaired, and converting the document to be repaired into a structured array.
[0044] Figure 3 is a structural diagram of document style self-repair according to an embodiment of the present invention, such as Figure 3 As shown, it is divided into four modules: template standard style extraction, document style comparison, style difference repair and style repair record. Among them, the template standard style extraction module mainly includes the extraction of the template's standard style into structured fields, and the categories involved include document body, title, header and footer, table, abstract and attachment, etc. The document style comparison module compares the standard style provided by the algorithm with the content style of the document to be repaired, and outputs the comparison results.
[0045] Figure 4 is a flow chart of a template specification style extraction module according to an embodiment of the present invention. Figure 4 As shown, the template standard style extraction module is first used to extract the standard style from the template to generate the structured data of the style, or the style structured data is generated in a configured manner through input.
[0046] Afterwards, the document style comparison module is executed to obtain the target document structured data to be repaired and compare it with the standard style structured data.
[0047] In this embodiment, the document content structured data of the target document to be repaired can be obtained, converted into a structured array, and the array content can be gradually obtained in sequence to better understand the content and problems of the document, facilitate analysis and processing, make the repair work more efficient, and facilitate subsequent further processing of the document.
[0048] It should be noted that the above structured array is a data structure that contains multiple elements of different data types, each element has a specific name or key, and this array is usually used to represent complex data, such as database records or table data. Structured arrays can be multidimensional, allowing more information to be stored in an array. In many programming languages, structured arrays are usually represented by objects, dictionaries, or similar data structures.
[0049] Step S204, determining whether the content in the structured array is text content, and if the content is text content, determining whether the type of the content is a text body type.
[0050] Figure 5 is a flowchart of another document style self-repair method according to an embodiment of the present invention. Figure 5 As shown, when it is determined that the content in the structured array is text content, it is determined whether the content type of this segment belongs to a title or a body text.
[0051] In this embodiment, it can be determined whether the content in the acquired structured array is text content. If it is text, it is determined whether the type of the text content is a text body type, which facilitates the identification and processing of the text content and the repair of the text body part.
[0052] Optionally, the above text body type may include at least one of the following: main text, directory, abstract, keywords, appendix, picture and formula.
[0053] It should be noted that when the content type is text, it is necessary to determine whether the text is an abstract, keyword, appendix, ordinary text, etc. according to the rules, and then match the corresponding standard styles one level at a time. If they are different, the style should be repaired.
[0054] Step S206, if the content type is a text body type, match the content style with the preset text style to determine whether the content style is consistent with the preset text style. If the content style is inconsistent with the preset text style, repair the content style to the preset text style.
[0055] It should be noted that the above-mentioned style difference repair module repairs the document to be repaired according to the standard style based on the style comparison result.
[0056] Figure 6 is a schematic diagram of a document style self-repairing method according to an embodiment of the present invention. Figure 6 As shown, when the type of the content is a text body type, the style of the content of the target document to be repaired is matched with the text style in the template specification style.
[0057] In this embodiment, when the type of the content is a text body type, the style of the content can be matched with the preset text style to determine whether they are consistent. If they are inconsistent, the style of the content can be repaired to the preset text style to check and repair the text style. Inconsistencies in text styles can be discovered and repaired in a timely manner to ensure that the style of the document is consistent throughout the day.
[0058] As can be seen from the above, in an embodiment of the present invention, a document to be repaired is obtained and converted into a structured array; it is determined whether the content in the structured array belongs to text content, and if the content belongs to text content, it is determined whether the type of the content is a text body type; if the type of the content is a text body type, the style of the content is matched with a preset text style to determine whether the style of the content is consistent with the preset text style, and if the style of the content is inconsistent with the preset text style, the style of the content is repaired to the preset text style, thereby achieving the purpose of extracting the document style into structured data in layers according to the content characteristics, and adopting a style-based multi-layer nested comparison method. At the same time, the purpose of recording the document style repair history is achieved, thereby achieving the technical effect of quickly extracting or customizing the standard document style and automatically performing document style detection and repair, thereby improving the efficiency and accuracy of repair.
[0059] The technical solution provided by the embodiment of the present invention solves the technical problem of low efficiency of the technical solution for document style repair in the prior art.
[0060] According to the above embodiment of the present invention, the style includes a page style, a paragraph style and a text block style, wherein determining whether the style of the content is consistent with a preset text style, and repairing the style of the content to the preset text style if the style of the content is inconsistent with the preset text style, includes: determining whether the page style of the content is consistent with the preset page style; if the page style of the content is consistent with the preset page style, determining whether the paragraph style of the content is consistent with the preset paragraph style; if the paragraph style of the content is consistent with the preset paragraph style, determining whether the text block style of the content is consistent with the preset text block style; if the text block style of the content is inconsistent with the preset text block style, repairing the text block style of the content to the preset text block style.
[0061] like Figure 4 As shown, the above-mentioned style structured data divides the document content into multiple groups, which may include: text, title, directory, abstract, keywords, appendix, table, picture and formula, etc. Except for the table, each group can contain three styles, namely page style, paragraph style and text block style. The table alone contains one more table style.
[0062] Figure 7 is a schematic diagram of a document style structure according to an embodiment of the present invention. Figure 7 As shown, the above three styles are ranked from large to small, and the smallest granularity is prioritized under multiple styles. That is, when multiple styles exist in a document content at the same time, the text block style is the final style standard. When a table style exists, the priority is between the page style and the paragraph style.
[0063] It should be noted that the above-mentioned document structured data is divided into two parts: content and page style. The priority of style effect is from inside to outside, but the hierarchy when comparing styles is from outside to inside. When comparing styles, first determine whether the page style part is equal to the standardized page style in the template. If they are not equal, repair it to the standardized page style.
[0064] like Figure 5 As shown, first determine whether the page style conforms to the standard page style, and if consistent, determine whether the paragraph style of the content is correct, and if consistent, determine whether the text block style of the content is correct. If inconsistent, modify the text block style.
[0065] In this embodiment, it is possible to determine in turn whether the page style, paragraph style, and text block style of the content are consistent. If not, they are repaired to the preset style, thereby ensuring that the style in the document is always consistent and meets expectations, thereby improving the overall quality of the document.
[0066] According to the above embodiment of the present invention, after determining whether the page style of the content is consistent with the preset page style, the document style self-repair method also includes: when the page style of the content is inconsistent with the preset page style, repairing the page style of the content to the preset page style; after determining whether the paragraph style of the content is consistent with the preset paragraph style, the document style self-repair method also includes: when the paragraph style of the content is inconsistent with the preset paragraph style, repairing the paragraph style of the content to the preset paragraph style.
[0067] It should be noted that the function of the above-mentioned style difference repair module is mainly to repair the content style of the document to be repaired into the template standard style, and the above-mentioned styles are layered into page styles, table styles, paragraph styles and text block styles.
[0068] In this embodiment, when the page style of the content is inconsistent with the preset page style, it can be modified to the preset page style; when the paragraph style is inconsistent with the preset paragraph style, it can be modified to the preset paragraph style to ensure that the style in the document is always consistent.
[0069] According to the above embodiment of the present invention, before determining whether the paragraph style of the content is consistent with the preset paragraph style, the document style self-repair method also includes: determining whether the page style number of the content is accurate, and if it is determined that the page style number of the content is inaccurate, modifying the page style number of the content to obtain a modified page style number.
[0070] like Figure 5 As shown, after determining that the page style conforms to the standard page style, it is also necessary to determine whether the page style number is correct. If it is incorrect, modify the corresponding page style number.
[0071] It should be noted that in addition to replacing the above-mentioned page styles with standard styles, the page style type bound to the document content also needs to be replaced with a new page style number, and the matching relationship between the original page style and the standard page style needs to be replaced. For other styles, only the style content needs to be replaced with the standard style.
[0072] In this embodiment, it is possible to determine whether the page style number of the content is accurate, and to modify it if it is inaccurate, thereby ensuring the consistency between the content in the document and the page style number and avoiding the problem of confusing document formats. Correcting the page style number can ensure that the overall format of the document is correct.
[0073] According to the above embodiment of the present invention, after determining whether the content in the structured array belongs to text content, the document style self-repair method also includes: when it is determined that the content in the structured array belongs to a table, determining whether the page style of the content is consistent with the preset page style; when the page style of the content is consistent with the preset page style, determining whether the table style of the content is consistent with the preset table style; when the table style of the content is inconsistent with the preset table style, repairing the table style of the content to the preset table style.
[0074] like Figure 5 As shown, after gradually acquiring the array content in sequence, it is determined whether the part of the content is text or a table. When it is detected that the content in the structured array is a table, it is determined in turn whether the page style, table style, paragraph style, and text block style are consistent.
[0075] In this embodiment, when it is determined that the content in the structured array is a table, it can be directly determined whether the table style in the paragraph of content is the same, and then the standard style is matched according to the above-mentioned text matching rules. When the table style is inconsistent with the preset table style, the table style of the content is repaired to the preset table style.
[0076] According to the above embodiment of the present invention, after the table style of the content is repaired to the preset table style, the document style self-repair method also includes: determining whether the paragraph style of the content is consistent with the preset paragraph style; when the paragraph style of the content is consistent with the preset paragraph style, determining whether the text block style of the content is consistent with the preset text block style; when the text block style of the content is inconsistent with the preset text block style, repairing the text block style of the content to the preset text block style.
[0077] like Figure 5 As shown, after determining that the page style number to which the content belongs is correct, determine whether the paragraph style is correct. If it is consistent with the preset paragraph style, determine whether the text block style is correct. If it is inconsistent with the preset text block style, modify the text block style to the preset text block style.
[0078] According to the above embodiment of the present invention, after determining whether the type of the content is a text body type, the document style self-repair method also includes: when the content is a title type, determining the title level of the content; matching the style of the content with a preset title style according to the title level, wherein the preset title style includes a title page style, a title paragraph style, and a title text block style.
[0079] In this embodiment, when the type of content is a title, it is determined whether the page style number is correct based on the title numbering level, that is, the first-level title corresponds to the page style of title one. After determining the page style, the title part in the standard style is matched and compared with the paragraph style in the standard style. If they are different, the style is repaired. After the paragraph style is confirmed, the text block content in the content array is obtained, and compared and repaired with the text block style in the standard style, and this process is repeated until the end.
[0080] It should be noted that since the structured data of the above-mentioned document is generated and arranged in a fixed order, for example, the style may include font size, font color, font type, and whether it is underlined, etc. If not, the attribute is empty or does not exist. This small piece of style structured data is marked, and the longest common subsequence (LCS) algorithm is used for style comparison to quickly compare the differences.
[0081] In addition, it should be noted that the style repair record module is used to record the document style repair records, which is convenient for subsequent tracking and system optimization. During the document style repair process, each style repair is stored in the database, and the record content involves style type, original style, new standard style, original binding relationship, new binding relationship, repairer and repair time, etc., which are used for statistics and traceability. For parts where style repairs are more frequent, they can be optimized later, and the author can be informed of the points to pay attention to in advance, so as to complete the target standard document faster.
[0082] Through the technical solution provided by the above-mentioned embodiment of the present invention, the document style is extracted into structured data in layers according to the content characteristics, which is convenient for document style comparison and repair. A style-based multi-layer nested comparison is provided to make style comparison and repair more accurate, solve the time-consuming and labor-intensive manual modification of styles, and record the document style repair history to facilitate tracing and subsequent optimization and improvement. It can quickly extract the target style from the standard template and quickly modify the document to be repaired into a target style document under the specified target style.
[0083] That is, the above-mentioned technical scheme provided by the embodiment of the present invention comprehensively considers various factors, adopts a suitable target style extraction method, and an advanced multi-layer nested comparison and repair method, which can not only quickly extract or customize the standard document style, but also automatically detect and repair the document style. The repair content includes the document text, title, table, picture, header and footer, etc. There is no need to enter the document editing page for manual style modification, which not only improves the repair efficiency, but also saves time and labor costs.
[0084] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described order of actions, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present application.
[0085] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods of each embodiment of the present application.
[0086] According to an embodiment of the present invention, a document style self-repairing device for implementing the above document style self-repairing method is also provided. Figure 8 is a schematic diagram of a document style self-repairing device according to an embodiment of the present invention. Figure 8 As shown, the device includes: an acquisition unit 801, a first determination unit 803 and a first modification unit 805. The document style self-repairing device is described below.
[0087] The acquisition unit 801 is used to acquire the document to be repaired and convert the document to be repaired into a structured array.
[0088] The first determination unit 803 is used to determine whether the content in the structured array is text content, and if the content is text content, determine whether the type of the content is a text body type.
[0089] The first modification unit 805 is used to match the style of the content with the preset text style if the type of the content is a text body type, determine whether the style of the content is consistent with the preset text style, and if the style of the content is inconsistent with the preset text style, repair the style of the content to the preset text style.
[0090] It should be noted here that the above-mentioned acquisition unit 801, first determination unit 803 and first modification unit 805 correspond to steps S202 to S206 in the above-mentioned embodiment, and the three modules are the same as the instances and application scenarios implemented by the corresponding steps, but are not limited to the contents disclosed in the above-mentioned embodiment.
[0091] As can be seen from the above, in the scheme recorded in the above-mentioned embodiment of the present invention, first, the acquisition unit can be used to acquire the document to be repaired and convert the document to be repaired into a structured array; then, the first determination unit can be used to determine whether the content in the structured array belongs to text content, and when the content belongs to text content, determine whether the type of the content is a text body type; finally, the first modification unit can be used to match the style of the content with the preset text style if the type of the content is a text body type, and determine whether the style of the content is consistent with the preset text style. When the style of the content is inconsistent with the preset text style, the style of the content is repaired to the preset text style, thereby achieving the purpose of extracting the document style into structured data in layers according to the content characteristics, and adopting a style-based multi-layer nested comparison method. At the same time, the purpose of recording the document style repair history is achieved, thereby achieving the technical effect of quickly extracting or customizing the standard document style and automatically performing document style detection and repair, thereby improving the efficiency and accuracy of repair.
[0092] The technical solution provided by the embodiment of the present invention solves the technical problem of low efficiency of the technical solution for document style repair in the prior art.
[0093] In an optional embodiment, the first modification unit includes: a first determination subunit, used to determine whether the page style of the content is consistent with the preset page style; a second determination subunit, used to determine whether the paragraph style of the content is consistent with the preset paragraph style when the page style of the content is consistent with the preset page style; a third determination subunit, used to determine whether the text block style of the content is consistent with the preset text block style when the paragraph style of the content is consistent with the preset paragraph style; the first modification subunit is used to repair the text block style of the content to the preset text block style when the text block style of the content is inconsistent with the preset text block style.
[0094] In an optional embodiment, the document style self-repair device further includes: a second modification subunit, which is used to repair the page style of the content to the preset page style after determining whether the page style of the content is consistent with the preset page style and if the page style of the content is inconsistent with the preset page style; and a third modification subunit, which is used to repair the paragraph style of the content to the preset paragraph style after determining whether the paragraph style of the content is consistent with the preset paragraph style and if the paragraph style of the content is inconsistent with the preset paragraph style.
[0095] In an optional embodiment, the document style self-repair device also includes: a fourth determination subunit, used to determine whether the page style number of the content is accurate before determining whether the paragraph style of the content is consistent with the preset paragraph style, and if it is determined that the page style number of the content is inaccurate, modify the page style number of the content to obtain a modified page style number.
[0096] In an optional embodiment, the document style self-repair device further includes: a second determination unit, used to determine whether the page style of the content is consistent with the preset page style after determining whether the content in the structured array belongs to text content and when it is determined that the content in the structured array belongs to a table; a third determination unit, used to determine whether the table style of the content is consistent with the preset table style when the page style of the content is consistent with the preset page style; and a second modification unit, used to repair the table style of the content to the preset table style when the table style of the content is inconsistent with the preset table style.
[0097] In an optional embodiment, the document style self-repair device also includes: a fourth determination unit, used to determine whether the paragraph style of the content is consistent with the preset paragraph style after the table style of the content is repaired to the preset table style; a fifth determination unit, used to determine whether the text block style of the content is consistent with the preset text block style when the paragraph style of the content is consistent with the preset paragraph style; and a third modification unit, used to repair the text block style of the content to the preset text block style when the text block style of the content is inconsistent with the preset text block style.
[0098] In an optional embodiment, the document style self-repair device also includes: a sixth determination unit, which is used to determine the title level of the content after determining whether the type of the content is a text body type and if the content is a title type; a matching unit, which is used to match the style of the content with a preset title style according to the title level, wherein the preset title style includes a title page style, a title paragraph style, and a title text block style.
[0099] According to another aspect of an embodiment of the present invention, there is also provided an electronic device, comprising: one or more processors, a memory, and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by the one or more processors, and the one or more programs include a document style self-repair method for executing any one of the above.
[0100] According to another aspect of an embodiment of the present invention, a processor is further provided, and the processor is used to run a program, wherein any one of the above-mentioned document style self-repairing methods is executed when the program is run.
[0101] According to another aspect of an embodiment of the present invention, a computer program product is provided, including computer instructions, and when the computer instructions are executed by a processor, any one of the above-mentioned document style self-repair methods is executed.
[0102] According to another aspect of an embodiment of the present invention, a computer-readable storage medium is also provided, the computer-readable storage medium including a stored program, wherein when the program is running, the device where the computer-readable storage medium is located is controlled to execute any one of the above-mentioned document style self-repair methods.
[0103] Optionally, in this embodiment, the computer-readable storage medium may be located in any one of the computer terminals in a computer terminal group in a computer network, or in any one of the communication devices in a communication device group.
[0104] Optionally, in this embodiment, the computer-readable storage medium is configured to store program codes for executing the following steps: obtaining the document to be repaired and converting the document to be repaired into a structured array; determining whether the content in the structured array is text content, and if the content is text content, determining whether the type of the content is a text body type; if the type of the content is a text body type, matching the style of the content with a preset text style, determining whether the style of the content is consistent with the preset text style, and if the style of the content is inconsistent with the preset text style, repairing the style of the content to the preset text style.
[0105] Optionally, in this embodiment, the computer-readable storage medium is configured to store program code for performing the following steps: determining whether the page style of the content is consistent with a preset page style; if the page style of the content is consistent with the preset page style, determining whether the paragraph style of the content is consistent with the preset paragraph style; if the paragraph style of the content is consistent with the preset paragraph style, determining whether the text block style of the content is consistent with the preset text block style; if the text block style of the content is inconsistent with the preset text block style, repairing the text block style of the content to the preset text block style.
[0106] Optionally, in this embodiment, the computer-readable storage medium is configured to store program code for performing the following steps: when the page style of the content is inconsistent with the preset page style, repairing the page style of the content to the preset page style; when the paragraph style of the content is inconsistent with the preset paragraph style, repairing the paragraph style of the content to the preset paragraph style.
[0107] Optionally, in this embodiment, the computer-readable storage medium is configured to store program code for performing the following steps: determining whether the page style number of the content is accurate, and if it is determined that the page style number of the content is inaccurate, modifying the page style number of the content to obtain a modified page style number.
[0108] Optionally, in this embodiment, the computer-readable storage medium is configured to store program code for performing the following steps: in a case where it is determined that the content in the structured array belongs to a table, determining whether the page style of the content is consistent with a preset page style; in a case where the page style of the content is consistent with the preset page style, determining whether the table style of the content is consistent with the preset table style; in a case where the table style of the content is inconsistent with the preset table style, repairing the table style of the content to the preset table style.
[0109] Optionally, in this embodiment, the computer-readable storage medium is configured to store program code for performing the following steps: determining whether the paragraph style of the content is consistent with a preset paragraph style; if the paragraph style of the content is consistent with the preset paragraph style, determining whether the text block style of the content is consistent with the preset text block style; if the text block style of the content is inconsistent with the preset text block style, repairing the text block style of the content to the preset text block style.
[0110] Optionally, in this embodiment, the computer-readable storage medium is configured to store program code for performing the following steps: when the content is of a title type, determining the title level of the content; matching the style of the content with a preset title style according to the title level, wherein the preset title style includes a title page style, a title paragraph style, and a title text block style.
[0111] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.
[0112] In the above embodiments of the present invention, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0113] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units can be a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
[0114] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0115] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0116] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disk or optical disk and other media that can store program codes.
[0117] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A document style self-repair method, characterized in that: include: Obtaining a document to be repaired, and converting the document to be repaired into a structured array; Determine whether the content in the structured array is text content, and if the content is text content, determine whether the type of the content is a text body type; If the type of the content is the text body type, match the style of the content with the preset text style to determine whether the style of the content is consistent with the preset text style. If the style of the content is inconsistent with the preset text style, repair the style of the content to the preset text style.
2. The method according to claim 1, characterized in that The style includes a page style, a paragraph style, and a text block style, wherein determining whether the style of the content is consistent with the preset text style, and if the style of the content is inconsistent with the preset text style, repairing the style of the content to the preset text style includes: Determining whether the page style of the content is consistent with a preset page style; In a case where the page style of the content is consistent with the preset page style, determining whether the paragraph style of the content is consistent with the preset paragraph style; In a case where the paragraph style of the content is consistent with the preset paragraph style, determining whether the text block style of the content is consistent with the preset text block style; When the text block style of the content is inconsistent with the preset text block style, the text block style of the content is repaired to the preset text block style.
3. The method according to claim 2, characterized in that After determining whether the page style of the content is consistent with the preset page style, the method further includes: if the page style of the content is inconsistent with the preset page style, repairing the page style of the content to the preset page style; After determining whether the paragraph style of the content is consistent with a preset paragraph style, the method further includes: if the paragraph style of the content is inconsistent with the preset paragraph style, repairing the paragraph style of the content to the preset paragraph style.
4. The method according to claim 2, characterized in that: Before determining whether the paragraph style of the content is consistent with a preset paragraph style, the method further includes: Determine whether the page style number of the content is accurate. If it is determined that the page style number of the content is inaccurate, modify the page style number of the content to obtain a modified page style number.
5. The method according to claim 1, characterized in that After determining whether the content in the structured array is text content, the method further includes: In the case where it is determined that the content in the structured array belongs to a table, determining whether the page style of the content is consistent with a preset page style; In the case where the page style of the content is consistent with the preset page style, determining whether the table style of the content is consistent with the preset table style; When the table style of the content is inconsistent with the preset table style, the table style of the content is repaired to the preset table style.
6. The method according to claim 5, characterized in that After the table style of the content is repaired to the preset table style, the method further includes: Determining whether the paragraph style of the content is consistent with a preset paragraph style; In a case where the paragraph style of the content is consistent with the preset paragraph style, determining whether the text block style of the content is consistent with the preset text block style; When the text block style of the content is inconsistent with the preset text block style, the text block style of the content is repaired to the preset text block style.
7. The method according to claim 1, characterized in that After determining whether the type of the content is a text body type, the method further includes: In the case where the content is of a title type, determining the title level of the content; The style of the content is matched with a preset title style according to the title level, wherein the preset title style includes a title page style, a title paragraph style, and a title text block style.
8. A document style self-repairing device, characterized in that: include: An acquisition unit, used for acquiring a document to be repaired and converting the document to be repaired into a structured array; A first determination unit, configured to determine whether the content in the structured array is text content, and if the content is text content, determine whether the type of the content is a text body type; The first modification unit is used to match the style of the content with a preset text style if the type of the content is the text body type, determine whether the style of the content is consistent with the preset text style, and if the style of the content is inconsistent with the preset text style, repair the style of the content to the preset text style.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored program, wherein when the program is executed, the device where the computer-readable storage medium is located is controlled to execute the document style self-repair method according to any one of claims 1 to 7.
10. An electronic device, characterized in that: include: One or more processors, a memory, and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by the one or more processors, and the one or more programs include a method for executing the document style self-repair method described in any one of claims 1 to 7.