Document style detection method and device, electronic equipment, storage medium and computer program product

By automating the comparison and correction of PDF document styles, the problem of low efficiency in manual inspection has been solved, achieving efficient style detection and correction and improving development efficiency.

CN122065807APending Publication Date: 2026-05-19CHINA MOBILE COMM LTD RES INST +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411654871.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-18
Publication Date
2026-05-19

AI Technical Summary

Technical Problem

In existing technologies, style detection of PDF documents generated based on CSS technology mainly relies on manual methods, resulting in low detection efficiency, inability to efficiently handle large-scale document testing, and separation of the testing and correction processes, which increases the time required to correct style defects.

Method used

By using an automated document style detection method, the detection results are determined by comparing standard style text with the style of the document to be tested. When the detection results indicate anomalies, the style is automatically modified, thereby improving the efficiency of detection and correction.

Benefits of technology

It automates PDF document style detection, improves detection efficiency and style correction speed, shortens the time for correcting style defects, and enhances development efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122065807A_ABST
    Figure CN122065807A_ABST
Patent Text Reader

Abstract

The invention provides a document style detection method and device, electronic equipment, a storage medium and a computer program product, and relates to the technical field of artificial intelligence, and the method comprises the steps of determining a detection result for a to-be-detected document style based on comparison between an obtained standard style text and the to-be-detected document style. And when the detection result represents that the abnormal document style is included, modifying the abnormal document style, and determining a target document style. Through the scheme in the embodiment of the invention, the detection and development efficiency of the PDF document style can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of artificial intelligence technology, and in particular to a document style detection method, apparatus, electronic device, storage medium, and computer program product. Background Technology

[0002] In related technologies, the Darwin Information Typing Architecture (DTA) is a universal standard in the field of technical writing. DTA files, generated based on this architecture, can be used to create documents in various formats. When generating Portable Document Format (PDF) documents from DTA files, Cascading Style Sheets (CSS) can be used to enrich their expressiveness, achieving a layout effect consistent with traditional desktop publishing software. After generating PDF files using CSS technology, testers typically test the existing PDF document styles to determine if the CSS stylesheets meet expectations. Currently, the styles of PDF documents generated using CSS technology are mainly checked manually. Furthermore, after testers point out style defects, developers cannot directly modify non-compliant CSS styles; instead, they need to manually locate and investigate based on the test results. This significantly impacts the efficiency of document style testing and development. Summary of the Invention

[0003] The document style detection method, apparatus, electronic device, storage medium, and computer program product provided in this application embodiment can improve the efficiency of PDF document style detection and development.

[0004] The technical solution of this application is implemented as follows:

[0005] This application provides a document style detection method, including:

[0006] Based on the comparison between the acquired standard style text and the style of the document to be tested, the detection result for the style of the document to be tested is determined;

[0007] When the detection result characterization includes abnormal document styles, the abnormal document styles are modified to determine the target document style.

[0008] In the above scheme, determining the detection result for the document style under test based on the comparison between the acquired standard style text and the style of the document under test includes:

[0009] The standard style text is segmented and transformed to obtain multiple standard styles; wherein, the data types of the standard styles and the document style to be tested are both predetermined data types;

[0010] The detection result is determined based on the comparison between each of the standard styles and the style of the document to be tested.

[0011] In the above scheme, the step of segmenting and transforming the standard style text to obtain multiple standard styles includes:

[0012] The standard style text is segmented to obtain multiple initial styles;

[0013] Each initial style includes style keywords that are converted into strings that match the predetermined data type; wherein the strings include at least one of the following: style name string and style attribute string;

[0014] The string corresponding to each initial style is added to the corresponding position in a predetermined data structure to determine multiple standard styles.

[0015] In the above scheme, determining the detection result based on the comparison between each standard style and the style of the document to be tested includes:

[0016] The comparison result is determined by comparing the string in the first standard style with the string to be tested included in the style of the document to be tested;

[0017] If the comparison result indicates that the string does not match the string to be tested, the standard pattern corresponding to the string is added to the preset dataset, and the next standard pattern is compared until the comparison of multiple standard patterns is completed. The detection result is determined based on whether the standard pattern is included in the preset dataset.

[0018] In the above scheme, the string to be tested includes at least one of the following: a string of the name to be tested and a string of the attribute to be tested; the comparison result is determined based on the comparison between the string in the first standard style and the string to be tested included in the document style to be tested, including:

[0019] The style name string in the first standard style is matched with the name string to be tested to determine the intermediate comparison result;

[0020] If the intermediate comparison result indicates that the style name string matches the test name string in the style of the first test document, then the corresponding style attribute string is matched with the test attribute string in the style of the first test document to determine the comparison result.

[0021] In the above scheme, after matching the style name string in the first standard style with the name string to be tested to determine the intermediate comparison result, the method further includes:

[0022] If the intermediate comparison result indicates that there is no test name string that matches the style name string, then the next standard style comparison is performed until the comparison of multiple standard styles is completed, and the detection result is determined based on the standard styles in the preset dataset.

[0023] In the above scheme, when the detection result characterization includes abnormal document styles, modifying the abnormal document styles to determine the target document style includes:

[0024] When the detection result characterization includes abnormal document styles, the abnormal document styles are determined and displayed by sequentially matching the style name strings included in each of the standard styles in the preset dataset in the document styles to be tested;

[0025] In response to the user's modification operation for each of the abnormal document styles, each of the abnormal document styles is modified to determine the target document style.

[0026] This application also provides a document style detection device, including:

[0027] The comparison and detection unit is used to determine the detection result for the document style under test based on the comparison between the acquired standard style text and the style of the document under test;

[0028] The modification unit is used to modify the abnormal document style when the detection result characterization includes an abnormal document style, and to determine the target document style.

[0029] This application also provides an electronic device, including a memory and a processor. The memory stores a computer program that can run on the processor, and the processor executes the computer program to implement the steps in the above-described method.

[0030] This application also provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the steps in the above-described method.

[0031] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps in the above-described method.

[0032] In this embodiment of the application, the detection result for the document under test is determined based on the comparison between the obtained standard style text and the style of the document under test.

[0033] In this embodiment, the detection result for the document style under test is determined based on a comparison between the acquired standard style text and the style of the document under test. When the detection result indicates that an abnormal document style exists, the abnormal document style is modified to determine the target document style. In this way, the detection result for the document style under test can be automatically determined by comparing the standard style text and the style of the document under test. Compared with the manual detection methods in related technologies, this avoids the problem of low detection efficiency, thus improving the detection efficiency of PDF document styles. Furthermore, when the detection result indicates the presence of an abnormal document style, it is modified promptly. Compared with the manual location, investigation, and modification methods in related technologies, this improves the efficiency of modifying abnormal document styles, allowing for the rapid acquisition of a document style that meets the requirements, thereby improving the development efficiency of PDF document styles. Attached Figure Description

[0034] Figure 1 A schematic flowchart of an optional document style detection method provided in an embodiment of this application;

[0035] Figure 2 A schematic flowchart of an optional document style detection method provided in an embodiment of this application;

[0036] Figure 3 A schematic flowchart of an optional document style detection method provided in an embodiment of this application;

[0037] Figure 4 A schematic flowchart of an optional document style detection method provided in an embodiment of this application;

[0038] Figure 5 A schematic flowchart of an optional document style detection method provided in an embodiment of this application;

[0039] Figure 6 A schematic flowchart of an optional document style detection method provided in an embodiment of this application;

[0040] Figure 7 A schematic flowchart of an optional document style detection method provided in an embodiment of this application;

[0041] Figure 8 A schematic flowchart of an optional document style detection method provided in an embodiment of this application;

[0042] Figure 9 A schematic flowchart of an optional document style detection method provided in an embodiment of this application;

[0043] Figure 10This is a schematic diagram of the document style detection device provided in the embodiments of this application;

[0044] Figure 11 This is a schematic diagram of a hardware entity of an electronic device provided in an embodiment of this application. Detailed Implementation

[0045] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions of this application are further described in detail below with reference to the accompanying drawings and embodiments. The described embodiments should not be regarded as limitations on this application. All other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0046] In the following description, references are made to “some embodiments,” which describe a subset of all possible embodiments. However, it is understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.

[0047] If the application documents contain similar descriptions such as "first / second", the following explanation shall be added: In the following description, the terms "first / second / third" are used only to distinguish similar objects and do not represent a specific order of objects. It is understood that "first / second / third" may be interchanged in a specific order or sequence where permitted, so that the embodiments of this application described herein can be implemented in an order other than that illustrated or described herein.

[0048] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of this application only and is not intended to limit this application.

[0049] Currently, the style testing of PDF documents generated using CSS technology is primarily done manually. This involves manually verifying the style according to requirements, marking and redeveloping styles that do not meet the specifications. Existing manual style testing methods have significant drawbacks. First, they are inefficient. Current manual testing methods cannot meet the testing needs of large-scale documents, especially when PDF documents reach a certain size, nor can they efficiently test common styles such as instructions and tables. Furthermore, after testers identify style defects, developers cannot directly modify non-compliant CSS styles; instead, they need to manually locate and investigate based on the test results, which greatly impacts development and testing efficiency. Second, the testing and correction processes are separated. Traditional style testing methods cannot unify the test results and correction process. Typically, a considerable amount of time elapses after testing before development can begin correcting style defects, increasing the time required for style defect correction.

[0050] To address the aforementioned technical problems, this application provides a document style detection method. Please refer to [link to relevant documentation]. Figure 1 This is an optional flowchart illustrating the document style detection method provided in the embodiments of this application, which will be combined with... Figure 1 The steps shown are explained below:

[0051] S101. Based on the comparison between the acquired standard style text and the style of the document to be tested, determine the detection result for the style of the document to be tested.

[0052] In this embodiment of the application, the detection device can convert the acquired standard style text into multiple standard styles with the same data format as the document style to be tested, and determine the detection result that characterizes whether there is an abnormal document style in the document style to be tested based on the comparison between the standard styles and the document style to be tested.

[0053] The detection device can be a server or terminal with corresponding functions. For example, standard style text may include: "First-level heading is 14 pixels, gray; second-level heading is 12 pixels, gray." The document style to be tested can be a CSS document style.

[0054] S102. When the detection result characterization includes an abnormal document style, modify the abnormal document style to determine the target document style.

[0055] In this embodiment of the application, when the detection result indicates that there is an abnormal document style in the document style to be tested, the abnormal document style can be displayed, and the abnormal document style can be modified in response to the user's modification operation on the abnormal document style to determine the target document style.

[0056] In this embodiment of the application, when the detection result characterization includes abnormal document styles, the abnormal document styles can be modified based on a preset procedure with reference to the standard styles corresponding to the abnormal document styles to determine the target document styles. The standard styles corresponding to the abnormal document styles are obtained during the process of determining the detection results.

[0057] In this embodiment, the detection result for the document style under test is determined based on a comparison between the acquired standard style text and the style of the document under test. When the detection result indicates that an abnormal document style exists, the abnormal document style is modified to determine the target document style. In this way, the detection result for the document style under test can be automatically determined by comparing the standard style text and the style of the document under test. Compared with the manual detection methods in related technologies, this avoids the problem of low detection efficiency, thus improving the detection efficiency of PDF document styles. Furthermore, when the detection result indicates the presence of an abnormal document style, it is modified promptly. Compared with the manual location, investigation, and modification methods in related technologies, this improves the efficiency of modifying abnormal document styles, allowing for the rapid acquisition of a document style that meets the requirements, thereby improving the development efficiency of PDF document styles.

[0058] This application provides an automated method for testing PDF document styles. To address the technical difficulties in testing the styles of PDF documents generated based on CSS technology, this application updates the current method for testing document styles and adds a PDF test rule table generator, a PDF style comparer, and a PDF style calibrator to complete a full style testing process. The specific working apparatus and general workflow after the update are as follows: The new process includes the following apparatus: a PDF test standard style table generator, a PDF style comparer, and a PDF style calibrator. For example, combined with... Figure 2 The following steps will be explained:

[0059] S11, Generate standard styles.

[0060] In this embodiment of the application, a style rule file (standard style text) described in natural language is received, and multiple standard styles are extracted and transformed from the style rule file described in natural language.

[0061] S12, Style comparison.

[0062] In this embodiment of the application, the standard style is compared with the CSS style file that needs to be tested. The standard style corresponding to the CSS style file that is found to be abnormal is stored in the dataset. The comparison of multiple standard styles is completed to obtain the dataset.

[0063] S13. Is the dataset empty?

[0064] In this embodiment of the application, it is detected whether the dataset is empty. If it is empty, S15 is executed; if it is not empty, S14 is executed.

[0065] S14, Style Calibration.

[0066] In this embodiment, abnormal CSS document styles are determined based on standard styles in the dataset, and the abnormal CSS document styles are corrected. In this embodiment, the user can also choose whether to re-compare the modified CSS document styles and re-detect the CSS document styles based on their selection.

[0067] S15, PDF style output

[0068] Please see Figure 3 This is a schematic diagram of an optional flowchart of the document style detection method provided in the embodiments of this application. Figure 1 The shown S101 can also be implemented through S201 to S202, which will be explained in conjunction with the steps:

[0069] S201. The standard style text is segmented and transformed to obtain multiple standard styles; wherein, the data types of the standard styles and the document style to be tested are both predetermined data types.

[0070] In this embodiment of the application, since the data form of the standard style text is a text type, the detection device can divide the standard sample text into multiple text type styles and convert the text type styles into standard styles of a predetermined data type.

[0071] S202. Determine the detection result based on the comparison between each of the standard styles and the document style to be tested.

[0072] In this embodiment of the application, the detection device can compare each standard style of the same data type with each document style to be tested to determine the detection result.

[0073] In this embodiment, standard style text is segmented and transformed to obtain multiple standard styles; wherein, the data types of both the standard styles and the document style to be tested are predetermined data types; the detection result is determined based on the comparison between each standard style and the document style to be tested. In this way, comparing standard styles and document styles to be tested for the same data type eliminates errors and noise caused by comparing different data types, and the detection device's program is more efficient in comparing standard styles and document styles to be tested for the same data type, allowing for a faster determination of the detection result for the document style to be tested.

[0074] Please see Figure 4 This is a schematic diagram of an optional flowchart of the document style detection method provided in the embodiments of this application. Figure 3 The steps S201 to S202 shown can also be implemented via S301 to S305, which will be explained in conjunction with the steps:

[0075] S301. The standard style text is divided to obtain multiple initial styles.

[0076] In this embodiment, the standard style text includes styles for multiple text data types. The detection device segments each style in the standard style text to obtain each style of the text type. Then, the style name keywords and style attribute keywords in each style are classified and saved to obtain multiple initial styles.

[0077] For example, standard style text may include: "First-level heading (style name keyword) is 14 pixels (style attribute keyword), gray (style attribute keyword); second-level heading (style name keyword) is 12 pixels (style attribute keyword), gray (style attribute keyword)". The detection device can segment this natural language into: Initial style 1 ``[First-level heading: {14 pixels, gray}, Initial style 2 Second-level heading: {12 pixels, gray}]``.

[0078] S302. Convert the style keywords included in each initial style into a string that matches the predetermined data type; wherein the string includes at least one of the following: a style name string and a style attribute string.

[0079] In this embodiment of the application, each initial style includes style name keywords and style attribute keywords. The detection device can convert the style name keywords and style attribute keywords into strings that match a predetermined data type to obtain the style name string corresponding to the style name keywords and the style attribute string corresponding to the style attribute keywords.

[0080] S303. Add the string corresponding to each initial style to the corresponding position in the predetermined data structure to determine multiple standard styles.

[0081] In this embodiment, the detection device can construct a predetermined data structure for comparing the styles of the document under test. The predetermined data structure includes a first position for storing style name strings, a second position for storing style attribute strings, and a string indicating whether the detection passes. The detection device can add the style name string corresponding to each initial style to the first position in the predetermined data structure and add the style attribute string to the second position in the predetermined data structure. This continues until the strings corresponding to multiple initial styles have been added, resulting in multiple standard styles.

[0082] For example, the default data structure is established as: ``{name:[],rule:{},checked:false}``; The first initial style is processed, converting the first-level heading into h1 and .topictitle1, two possible first-level heading selectors generated by `dita`, and adding them to the name object of the default data structure. The converted object is: ``{name:['h1','.topictitle1'],rule:{}}``; The natural language attribute value expression is converted into: font-size:12px; color:grey; and added to the rule object. The converted object is: ``[{n ame:['h1','.topictitle1'],rule:{font-size:14px;color:grey;}}]``; Continue iterating through the second initial style, repeating the above operations, and finally forming the standard style: [{name:['h1','.topictitle1'],rule:{font-size:14px;color:grey;},checked:false},{name:['h2','.topictitle2'],rule:{font-size:12px;color:grey;},checked:false}].

[0083] S304. Based on the comparison between the string in the first standard style and the string to be tested included in the document style to be tested, determine the comparison result.

[0084] In this embodiment, the data structure of the document style to be tested is similar to that of the standard style, and both have corresponding strings. The detection device can compare the strings in the first standard style with the strings in the document style to be tested to determine the comparison result. The comparison result is used to characterize whether the strings in the standard style and the strings in the document style to be tested match.

[0085] S305. If the comparison result indicates that the string does not match the string to be tested, the standard pattern corresponding to the string is added to the preset dataset, and the next standard pattern is compared until the comparison of multiple standard patterns is completed. The detection result is determined based on whether the standard pattern is included in the preset dataset.

[0086] In this embodiment, if the comparison result indicates that the string does not match the string to be tested, the standard pattern corresponding to the string is added to a preset dataset, and the comparison of the next standard pattern is performed until the comparison of multiple standard patterns is completed. The detection result is determined based on whether the standard pattern is included in the preset dataset. If the comparison result indicates that the string matches the string to be tested, the standard pattern corresponding to the string is not added to the preset dataset, and the comparison of the next standard pattern is performed directly until the comparison of multiple standard patterns is completed. The detection result is determined based on whether the standard pattern is included in the preset dataset.

[0087] Please see Figure 5 This is a schematic diagram of an optional flowchart of the document style detection method provided in the embodiments of this application. Figure 4 The steps S301 to S303 shown can also be implemented via S16 to S19, which will be explained in conjunction with the steps:

[0088] S16. Import standard style text and segment it.

[0089] In this embodiment, the standard style text of the natural language description is divided into two parts: style name keywords and attribute keywords, and stored in the natural language description rule array to form the initial style. The storage format is: [{rule name 1: {attribute rule 1, attribute rule 2}}, {rule name 2: {attribute rule 1, attribute rule 2}},...].

[0090] S17. Establish a predetermined data structure.

[0091] In this embodiment of the application, a description rule data structure (predefined data structure) is established: {name:[selector name1, selector name2....], rule:{css property name1: property value1; css property name2: property value2.......}, checked:true / false}, where the name object defaults to [], used to store the style name string, the rule object defaults to {}, used to store the style property string, and the checked object defaults to false, used to indicate whether this standard style has passed the comparison.

[0092] S18. Iterate through the initial styles and add the style names to the name object.

[0093] In this embodiment, the first initial style is found. According to the generation rules of converting a .dita file to HTML (there are several possible selector generator types when converting .dita to HTML), the style name in this initial style is converted into a string that matches the CSS selector name, and then added to the name array created in the previous step.

[0094] S19. Convert the property to a CSS property expression and add it to the rule object.

[0095] In this embodiment, the style attribute keywords described in natural language are expressed using CSS and added to the rule object. The generated initial styles are then iterated through until the second initial style is found. The judgment is repeated starting from S18, and the generated transformation result is added to a standard CSS rule set until this iteration is complete. After this operation, the specific form of the generated standard style is: [{name:[selector1,selector2],rule:{attribute expression1,attribute expression2},checked:true / false}; {name:[selector1,selector2],rule:{attribute expression1,attribute expression2},checked:true / false},...].

[0096] In this embodiment, standard style text is segmented to obtain multiple initial styles; the style keywords included in each initial style are converted into strings matching a predetermined data type; wherein the strings include at least one of the following: a style name string and a style attribute string; the string corresponding to each initial style is added to the corresponding position in a predetermined data structure to determine multiple standard styles. Based on the comparison between the string in each standard style and the test string included in the test document style, the comparison result is determined; if the comparison result characterization string does not match the test string, the standard style corresponding to the string is added to a preset dataset, and the comparison of the next standard style is performed until the comparison of multiple standard styles is completed. The detection result is determined based on whether the preset dataset includes a standard style. In this way, converting the style keywords included in the initial styles into strings matching a predetermined data type and adding them to the corresponding positions in a predetermined data structure to determine multiple standard styles ensures that the data type of the standard styles is the same as the data type of the test document styles. This facilitates the detection device in comparing standard styles and test document styles within the same data type, improving the efficiency of determining the detection result.

[0097] Please see Figure 6 This is a schematic diagram of an optional flowchart of the document style detection method provided in the embodiments of this application. Figure 4 The shown S304 can also be implemented via S401 to S402, which will be explained in conjunction with the steps:

[0098] S401. Match the style name string in the first standard style with the name string to be tested to determine the intermediate comparison result.

[0099] In this embodiment, the style name string in the first standard style is compared with the test name string in each test document style to determine an intermediate comparison result. If the intermediate comparison result indicates that there is no test name string that matches the style name string, then the comparison of the next standard style is performed until the comparison of multiple standard styles is completed, and the detection result is determined based on the standard styles in the preset dataset. That is, the detection result of whether there is an abnormal document style is determined based on whether there is a standard style in the preset dataset.

[0100] For example, the string in {name:[selector1, selector2] in the standard style is compared with the corresponding test name string in the style of the document under test to determine the first comparison result.

[0101] S402. If the intermediate comparison result indicates that the style name string matches the test name string in the style of the first test document, then the corresponding style attribute string is matched with the test attribute string in the style of the first test document to determine the comparison result.

[0102] In this embodiment of the application, if the intermediate comparison result indicates that the style name string matches the test name string in the first test document style, the detection device will match the corresponding style attribute string with the test attribute string in the first test document style to determine the comparison result.

[0103] If the style attribute string does not match the style attribute string to be tested in the first test document style, then the comparison result of the string not matching the test string is determined; the standard style corresponding to the style attribute string is added to the preset dataset, and the next standard style is compared, until the comparison of multiple standard styles is completed, and the detection result is determined based on the standard styles in the preset dataset.

[0104] If the style attribute string matches the test style attribute string in the first test document style, the comparison result of the string matching the test string is determined, and the next standard style comparison is performed until the comparison of multiple standard styles is completed. The detection result is determined based on the standard styles in the preset dataset.

[0105] For example, if the string in {name:[selector1, selector2] in the first standard style matches the corresponding test name string in the first test document style, then the string in rule:{attribute expression1, attribute expression2} in the first standard style is compared with the corresponding test attribute string in the first test document style to determine the second comparison result.

[0106] Please see Figure 7 This is a schematic diagram of an optional flowchart of the document style detection method provided in the embodiments of this application. Figure 6 The steps S401 to S402 shown can also be implemented via S20 to S27. This step receives multiple standard styles, compares each received standard style with the style of the CSS document to be tested, outputs the comparison result, and determines whether the test standard has been met. This will be explained in conjunction with the steps:

[0107] S20. Create a preset dataset.

[0108] In this embodiment of the application, an empty array is created to store CSS rules that fail the test.

[0109] S21. Poll the standard patterns in the preset dataset.

[0110] In this embodiment, a standard style is received via polling. If the checked property value of the polled standard style is true, the standard style is deleted; otherwise, the corresponding selector in the CSS document style file to be tested is found through the name property value.

[0111] S22. Whether the name of this standard style is included.

[0112] In this embodiment, the `name` value corresponding to the standard style is searched in the CSS document style to see if a matching string for the name to be tested exists. If no match is found, the standard style is directly determined to be non-compliant, and the `checked` property value of this rule is set to `false`.

[0113] S23, Non-compliance is determined.

[0114] S24. Does it include the rule attribute of a standard style?

[0115] In this embodiment of the application, if the CSS document style to be tested contains a style name string that matches the name value of the standard style, then it is compared whether this CSS document style contains the rule attribute of the standard style; if they match, then the standard style rule test rule is considered to be true, and the checked attribute value of this standard style is marked as true; otherwise, it is marked as false.

[0116] For example, the CSS document style to be tested is: h1{font-size:12px;}, which is the standard style: {name:['h1',

[0117] The statement `[.topictitle1'], rule:{font-size:14px;color:grey;},checked:false}` does not match. The `font-size` property value in the CSS document under test is incorrect, and the `color` property value is missing from the standard style. Therefore, it does not meet the test rules, and the `checked` property value of this standard style is set to `false`.

[0118] S25. Set the checked flag for this standard style to true.

[0119] In this embodiment of the application, it is compared whether the CSS document style contains the rule property in the standard style; if they match, the checked property of the standard style is marked as true.

[0120] S26. Set the checked flag for this standard style to false.

[0121] In this embodiment of the application, it is compared whether the CSS document style contains the rule property in the standard style; if they do not match, the checked property of the standard style is marked as false.

[0122] S27. Add to preset dataset.

[0123] In this embodiment, if the checked value of a standard style is marked as false, it is copied to a preset dataset in the format: {name:[selector name1, selector name2....], rule:{css property name1: property value1; css property name2: property value2.......}, checked:true / false}, and considered as a style rule to be calibrated. The output is a preset dataset containing the standard style. It is then determined whether the preset dataset is empty. If it is, it means all test rules have passed, and the target document style is directly output; otherwise, modifications are made based on the abnormal document styles in the standard style test document style within the preset dataset.

[0124] In this embodiment, the style name string in the first standard style is matched with the test name string to determine the intermediate comparison result. If the intermediate comparison result indicates that the style name string matches the test name string in the first test document style, then the corresponding style attribute string is matched with the test attribute string in the first test document style to determine the comparison result. This embodiment, by sequentially matching the style name string and style attribute string with the test document style to determine the comparison result, can quickly determine the comparison result between the test document style and the standard style, thereby improving the efficiency of determining the detection result.

[0125] Please see Figure 8 This is a schematic diagram of an optional flowchart of the document style detection method provided in the embodiments of this application. Figure 6 The shown S102 can also be implemented by S501 to S502, which will be explained in conjunction with the steps:

[0126] S501. When the detection result characterization includes abnormal document styles, the abnormal document styles are determined and displayed by sequentially matching the style name strings included in each of the standard styles in the preset dataset among the document styles to be tested.

[0127] In this embodiment, if the preset dataset includes standard styles, a detection result representing an abnormal document style is determined. The detection device sequentially matches the abnormal document style containing the style name string (name value) included in the test document style based on the style name string included in each of the standard styles in the preset dataset. The determined abnormal document styles are displayed in a window where the user can modify the style.

[0128] S502. In response to the user's modification operation for each of the abnormal document styles, modify each of the abnormal document styles and determine the target document style.

[0129] In this embodiment, the user can modify the abnormal document style displayed in the window based on the human-computer interaction device, and retain the user's modifications in the abnormal document style until all abnormal document styles have been modified to obtain the target document style.

[0130] In this embodiment, in response to the user's modification operation for each of the abnormal document styles, after modifying each abnormal document style, the user can choose whether to re-detect the modified abnormal document style. If re-detection is selected, the checked object of the corresponding standard style in the preset dataset is modified to false, and the comparison is performed again to determine the detection result. If re-detection is not selected, the checked object of the corresponding standard style in the preset dataset is modified to true, and the standard style with a checked object of true will be deleted in the next comparison using multiple standard styles.

[0131] In this embodiment, when the detection results indicate the presence of abnormal document styles, the abnormal document styles are modified in a timely manner. Compared with the manual location, investigation and modification of styles in related technologies, this improves the efficiency of modifying abnormal document styles and can quickly obtain document styles that meet the requirements, thereby improving the development efficiency of PDF document styles.

[0132] Please see Figure 9 This is a schematic diagram of an optional flowchart of the document style detection method provided in the embodiments of this application. Figure 8 The steps S501 to S502 shown can also be implemented via S28 to S35, which will be explained in conjunction with the steps:

[0133] S28. Poll the preset dataset.

[0134] S29. Based on the name value of each standard style, locate it in the style of the document to be tested.

[0135] In this embodiment, each standard style in the preset dataset is polled, and the abnormal document style is located in the document style to be tested based on the name value in each standard style.

[0136] S30. Locate the abnormal document style and provide an interface to display that style.

[0137] In this embodiment of the application, after finding an abnormal document style, an interface is provided to display that style.

[0138] S31. Developers can modify the exception document style in this interface, and it will be saved automatically.

[0139] In this embodiment of the application, the developer modifies the style in the interface and the developer's modification is automatically saved to this abnormal document style.

[0140] S32. Should we re-verify?

[0141] In this embodiment, the detection device can also provide an option on the interface to re-detect the style of the document under test, allowing the developer to decide whether to re-verify the modified rules. If re-detection is required, the checked attribute of this standard style will not be changed; otherwise, the checked attribute of this standard style will be changed to true.

[0142] S33, the checked attribute value is false.

[0143] S34, the checked attribute value is true.

[0144] S35. Output the target document style.

[0145] In this embodiment, the detection device modifies all abnormal document styles and outputs the modified target document styles.

[0146] Please see Figure 10 This is a schematic diagram of the document style detection device provided in the embodiments of this application.

[0147] This application embodiment also provides a document style detection device 800, including: a comparison and detection unit 801 and a modification unit 802.

[0148] The comparison and detection unit 801 is used to determine the detection result for the document style under test based on the comparison between the acquired standard style text and the style of the document under test.

[0149] Modification unit 802 is used to modify the abnormal document style when the detection result characterization includes an abnormal document style, and to determine the target document style.

[0150] In this embodiment of the application, the comparison and detection unit 801 in the document style detection device 800 is used to segment and convert the standard style text to obtain multiple standard styles; wherein, the data types of the standard styles and the document style to be tested are both predetermined data types;

[0151] The detection result is determined based on the comparison between each of the standard styles and the style of the document to be tested.

[0152] In this embodiment of the application, the comparison and detection unit 801 in the document style detection device 800 is used to segment the standard style text to obtain multiple initial styles;

[0153] Each initial style includes style keywords that are converted into strings that match the predetermined data type; wherein the strings include at least one of the following: style name string and style attribute string;

[0154] The string corresponding to each initial style is added to the corresponding position in a predetermined data structure to determine multiple standard styles.

[0155] In this embodiment of the application, the comparison detection unit 801 in the document style detection device 800 is used to determine the comparison result based on the comparison between the string in the first standard style and the string to be tested included in the document style to be tested;

[0156] If the comparison result indicates that the string does not match the string to be tested, the standard pattern corresponding to the string is added to the preset dataset, and the next standard pattern is compared until the comparison of multiple standard patterns is completed. The detection result is determined based on whether the standard pattern is included in the preset dataset.

[0157] In this embodiment of the application, the string to be tested includes at least one of the following: a string of names to be tested and a string of attributes to be tested; the comparison and detection unit 801 in the document style detection device 800 is used to match the style name string in the first standard style with the string of names to be tested to determine the intermediate comparison result;

[0158] If the intermediate comparison result indicates that the style name string matches the test name string in the style of the first test document, then the corresponding style attribute string is matched with the test attribute string in the style of the first test document to determine the comparison result.

[0159] In this embodiment of the application, the comparison and detection unit 801 in the document style detection device 800 is used to perform the comparison of the next standard style if the intermediate comparison result indicates that there is no test name string that matches the style name string, until the comparison of multiple standard styles is completed, and determine the detection result based on the standard styles in the preset dataset.

[0160] In this embodiment of the application, the modification unit 802 in the document style detection device 800 is used to, when the detection result characterizes an abnormal document style, sequentially match and determine the abnormal document style in the document style to be tested based on the style name string included in each of the standard styles in the preset dataset and display it.

[0161] In response to the user's modification operation for each of the abnormal document styles, each of the abnormal document styles is modified to determine the target document style.

[0162] It should be noted that, in the embodiments of this application, if the above-described item information processing method is implemented as a software functional module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiments of this application, or the part that contributes to the related technology, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause an item information processing device (which may be a personal computer, etc.) to execute all or part of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), magnetic disks, or optical disks. Thus, the embodiments of this application are not limited to any specific hardware and software combination.

[0163] Correspondingly, embodiments of this application provide a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the steps in the method on one side of the detection device.

[0164] It should be noted that the descriptions of the storage medium and device embodiments above are similar to the descriptions of the method embodiments above, and have similar beneficial effects. For technical details not disclosed in the storage medium and device embodiments of this application, please refer to the descriptions of the method embodiments of this application for understanding.

[0165] It should be noted that, Figure 11 A schematic diagram of a hardware entity of an electronic device provided in an embodiment of this application, such as... Figure 11 As shown, this application embodiment provides an electronic device 900, including a memory 902 and a processor 901. The memory 902 stores a computer program that can run on the processor 901. When the processor 901 executes the program, it implements the steps in the above-described method, wherein;

[0166] Processor 901 typically controls the overall operation of electronic device 900.

[0167] The memory 902 is configured to store instructions and applications executable by the processor 901, and can also cache data to be processed or already processed (e.g., image data, audio data, voice communication data and video communication data) in the processor 901 and various modules in the electronic device 900. It can be implemented by flash memory or random access memory (RAM).

[0168] Correspondingly, this application also provides a computer program product, including a computer program that can be executed by the processor 901 of the electronic device 900 to complete the steps in the method on one side of the detection device 800.

[0169] It should be understood that the phrase "one embodiment" or "an embodiment" throughout the specification means that a specific feature, structure, or characteristic related to the embodiment is included in at least one embodiment of this application. Therefore, "in one embodiment" or "in an embodiment" appearing throughout the specification does not necessarily refer to the same embodiment. Furthermore, these specific features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. It should be understood that in the various embodiments of this application, the sequence numbers of the above-described processes do not imply a sequential order of execution; the execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application. The sequence numbers of the above-described embodiments are merely descriptive and do not represent the superiority or inferiority of the embodiments.

[0170] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.

[0171] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. The apparatus embodiments described above are merely illustrative. For example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods, such as: multiple units or components can be combined, or integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the various components shown or discussed can be through some interfaces, and the indirect coupling or communication connection of the apparatus or units can be electrical, mechanical, or other forms.

[0172] The units described above as separate components may or may not be physically separate. The components shown as units may or may not be physical units. They may be located in one place or distributed across multiple network units. Some or all of the units may be selected to achieve the purpose of this embodiment according to actual needs.

[0173] In addition, each functional unit in the various embodiments of this application can be integrated into one processing unit, or each unit can be a separate unit, or two or more units can be integrated into one unit; the integrated unit can be implemented in hardware or in the form of hardware plus software functional units.

[0174] Those skilled in the art will understand that all or part of the steps of the above method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it performs the steps of the above method embodiments. The aforementioned storage medium includes various media that can store program code, such as mobile storage devices, read-only memory (ROM), magnetic disks, or optical disks.

[0175] Alternatively, if the integrated units described above are implemented as software functional modules and sold or used as independent products, they can also be stored in a computer-readable storage medium. Based on this understanding, the technical solutions of the embodiments of this application, or the parts that contribute to related technologies, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as mobile storage devices, ROMs, magnetic disks, or optical disks.

[0176] The above description is merely an embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. A document style detection method, characterized in that, include: Based on the comparison between the acquired standard style text and the style of the document to be tested, the detection result for the style of the document to be tested is determined; When the detection result characterization includes abnormal document styles, the abnormal document styles are modified to determine the target document style.

2. The document style detection method according to claim 1, characterized in that, The determination of the detection result for the document style under test based on the comparison between the acquired standard style text and the style of the document under test includes: The standard style text is segmented and transformed to obtain multiple standard styles; wherein, the data types of the standard styles and the document style to be tested are both predetermined data types; The detection result is determined based on the comparison between each of the standard styles and the style of the document to be tested.

3. The document style detection method according to claim 2, characterized in that, The standard style text segmentation and transformation yields multiple standard styles, including: The standard style text is segmented to obtain multiple initial styles; Each initial style includes style keywords that are converted into strings that match the predetermined data type; wherein the strings include at least one of the following: style name string and style attribute string; The string corresponding to each initial style is added to the corresponding position in a predetermined data structure to determine multiple standard styles.

4. The document style detection method according to claim 3, characterized in that, The step of determining the detection result based on the comparison between each of the standard styles and the document style to be tested includes: The comparison result is determined by comparing the string in the first standard style with the string to be tested included in the style of the document to be tested; If the comparison result indicates that the string does not match the string to be tested, the standard pattern corresponding to the string is added to the preset dataset, and the next standard pattern is compared until the comparison of multiple standard patterns is completed. The detection result is determined based on whether the standard pattern is included in the preset dataset.

5. The document style detection method according to claim 4, characterized in that, The string to be tested includes at least one of the following: a string of the name to be tested and a string of the attribute to be tested; the comparison result is determined based on the comparison between the string in the first standard style and the string to be tested included in the document style to be tested, including: The style name string in the first standard style is matched with the name string to be tested to determine the intermediate comparison result; If the intermediate comparison result indicates that the style name string matches the test name string in the style of the first test document, then the corresponding style attribute string is matched with the test attribute string in the style of the first test document to determine the comparison result.

6. The document style detection method according to claim 5, characterized in that, After matching the style name string in the first standard style with the name string to be tested to determine the intermediate comparison results, the method further includes: If the intermediate comparison result indicates that there is no test name string that matches the style name string, then the next standard style comparison is performed until the comparison of multiple standard styles is completed, and the detection result is determined based on the standard styles in the preset dataset.

7. The document style detection method according to any one of claims 4 to 6, characterized in that, When the detection result characterization includes abnormal document styles, the step of modifying the abnormal document styles and determining the target document style includes: When the detection result characterization includes abnormal document styles, the abnormal document styles are matched and determined in the document styles to be tested based on the style name strings included in each of the standard styles in the preset dataset, and then displayed. In response to the user's modification operation for each of the abnormal document styles, each of the abnormal document styles is modified to determine the target document style.

8. A document style detection device, characterized in that, include: The comparison and detection unit is used to determine the detection result for the document style under test based on the comparison between the acquired standard style text and the style of the document under test; The modification unit is used to modify the abnormal document style when the detection result characterization includes an abnormal document style, and to determine the target document style.

9. An electronic device, characterized in that, It includes a memory and a processor, the memory storing a computer program that can run on the processor, the processor executing the computer program to implement the steps of the method according to any one of claims 1 to 7.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 7.

11. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 7.