Courseware beautifying method and device, electronic equipment and storage medium
By hierarchically classifying and analyzing the logical relationships of text elements on courseware pages and adjusting the page layout, the problems of high labor costs and poor beautification effects in existing technologies are solved, and efficient beautification is achieved while retaining the teacher's intentions.
Patent Information
- Application Number
- CN202410309888.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-19
- Publication Date
- 2025-09-23
AI Technical Summary
The existing technology requires a complete template library in the process of beautifying courseware pages, which leads to high labor costs and poor beautification effects. It is also impossible to understand the teacher's production intentions, resulting in confusing logical relationships.
By classifying the text elements of the courseware page into hierarchical categories, the contextual logical relationship between the text elements is determined, and the page layout is adjusted according to the text hierarchy, keeping the original logical relationship unchanged.
It improves the beautification effect of the courseware pages, simplifies the teacher's production time cost, and at the same time retains the teacher's production intention and avoids confusion in logical relationships.
Smart Images

Figure CN120688488A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and more specifically, to a courseware beautification method, device, electronic device and storage medium in the field of computer technology. Background Art
[0002] Currently, the beautification of courseware pages on the market mainly focuses on matching templates. This involves matching each page with a template, or statistically classifying and matching elements within the page, and then using a preset template to beautify the page. While this approach can beautify courseware pages to a certain extent, it requires a comprehensive template library, consumes more labor costs, and has poor results for teacher-created courseware pages.
[0003] Therefore, how to improve the beautification effect of courseware pages while saving labor costs has become a technical problem that needs to be solved urgently. Summary of the Invention
[0004] The present application provides a courseware beautification method, device, electronic device and storage medium, which can improve the beautification effect of courseware pages while saving labor costs.
[0005] In a first aspect, a courseware beautification method is provided, which includes: hierarchically classifying text elements of a courseware page to be beautified to obtain a text hierarchy of the text elements; determining semantic information of text elements of a target text hierarchy in the courseware page based on the text hierarchy, and determining contextual logical relationships between text elements of the target text hierarchy based on the semantic information; adjusting a page layout of the courseware page to be beautified based on the text hierarchy and the contextual logical relationships to obtain an adjusted courseware page; wherein the contextual logical relationships in the courseware page to be beautified after the adjustment are the same as those in the courseware page to be beautified before the adjustment.
[0006] In the above technical scheme, considering that teachers make courseware according to their own hearts when making courseware, there is no unified paradigm, and the preset template in the traditional beautification method may not understand the teacher's production intention, that is, it is impossible to understand the contextual logical relationship in the courseware page made by the teacher, which easily causes the logical relationship of the courseware page after beautification to be confused. Therefore, when the courseware page is beautified by the traditional preset template, it is easy to bring poor beautification effect. And in the technical scheme of the embodiment of the application, by the text elements of the courseware page to be beautified being carried out hierarchical classification, the text hierarchy of the text elements is obtained, and then the contextual logical relationship between the text elements of the target text hierarchy in the courseware page to be beautified is determined, thereby on the basis of not changing the contextual logical relationship, the page layout of the courseware page to be beautified is adjusted according to the text hierarchy to obtain the adjusted courseware page. In this scheme, the beautification of the courseware page to be beautified can be achieved by adjusting the page layout of the courseware page to be beautified, and the original contextual logical relationship in the courseware page can not be changed while beautifying, so that the courseware page after beautification can retain the logical intention when the teacher makes the courseware page to a certain extent, so the courseware beautification effect can be improved. Furthermore, it can simplify the time cost of teachers in making courseware.
[0007] In combination with the first aspect, in some possible implementations, the target text level includes secondary titles and body text.
[0008] In the above technical solution, since semantic incoherence is prone to occur, that is, the text level with chaotic context logic is the second-level title and the main text, therefore, in this embodiment, the second-level title and the main text are used as the target text level, and the semantic information of the text elements of the target text level in the courseware page is determined according to the text level of the courseware page, and then the context logic between the text elements of the target text level is analyzed according to the semantic information, which is conducive to more targeted acquisition of the context logic relationship between the text elements of the target text level that is prone to context logic problems. The first-level title generally governs the entire courseware page, and generally does not cause logical problems with other text elements when beautifying the courseware. Therefore, when determining the semantic information and context logic relationship, the first-level title does not need to be considered, which is conducive to improving the acquisition speed of the context logic relationship to a certain extent, while not affecting the beautification effect.
[0009] In combination with the first aspect, in some possible implementations, the above-mentioned determining the semantic information of the text elements of the target text level in the above-mentioned courseware page based on the above-mentioned text level, and determining the contextual logical relationship between the text elements of the above-mentioned target text level based on the above-mentioned semantic information, includes: inputting the text elements of the above-mentioned text level, the above-mentioned text level and the text identifiers of the above-mentioned text elements into a large language model to output the contextual logical relationship between the text elements of the above-mentioned target text level; wherein the above-mentioned large language model outputs the above-mentioned contextual logical relationship according to preset rules, and the above-mentioned preset rules are: performing semantic understanding on the input text elements of the above-mentioned target text level to obtain the semantic information of the text elements of the above-mentioned target text level, and outputting the above-mentioned contextual logical relationship in a preset format based on the above-mentioned semantic information; the above-mentioned contextual logical relationship output in the above-mentioned preset format is: the relationship between the above-mentioned text identifiers, and the relationship between the above-mentioned text identifiers represents the contextual logical relationship between the text elements corresponding to the above-mentioned text identifiers.
[0010] In combination with the first aspect, in some possible implementations, the page layout of the courseware page is adjusted according to the text hierarchy and the contextual logical relationship to obtain an adjusted courseware page, including: if the courseware page is a first-category courseware page, the main text in the courseware page is determined according to the text hierarchy; wherein, the first-category courseware page includes a text box in addition to the text box where the first-level title is located, the one text box is the target text box where the main text is located, and the first-category courseware page does not contain a target image, and the area of the target image is greater than the first preset area and smaller than the second preset area; obtaining the first size information of the target text box and the second size information of the courseware page; while maintaining the contextual logical relationship unchanged, centering the position of the target text box on the courseware page according to the first size information and the second size information to obtain the adjusted courseware page.
[0011] In the above technical solution, for the first type of courseware page, that is, the courseware page with only text and no pictures, the main text will be centered while maintaining the contextual logical relationship. This can make the main text evenly occupy the courseware page to a certain extent, and can also avoid the appearance of excess blank space, which is conducive to improving the visual experience.
[0012] In conjunction with the first aspect, in some possible implementations, the first size information includes: the width of the target text box text w and height text h The second size information includes the width of the courseware page slide w and height slide hThe above-mentioned step of centering the position of the target text box on the courseware page according to the first size information and the second size information to obtain the adjusted courseware page includes: calculating the adjusted position information of the target text box on the courseware page by the following formula:
[0013]
[0014] Among them, text x The first horizontal distance between the left edge of the target text box and the left edge of the courseware page after adjustment, text y It is the first vertical distance between the upper boundary of the above-mentioned target text box and the upper boundary of the above-mentioned courseware page after adjustment; according to the above-mentioned first horizontal distance and the first vertical distance, the position of the above-mentioned target text box on the above-mentioned courseware page is centered to obtain the adjusted courseware page.
[0015] In the above technical solution, through the calculation formula of the above position information, the position coordinates to which the target text box should be adjusted can be accurately obtained. While maintaining the contextual logical relationship unchanged, according to the calculated first horizontal distance and first vertical distance, it is beneficial to quickly adjust the position of the target text box on the courseware page to the center, which is beneficial to improve the beautification speed to a certain extent.
[0016] In combination with the first aspect, in some possible implementations, the page layout of the above-mentioned courseware page is adjusted according to the logical relationship between the above-mentioned text hierarchy and the above-mentioned text elements to obtain the adjusted courseware page, including: if the above-mentioned courseware page is a second-category courseware page, then the main text and target image in the above-mentioned courseware page are determined according to the above-mentioned text hierarchy; wherein, the above-mentioned second-category courseware page includes a text box in addition to the text box where the first-level title is located, the above-mentioned one text box is the target text box where the above-mentioned main text is located, and the above-mentioned second-category courseware page contains one of the above-mentioned target images, and the area of the above-mentioned target image is larger than the first preset area and smaller than the second preset area. Area; obtaining the first size information of the target text box, the second size information of the courseware page and the third size information of the target image; while maintaining the above-mentioned contextual logical relationship unchanged, adjusting the layout positions of the target text box and the target image on the courseware page according to the first size information, the second size information and the third size information to obtain an adjusted courseware page; wherein, the adjusted target text box is located on one side of the courseware page, the adjusted target image is located on the other side of the courseware page, and the horizontal center line of the adjusted target text box coincides with the horizontal center line of the adjusted target image.
[0017] In the above technical solution, for the second type of courseware page, that is, the courseware page with single text and single picture, the left and right structure is used for layout, and the target text box and the target picture are adjusted together, the target text box is placed on one side, and the target picture is placed on the other side, and the target text box is centered on the midline of the target picture, that is, the horizontal midlines of the target text box and the target picture coincide, which is conducive to improving the aesthetics and coordination of the adjusted courseware page.
[0018] In conjunction with the first aspect, in some possible implementations, the first size information includes: the width of the target text box text w and height text h The second size information includes the width of the courseware page slide w and height slide h The third size information includes the width of the target image pic w and height pic h The above-mentioned adjusting the layout positions of the target text box and the target image on the courseware page according to the first size information, the second size information and the third size information includes: calculating the adjusted position information of the target image on the courseware page by the following formula:
[0019] pic x =slide w -pic w -a
[0020]
[0021] Among them, pic x The second horizontal distance between the left edge of the adjusted target image and the left edge of the courseware page, pic y is the second longitudinal distance between the upper boundary of the target image and the upper boundary of the courseware page after adjustment, and a is the length of the area reserved on the right side of the courseware page;
[0022] The adjusted layout position of the target text box on the courseware page is calculated using the following formula:
[0023] text x =slide w -pic w -text w -b
[0024]
[0025] Among them, text x The first horizontal distance between the left edge of the target text box and the left edge of the courseware page after adjustment, texty is the first vertical distance between the upper boundary of the above-mentioned target text box and the upper boundary of the above-mentioned courseware page after adjustment, and b is the length of the area reserved on the left side of the above-mentioned courseware page; according to the above-mentioned second horizontal distance and the above-mentioned second vertical distance, the layout position of the above-mentioned target picture on the above-mentioned courseware page is adjusted, and according to the above-mentioned first horizontal distance and the above-mentioned first vertical distance, the layout position of the above-mentioned target text box on the above-mentioned courseware page is adjusted.
[0026] In the above technical solution, the position coordinates to which the target text box should be adjusted and the position coordinates to which the target picture should be adjusted can be accurately obtained through the calculation formula of the above position information. x 、pic y 、text x and text y , which helps to quickly adjust the position of the target text box and target image on the courseware page, and to a certain extent helps to improve the beautification speed.
[0027] In combination with the first aspect, in some possible implementations, the page layout of the courseware page is adjusted according to the logical relationship between the text hierarchy and the text elements to obtain an adjusted courseware page, including: if the courseware page is a third-category courseware page, the main text in the courseware page is determined according to the text hierarchy; wherein, the third-category courseware page includes n text boxes in addition to the text box where the first-level title is located, the n text boxes are the target text boxes where the main text is located, n is greater than 1, the number of target images included in the third-category courseware page is less than a preset number threshold, and the area of the target image is greater than a first preset area and less than a second preset area; obtain the first height of the text box where the first-level title is located, the second height of the courseware page, and the third height of each of the n text boxes; while maintaining the contextual logical relationship unchanged, adjust the vertical spacing between the n text boxes according to the first height, the second height and the third height to obtain an adjusted courseware page.
[0028] In combination with the first aspect, in some possible implementation methods, the page layout of the above-mentioned courseware page is adjusted according to the logical relationship between the above-mentioned text hierarchy and the above-mentioned text elements to obtain an adjusted courseware page, including: if the above-mentioned courseware page is a fourth-category courseware page, then the first-level title in the above-mentioned courseware page is determined based on the above-mentioned text hierarchy; wherein the above-mentioned fourth-category courseware page includes target teaching elements; while maintaining the above-mentioned contextual logical relationship unchanged, the first-level title in the above-mentioned courseware page is adjusted by any of the following methods to obtain an adjusted courseware page: adjusting the above-mentioned first-level title to the upper left corner of the above-mentioned courseware page, unifying the font of the above-mentioned first-level title, and adjusting the font size of the above-mentioned first-level title.
[0029] In the above technical solution, it is usually difficult to accurately lock the target teaching elements in the fourth category of courseware pages. For example, only the position of the text box can be obtained, and it is not possible to specifically circle a certain word. If the text box where the target teaching element is located is beautified, it is easy to lose the special meaning of the target teaching element in the courseware page. For example, due to adjustment of the beautified courseware page, the circled text elements are not the text elements circled when the teacher made it, which can easily lead to problems such as dislocation of the circled text and horizontal line. Such beautification is counterproductive. Therefore, for the fourth category of courseware pages that include target teaching elements, the first-level title will be simply beautified. For this type of courseware page, simply beautifying the first-level title can maintain the maximum degree of beauty without losing the original teaching effect that the teacher wanted to express.
[0030] In a second aspect, a courseware beautification device is provided, which includes: a hierarchical classification module for hierarchically classifying the text elements of the courseware page to be beautified to obtain the text hierarchy of the above text elements; a determination module for determining the semantic information of the text elements of the target text hierarchy in the above courseware page based on the above text hierarchy, and determining the contextual logical relationship between the text elements of the above target text hierarchy based on the above semantic information; an adjustment module for adjusting the page layout of the above courseware page based on the above text hierarchy and the above contextual logical relationship to obtain an adjusted courseware page; wherein the contextual logical relationship in the above adjusted courseware page is the same as that in the courseware page before adjustment.
[0031] In conjunction with the second aspect, in some possible implementations, the target text level includes secondary titles and body text.
[0032] In combination with the second aspect, in some possible implementations, the determination module is specifically used to input the text elements of the above-mentioned text level, the above-mentioned text level and the text identifiers of the above-mentioned text elements into the large language model to output the contextual logical relationship between the text elements of the above-mentioned target text level; wherein the above-mentioned large language model outputs the above-mentioned contextual logical relationship according to preset rules, and the above-mentioned preset rules are: performing semantic understanding on the input text elements of the above-mentioned target text level to obtain the semantic information of the text elements of the above-mentioned target text level, and outputting the above-mentioned contextual logical relationship in a preset format according to the above-mentioned semantic information; the above-mentioned contextual logical relationship output in the above-mentioned preset format is: the relationship between the above-mentioned text identifiers, and the relationship between the above-mentioned text identifiers represents the contextual logical relationship between the text elements corresponding to the above-mentioned text identifiers.
[0033] In combination with the second aspect, in some possible implementations, the adjustment module is specifically used to: if the above-mentioned courseware page is a first-category courseware page, determine the main text in the above-mentioned courseware page according to the above-mentioned text hierarchy; wherein, the above-mentioned first-category courseware page includes a text box in addition to the text box where the first-level title is located, the above-mentioned one text box is the target text box where the above-mentioned main text is located, and the above-mentioned first-category courseware page does not contain a target image, and the area of the above-mentioned target image is greater than the first preset area and smaller than the second preset area; obtain the first size information of the above-mentioned target text box and the second size information of the above-mentioned courseware page; while maintaining the above-mentioned contextual logical relationship unchanged, adjust the position of the above-mentioned target text box on the above-mentioned courseware page to the center according to the above-mentioned first size information and the above-mentioned second size information to obtain the adjusted courseware page.
[0034] In conjunction with the second aspect, in some possible implementations, the first size information includes: the width of the target text box text w and height text h The second size information includes the width of the courseware page slide w and height slide h The adjustment module is specifically used to calculate the adjusted position information of the target text box on the courseware page using the following formula:
[0035]
[0036] Among them, text x The first horizontal distance between the left edge of the target text box and the left edge of the courseware page after adjustment, text y It is the first vertical distance between the upper boundary of the above-mentioned target text box and the upper boundary of the above-mentioned courseware page after adjustment; according to the above-mentioned first horizontal distance and the first vertical distance, the position of the above-mentioned target text box on the above-mentioned courseware page is centered to obtain the adjusted courseware page.
[0037] In combination with the second aspect, in some possible implementations, the adjustment module is specifically used to: if the above-mentioned courseware page is a second-category courseware page, determine the main text and target image in the above-mentioned courseware page according to the above-mentioned text hierarchy; wherein, the above-mentioned second-category courseware page includes a text box in addition to the text box where the first-level title is located, the above-mentioned one text box is the target text box where the above-mentioned main text is located, and the above-mentioned second-category courseware page contains one of the above-mentioned target images, and the area of the above-mentioned target image is greater than the first preset area and smaller than the second preset area; obtain the first size information of the above-mentioned target text box, the second size information of the above-mentioned courseware page, and the third size information of the above-mentioned target image; while maintaining the above-mentioned contextual logical relationship unchanged, adjust the layout position of the above-mentioned target text box and the above-mentioned target image on the above-mentioned courseware page according to the above-mentioned first size information, the above-mentioned second size information, and the above-mentioned third size information to obtain an adjusted courseware page; wherein, the adjusted target text box is located on one side of the above-mentioned courseware page, and the adjusted target image is located on the other side of the above-mentioned courseware page, and the horizontal center line of the above-mentioned adjusted target text box coincides with the horizontal center line of the above-mentioned adjusted target image.
[0038] In conjunction with the second aspect, in some possible implementations, the first size information includes: the width of the target text box text w and height text h The second size information includes the width of the courseware page slide w and height slide h The third size information includes the width of the target image pic w and height pic h The adjustment module is specifically used to calculate the position information of the adjusted target image on the courseware page using the following formula:
[0039] pic x =slide w -pic w -a
[0040]
[0041] Among them, pic x The second horizontal distance between the left edge of the adjusted target image and the left edge of the courseware page, pic y is the second longitudinal distance between the upper boundary of the target image and the upper boundary of the courseware page after adjustment, and a is the length of the area reserved on the right side of the courseware page;
[0042] The adjusted layout position of the target text box on the courseware page is calculated using the following formula:
[0043] textx =slide w -pic w -text w -b
[0044]
[0045] Among them, text x The first horizontal distance between the left edge of the target text box and the left edge of the courseware page after adjustment, text y is the first vertical distance between the upper boundary of the above-mentioned target text box and the upper boundary of the above-mentioned courseware page after adjustment, and b is the length of the area reserved on the left side of the above-mentioned courseware page; according to the above-mentioned second horizontal distance and the above-mentioned second vertical distance, the layout position of the above-mentioned target picture on the above-mentioned courseware page is adjusted, and according to the above-mentioned first horizontal distance and the above-mentioned first vertical distance, the layout position of the above-mentioned target text box on the above-mentioned courseware page is adjusted.
[0046] In combination with the second aspect, in some possible implementations, the adjustment module is specifically used to: if the above-mentioned courseware page is a third-category courseware page, determine the main text in the above-mentioned courseware page according to the above-mentioned text hierarchy; wherein, the above-mentioned third-category courseware page includes n text boxes in addition to the text box where the first-level title is located, and the above-mentioned n text boxes are the target text boxes where the above-mentioned main text is located, n is greater than 1, the number of target images included in the above-mentioned third-category courseware page is less than a preset number threshold, and the area of the above-mentioned target image is greater than the first preset area and less than the second preset area; obtain the first height of the text box where the above-mentioned first-level title is located, the second height of the above-mentioned courseware page, and the third height of each of the above-mentioned n text boxes; while maintaining the above-mentioned contextual logical relationship unchanged, adjust the vertical spacing between the above-mentioned n text boxes according to the above-mentioned first height, the above-mentioned second height and the above-mentioned third height to obtain the adjusted courseware page.
[0047] In combination with the second aspect, in some possible implementation methods, the adjustment module is specifically used to: if the above-mentioned courseware page is a fourth-category courseware page, then determine the first-level title in the above-mentioned courseware page based on the above-mentioned text hierarchy; wherein, the above-mentioned fourth-category courseware page includes target teaching elements; while maintaining the above-mentioned contextual logical relationship unchanged, adjust the first-level title in the above-mentioned courseware page by any of the following methods to obtain an adjusted courseware page: adjust the above-mentioned first-level title to the upper left corner of the above-mentioned courseware page, unify the font of the above-mentioned first-level title, and adjust the font size of the above-mentioned first-level title.
[0048] In a third aspect, an electronic device is provided, comprising a memory and a processor. The memory is configured to store executable program code, and the processor is configured to retrieve and execute the executable program code from the memory, so that the electronic device executes the method of the first aspect or any possible implementation of the first aspect.
[0049] In a fourth aspect, a computer program product is provided, comprising: a computer program code, which, when executed on a computer, enables the computer to execute the method in the first aspect or any possible implementation of the first aspect.
[0050] In a fifth aspect, a computer-readable storage medium is provided, which stores a computer program code. When the computer program code runs on a computer, the computer executes the method in the above-mentioned first aspect or any possible implementation of the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] Figure 1 This is a schematic flow chart of a courseware beautification method provided in an embodiment of the present application;
[0052] Figure 2 This is a schematic diagram of a text hierarchy for outputting a courseware page provided by an embodiment of the present application;
[0053] FIG3( a ) is a schematic diagram of a courseware page annotated with text levels provided in an embodiment of the present application;
[0054] FIG3( b ) is a schematic diagram of a courseware page after being beautified without considering the contextual logical relationship provided by an embodiment of the present application;
[0055] Figure 4 This is a schematic diagram of a first type of courseware page provided in an embodiment of the present application;
[0056] Figure 5 This is a schematic diagram of a second type of courseware page provided in an embodiment of the present application;
[0057] Figure 6 This is a schematic diagram of a third type of courseware page provided in an embodiment of the present application;
[0058] Figure 7 This is a schematic diagram of a fourth type of courseware page provided in an embodiment of the present application;
[0059] Figure 8 This is a schematic diagram of an adjusted first-category courseware page provided in an embodiment of the present application;
[0060] Figure 9 is a schematic diagram of an adjusted second-category courseware page provided in an embodiment of the present application;
[0061] Figure 10 This is a schematic diagram of an adjusted third-category courseware page provided in an embodiment of the present application;
[0062] Figure 11 This is a structural diagram of a courseware beautification device provided in an embodiment of the present application;
[0063] Figure 12 This is a structural diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0064] The following will clearly and thoroughly describe the technical solutions in this application in conjunction with the accompanying drawings. In the description of the embodiments of this application, unless otherwise specified, " / " means or, for example, A / B can mean A or B: "and / or" in the text is only a description of the association relationship of associated objects, indicating that there can be three relationships, for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, in the description of the embodiments of this application, "multiple" means two or more than two.
[0065] In the following, the terms "first" and "second" are used for descriptive purposes only and should not be understood to imply or suggest relative importance or implicitly indicate the number of technical features indicated. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features.
[0066] At present, the courseware page beautification on the market mainly focuses on matching templates for beautification, by matching templates on each page of the courseware, or statistically classifying and matching the elements in the courseware page, and then using preset templates to beautify the courseware page. Although this approach can beautify the courseware page to a certain extent,
[0067] However, there are problems such as the following: it is difficult for rule matching to identify the meaning of the pictures in the courseware page and which template should be applied to make it more beautiful; or some elements that should be combined are simply stacked together, which will lead to more confusion after template matching, and a complete template library will also require more manpower costs.
[0068] Considering that teachers create courseware based on their own ideas and lack a unified paradigm, the preset templates used in traditional beautification methods may not understand the teacher's intentions. In other words, they cannot understand the contextual logical relationships within the courseware pages created by the teacher, which can easily lead to logical confusion in the beautified courseware pages. Therefore, using traditional preset templates to beautify courseware pages can easily lead to poor beautification effects. Therefore, how to improve the beautification effect of courseware pages while saving labor costs has become a technical problem that needs to be solved urgently.
[0069] For at least solving the above-mentioned technical problems, the present application embodiment provides a kind of courseware beautification method, device, electronic equipment and computer-readable storage medium.By carrying out hierarchical classification to the text elements of the courseware page to be beautified, then determine the contextual logical relationship between the text elements in the courseware page to be beautified, thereby can be based on not changing this contextual logical relationship, according to the text hierarchy, the page layout of the courseware page to be beautified is adjusted, obtain the adjusted courseware page.Can realize the beautification of the courseware page to be beautified by adjusting the page layout of the courseware page to be beautified in this scheme, and can not change the original contextual logical relationship in the courseware page when beautifying, make the courseware page after the beautification can retain the logical intention when the teacher makes the courseware page to a certain extent, therefore can improve the courseware beautification effect.And then, can simplify the time cost of the teacher when making courseware.
[0070] Figure 1 The following is a schematic flow chart of a courseware beautification method provided in an embodiment of the present application. The courseware beautification method of this embodiment is applied to an electronic device, which may be a computer device with a courseware beautification function and installed with courseware beautification software, such as a computer, mobile phone, tablet computer, etc., so that the courseware beautification method can be implemented based on the courseware beautification software.
[0071] The above-mentioned courseware beautification software can be an interactive courseware tool designed specifically for teaching scenarios, such as a seewo whiteboard. In an embodiment of the present application, the courseware produced for teachers can be automatically beautified in the scenario of the seewo whiteboard to simplify the time cost of teachers in making courseware. It is understandable that the main difference between courseware and ordinary slides is that the courseware has some unique teaching elements, and how to beautify it is also a concern of teachers. The embodiment of the present application can automatically beautify existing courseware, which can greatly save teachers the time overhead of adjusting courseware elements, and is conducive to avoiding the problem that the traditional preset template cannot understand the teacher's intention because the teacher does not combine related elements when placing elements, resulting in a poor beautification experience.
[0072] For example, Figure 1 As shown, the method includes:
[0073] Step 101: hierarchically classify the text elements of the courseware page to be beautified to obtain the text hierarchy of the text elements.
[0074] Step 102: Determine the semantic information of the text elements of the target text level in the courseware page based on the text level, and determine the contextual logical relationship between the text elements of the target text level based on the semantic information.
[0075] Step 103: According to the text hierarchy and the contextual logical relationship, the page layout of the courseware page is adjusted to obtain an adjusted courseware page; wherein the contextual logical relationship of the adjusted courseware page is the same as that of the courseware page before the adjustment.
[0076] exist Figure 1 In the embodiment shown, considering that teachers make courseware according to their own hearts when making courseware, there is no unified paradigm, and the preset template in the traditional beautification method may not understand the teacher's production intention, that is, it is impossible to understand the contextual logical relationship in the courseware page made by the teacher, which easily leads to confusion in the logical relationship of the beautified courseware page. Therefore, when the traditional preset template is used to beautify the courseware page, it is easy to bring poor beautification effect. In the technical scheme of the embodiment of the present application, by classifying the text elements of the courseware page to be beautified, the text level of the text elements is obtained, and then the contextual logical relationship between the text elements of the target text level in the courseware page is determined, so that the page layout of the courseware page can be adjusted according to the text level without changing the contextual logical relationship, and the adjusted courseware page is obtained. In this scheme, the beautification of the courseware page can be achieved by adjusting the page layout of the courseware page, and the original contextual logical relationship in the courseware page can be maintained while beautifying, so that the courseware page after the beautification can retain the logical intention of the teacher when making the courseware page to a certain extent, so that the courseware beautification effect can be improved. Furthermore, it can simplify the time cost of teachers in making courseware.
[0077] Below Figure 1 The specific implementation of each step in the embodiment is described below:
[0078] In step 101, the courseware page to be beautified is the courseware page that needs to be beautified in the courseware file. By including multiple courseware pages in the courseware file, each of the multiple courseware pages can be used as the courseware page to be beautified. In this step, by carrying out hierarchical classification of the text elements of the courseware page to be beautified, the text elements in the courseware page can be divided into three categories, namely, first-level title, second-level title and body text. It is understandable that the courseware page does not necessarily include the above three types of text hierarchies at the same time. The courseware page may include one text hierarchy, two text hierarchies or three text hierarchies.
[0079] In an exemplary embodiment, the text hierarchy of text elements in a previous courseware page can be obtained based on the document intelligent multimodal pre-trained model LayoutLMv3. For example, the courseware page can be pre-processed so that its format conforms to the input format of LayoutLMv3. The pre-processed courseware page is then input into LayoutLMv3, which can output the text hierarchy of the text elements in the courseware page.
[0080] Among them, the input format of LayoutLMv3 is funsd format. Specifically, the xml file of the courseware can be read, and by utilizing the xmltodict parsing library, the xml file can be converted into data in json format, and then converted into usable funsd format data to be fed into the LayoutLMv3 model to output the text hierarchy. The preprocessed courseware page includes the text elements in the courseware page, the position information of the text box where the text elements are located, and the thumbnail of the courseware page. The position information of the text box can include the position coordinates of the starting point and the position coordinates of the ending point of the text box. The starting point of the text box can be in the upper left corner of the text box, and the ending point of the text box can be in the lower right corner of the text box. In this embodiment, the text elements of each courseware page in the courseware file, the position information of the text box where the text elements are located, and the thumbnail can be input into LayoutLMv3, so that LayoutLMv3 can classify each courseware page into a hierarchical classification, which is divided into a first-level title, a second-level title, and the main text.
[0081] For example, a diagram of the text hierarchy for the courseware page output can be found in Figure 2 ,Depend on Figure 2 It can be seen that the text level of the text element 201 in the courseware page is the secondary title L2_title, and the text levels of the text elements 202, 203 and 204 are all the main text text.
[0082] In this embodiment, a lot of manpower costs can be saved by outputting the text hierarchy of the courseware page through LayoutLMv3. LayoutLMv3 can overcome the differences in pre-training objectives between text and images and promote multimodal representation learning. LayoutLMv3 pre-trains the multimodal model with a unified text and image mask modeling objective, that is, it learns to reconstruct the masked word ID of the language modality and symmetrically reconstruct the masked image block ID of the image modality. Three pre-training objectives are used to learn multimodality, namely Masked Language Model (MLM), Masked Image Modeling (MIM), and Word-Patch Alignment (WPA). MLM is designed to learn the correspondence between layout information and text images. It primarily randomly masks 30% of the words and restores the masked words in the text based on the uncovered text and layout information. MIM randomly masks 40% of the image and restores the discretized ID of the masked image based on the uncovered text and image information. WPA learns the fine-grained alignment of language and visual modalities by explicitly predicting whether the image block corresponding to a text word is masked. Secondly, LayoutLMv3 does not rely on complex convolutional neural networks (CNNs) or Faster R-CNN to represent images, which reduces the number of parameters and enables faster inference.
[0083] In step 102, the contextual logical relationship between the text elements in each text level of the courseware page is determined based on the text level. The contextual logical relationship is also known as the semantic logical relationship. It is understandable that the text elements in the courseware page are usually created by the teacher to facilitate students to understand the teaching content. Therefore, the text elements in the courseware page are usually arranged step by step. In order to guide students to understand the teaching content, the text elements in the courseware page created by the teacher have certain contextual logical relationships. This upper and lower logical relationship is, for example,: text element 1 in the courseware page is in the upper area of text element 2, and text element 1 is used to introduce text element 2.
[0084] If the courseware page is beautified without considering the contextual logical relationship, the secondary title may not correspond to the original main text. As shown in Figure 3(a), the text level of text element 301 is the main text text, the text level of text element 302 is the secondary title L2_title, and the text level of text element 303 is the main text text. The text level of "Why is the egret flying low at dusk a blessing of rural life?" is a secondary title. This secondary title should lead the text element 303 below. If Figure 3(b) is obtained after beautification, and the secondary title, that is, text element 302, is placed at the top in Figure 3(b), the original semantic logical relationship will be lost, and this beautification effect is unacceptable to teachers.
[0085] In an exemplary embodiment, step 102 is implemented by determining semantic information of text elements at a target text level in a courseware page based on the text level; wherein the target text level includes secondary headings and body text; and determining contextual logical relationships between text elements at the target text level based on the semantic information. For example, semantic parsing can be performed on text elements belonging to secondary headings and text elements belonging to body text in the courseware page to obtain semantic information of text elements at the target text level, and then analyzing the semantic information to obtain contextual logical relationships.
[0086] Since semantic incoherence, i.e., confusion in contextual logic, is more likely to occur at the secondary title and main text level, in this embodiment, the secondary title and main text are used as the target text level, and the semantic information of the text elements of the target text level in the courseware page is determined based on the text level of the courseware page. Then, based on the semantic information, the contextual logic between the text elements of the target text level is analyzed, which is conducive to more targeted acquisition of the contextual logic relationship between the text elements of the target text level that is prone to contextual logic problems. The first-level title generally governs the entire courseware page. When beautifying the courseware, it generally does not cause logical problems with other text elements. Therefore, when determining the semantic information and contextual logic relationship, the first-level title does not need to be considered, which is conducive to improving the acquisition speed of the contextual logic relationship to a certain extent without affecting the beautification effect.
[0087] In an exemplary embodiment, the above-mentioned method of determining the semantic information of the text elements of the target text level in the courseware page according to the text level, and determining the contextual logical relationship between the text elements of the target text level according to the semantic information, includes: inputting the text elements of the text level, the text level and the text identifiers of the text elements into the large language model to output the contextual logical relationship between the text elements of the target text level; wherein the large language model outputs the contextual logical relationship according to a preset rule, and the preset rule is: performing semantic understanding on the input text elements of the target text level to obtain the semantic information of the text elements of the target text level, and outputting the contextual logical relationship in a preset format according to the semantic information; the contextual logical relationship output in the preset format is: the relationship between the text identifiers, and the relationship between the text identifiers represents the contextual logical relationship between the text elements corresponding to the text identifiers.
[0088] The Big Language Model is a neural network-based natural language processing technology that can learn and predict patterns and regularities in natural language text. Simply put, the Big Language Model is a program that can understand and generate natural language. By learning from large amounts of corpus data, the Big Language Model automatically extracts features and patterns from natural language text, enabling natural language understanding and generation.
[0089] In the embodiments of the present application, natural language processing (NLP) technology is involved. Specifically, natural language processing is an important direction in the fields of computer science and artificial intelligence. It studies various theories and methods that can realize effective communication between people and computers using natural language. Natural language processing involves natural language, that is, the language people use in daily life, which is closely related to linguistic research; it also involves computer science and mathematics. The pre-training model, an important technology for model training in the field of artificial intelligence, is developed from the large language model (LLM) in the field of NLP. After fine-tuning, the large language model can be widely used in downstream tasks. The downstream task implemented by the large language model in this embodiment is to output the contextual logical relationship between text elements at the target text level.
[0090] Specifically, for the contextual logical relationship between text elements, this embodiment adopts the reasoning and summarizing ability of the large language model, and adds a preset prompt to enable the large language model to output the contextual logical relationship more accurately. The preset prompt can be the preset rule mentioned above. For example, GPT3.5 can be used, and a prompt can be added to output the contextual logical relationship of the current courseware page. This solution can not only understand the semantic information of a given courseware page, but also summarize the contextual logical relationship according to the text level. For example, the preset rules set for the large language model can be as follows:
[0091] Your task is to think through the semantics of the given text elements step by step, and thus determine the contextual logical relationship between the text elements. L1_tile is the first-level title, L2_title is the second-level title, and text is the main text. L2_title generally requires a corresponding text to answer, not a corresponding L2_title.
[0092] Then, the text content (text elements at the text level), text-level labels, and text identifiers of text elements (hereinafter referred to as text IDs or simply IDs) are used as input text for the large language model. The large language model is required to output according to the following rules: "Don't jump to conclusions first. Perform semantic understanding of the given text, clarify the relationships between texts, and then output only the contextual logical relationships of text elements at the target text level (L2_title and text) in JSON format."
[0093] For example, the input of a large language model includes the following:
[0094] {"text":"Give: Money","label":"text","id":1}
[0095] {"text":"What did Lao Yang give?","label":"L2_title","id":2}
[0096] {"text":"What does Lao Wang really need?","label":"L2_title","id":3}
[0097] {"text":"Needs: family love, warmth, support","label":"text","id":4}
[0098] {"text":"Ignore:emotion","label":"text","id":5}
[0099] {"text":"What did Lao Yang overlook?","label":"L2_title","id":6}
[0100] The meaning of the first content item above is: the text element ("Give: Money") has a text level (label) of "Text" and a text id of 1. The meaning of the second content item above is: the text element ("What did Lao Yang give?") has a text level (label) of "L2_title" and a text id of 2. The meanings of the remaining four content items can be deduced in this way, so we will not repeat them here to avoid repetition.
[0101] When the large language model is fed with the above six items, the output of the large language model can be as follows:
[0102] The input text of the current large language model includes the following:
[0103] 1. "Give: money" (id=1, text)
[0104] 2. "What did Lao Yang give?" (id=2, L2_title)
[0105] 3. "What does Lao Wang really need?" (id=3, L2_title)
[0106] 4. "Needs: family affection, warmth, support" (id=4, text)
[0107] 5. "Ignore: emotion" (id=5, text)
[0108] 6. "What did Lao Yang overlook?" (id=6, L2_title)
[0109] Based on the above text elements, the following contextual logical relationships can be derived:
[0110] 1. For the question "What did Lao Yang give?" (id=2), the answer can be found in the text "Give: money" (id=1).
[0111] 2. Regarding the question "What does Lao Wang really need?" (id=3), the answer can be found in the text "Needs: family affection, warmth, support" (id=4).
[0112] 3. For the question "What did Lao Yang ignore?" (id=6), the answer can be found in the text "Ignore: Emotion" (id=5).
[0113] Therefore, the following logical relationship can be obtained:
[0114] For L2_title "What did Lao Yang give?" (id=2), the next related text id is 1.
[0115] For L2_title "What does Lao Wang really need?" (id=3), the next related text id is 4.
[0116] For L2_title "What did Lao Yang overlook?" (id=6), the next related text id is 5.
[0117] The logical relationship of the returned json is as follows:
[0118] "2": {"next": 1},
[0119] "3": {"next": 4},
[0120] "6": {"next": 5}
[0121] The json logical relationship returned above is the contextual logical relationship output in a preset format, and the json logical relationship is the relationship between text ids, that is, the text element with text id 2 (What did Lao Yang give?) is followed by the text element with text id 1 (Give: Money), the text element with text id 3 (What does Lao Wang really need?) is followed by the text element with text id 4 (Needs: Family, Warmth, Support), the text element with text id 6 (What did Lao Yang ignore?) is followed by the text element with text id 5 (Ignore: Emotion). It can also be seen from the above examples that the contextual logical relationship output in this embodiment is the contextual logical relationship between the text element of the secondary title L2_title and the text element of the main text text. In this embodiment, with the help of the reasoning ability of the large language model, it is beneficial to accurately obtain the contextual logical relationship.
[0122] In step 103, the page layout of the courseware page is adjusted according to the text level without changing the context logic.
[0123] Specifically, in this step, the page layout of the courseware page is adaptively adjusted according to the text elements and contextual logical relationships of the courseware page. Since the courseware pages made by teachers usually have many styles, the courseware pages are divided into multiple types in this embodiment, and different adjustment methods are used to adjust the page layout for different types of courseware pages. Different adjustment methods can also be understood as different beautification methods. The above-mentioned multiple different types of courseware pages include: first-category courseware pages, second-category courseware pages, third-category courseware pages, and fourth-category courseware pages. These four types of courseware pages are explained below:
[0124] The first type of courseware page includes a text box in addition to the text box containing the first-level title. This text box is the target text box for the main body text. The first type of courseware page does not contain a target image, and the target image's area is greater than a first preset area and smaller than a second preset area. The first and second preset areas can be pre-calibrated. A target image's area greater than the first preset area indicates that the target image is not very small; for example, a decorative icon used by a teacher does not qualify as a target image. A target image's area smaller than the second preset area indicates that the target image is not very large; for example, a background image on a courseware page does not qualify as a target image. The target image should have a meaningful meaning and should not be a small image or a large background image. Hereinafter, the first type of courseware page will also be referred to as a single-text, no-image courseware page. "Single-text, no-image" refers to a courseware page with only a single target text box containing the main body text, in addition to the text box containing the first-level title. "No image" in "single-text, no-image" refers to a courseware page with no target image.
[0125] For example, the diagram of the first type of courseware page can be found in Figure 4 , Figure 4 In addition to the text box where the first-level title 401 "Creation Background" is located, only the target text box where the main text 402 is located is included, and Figure 4 The picture in is the background picture, that is, Figure 4 The target image does not exist in the courseware page shown.
[0126] The second type of courseware page includes a text box in addition to the text box where the first-level title is located. The above-mentioned text box is the target text box where the main text is located, and the second type of courseware page contains a target picture, and the area of the target picture is larger than the first preset area and smaller than the second preset area. The definition of the target picture is the same as the definition of the target picture in the above-mentioned first type of courseware page, and will not be repeated here to avoid repetition. The second type of courseware page can also be referred to as a single-text, single-picture courseware page. The single text in the single-text, single-picture means: in addition to the text box where the first-level title is located, there is only one target text box where the main text is located in the courseware page. The single picture in the single-text, single-picture means: the above-mentioned target picture exists in the courseware page.
[0127] For example, the diagram of the second type of courseware page can be found in Figure 5 , Figure 5 In addition to the text box where the first-level title "Writing Background" is located, only the target text box where the body text 501 is located is included, and Figure 5 The images in the include background images and images to the right of the body text. The background images are not target images, so Figure 5 There is a target picture 502 in the courseware page shown.
[0128] The third type of courseware page includes n text boxes in addition to the text box where the first-level title is located, and n text boxes are target text boxes where the main text is located, n is greater than 1, and the number of target images included in the third type of courseware page is less than a preset number threshold, and the area of the target image is greater than the first preset area and less than the second preset area. Among them, the definition of the target image is the same as the definition of the target image in the first type of courseware page mentioned above, and will not be repeated here to avoid repetition. The preset number threshold can be pre-calibrated. When the number of target images is less than the preset number threshold, it means that the number of target images present in the courseware page is small. For example, the preset number threshold can be set to 5. The third type of courseware page can also be referred to as a courseware page with more text and fewer images. The "more text" in "more text and fewer images" means that the courseware page includes multiple text boxes in addition to the text box where the first-level title is located, and the "fewer images" in "more text and fewer images" means that the courseware page does not have target images, or although target images exist, the number of target images present is small.
[0129] The third category of courseware pages includes fewer target images than the preset threshold. This allows for adaptive layout adjustments only for pages with fewer target images, eliminating the need to determine if text box positions overlap with other target images. If the number of target images on a courseware page is greater than or equal to the preset threshold, it indicates that the page is rich in image elements, with text likely interspersed among them. This makes adaptive text adjustments difficult.
[0130] For example, the diagram of the third type of courseware page can be found in Figure 6 , Figure 6 In addition to the text box where the first-level title "Layout Text" is located, it includes the target text box 601, target text box 602, and target text box 603 where the body text is located below, and Figure 6 The images in include background images, which are not part of the target images. Figure 6 There are 0 target images in the courseware page shown, that is, there are no target images.
[0131] The fourth category of courseware pages includes target teaching elements, which are elements unique to the teaching scenario. Target teaching elements may include one of the following or a combination thereof: classroom activities (a feature of the seewo whiteboard; these classroom activities enable teachers and students to interact), mind maps, Chinese character cards, pinyin elements (this category generally requires aligning the pinyin with a certain Chinese character), text elements with overlapping words, circled text elements, and underlined text elements.
[0132] For example, the diagram of the fourth type of courseware page can be found in Figure 7 , Figure 7The target teaching elements in include: text elements 701 with overlapping words, i.e. Figure 7 The word “evanescent” in the text, the text elements covered by “evanescent”, and the circled text elements 702 are Figure 7 The “fragmented” and circled text elements 703 are Figure 7 The “torn into pieces” in the text element 704 is the circled text element 704. Figure 7 The "broken shadow" in the.
[0133] The fourth type of courseware page can be understood as a special courseware page. For this type of courseware page, it is usually difficult to accurately lock the target teaching element. For example, only the position of the text box can be obtained, and it is not possible to specifically circle a specific word. If the text box where the target teaching element is located is beautified, the special meaning of the target teaching element in the courseware page is easily lost. For example, due to adjustments to the beautified courseware page, the circled text element is not the same as the text element circled when the teacher created it, which easily leads to problems such as dislocation of the circled text and dislocation of horizontal lines. Such beautification is counterproductive. Therefore, in the present embodiment, only the first-level title can be beautified for the fourth type of courseware page.
[0134] In an exemplary embodiment, the implementation method of the above-mentioned step 103 includes: if the courseware page is a fourth-category courseware page, determining the first-level title in the courseware page based on the text hierarchy; while maintaining the contextual logical relationship unchanged, adjusting the first-level title in the courseware page by any of the following methods to obtain an adjusted courseware page: adjusting the first-level title to the upper left corner of the courseware page, unifying the font of the first-level title, and adjusting the font size of the first-level title.
[0135] That is to say, in this embodiment, for the fourth type of courseware page that includes the target teaching elements, the first-level title will be simply beautified. For this type of courseware page, it can maintain the greatest degree of beauty without losing the teaching effect that the teacher originally wanted to express. Beautifying the first-level title can be as described above: adjust the first-level title to the upper left corner of the courseware page, that is, if a first-level title exists, it will be beautified to the style of the upper left corner by default. Unify the font of the first-level title, that is, set the font of the text elements in the first-level title to the same font. Adjust the font size of the first-level title, for example, decide whether the font size needs to be adjusted based on whether the text elements in the first-level title overflow and the text box where the title is located.
[0136] It should be noted that for the first, second, and third types of courseware pages, if they have a first-level title, they will also be beautified. The beautification method for the first-level title can be the same for different types of courseware pages. The following explains the different beautification methods for different types of courseware pages:
[0137] In an exemplary embodiment, the implementation method of the above-mentioned step 103 includes: if the courseware page is a first-type courseware page, determining the main text in the courseware page according to the text hierarchy; obtaining the first size information of the target text box and the second size information of the courseware page; while maintaining the contextual logical relationship unchanged, adjusting the position of the target text box on the courseware page to the center according to the first size information and the second size information to obtain an adjusted courseware page.
[0138] It can be understood that, since the text hierarchy of the courseware page has been obtained, and the text hierarchy of the courseware page includes the main text, the main text in the courseware page can be determined based on the text hierarchy. The first size information of the above-mentioned target text box is also the size information of the text box where the main text is located, and this size information may include: the height and width of the target text box. The second size information of the courseware page is the size of the courseware page itself, including: the width and height of the courseware page. The above-mentioned centering adjustment of the position of the target text box on the courseware page can be understood as: adjusting the target text box to the middle area of the courseware page, so that the main text in the adjusted courseware page is in the middle area.
[0139] In this embodiment, for the first type of courseware page, that is, the above-mentioned single-text courseware page without pictures, the main text will be centered while maintaining the contextual logical relationship unchanged. This can make the main text evenly occupy the courseware page to a certain extent, and can also avoid the appearance of excess blank space, which is conducive to improving the visual experience.
[0140] In an exemplary embodiment, the first size information includes: the width of the target text box w and height text h The second size information includes the width of the courseware page slide w and height slide h The above-mentioned step of centering the position of the target text box on the courseware page according to the first size information and the second size information to obtain the adjusted courseware page includes: calculating the position information of the adjusted target text box on the courseware page by the following formula:
[0141]
[0142] Among them, text x The first horizontal distance between the left border of the target text box and the left border of the courseware page after adjustment, text y The first vertical distance between the upper boundary of the target text box and the upper boundary of the courseware page after adjustment is used to adjust the position of the target text box on the courseware page to obtain the adjusted courseware page.
[0143] It is understandable that the target text box is usually a rectangular box, and the starting point of the target text box can be the position point of the upper left corner of the target text box, that is, the upper left vertex of the rectangular box. If a coordinate system is established with the upper left vertex of the courseware page as the origin, the coordinates of the position point of the upper left corner of the target text box can be determined based on the above-mentioned first horizontal distance and first vertical distance, so that the position of the target text box on the courseware page can be adjusted to the center based on the coordinates to obtain the adjusted courseware page. The coordinates of the position point of the upper left corner of the target text box in the adjusted courseware page are (text x , -text y ).
[0144] For example, the first type of courseware page before adjustment is as above Figure 4 The courseware page in the adjustment can be the first type of courseware page Figure 8 The courseware page in . Figure 8 It can be seen that the main text 801 in the adjusted first type of courseware page is located in the middle area, that is, it is centered in the entire courseware page. Figure 8 The distance between the left edge of the target text box where the text 801 is located and the left edge of the courseware page is text x The distance between the upper boundary of the target text box where the text 801 is located and the upper boundary of the courseware page is text y Optionally, you can adjust the size and font of the main text according to actual needs so that the main text can be more coordinated and centered in the entire courseware page.
[0145] In this embodiment, through the calculation formula of the above-mentioned position information, the position coordinates to which the target text box should be adjusted can be accurately obtained. While maintaining the contextual logical relationship unchanged, according to the calculated first horizontal distance and first vertical distance, it is beneficial to quickly adjust the position of the target text box on the courseware page to the center, which is beneficial to improve the beautification speed to a certain extent.
[0146] In an exemplary embodiment, the implementation method of the above-mentioned step 103 includes: if the courseware page is a second-category courseware page, determining the main text and target image in the courseware page according to the text hierarchy; obtaining the first size information of the target text box, the second size information of the courseware page, and the third size information of the target image; while maintaining the contextual logical relationship unchanged, adjusting the layout position of the target text box and the target image on the courseware page according to the first size information, the second size information, and the third size information to obtain an adjusted courseware page; wherein, the adjusted target text box is located on one side of the courseware page, and the adjusted target image is located on the other side of the courseware page, and the horizontal center line of the adjusted target text box coincides with the horizontal center line of the adjusted target image.
[0147] The first size information of the above-mentioned target text box and the second size information of the courseware page have been introduced above, and can be referred to the above description, so they will not be repeated here. The third size information of the target image, that is, the size of the target image itself, can include the height and width of the target image. The adjusted target text box and target image are distributed left and right in the courseware page, and the horizontal center line of the adjusted target text box and the adjusted target image coincides, and the horizontal center line is the center line in the height direction. Among them, one side and the other side of the courseware page can be the left side and the right side respectively.
[0148] In this embodiment, for the second type of courseware page, that is, the courseware page with single text and single picture, a left-right structure is used for typesetting and layout, and the target text box and the target picture are adjusted together, the target text box is placed on the left, and the target picture is placed on the right, and the target text box is centered on the center line of the target picture, that is, the horizontal center line of the target text box and the target picture coincides, which is conducive to improving the aesthetics and coordination of the adjusted courseware page.
[0149] In an exemplary embodiment, the first size information includes: the width of the target text box w and height text h The second size information includes the width of the courseware page slide w and height slide h The third size information includes the width of the target picture pic w and height pic h ; The step of adjusting the layout positions of the target text box and the target image on the courseware page according to the first size information, the second size information, and the third size information comprises: calculating the adjusted position information of the target image on the courseware page by the following formula:
[0150] pic x =slide w -pic w -a
[0151]
[0152] Among them, pic x The second horizontal distance between the left border of the adjusted target image and the left border of the courseware page, pic yThe second vertical distance between the upper edge of the adjusted target image and the upper edge of the courseware page, and a, the length of the area reserved on the right side of the courseware page. a can be preset and is equivalent to the length of the area on the right side of the courseware page not occupied by the target image, i.e., the length of the blank space, so that there is a certain distance between the right edge of the target image and the right edge of the courseware page, improving the aesthetics. For example, the value of a can be 5 cm.
[0153] The adjusted layout position of the target text box on the courseware page is calculated using the following formula:
[0154] text x =slide w -pic w -text w -b
[0155]
[0156] Among them, text x The first horizontal distance between the left border of the adjusted target text box and the left border of the courseware page, text y is the first vertical distance between the upper edge of the adjusted target text box and the upper edge of the courseware page, and b is the length of the area reserved on the left side of the courseware page. b can be preset and is equivalent to the length of the area reserved on the left side of the courseware page that is not occupied by the target text box, that is, the length of the blank space, so that there is a certain distance between the left edge of the target text box and the left edge of the courseware page, improving the aesthetics. For example, the value of b can be 8 cm.
[0157] In the calculation of the above pic x 、pic y 、text x and text y After that, the second lateral distance pic x and the second longitudinal distance pic y , adjust the layout position of the target image on the courseware page, and follow the first horizontal distance text x and the first vertical distance text y , adjust the layout position of the target text box on the courseware page.
[0158] If the coordinate system is established with the upper left vertex of the courseware page as the origin, then based on the second horizontal distance pic x and the second longitudinal distance pic y The coordinates of the position point of the upper left corner of the target image can be determined, so that the position of the target image on the courseware page can be adjusted based on the coordinates to obtain the adjusted courseware page. The coordinates of the position point of the upper left corner of the target image in the adjusted courseware page are (picx , -pic y ). Based on the above first horizontal distance text x and the first vertical distance text y The coordinates of the position point of the upper left corner of the target text box can be determined, so that the position of the target text box on the courseware page can be adjusted based on the coordinates to obtain the adjusted courseware page. The coordinates of the position point of the upper left corner of the target text box in the adjusted courseware page are (text x , -text y ).
[0159] For example, the second type of courseware page before adjustment is as above Figure 5 The courseware page in the adjustment can be the second type of courseware page Figure 9 The courseware page in . Figure 9 It can be seen that in the adjusted second type of courseware page, the main text 901 is located in the left area, the target image 902 is located in the right area, and the target text box where the Chinese text is located is centered on the horizontal center line 903 of the target image. Figure 9 The distance between the left edge of the target text box where the text 901 is located and the left edge of the courseware page is text x The distance between the upper boundary of the target text box where the text 901 is located and the upper boundary of the courseware page is text y The distance between the left edge of the target image 902 and the left edge of the courseware page is pic x The distance between the upper boundary of the target image 902 and the upper boundary of the courseware page is pic y .
[0160] In this embodiment, the position coordinates to which the target text box should be adjusted and the position coordinates to which the target picture should be adjusted can be accurately obtained by using the calculation formula of the position information. x 、pic y 、text x and text y , which helps to quickly adjust the position of the target text box and target image on the courseware page, and to a certain extent helps to improve the beautification speed.
[0161] In an exemplary embodiment, the implementation method of the above-mentioned step 103 includes: if the courseware page is a third-category courseware page, determining the main text in the courseware page according to the text hierarchy; obtaining the first height of the text box where the first-level title is located, the second height of the courseware page, and the third height of each of the n text boxes; while maintaining the contextual logical relationship unchanged, adjusting the vertical spacing between the n text boxes according to the first height, the second height and the third height to obtain an adjusted courseware page.
[0162] For the third type of courseware page, i.e., the one with more text and fewer images, in this embodiment, the images are kept in their original positions if possible to prevent errors. By adjusting the vertical spacing between the n text boxes so that the vertical spacing between adjacent text boxes is the same, the overall page looks more coordinated and beautiful.
[0163] For example, the vertical gap between two adjacent text boxes among n text boxes can be calculated by the following formula:
[0164]
[0165] Among them, slide h The second height of the courseware page, title h The first height of the text box where the first-level title is located, text ih is the third height of the ith text box among the n text boxes, min_gap is the preset spacing value. Here, min_gap is subtracted to prevent the text from overflowing the courseware page. In the specific implementation, if there is no first-level title in the courseware page, the title in the above formula h You can take the default value, for example, 4cm. n+1 can represent the number of blank spaces in the courseware page, for example Figure 10 In the example, there are four blank spaces: the blank space between text box 1001 and the top of the page, the blank space between text box 1001 and text box 1002, the blank space between text box 1002 and text box 1003, and the blank space between text box 1003 and the bottom of the page. The gap calculated using the above formula helps to ensure that the distances between adjacent blank spaces in the adjusted page are uniform, improving the rationality and aesthetics of the page layout.
[0166] For example, the third category courseware page before adjustment is as above Figure 6 The courseware page in the adjustment can be the third type of courseware page Figure 10 The courseware page in . Figure 10 It can be seen that the vertical spacing between the three text boxes (text box 1001, text box 1002, and text box 1003) in the adjusted third type of courseware page is uniform, and the spacing between text box 1001 and the top of the courseware page and the spacing between text box 1003 and the bottom of the courseware page are also relatively uniform, which improves the aesthetics and coordination of the overall layout.
[0167] For example, after the page layout adjustment of the above-mentioned various types of courseware pages is completed, further overlap detection can be performed. If the elements of the completed layout overlap with each other, the overlapping elements can be fine-tuned based on the positions of the overlapping elements to obtain a courseware page without overlapping elements.
[0168] Through the above-mentioned courseware beautification method, the layout of text, pictures and other elements on the courseware page can be readjusted to the greatest extent, making the overall appearance more beautiful. In addition, the calculation of formulas can also make the placement of text, pictures and other elements more accurate, in line with human cognitive beauty.
[0169] In summary, in this embodiment, in order to improve the aesthetics and convenience of courseware beautification, a solution for automatic beautification of teaching courseware is proposed, and the LayoutLMv3 model is used to hierarchically classify the text elements of the courseware page, and divide them into first-level titles, second-level titles and body text for beautification. According to the text hierarchy and semantic information of the text elements obtained on each page of the courseware, the contextual logical relationship between the prompt statement output text is constructed using a large language model. The page layout is adaptively adjusted according to the text hierarchy and the contextual logical relationship, so that the courseware is more beautiful, and the change of the contextual logical relationship can be avoided, and the inconvenience and labor cost of making a complete template are avoided.
[0170] Figure 11 It is a structural diagram of a courseware beautification device provided in an embodiment of the present application.
[0171] For example, Figure 11 As shown, the courseware beautification device includes: a hierarchical classification module 1101, which is used to hierarchically classify the text elements of the courseware page to be beautified to obtain the text hierarchy of the above text elements; a determination module 1102, which is used to determine the semantic information of the text elements of the target text hierarchy in the above courseware page according to the above text hierarchy, and determine the contextual logical relationship between the text elements of the above target text hierarchy according to the above semantic information; an adjustment module 1103, which is used to adjust the page layout of the above courseware page according to the above text hierarchy and the above contextual logical relationship to obtain an adjusted courseware page; wherein the contextual logical relationship in the above adjusted courseware page is the same as that in the courseware page before adjustment.
[0172] In a possible implementation, the target text level includes a secondary title and body text.
[0173] In one possible implementation, the determination module 1102 is specifically used to input the text elements of the above-mentioned text level, the above-mentioned text level and the text identifiers of the above-mentioned text elements into the large language model to output the contextual logical relationship between the text elements of the above-mentioned target text level; wherein the above-mentioned large language model outputs the above-mentioned contextual logical relationship according to preset rules, and the above-mentioned preset rules are: performing semantic understanding on the input text elements of the above-mentioned target text level to obtain the semantic information of the text elements of the above-mentioned target text level, and outputting the above-mentioned contextual logical relationship in a preset format according to the above-mentioned semantic information; the above-mentioned contextual logical relationship output in the above-mentioned preset format is: the relationship between the above-mentioned text identifiers, and the relationship between the above-mentioned text identifiers represents the contextual logical relationship between the text elements corresponding to the above-mentioned text identifiers.
[0174] In one possible implementation, the adjustment module 1103 is specifically used to: if the above-mentioned courseware page is a first-category courseware page, determine the main text in the above-mentioned courseware page according to the above-mentioned text hierarchy; wherein, the above-mentioned first-category courseware page includes a text box in addition to the text box where the first-level title is located, the above-mentioned one text box is the target text box where the above-mentioned main text is located, and the above-mentioned first-category courseware page does not contain a target image, and the area of the above-mentioned target image is larger than the first preset area and smaller than the second preset area; obtain the first size information of the above-mentioned target text box and the second size information of the above-mentioned courseware page; while maintaining the above-mentioned contextual logical relationship unchanged, adjust the position of the above-mentioned target text box on the above-mentioned courseware page to the center according to the above-mentioned first size information and the above-mentioned second size information to obtain the adjusted courseware page.
[0175] In a possible implementation, the first size information includes: the width of the target text box w and height text h The second size information includes the width of the courseware page slide w and height slide h The adjustment module 1103 is specifically used to calculate the adjusted position information of the target text box on the courseware page using the following formula:
[0176]
[0177] Among them, text x The first horizontal distance between the left edge of the target text box and the left edge of the courseware page after adjustment, text y It is the first vertical distance between the upper boundary of the above-mentioned target text box and the upper boundary of the above-mentioned courseware page after adjustment; according to the above-mentioned first horizontal distance and the first vertical distance, the position of the above-mentioned target text box on the above-mentioned courseware page is centered to obtain the adjusted courseware page.
[0178] In one possible implementation, the adjustment module 1103 is specifically used to: if the above-mentioned courseware page is a second-category courseware page, determine the main text and target image in the above-mentioned courseware page according to the above-mentioned text hierarchy; wherein, the above-mentioned second-category courseware page includes a text box in addition to the text box where the first-level title is located, the above-mentioned one text box is the target text box where the above-mentioned main text is located, and the above-mentioned second-category courseware page contains the above-mentioned target image, and the area of the above-mentioned target image is greater than the first preset area and smaller than the second preset area; obtain the first size information of the above-mentioned target text box, the second size information of the above-mentioned courseware page, and the third size information of the above-mentioned target image; while maintaining the above-mentioned contextual logical relationship unchanged, adjust the layout position of the above-mentioned target text box and the above-mentioned target image on the above-mentioned courseware page according to the above-mentioned first size information, the above-mentioned second size information, and the above-mentioned third size information to obtain an adjusted courseware page; wherein, the adjusted target text box is located on one side of the above-mentioned courseware page, and the adjusted target image is located on the other side of the above-mentioned courseware page, and the horizontal center line of the above-mentioned adjusted target text box coincides with the horizontal center line of the above-mentioned adjusted target image.
[0179] In a possible implementation, the first size information includes: the width of the target text box w and height text h The second size information includes the width of the courseware page slide w and height slide h The third size information includes the width of the target image pic w and height pic h The adjustment module 1103 is specifically used to calculate the position information of the adjusted target image on the courseware page using the following formula:
[0180] pic x =slide w -pic w -a
[0181]
[0182] Among them, pic x The second horizontal distance between the left edge of the adjusted target image and the left edge of the courseware page, pic y is the second longitudinal distance between the upper boundary of the target image and the upper boundary of the courseware page after adjustment, and a is the length of the area reserved on the right side of the courseware page;
[0183] The adjusted layout position of the target text box on the courseware page is calculated using the following formula:
[0184] text x =slide w -pic w -text w -b
[0185]
[0186] Among them, text x The first horizontal distance between the left edge of the target text box and the left edge of the courseware page after adjustment, text y is the first vertical distance between the upper boundary of the above-mentioned target text box and the upper boundary of the above-mentioned courseware page after adjustment, and b is the length of the area reserved on the left side of the above-mentioned courseware page; according to the above-mentioned second horizontal distance and the above-mentioned second vertical distance, the layout position of the above-mentioned target picture on the above-mentioned courseware page is adjusted, and according to the above-mentioned first horizontal distance and the above-mentioned first vertical distance, the layout position of the above-mentioned target text box on the above-mentioned courseware page is adjusted.
[0187] In one possible implementation, the adjustment module 1103 is specifically used for: if the above-mentioned courseware page is a third-category courseware page, then determining the main text in the above-mentioned courseware page according to the above-mentioned text hierarchy; wherein, the above-mentioned third-category courseware page includes n text boxes in addition to the text box where the first-level title is located, and the above-mentioned n text boxes are the target text boxes where the above-mentioned main text is located, n is greater than 1, the number of target images included in the above-mentioned third-category courseware page is less than a preset number threshold, and the area of the above-mentioned target image is greater than the first preset area and less than the second preset area; obtaining the first height of the text box where the above-mentioned first-level title is located, the second height of the above-mentioned courseware page, and the third height of each of the above-mentioned n text boxes; while maintaining the above-mentioned contextual logical relationship unchanged, adjusting the vertical spacing between the above-mentioned n text boxes according to the above-mentioned first height, the above-mentioned second height and the above-mentioned third height to obtain the adjusted courseware page.
[0188] In one possible implementation, the adjustment module 1103 is specifically used for: if the above-mentioned courseware page is a fourth-category courseware page, then determining the first-level title in the above-mentioned courseware page based on the above-mentioned text hierarchy; wherein, the above-mentioned fourth-category courseware page includes target teaching elements; while maintaining the above-mentioned contextual logical relationship unchanged, adjusting the first-level title in the above-mentioned courseware page by any of the following methods to obtain an adjusted courseware page: adjusting the above-mentioned first-level title to the upper left corner of the above-mentioned courseware page, unifying the font of the above-mentioned first-level title, and adjusting the font size of the above-mentioned first-level title.
[0189] It should be noted that the courseware beautification device provided in the above embodiment only uses the division of the above functional modules as an example when executing the courseware beautification method. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the courseware beautification device provided in the above embodiment and the courseware beautification method embodiment are of the same concept. Therefore, for details not disclosed in the device embodiment of this application, please refer to the above-mentioned courseware beautification method embodiment of this application, and no further details will be given here.
[0190] Figure 12 This is a structural diagram of an electronic device provided in an embodiment of the present application.
[0191] For example, Figure 12 As shown, the electronic device includes: a memory 1201 and a processor 1202, wherein the memory 1201 stores executable program code, and the processor 1202 is used to call and execute the executable program code to perform a courseware beautification method.
[0192] In this embodiment, the electronic device can be divided into functional modules according to the above-described method example. For example, each functional module can be mapped to a specific function, or two or more functions can be integrated into a single processing module. The integrated module can be implemented in hardware. It should be noted that the module division in this embodiment is illustrative and represents only a logical functional division. In actual implementation, other division methods may be used.
[0193] When the functional modules are divided according to their functions, the electronic device may include a reading module, a conversion module, a fusion module, etc. It should be noted that all relevant contents of the steps involved in the above method embodiment can be referred to the functional description of the corresponding functional modules and will not be repeated here.
[0194] The electronic device provided in this embodiment is used to execute the above-mentioned courseware beautification method, and thus can achieve the same effect as the above-mentioned implementation method.
[0195] In the case of an integrated unit, the electronic device may include a processing module and a storage module. The processing module may be used to control and manage the operation of the electronic device, and the storage module may be used to support the electronic device in executing mutual program codes and data.
[0196] The processing module may be a processor or controller that implements or executes the various exemplary logic blocks, modules, and circuits described in conjunction with the disclosure of this application. The processor may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a digital signal processing (DSP) and a microprocessor, and the storage module may be a memory.
[0197] This embodiment also provides a computer-readable storage medium, which stores computer program code. When the computer program code runs on a computer, the computer executes the above-mentioned related method steps to implement a courseware beautification method in the above-mentioned embodiment.
[0198] This embodiment further provides a computer program product. When the computer program product is run on a computer, the computer is caused to execute the above-mentioned related steps to implement a courseware beautification method in the above-mentioned embodiment.
[0199] In addition, the electronic device provided in the embodiments of the present application can specifically be a chip, component or module, and the electronic device may include a connected processor and memory; wherein the memory is used to store instructions, and when the electronic device is running, the processor can call and execute instructions to enable the chip to execute a courseware beautification method in the above embodiment.
[0200] Among them, the electronic device, computer-readable storage medium, computer program product or chip provided in this embodiment are all used to execute the corresponding methods provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding methods provided above, and will not be repeated here.
[0201] Through the description of the above implementation methods, technical personnel in the relevant field can understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be distributed and completed by different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.
[0202] In the embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely schematic. For example, the division of modules or units is only a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another device, 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 devices or units, which can be electrical, mechanical or other forms.
[0203] The above content is merely a specific embodiment of the present application, but the scope of protection of the present application is not limited thereto. Any changes or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in this application should be included in the scope of protection of the present application. Therefore, the scope of protection of the present application should be based on the scope of protection of the claims.
Claims
1. A courseware beautification method, characterized in that: The method comprises: Classifying the text elements of the courseware page to be beautified into different levels to obtain the text levels of the text elements; Determining semantic information of text elements of a target text level in the courseware page according to the text level, and determining contextual logical relationships between text elements of the target text level according to the semantic information; According to the text level and the contextual logical relationship, the page layout of the courseware page is adjusted to obtain an adjusted courseware page; wherein the contextual logical relationship in the adjusted courseware page is the same as that in the courseware page before the adjustment.
2. The method according to claim 1, characterized in that The target text level includes secondary headings and body text.
3. The method according to claim 1 or 2, characterized in that Determining semantic information of text elements at a target text level in the courseware page based on the text level, and determining contextual logical relationships between text elements at the target text level based on the semantic information, includes: Inputting the text elements of the text level, the text level and the text identifiers of the text elements into a large language model to output contextual logical relationships between the text elements of the target text level; In which, the large language model outputs the contextual logical relationship according to preset rules, and the preset rules are: performing semantic understanding on the text elements of the input target text level to obtain semantic information of the text elements of the target text level, and outputting the contextual logical relationship in a preset format based on the semantic information; the contextual logical relationship output in the preset format is: the relationship between the text identifiers, and the relationship between the text identifiers represents the contextual logical relationship between the text elements corresponding to the text identifiers.
4. The method according to claim 1, wherein The step of adjusting the page layout of the courseware page according to the text level and the contextual logical relationship to obtain the adjusted courseware page includes: If the courseware page is a first-category courseware page, determining the body text in the courseware page according to the text hierarchy; wherein the first-category courseware page includes a text box in addition to the text box where the first-level title is located, the text box being a target text box where the body text is located, and the first-category courseware page does not include a target image, and the area of the target image is greater than a first preset area and smaller than a second preset area; Obtaining first size information of the target text box and second size information of the courseware page; While maintaining the contextual logical relationship unchanged, the position of the target text box on the courseware page is adjusted to the center according to the first size information and the second size information to obtain an adjusted courseware page.
5. The method according to claim 4, characterized in that The first size information includes: the width of the target text box w and height text h The second size information includes the width of the courseware page slide w and height slide h ; The step of centering the target text box on the courseware page according to the first size information and the second size information to obtain an adjusted courseware page includes: The position information of the adjusted target text box on the courseware page is calculated using the following formula: Among them, text x The first horizontal distance between the left border of the target text box and the left border of the courseware page after adjustment, text y The first vertical distance between the upper boundary of the target text box and the upper boundary of the courseware page after adjustment; The position of the target text box on the courseware page is adjusted to the center according to the first horizontal distance and the first vertical distance to obtain an adjusted courseware page.
6. The method according to claim 1, characterized in that The step of adjusting the page layout of the courseware page according to the logical relationship between the text levels and the text elements to obtain the adjusted courseware page includes: If the courseware page is a second-category courseware page, determining the body text and the target image in the courseware page according to the text hierarchy; wherein the second-category courseware page includes a text box in addition to the text box where the first-level title is located, the text box being the target text box where the body text is located, and the second-category courseware page includes a target image, the area of which is larger than the first preset area and smaller than the second preset area; Obtaining first size information of the target text box, second size information of the courseware page, and third size information of the target image; While maintaining the contextual logical relationship unchanged, the layout positions of the target text box and the target image on the courseware page are adjusted according to the first size information, the second size information and the third size information to obtain an adjusted courseware page; wherein, the adjusted target text box is located on one side of the courseware page, the adjusted target image is located on the other side of the courseware page, and the horizontal center line of the adjusted target text box coincides with the horizontal center line of the adjusted target image.
7. The method according to claim 6, characterized in that The first size information includes: the width of the target text box w and height text h The second size information includes the width of the courseware page slide w and height slide h The third size information includes the width of the target picture pic w and height pic h ; The adjusting the layout positions of the target text box and the target image on the courseware page according to the first size information, the second size information, and the third size information includes: The position information of the adjusted target image on the courseware page is calculated using the following formula: pic x =slide w -pic w -a Among them, pic x The second horizontal distance between the left edge of the target image and the left edge of the courseware page after adjustment, pic y is the second longitudinal distance between the upper boundary of the target image and the upper boundary of the courseware page after adjustment, and a is the length of the area reserved on the right side of the courseware page; The adjusted layout position of the target text box on the courseware page is calculated using the following formula: text x =slide w -pic w -text w -b Among them, text x The first horizontal distance between the left border of the target text box and the left border of the courseware page after adjustment, text y is the first longitudinal distance between the upper boundary of the target text box and the upper boundary of the courseware page after adjustment, and b is the length of the area reserved on the left side of the courseware page; The layout position of the target image on the courseware page is adjusted according to the second horizontal distance and the second vertical distance, and the layout position of the target text box on the courseware page is adjusted according to the first horizontal distance and the first vertical distance.
8. The method according to claim 1, characterized in that The step of adjusting the page layout of the courseware page according to the logical relationship between the text levels and the text elements to obtain the adjusted courseware page includes: If the courseware page is a third-category courseware page, determining the body text in the courseware page according to the text hierarchy; wherein the third-category courseware page includes n text boxes in addition to the text box where the first-level title is located, the n text boxes are target text boxes where the body text is located, n is greater than 1, the number of target images included in the third-category courseware page is less than a preset number threshold, and the area of the target image is greater than a first preset area and less than a second preset area; Get the first height of the text box where the first-level title is located, the second height of the courseware page, and the third height of each of the n text boxes; While maintaining the contextual logical relationship unchanged, the vertical intervals between the n text boxes are adjusted according to the first height, the second height and the third height to obtain an adjusted courseware page.
9. The method according to claim 1, characterized in that The step of adjusting the page layout of the courseware page according to the logical relationship between the text levels and the text elements to obtain the adjusted courseware page includes: If the courseware page is a fourth-category courseware page, determining a first-level title in the courseware page based on the text level; wherein the fourth-category courseware page includes a target teaching element; While maintaining the contextual logical relationship unchanged, the first-level title in the courseware page is adjusted by any of the following methods to obtain an adjusted courseware page: Adjust the first-level title to the upper left corner of the courseware page, unify the font of the first-level title, and adjust the font size of the first-level title.
10. A courseware beautification device, characterized in that: The device comprises: A hierarchical classification module is used to hierarchically classify the text elements of the courseware page to be beautified and obtain the text hierarchy of the text elements; A determination module, configured to determine semantic information of text elements of a target text level in the courseware page according to the text level, and to determine contextual logical relationships between text elements of the target text level according to the semantic information; The adjustment module is used to adjust the page layout of the courseware page according to the text level and the contextual logical relationship to obtain an adjusted courseware page; wherein the contextual logical relationship in the adjusted courseware page is the same as that in the courseware page before the adjustment.
11. An electronic device, characterized in that: The electronic device comprises: a memory for storing executable program code; A processor is configured to call and run the executable program code from the memory, so that the electronic device executes the method according to any one of claims 1 to 9.
12. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed, the method according to any one of claims 1 to 9 is implemented.