Page layout model establishing method and page layout making method and device
By building a page layout model of natural language instructions, users can flexibly generate or adjust the page layout of PPT files, solving the problem of cumbersome template selection in the existing technology and improving the user experience.
Patent Information
- Application Number
- CN202410207917.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-02-26
- Publication Date
- 2025-08-26
AI Technical Summary
In the prior art, users need to select and fill templates when making PPT files. The process is cumbersome and the template cannot fully meet the needs, resulting in poor user experience.
By obtaining page element information and layout information of sample PPT files, building natural language instructions, generating training data sets, and training page layout models, users can flexibly generate or adjust the page layout of PPT files based on natural language instructions.
It reduces the time for users to select and create templates, and improves the flexibility and user experience of PPT file production.
Smart Images

Figure CN120541245A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of machine learning, and more specifically, to a method for establishing a page layout model, a method for producing a page layout, and an apparatus for producing the page layout in the field of machine learning. Background Art
[0002] As the application level of PPT (PowerPoint, presentation) gradually improves and its application fields become wider and wider, PPT is becoming an important part of people's work and life, occupying a pivotal position in work reports, corporate publicity, product promotion, wedding celebrations, project bidding, management consulting, education and training and other fields.
[0003] However, a complete PPT file typically includes: an opening sequence, animation, cover, preface, table of contents, transition pages, chart pages, image pages, text pages, back cover, and ending animation. Materials used include text, images, charts, animations, sounds, videos, and more. Therefore, creating a beautiful PPT, especially perfecting its layout, is a time-consuming and laborious task for most people.
[0004] In existing technology, users can create PPTs based on pre-made templates or use algorithms to fill page content into pre-made templates. This requires technicians to prepare a large number of templates in advance. Before creating a PPT based on a template, users must first select a template that suits them and fill in the corresponding content based on the selected template. However, templates cannot fully meet users' needs for page content, and collecting and selecting templates is a cumbersome task. The template format is fixed, and using templates to create PPT files is not flexible enough, resulting in a poor user experience. Summary of the Invention
[0005] The present application provides a method for establishing a page layout model, a method for producing a page layout, and a device. The method enables users to flexibly generate or adjust the page layout of a PPT file based on the page layout model without having to produce a large number of templates in advance, which can save users time spent on selecting templates, facilitate users to create PPT files, and improve users' usage experience.
[0006] In a first aspect, a method for establishing a page layout model is provided, the method comprising: obtaining a sample PPT file; extracting page element information and page layout information from the sample PPT file; constructing a natural language instruction corresponding to the sample PPT file based on the page element information and the page layout information; wherein the natural language instruction is used to indicate that the page element information is laid out based on the page layout information; determining a training data set based on the page element information, the page layout information and the natural language instruction; and generating a page layout model through training based on the training data set, so that a user can generate or adjust the page layout of a target PPT file based on the page layout model.
[0007] In the above technical solution, by extracting the page element information and page layout information from the sample PPT file, natural language instructions for indicating the layout of the page element information based on the page layout information are constructed to obtain a training data set. Subsequently, training can be performed based on the obtained training data set to generate a page layout model capable of parsing the user's natural language instructions. This allows the user to flexibly generate or adjust the page layout based on the natural language instructions after obtaining the page layout model, and facilitates the user to create PPT files without having to prepare a large number of templates in advance. This can save the user time spent on selecting templates, facilitate the user to create PPT files, and improve the user experience.
[0008] In combination with the first aspect, in some possible implementations, the natural language instructions include a first natural language instruction, and the page layout information includes: layout coordinate information, based on the page element information and the page layout information, constructing a natural language instruction corresponding to the sample PPT file, including: based on the page element information and the layout coordinate information corresponding to the page element information, constructing a first natural language instruction corresponding to the page element information; the first natural language instruction is used to generate the page layout.
[0009] In the above technical solution, the first natural language instruction for generating the page layout is constructed through a sample PPT file to obtain a training data set, which can enable the page layout model subsequently trained based on the training data set to have the ability to parse the natural language instructions for generating the page layout, so that the user can generate the page layout based on the natural language instructions after obtaining the page layout model, thereby realizing flexible creation of PPT files.
[0010] In combination with the first aspect and the above-mentioned implementation methods, in some possible implementation methods, the natural language instruction includes a second natural language instruction, the page layout information includes: layout coordinate information and layout size information, and constructing a natural language instruction corresponding to the sample PPT file based on the page element information and the page layout information includes: based on at least two page element information in the page element information and the layout coordinate information and layout size information corresponding to the at least two page element information, constructing a second natural language instruction corresponding to the at least two page element information; the second natural language instruction is used to adjust the page layout.
[0011] In combination with the first aspect and the above-mentioned implementation manner, in some possible implementation manners, when the at least two page element information include first page element information and second page element information, the second natural language instruction includes an element exchange instruction, and based on the at least two page element information in the page element information and the layout coordinate information and layout size information corresponding to the at least two page element information, a second natural language instruction corresponding to the at least two page element information is constructed, including: based on the first page element information, the layout coordinate information and layout size information corresponding to the first page element information, the second page element information, and the layout coordinate information and layout size information corresponding to the second page element information, an element exchange instruction for exchanging the first page element information and the second page element information is constructed; when at least When the two page element information include first page element information and candidate page element information adjacent to the first page element information, the second natural language instruction includes an element insertion instruction, and based on at least two page element information in the page element information and the layout coordinate information and layout size information corresponding to the at least two page element information, a second natural language instruction corresponding to the at least two page element information is constructed, including: based on the first page element information, the layout coordinate information and layout size information corresponding to the first page element information, the candidate page element information, and the layout coordinate information and layout size information corresponding to the candidate page element information, an element insertion instruction for inserting the first page element information into a target area is constructed, and the target area is an area adjacent to the area to which the candidate page element information belongs.
[0012] In the above technical solution, the second natural language instruction for adjusting the page layout is constructed through a sample PPT file: an element replacement instruction and an element insertion instruction. This can enable the subsequent page layout model trained based on the training data set to have the ability to parse the natural language instructions for adjusting the page layout, so that the user can adjust the page layout based on the natural language instructions after obtaining the page layout model, thereby realizing flexible creation of PPT files.
[0013] In combination with the first aspect and the above-mentioned implementation methods, in some possible implementation methods, the training data set is trained to generate a page layout model, including: inputting page element information, page layout information corresponding to the page element information, and natural language instructions into a pre-trained generative large model for training to obtain a page layout model.
[0014] In the above technical solution, training is performed based on the pre-trained generative large model and the page element information of the sample PPT file, the page layout information corresponding to the page element information, and the natural language instructions. The trained page layout model can have the ability to understand and generate natural language, as well as the ability to parse and adjust the page layout information of the PPT file.
[0015] In summary, this application extracts page element information and page layout information from a sample PPT file, constructs natural language instructions for indicating the layout of the page element information based on the page layout information, and obtains a training dataset. This allows subsequent training based on the obtained training dataset to generate a page layout model capable of parsing user natural language instructions. This facilitates the user to flexibly generate or adjust the page layout based on the natural language instructions after obtaining the page layout model, making it easier for the user to create a PPT file without having to prepare a large number of templates in advance, saving the user time spent on selecting templates, facilitating the user's creation of PPT files, and improving the user experience. The first natural language instructions for generating a page layout are constructed from the sample PPT file to obtain a training dataset. This allows the page layout model subsequently trained based on the training dataset to have the ability to parse the natural language instructions for generating a page layout, making it easier for the user to generate a page layout based on the natural language instructions after obtaining the page layout model, thus achieving flexible creation of PPT files. The second natural language instructions for adjusting the page layout: element swap instructions and element insert instructions are constructed from the sample PPT file. This allows the page layout model subsequently trained based on the training dataset to have the ability to parse the natural language instructions for adjusting the page layout, making it easier for the user to adjust the page layout based on the natural language instructions after obtaining the page layout model, thus achieving flexible creation of PPT files. Training is performed based on the pre-trained generative large model and the page element information of the sample PPT file, the page layout information corresponding to the page element information, and natural language instructions. The trained page layout model can have the ability to understand and generate natural language, as well as the ability to parse and adjust the page layout information of the PPT file.
[0016] In the second aspect, a method for producing a page layout is provided, which includes: collecting the user's target natural language instructions; inputting the target natural language instructions into a page layout model to obtain target page layout information; wherein the page layout model is pre-established using the method provided in the first aspect above; and generating or adjusting the page layout of the target PPT file based on the target page layout information.
[0017] In the above technical solution, users can flexibly generate or adjust the page layout of PPT files based on the page layout model without having to prepare a large number of templates in advance, which can save users the time spent on selecting templates, facilitate users to create PPT files, and improve users' usage experience.
[0018] On the third aspect, a device for establishing a surface layout model is provided, which includes: an acquisition module for acquiring a sample PPT file; an extraction module for extracting page element information and page layout information in the sample PPT file; a construction module for constructing natural language instructions corresponding to the sample PPT file based on the page element information and page layout information; wherein the natural language instructions are used to indicate that the page element information is laid out based on the page layout information; a determination module for determining a training data set based on the page element information, page layout information and natural language instructions; and a training module for generating a page layout model through training based on the training data set, so that the user can generate or adjust the page layout of the target PPT file based on the page layout model.
[0019] In combination with the third aspect, in some possible implementations, the natural language instruction includes a first natural language instruction, and the page layout information includes: layout coordinate information. The construction module is specifically used to construct a first natural language instruction corresponding to the page element information based on the page element information and the layout coordinate information corresponding to the page element information; the first natural language instruction is used to generate the page layout.
[0020] In combination with the third aspect and the above-mentioned implementation methods, in some possible implementation methods, the natural language instruction includes a second natural language instruction, the page layout information includes: layout coordinate information and layout size information, and the construction module is specifically used to construct a second natural language instruction corresponding to at least two page element information based on at least two page element information in the page element information and the layout coordinate information and layout size information corresponding to the at least two page element information; the second natural language instruction is used to adjust the page layout.
[0021] In combination with the third aspect and the above-mentioned implementation methods, in some possible implementation methods, when at least two page element information include first page element information and second page element information, the second natural language instruction includes an element exchange instruction, and the construction module is specifically used to construct an element exchange instruction for exchanging the first page element information and the second page element information based on the first page element information, the layout coordinate information and layout size information corresponding to the first page element information, the second page element information, and the layout coordinate information and layout size information corresponding to the second page element information; when at least two page element information include first page element information and candidate page element information adjacent to the first page element information, the second natural language instruction includes an element insertion instruction, and the construction module is specifically used to construct an element insertion instruction for inserting the first page element information into the target area based on the first page element information, the layout coordinate information and layout size information corresponding to the first page element information, the candidate page element information, and the layout coordinate information and layout size information corresponding to the candidate page element information, where the target area is an area adjacent to the area to which the candidate page element information belongs.
[0022] In combination with the third aspect and the above-mentioned implementation methods, in some possible implementation methods, the training module is specifically used to input page element information, page layout information corresponding to the page element information, and natural language instructions into a pre-trained generative large model for training to obtain a page layout model.
[0023] In a fourth aspect, a device for producing a page layout is provided, which includes: an acquisition module for acquiring the user's target natural language instructions; a parsing module for inputting the target natural language instructions into a page layout model to obtain target page layout information; wherein the page layout model is pre-established using the device provided in the third aspect above; and a layout module for generating or adjusting the page layout of a target PPT file based on the target page layout information.
[0024] In a fifth 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, causing the electronic device to perform the method of the first aspect or any possible implementation of the first aspect, or causing the electronic device to perform the method of the second aspect.
[0025] In a sixth aspect, a computer program product is provided, which includes: computer program code, which, when running on a computer, enables the computer to execute the method in the first aspect or any possible implementation of the first aspect, or enables the computer to execute the method in the second aspect.
[0026] In the seventh 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, or the computer executes the method in the above-mentioned second aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] Figure 1 This is a flow chart of a method for establishing a page layout model provided in an embodiment of the present application.
[0028] Figure 2 This is a schematic diagram of a page layout provided in an embodiment of the present application.
[0029] Figure 3 This is a schematic diagram of a sample page provided in an embodiment of the present application.
[0030] Figure 4 This is a schematic flow chart of a method for creating a page layout provided in an embodiment of the present application.
[0031] Figure 5 It is a structural diagram of a device for establishing a page layout model provided in an embodiment of the present application.
[0032] Figure 6 It is a structural diagram of a page layout production device provided in an embodiment of the present application.
[0033] Figure 7 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0034] 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.
[0035] 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.
[0036] Creating a PPT file usually requires content such as opening credits, animation, cover, preface, table of contents, transition page, chart page, picture page, text page, back cover, and ending animation.
[0037] In existing technologies, users can create PPT files based on pre-made templates or by using algorithms to fill page content into pre-made templates. This process requires users to first select a template that suits them from a large number of pre-made templates and then fill in the corresponding content based on the selected template. However, templates cannot fully meet users' needs for page content, and collecting and selecting templates is a tedious task. Templates are fixed in format, and creating PPT files using templates is not flexible enough, resulting in a poor user experience.
[0038] Based on this, this application proposes a method for establishing a page layout model, which is applied to an electronic device. The electronic device can establish a page layout model based on a sample PPT file, allowing users to flexibly create PPT files based on the established page layout model, thereby improving the user experience.
[0039] Figure 1 This is a flow chart of a method for establishing a page layout model provided in an embodiment of the present application.
[0040] For example, Figure 1 , the method 100 comprises:
[0041] Step 101: Obtain a sample PPT file.
[0042] The sample PPT file is a user-created PPT file that includes complete PPT content. After creating a PPT using the PPT creation software, the user can authorize the software so that the model builder can access the completed PPT file and obtain the sample PPT file.
[0043] In some embodiments, the sample PPT file may also include a pre-created PPT template file. It should be understood that when a user creates a PPT file based on a template, they may modify the created template, or they may create a PPT file based on a blank file. Therefore, when the sample PPT file is a PPT template file, the tester may also obtain the template of the PPT file that the user has already created to obtain the sample PPT file.
[0044] It should be understood that the obtained sample PPT file can be a high-quality PPT file with a reasonable and beautiful page layout.
[0045] Step 102: extracting page element information and page layout information from the sample PPT file;
[0046] A sample PTT file includes at least one sample PPT page. The sample page may include various content, such as a primary title, a secondary title, text, and images. The content of the sample page is the page element information included in the page. Each page element occupies a specific area and position on the PPT page. The information describing the area and position of each page element on the PPT page is called page layout information.
[0047] After obtaining the sample PPT file, the sample pages included in each sample PPT file may be determined based on the sample PPT file, and then the page element information and page layout information included in each sample page may be determined.
[0048] Step 103: constructing a natural language instruction corresponding to the sample PPT file based on the page element information and the page layout information;
[0049] The natural language instruction is used to instruct the layout of the page element information based on the page layout information.
[0050] Natural language is an organic and naturally developed form of written and oral communication. The natural language instructions in this application are natural language spoken by the user to indicate the placement of page element information based on a certain position.
[0051] After determining the page element information and page layout information of each sample page, a natural language instruction corresponding to the sample PPT file can be constructed based on the page element information and page layout information to instruct the page element information to perform page layout based on the page layout information, that is, an instruction set can be obtained.
[0052] Step 104: determining a training data set based on the page element information, the page layout information, and the natural language instructions;
[0053] After obtaining the natural language instructions, the page element information, page layout information and constructed natural language instructions can be used as a training data set.
[0054] In one possible implementation, the natural language instructions include a first natural language instruction, and the page layout information includes: layout coordinate information. Based on the page element information and the page layout information, a natural language instruction corresponding to the sample PPT file is constructed, including: based on the page element information and the layout coordinate information corresponding to the page element information, a first natural language instruction corresponding to the page element information is constructed; the first natural language instruction is used to generate the page layout.
[0055] Among them, the layout coordinate information can be the coordinate information of each page element information. Specifically, it can be the coordinate information of the center of the area occupied by the page element information. Alternatively, the layout coordinate information can also be the coordinate information of the upper left vertex of the rectangular box of the area occupied by the page element information. The embodiment of the present application is not limited to this. The layout coordinate information can be specifically expressed based on (x, y) in a rectangular coordinate system, and the lower left corner of each PPT page can be recorded as the origin of the rectangular coordinate system.
[0056] It should be understood that a user may create a PPT file based on a blank file, which only includes a blank page without a page layout. In this case, a page layout needs to be generated on the blank page based on the user's layout intention. Specifically, the user's layout intention may be to place target page element information at a target location on the blank page. The generated page layout may be to divide the blank page into areas based on the target page element information and the target location.
[0057] For example, assuming that the user's layout intention is to place a first-level title at the top center of a blank page, body text on the left, and an image on the right, the blank page target page can be divided into regions based on the natural language instructions containing the user's layout intention. The generated page layout is as follows: Figure 2 As shown, it includes area 1 for placing a first-level title, area 2 for placing body text, and area 3 for placing a picture.
[0058] The sample PPT file includes sample pages, and each sample page includes page element information and layout coordinate information of each page element information. At this time, natural language instructions for generating page layout can be constructed based on the page element information and the layout coordinate information of each page element information to obtain a training data set based on the sample PPT file.
[0059] Figure 3 This is a schematic diagram of a sample page provided in an embodiment of the present application.
[0060] For example, Figure 3 As shown, the page element information of the page includes element 1, element 2, element 3, element 4, and element 5, wherein the layout coordinate information of element 1 is (x1, y1), the layout coordinate information of element 2 is (x2, y2), the layout coordinate information of element 3 is (x3, y3), the layout coordinate information of element 4 is (x4, y4), and the layout coordinate information of element 5 is (x5, y5). Based on element 1 and its layout coordinate information (x1, y1), a first natural language instruction for placing element 1 at (x1, y1) can be constructed, for example, "I want to place element 1 at position (x1, y1)". Based on element 2 and its layout coordinate information (x2, y2), a first natural language instruction for placing element 2 at position (x2, y2) can be constructed, for example, "I want to place element 2 at position (x2, y2).".
[0061] In some embodiments, the page can be divided into regions based on the page elements and their coordinate information, and natural language instructions can be constructed to place the page elements in the corresponding regions. For example, the regions are divided to obtain region 11 where element 1 is located, region 12 where element 2 is located, region 13 where element 3 is located, region 14 where element 4 is located, and region 15 where element 5 is located; wherein region 11 contains the layout coordinate information (x1, y1) of element 1, region 12 contains the layout coordinate information (x2, y2) of element 2, region 13 contains the layout coordinate information (x3, y3) of element 3, region 14 contains the layout coordinate information (x4, y4) of element 4, and region 15 contains the layout coordinate information (x5, y5) of element 5. Based on element 1 and its layout coordinate information (x1, y1), a first natural language instruction can be constructed to place element 1 in region 11, such as "I want to place element 1 in region 11." Based on element 2 and its layout coordinate information (x2, y2), a first natural language instruction can be constructed to place element 2 in region 12, such as "I want to place element 2 in region 12."
[0062] In the above method, the first natural language instruction for generating the page layout is constructed through a sample PPT file to obtain a training data set, which can enable the page layout model subsequently trained based on the training data set to have the ability to parse the natural language instructions for generating the page layout, making it convenient for users to generate the page layout based on the natural language instructions after obtaining the page layout model, thereby realizing flexible creation of PPT files.
[0063] In one possible implementation, the natural language instruction includes a second natural language instruction, and the page layout information includes: layout coordinate information and layout size information. The natural language instruction corresponding to the sample PPT file is constructed based on the page element information and the page layout information, including: based on at least two page element information in the page element information and the layout coordinate information and layout size information corresponding to the at least two page element information, constructing a second natural language instruction corresponding to the at least two page element information; the second natural language instruction is used to adjust the page layout.
[0064] Among them, the layout size information can be the size information of the page element information. It should be understood that when the page element information is placed on the page, it will occupy a certain area or region, and the occupied area or region is the size information of the page element. The layout size information can be expressed by the proportion of the page element information occupied by the page, or it can be expressed by the (length value l, width value w) of the area occupied by the page element information. This embodiment of the application is not limited to this.
[0065] The user may adjust the created PPT file, specifically, adjust the target page in the created PPT file. It should be understood that the created PPT file may include multiple PPT pages, and the target page is any page in the created PPT file.
[0066] The target page of the created PPT file already has a page layout, that is, page element information such as element a and element b has been placed in the target page, and the page element information such as element a and element b already occupies a certain area in the target page (that is, the above elements have a certain size). The user's adjustment to the target page may specifically be that the user wants to adjust the positions of at least two elements in the page element information such as element a and element b. If the page already has a layout, the adjustment needs to be made based on the positions of the at least two elements and the area occupied by the at least two elements in the target page.
[0067] As in the above embodiment, the sample PPT file includes sample pages, and each sample page includes page element information, layout coordinate information of each page element information, and layout size information of each page element information. At this time, a second natural language instruction for adjusting the page layout can be constructed based on at least two page element information in the page element information and the layout coordinate information and layout size information of at least two page element information to obtain a training data set based on the sample PPT file.
[0068] Specifically, adjusting the page layout may include replacing elements and inserting elements. The following embodiment illustrates this situation:
[0069] In one possible implementation, when at least two page element information include first page element information and second page element information, the second natural language instruction includes an element exchange instruction, and based on at least two page element information in the page element information and the layout coordinate information and layout size information corresponding to the at least two page element information, a second natural language instruction corresponding to the at least two page element information is constructed, including: based on the first page element information, the layout coordinate information and layout size information corresponding to the first page element information, the second page element information, and the layout coordinate information and layout size information corresponding to the second page element information, an element exchange instruction for exchanging the first page element information and the second page element information is constructed.
[0070] There is a situation where the user wants to swap the positions of elements that have been placed on the target page. As in the above embodiment, the target page includes page element information such as element a and element b, and the page element information such as element a and element b already occupies a certain area in the target page. At this time, the page layout of the target page can be adjusted based on the user's swap intention. Specifically, the user's swap intention can be to swap the positions of element a and element b.
[0071] It should be understood that element swapping is generally swapping between two elements in the same page, and swapping between multiple elements can be decomposed into multiple swaps between two elements. The two elements for swapping can be any two elements in the page.
[0072] As in the above embodiment, the sample PPT file includes sample pages. When each sample page includes first page element information and second page element information as well as their respective layout coordinate information and layout size information, an element exchange instruction for adjusting the page layout by exchanging the first page element information and the second page element information can be constructed based on the first page element information and the second page element information as well as their respective layout coordinate information and layout size information of the sample page, so as to obtain a training data set based on the sample PPT file.
[0073] The first page element information and the second page element information can be any two elements in the above-mentioned sample page. Before constructing the instruction, it can be determined whether there is a situation where the page element information overlaps or the page element information overflows the page based on the layout coordinate information and layout size information of the first page element information and the layout coordinate information and layout size information of the second page element information. When it is determined that there will be no page element information overlap or page element information overflow, an element exchange instruction is constructed to place the first page element information with the layout coordinate information of the second page element information and to place the second page element information with the layout coordinate information of the first page element information.
[0074] For example, Figure 3 As shown, the layout size information of element 2 and element 4 is the same. Assuming that the first page element information is element 2 and the second page element information is element 4, and the layout size information of element 2 and element 4 is the same, combined with the layout coordinate information of element 2 and element 4, it can be determined that after the swap, there will be no overlap of page element information or overflow of page element information. At this time, based on the layout coordinate information of element 2 and element 4, an element swap instruction of "put element 2 at the position of element 4 and put element 4 at the position of element 2" can be constructed, or an element swap instruction of "swap element 2 with element 4" can be constructed.
[0075] When it is determined that page element information overlaps or overflows the page after direct swapping, the page element information in the first page element information and the second page element information that will overlap or overflow the page is first determined, and then a new layout coordinate information is re-determined based on the overlapping area size or the overflow area size of the page, so that the swapped page element information will not overlap or overflow the page, and the first page element information and the second page element information are swapped based on the new layout coordinate information.
[0076] For example, Figure 3As shown, the layout size information of element 4 and element 5 are different, wherein the layout size information of element 4 is (l4, w4), and the layout size information of element 5 is (l5, w5). Assuming that the first page element information is element 4 and the second page element information is element 5, it is determined based on the layout size information of elements 4 and 5 that there is overlap of page element information after direct swapping, and the overlapping page elements are elements 4 and 5. Combining the coordinates of elements 4 and 5, it is determined that element 5 cannot move upward after swapping. In order to eliminate the overlap, element 4 can only be translated downward. Based on the overlapping area, the coordinates of element 4 to be placed are re-determined as (x, y5). Then, based on the layout coordinate information of element 4 before swapping and the re-determined layout coordinate information, an element swap instruction of "place element 5 at the position of element 4 and place element 4 at the position of element 5, and translate element 4 downward" is constructed. Alternatively, in some embodiments, an element swap instruction of "swap elements 4 and 5 based on the layout coordinate information and layout size information of elements 4 and 5" can be directly constructed.
[0077] In one possible implementation, when at least two page element information include first page element information and candidate page element information adjacent to the first page element information, the second natural language instruction includes an element insertion instruction, and based on at least two page element information in the page element information and the layout coordinate information and layout size information corresponding to the at least two page element information, a second natural language instruction corresponding to the at least two page element information is constructed, including: based on the first page element information, the layout coordinate information and layout size information corresponding to the first page element information, the candidate page element information, and the layout coordinate information and layout size information corresponding to the candidate page element information, an element insertion instruction for inserting the first page element information into a target area is constructed, and the target area is an area adjacent to the area to which the candidate page element information belongs.
[0078] There is also a situation where the user inserts an element next to an element already placed on the page. As in the above embodiment, the target page includes page element information such as element a and element b, and the page element information such as element a and element b already occupies a certain area in the target page. At this time, the page layout of the target page can be adjusted based on the user's insertion intention. Specifically, the user's insertion intention can be to insert element c between element a and element b.
[0079] As in the above embodiment, the sample PPT file includes sample pages. When each sample page includes first page element information, candidate page element information adjacent to the first page element information, and their respective layout coordinate information and layout size information, an element insertion instruction can be constructed based on the first page element information and candidate page element information of the sample page, and their respective layout coordinate information and layout size information, to insert the first page element information into an area adjacent to an area to which the candidate page element information belongs, thereby obtaining a training dataset based on the sample PPT file. The first page element information can be any element in the sample page.
[0080] For example, Figure 3 As shown, the sample page includes element 1, element 2, element 3, element 4 and element 5. Assuming that the first page element information is element 2, and the candidate page element information adjacent to element 2 is element 1 and element 3, an element insertion instruction for inserting element 2 between element 1 and element 3 can be constructed based on element 1, element 2, element 3 and their respective layout coordinate information and layout size information, for example, "I want to put element 2 between element 1 and element 3."
[0081] In some embodiments, the first page element information may also be element 1, and the candidate page element information may also be element 2 adjacent to element 1. An element insertion instruction for inserting element 1 above element 2 may be constructed based on element 1, element 2 and their respective layout coordinate information and layout size information.
[0082] In the above method, the second natural language instruction for adjusting the page layout is constructed through the sample PPT file: the element replacement instruction and the element insertion instruction. This can enable the subsequent page layout model trained based on the training data set to have the ability to parse the natural language instructions for adjusting the page layout, so that the user can adjust the page layout based on the natural language instructions after obtaining the page layout model, thereby realizing flexible creation of PPT files.
[0083] In some embodiments, the page element information also includes a corresponding format. Natural language instructions for adjusting or generating the page element information format can be constructed based on the page element information included in the sample PPT file and the format information corresponding to the page element information to obtain a training data set.
[0084] For example, when the page element information is text, the text also includes formatting information such as font, color, and size. Based on the text and its formatting information, natural language instructions for generating or adjusting the font, color, and size of the text can be constructed to obtain a training dataset. This enables a page layout model trained based on the training dataset to parse natural language instructions for generating or adjusting the format of page element information, allowing users to flexibly create PPT files based on the page layout model.
[0085] Step 105 : Generate a page layout model through training based on the training data set, so that the user can generate or adjust the page layout of the target PPT file based on the page layout model.
[0086] After obtaining the training data set, training can be performed based on the page element information, page layout information, and natural language instructions constructed based on the page element information and page layout information of the sample PPT files included in the training data set to generate a page layout model that can parse the natural language instructions to generate page layout information.
[0087] In the above method, by extracting page element information and page layout information from a sample PPT file, natural language instructions for indicating the layout of page element information based on the page layout information are constructed to obtain a training data set. This allows subsequent training based on the obtained training data set to generate a page layout model capable of parsing user natural language instructions, so that users can flexibly generate or adjust page layouts based on natural language instructions after obtaining the page layout model, and it is convenient for users to create PPT files without having to prepare a large number of templates in advance, which can save users time spent on selecting templates, facilitate users to create PPT files, and improve user experience.
[0088] In one possible implementation, page element information, page layout information corresponding to the page element information, and natural language instructions are input into a pre-trained generative large model for training to obtain a page layout model.
[0089] Before obtaining a sample PPT file, you can pre-train it based on the GPT (Generative Pre-trained Transformer) neural network structure to obtain a generative large model. GPT is a natural language processing model based on the Transformer architecture. The resulting generative large model is a pre-trained language model based on the Transformer architecture that can learn the patterns and regularities of natural language. Among them, the pre-trained generative large model can be called a text-to-layout model.
[0090] The page element information, page layout information, and natural language instructions obtained from processing the sample PPT file can be organized accordingly to obtain multiple sets of training data, which constitute the training dataset. A set of training data includes at least one piece of page element information, at least one piece of page element information's page layout information, and a natural language instruction constructed based on the at least one piece of page element information and the at least one piece of page element information's page layout information.
[0091] The multiple groups of training data obtained can be input into the pre-trained generative model one by one for training. Specifically, the page element information, page layout information and natural language instructions are input correspondingly for training, so that the pre-trained generative model can master the ability to generate corresponding page layout information according to different natural language instructions, and generate or adjust the page layout based on the page layout information, thereby obtaining a page layout model.
[0092] In some embodiments, after training is completed, model parameters can be adjusted through optimization algorithms such as gradient descent to reduce the loss on the training data set and improve the performance of the model in practical applications.
[0093] In some embodiments, after obtaining the page layout model, the page layout model can also be verified and optimized. The following embodiment illustrates this situation:
[0094] In one possible implementation, after obtaining the page layout model, a test data set can be obtained, wherein the test data set includes test natural language instructions, test PPT files, and target page layout results. The test PPT files and test natural language instructions can be input into the page layout model to obtain the actual page layout results of the test PPT files; the page layout model is verified and optimized based on the actual page layout results and the target page layout results.
[0095] It should be understood that the test PPT files included in the test data set are different from the sample PPT files used to obtain the training data set, and the test language instructions included in the test data set may also be different from the natural language instructions constructed in the training data set.
[0096] Specifically, the accuracy of the page layout model can be calculated based on the actual page layout results and the target page layout results; when the accuracy is greater than or equal to the preset threshold, it is determined that the verification is passed; when the accuracy is less than the preset threshold, it is determined that the verification is failed. At this time, the page layout model can be optimized until the accuracy of the page layout model is greater than or equal to the preset threshold.
[0097] In the above method, training is performed based on the pre-trained generative large model and the page element information of the sample PPT file, the page layout information corresponding to the page element information, and the natural language instructions. This allows the trained page layout model to have the ability to understand and generate natural language, as well as the ability to parse and adjust the page layout information of the PPT file.
[0098] Figure 4 This is a schematic flow chart of a method for creating a page layout provided in an embodiment of the present application. The method is applied to electronic devices.
[0099] For example, Figure 4 As shown, the method 400 includes:
[0100] Step 401: collecting the user's target natural language instruction;
[0101] Step 402: Input the target natural language instruction into the page layout model to obtain target page layout information;
[0102] The page layout model is pre-established using the method in the above embodiment.
[0103] Step 403: Generate or adjust the page layout of the target PPT file based on the target page layout information.
[0104] exist Figure 4 In the embodiment shown, after obtaining the page layout model, the target natural language instructions issued by the user can be collected, the target natural language instructions can be input into the page layout model, and the target page layout information can be obtained. Based on the target page layout information, the page layout of the target PPT file can be generated or adjusted.
[0105] Specifically, after obtaining the page layout model, the page layout model can be deployed in PPT file creation software, allowing users to use the page layout model based on the PPT file creation software. The PPT file creation software can be software in electronic devices such as mobile phones, tablets, and computers.
[0106] Assume that the PPT file creation software that deploys the page layout model in the embodiment of the present application is software on a computer. The process of a user creating a PPT file based on the computer is as follows:
[0107] The user can operate the computer to open the PPT file creation software that deploys the page layout model, and then the user can issue the target natural language instructions in the form of voice. The computer may include a voice acquisition module (such as a microphone) for collecting the target natural language instructions issued by the user, and input the collected target natural language instructions into the page layout model of the PPT file creation software.
[0108] After receiving the target natural language instruction, the page layout model analyzes and processes the target natural language instruction to obtain target page layout information, and then generates or adjusts the page layout of the target PPT file based on the target page layout information.
[0109] For example, assuming the target natural language instruction is: "I want to place a first-level title in the center of the top of the page, a second-level title on the left below, and two pictures under the second-level title", the page layout model can generate target page layout information based on the target natural language instruction: "First-level title placement area A, second-level title placement area B, picture 1 placement area C, picture 2 placement area D", divide the page into areas based on the target page layout information, and generate the page layout.
[0110] In some embodiments, the page layout model also has the ability to identify the page element information and page layout information of the current interface of the current PPT file. The user can open the previously created target PPT file based on the PPT file creation software that deploys the page recognition model, and adjust the page layout of the target PPT file based on natural language instructions. Adjusting the page layout includes two situations: element replacement and element insertion, which is similar to the process of constructing natural language instructions for adjusting the page layout in the above embodiment, and will not be repeated here.
[0111] In the above method, users can flexibly generate or adjust the page layout of PPT files based on the page layout model without having to prepare a large number of templates in advance, which can save users time spent on selecting templates, facilitate users to create PPT files, and improve users' usage experience.
[0112] In summary, this application extracts page element information and page layout information from a sample PPT file, constructs natural language instructions for indicating the layout of the page element information based on the page layout information, and obtains a training dataset. This allows subsequent training based on the obtained training dataset to generate a page layout model capable of parsing user natural language instructions. This facilitates the user to flexibly generate or adjust the page layout based on the natural language instructions after obtaining the page layout model, making it easier for the user to create a PPT file without having to prepare a large number of templates in advance, saving the user time spent on selecting templates, facilitating the user's creation of PPT files, and improving the user experience. The first natural language instructions for generating a page layout are constructed from the sample PPT file to obtain a training dataset. This allows the page layout model subsequently trained based on the training dataset to have the ability to parse the natural language instructions for generating a page layout, making it easier for the user to generate a page layout based on the natural language instructions after obtaining the page layout model, thus achieving flexible creation of PPT files. The second natural language instructions for adjusting the page layout: element swap instructions and element insert instructions are constructed from the sample PPT file. This allows the page layout model subsequently trained based on the training dataset to have the ability to parse the natural language instructions for adjusting the page layout, making it easier for the user to adjust the page layout based on the natural language instructions after obtaining the page layout model, thus achieving flexible creation of PPT files. Training is performed based on the pre-trained generative large model and the page element information of the sample PPT file, the page layout information corresponding to the page element information, and natural language instructions. The trained page layout model can have the ability to understand and generate natural language, as well as the ability to parse and adjust the page layout information of the PPT file.
[0113] Figure 5 It is a structural diagram of a device for establishing a page layout model provided in an embodiment of the present application.
[0114] For example, Figure 5 As shown, the device 500 includes:
[0115] Acquisition module 501, used to acquire a sample PPT file;
[0116] Extraction module 502, used to extract page element information and page layout information from the sample PPT file;
[0117] A construction module 503 is configured to construct a natural language instruction corresponding to the sample PPT file based on the page element information and the page layout information; wherein the natural language instruction is used to instruct the page element information to be laid out based on the page layout information;
[0118] A determination module 504 is configured to determine a training data set based on the page element information, the page layout information, and the natural language instruction;
[0119] The training module 505 is used to generate a page layout model based on the training data set, so that the user can generate or adjust the page layout of the target PPT file based on the page layout model.
[0120] In one possible implementation, the natural language instruction includes a first natural language instruction, and the page layout information includes: layout coordinate information. The construction module 503 is specifically used to construct a first natural language instruction corresponding to the page element information based on the page element information and the layout coordinate information corresponding to the page element information; the first natural language instruction is used to generate the page layout.
[0121] In one possible implementation, the natural language instruction includes a second natural language instruction, and the page layout information includes: layout coordinate information and layout size information. The construction module 503 is specifically used to construct a second natural language instruction corresponding to the at least two page element information based on the at least two page element information in the page element information and the layout coordinate information and layout size information corresponding to the at least two page element information; the second natural language instruction is used to adjust the page layout.
[0122] In one possible implementation, when at least two page element information include first page element information and second page element information, the second natural language instruction includes an element exchange instruction, and the construction module 503 is specifically used to construct an element exchange instruction for exchanging the first page element information and the second page element information based on the first page element information, the layout coordinate information and layout size information corresponding to the first page element information, the second page element information, and the layout coordinate information and layout size information corresponding to the second page element information; when at least two page element information include first page element information and candidate page element information adjacent to the first page element information, the second natural language instruction includes an element insertion instruction, and the construction module 503 is specifically used to construct an element insertion instruction for inserting the first page element information into a target area based on the first page element information, the layout coordinate information and layout size information corresponding to the first page element information, the candidate page element information, and the layout coordinate information and layout size information corresponding to the candidate page element information, where the target area is an area adjacent to the area to which the candidate page element information belongs.
[0123] In one possible implementation, the training module 505 is specifically configured to input the page element information, the page layout information corresponding to the page element information, and the natural language instructions into a pre-trained generative large model for training to obtain a page layout model.
[0124] Figure 6 It is a structural diagram of a page layout production device provided in an embodiment of the present application.
[0125] For example, Figure 6 As shown, the apparatus 600 includes:
[0126] The acquisition module 601 is used to acquire the user's target natural language instruction;
[0127] The parsing module 602 is used to input the target natural language instruction into the page layout model to obtain target page layout information; wherein the page layout model is pre-established using the apparatus in the above embodiment;
[0128] The layout module 603 is used to generate or adjust the page layout of the target PPT file based on the target page layout information.
[0129] Figure 7 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application.
[0130] For example, Figure 7As shown, the electronic device 700 includes: a memory 701 and a processor 702, wherein the memory 701 stores an executable program code 7011, and the processor 702 is used to call and execute the executable program code 7011 to perform a method for establishing a page layout model or a method for making a page layout.
[0131] In addition, an embodiment of the present application also protects a device, which may include a memory and a processor, wherein the memory stores executable program code, and the processor is used to call and execute the executable program code to execute a method for establishing a page layout model or a method for producing a page layout provided in an embodiment of the present application.
[0132] In this embodiment, the device can be divided into functional modules based on the above-described method examples. For example, each functional module can be mapped to a specific functional module, 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.
[0133] When the functional modules are divided according to their functions, the device for establishing the page layout model may further include an acquisition module, an extraction module, a construction module, a determination module, and a training module, and the device for creating the page layout may further include an acquisition module, a parsing module, and a layout module. It should be noted that all relevant content of each step involved in the above method embodiment can be referred to the functional description of the corresponding functional module and will not be repeated here.
[0134] It should be understood that the device provided in this embodiment is used to execute the above-mentioned method for establishing a page layout model or a method for producing a page layout, and thus can achieve the same effect as the above-mentioned implementation method.
[0135] In the case of an integrated unit, the device may include a processing module and a storage module. When the device is applied to an electronic device, the processing module may be used to control and manage the operation of the electronic device. The storage module may be used to support the electronic device in executing relevant program codes, etc.
[0136] 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 present disclosure. 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.
[0137] In addition, the device provided in the embodiments of the present application can specifically be a chip, component or module, and the chip may include a connected processor and memory; wherein the memory is used to store instructions, and when the processor calls and executes the instructions, the chip can execute a method for establishing a page layout model or a method for making a page layout provided in the above embodiments.
[0138] 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 method for establishing a page layout model or a method for producing a page layout provided in the above embodiment.
[0139] This embodiment also provides a computer program product. When the computer program product runs on a computer, it enables the computer to execute the above-mentioned related steps to implement a method for establishing a page layout model or a method for making a page layout provided in the above embodiment.
[0140] Among them, the 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.
[0141] 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.
[0142] 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.
[0143] 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 method for establishing a page layout model, characterized in that: The method comprises: Get the sample PPT file; Extracting page element information and page layout information from the sample PPT file; Based on the page element information and the page layout information, constructing a natural language instruction corresponding to the sample PPT file; wherein the natural language instruction is used to instruct the page element information to be laid out based on the page layout information; determining a training data set based on the page element information, the page layout information, and the natural language instruction; A page layout model is generated by training based on the training data set, so that a user can generate or adjust the page layout of a target PPT file based on the page layout model.
2. The method according to claim 1, characterized in that The natural language instruction includes a first natural language instruction, the page layout information includes: layout coordinate information, and constructing a natural language instruction corresponding to the sample PPT file based on the page element information and the page layout information includes: Based on the page element information and the layout coordinate information corresponding to the page element information, a first natural language instruction corresponding to the page element information is constructed; the first natural language instruction is used to generate a page layout.
3. The method according to claim 1 or 2, characterized in that The natural language instruction includes a second natural language instruction, the page layout information includes: layout coordinate information and layout size information, and the natural language instruction corresponding to the sample PPT file constructed based on the page element information and the page layout information includes: Based on at least two pieces of page element information in the page element information and the layout coordinate information and layout size information corresponding to the at least two pieces of page element information, a second natural language instruction corresponding to the at least two pieces of page element information is constructed; the second natural language instruction is used to adjust the page layout.
4. The method according to claim 3, characterized in that When the at least two pieces of page element information include first page element information and second page element information, the second natural language instruction includes an element swap instruction, and constructing the second natural language instruction corresponding to the at least two pieces of page element information based on the at least two pieces of page element information and the layout coordinate information and layout size information corresponding to the at least two pieces of page element information includes: constructing an element swap instruction for swapping the first page element information with the second page element information based on the first page element information, the layout coordinate information and layout size information corresponding to the first page element information, the second page element information, and the layout coordinate information and layout size information corresponding to the second page element information; When the at least two pieces of page element information include first page element information and candidate page element information adjacent to the first page element information, the second natural language instruction includes an element insertion instruction, and constructing the second natural language instruction corresponding to the at least two pieces of page element information based on the at least two pieces of page element information and the layout coordinate information and layout size information corresponding to the at least two pieces of page element information includes: Based on the first page element information, the layout coordinate information and layout size information corresponding to the first page element information, the candidate page element information, and the layout coordinate information and layout size information corresponding to the candidate page element information, an element insertion instruction for inserting the first page element information into a target area is constructed, where the target area is an area adjacent to the area to which the candidate page element information belongs.
5. The method according to claim 1, characterized in that The step of training the training data set to generate a page layout model includes: The page element information, the page layout information corresponding to the page element information, and the natural language instructions are input into a pre-trained generative model for training to obtain the page layout model.
6. A method for making a page layout, characterized in that: The method comprises: Collect the user's target natural language instructions; Inputting the target natural language instruction into a page layout model to obtain target page layout information; wherein the page layout model is pre-established using the method according to any one of claims 1 to 5; The page layout of the target PPT file is generated or adjusted based on the target page layout information.
7. A device for establishing a page layout model, characterized in that: The device comprises: Acquisition module, used to obtain sample PPT files; An extraction module, used to extract page element information and page layout information from the sample PPT file; A construction module, configured to construct a natural language instruction corresponding to the sample PPT file based on the page element information and the page layout information; wherein the natural language instruction is used to instruct the page element information to be laid out based on the page layout information; a determination module, configured to determine a training data set based on the page element information, the page layout information, and the natural language instruction; The training module is used to generate a page layout model based on the training data set, so that the user can generate or adjust the page layout of the target PPT file based on the page layout model.
8. A device for making a page layout, characterized in that: The device comprises: A collection module, used to collect the user's target natural language instructions; a parsing module, configured to input the target natural language instruction into the page layout model to obtain target page layout information; wherein the page layout model is pre-established using the method according to any one of claims 1 to 6; The layout module is used to generate or adjust the page layout of the target PPT file based on the target page layout information.
9. 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 6.
10. 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 6 is implemented.