Presentation generation methods, apparatus, computer equipment and storage media
By generating presentation outlines and content text using predefined prompt templates and large models, the system solves the problem of low efficiency in manually creating presentations for different fields, achieving efficient and accurate presentation generation.
Patent Information
- Application Number
- CN202411467286.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-21
- Publication Date
- 2025-10-31
- Estimated Expiration
- 2044-10-21
AI Technical Summary
In existing technologies, users need to manually create presentations for different fields, which takes a lot of time and results in low presentation creation efficiency.
The document generates an outline and content text corresponding to the theme information of the document by using predefined prompt word templates, generates multi-level text using a large model, and determines the matching relationship between text and elements based on the parsing result file of the target document template, thus generating a presentation containing the target text.
It improves the efficiency of presentation production and ensures the accuracy and standardization of the generated presentations' thematic information.
Smart Images

Figure CN119598982B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of artificial intelligence technology, and in particular to a presentation generation method, apparatus, computer equipment, storage medium, and computer program product. Background Technology
[0002] Currently, office software is widely used, allowing users to edit presentations on specific topics via their devices.
[0003] However, for different topics, users can only create presentations manually, preparing a large amount of text and images for each topic, and then designing and formatting the content of the text and images to obtain presentations on different topics. However, this method of creating presentations is time-consuming and inefficient. Summary of the Invention
[0004] Therefore, it is necessary to provide a presentation generation method, apparatus, computer equipment, computer-readable storage medium, and computer program product that can improve the efficiency of presentation production, in response to the above-mentioned technical problems.
[0005] Firstly, this application provides a method for generating presentation slides. The method includes:
[0006] Once the manuscript's theme information is obtained, a first prompt word corresponding to the manuscript's theme information is generated based on a predefined first prompt word template. Then, based on the first prompt word, a pre-loaded large model is called to generate an outline directory corresponding to the manuscript's theme information. The outline directory includes at least two levels of directories.
[0007] For each subdirectory in the outline directory, a second prompt word is generated for each subdirectory based on a predefined second prompt word template, and the main model is called based on the second prompt word to generate the content text for each subdirectory; the subdirectory is the last level directory in the at least two-level directory, and the second prompt word template is different from the first prompt word template;
[0008] Given the target text containing the outline directory and the content text corresponding to each of the subdirectories, based on the parsing result file of the target document template, the elements contained in the target document template and the association information between the elements are obtained; based on the elements and the association information between the elements, the matching relationship between the target text and the elements is obtained, and a presentation containing the target text is generated based on the matching relationship.
[0009] In one embodiment, the elements include text placeholders and image placeholders; generating a presentation containing the target text based on the matching relationship includes:
[0010] For the text placeholders in the target document template, determine the first text in the target text that corresponds to the text placeholders according to the matching relationship, and replace the text placeholders with the first text;
[0011] For the image placeholders in the target document template, based on the association information between the elements, the target text placeholder associated with the image placeholder is determined, and the second text corresponding to the target text placeholder is determined according to the matching relationship;
[0012] The third prompt word is generated based on a predefined third prompt word template, and the large model is called based on the third prompt word to determine the text entity corresponding to the second text. The corresponding text feature vector is obtained from the text entity. The third prompt word template is different from either the first prompt word template or the second prompt word template.
[0013] From a pre-built image vector database, a target image vector matching the text feature vector is determined, and the image placeholder is replaced with the image corresponding to the target image vector; the image vector database stores image feature vectors corresponding to multiple preset images.
[0014] After the text placeholders and image placeholders in the target document template are replaced, a presentation containing the target text is obtained.
[0015] In one embodiment, the method further includes:
[0016] Iterate through multiple images pre-saved in the image library and call the large model to determine the image feature vector corresponding to each image;
[0017] Establish a correspondence between the storage addresses of multiple images and the corresponding image feature vectors of each image, and store the image feature vectors corresponding to the images and the correspondence in a pre-constructed image vector database.
[0018] In one embodiment, determining the target image vector matching the text feature vector from a pre-built image vector database includes:
[0019] Determine the vector distance between each image feature vector and the text feature vector in the image vector database;
[0020] According to the order of the vector distances from smallest to largest, a predetermined number of image feature vectors are determined as target image vectors that match the text feature vectors;
[0021] Replacing the image placeholder with the image corresponding to the target image vector includes:
[0022] The images corresponding to the predetermined number of image feature vectors are identified as candidate images, and one image is randomly selected from the candidate images as the target image, replacing the image placeholder.
[0023] In one embodiment, replacing the image placeholder with the image corresponding to the target image vector includes:
[0024] Based on the size information of the image placeholder and the size information of the target image, the target image is adjusted, and the adjusted target image is used to replace the image placeholder.
[0025] In one embodiment, the method further includes:
[0026] The target document template is parsed to obtain the elements on the pages and the element attributes of each element; the element attributes include hierarchy information and position information.
[0027] Based on the hierarchical and positional information, the association information between each element is determined;
[0028] According to the order of each page in the target document template, the elements, element attributes and association information of each page contained in the target document template are stored as JSON files, which serve as the parsing result files of the target document template.
[0029] In one embodiment, obtaining the matching relationship between the target text and the element based on the element and the association information between the elements includes:
[0030] Based on the JSON file, the elements in the target document template and the relationships between the elements are obtained as the first association information;
[0031] Based on the hierarchical relationship of the directories in the outline directory and the correspondence between each subdirectory and the content text, the second association relationship of the text in the target text is obtained;
[0032] Based on the first association relationship and the second association relationship, the matching relationship between the target text and the element is determined.
[0033] Secondly, this application also provides a presentation generation apparatus. The apparatus includes:
[0034] The outline generation module is used to generate a first prompt word corresponding to the document topic information based on a predefined first prompt word template when the document topic information is obtained, and to call a preloaded large model based on the first prompt word to generate an outline directory corresponding to the document topic information; the outline directory includes at least two levels of directories;
[0035] The content generation module is used to generate a second prompt word for each subdirectory in the outline directory based on a predefined second prompt word template, and to call the large model based on the second prompt word to generate the content text for each subdirectory; the subdirectory is the last level directory in the at least two-level directory, and the second prompt word template is different from the first prompt word template;
[0036] The document generation module is used to, upon obtaining a target text containing the outline directory and the content text corresponding to each of the subdirectories, obtain the elements contained in the target document template and the association information between the elements based on the parsing result file of the target document template; obtain the matching relationship between the target text and the elements based on the elements and the association information between the elements; and generate a presentation containing the target text based on the matching relationship.
[0037] Thirdly, this application also provides a computer device. The computer device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the steps of the method described in the first aspect.
[0038] Fourthly, this application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program thereon, which, when executed by a processor, implements the steps of the method described in the first aspect.
[0039] Fifthly, this application also provides a computer program product. The computer program product includes a computer program that, when executed by a processor, implements the steps of the method as described in the first aspect.
[0040] The aforementioned presentation generation method, apparatus, computer equipment, storage medium, and computer program product, upon obtaining the presentation topic information, generate a first prompt word corresponding to the presentation topic information using a predefined first prompt word template. This allows a pre-loaded large model to generate an outline directory corresponding to the presentation topic information based on the first prompt word. The outline directory can contain multiple levels of directories, with the last level being a subdirectory. For each subdirectory within the outline directory, a second prompt word corresponding to the subdirectory can be generated based on a predefined second prompt word template. This allows the pre-loaded large model to generate the content text corresponding to each subdirectory based on the second prompt word. This results in a multi-level text consisting of the outline directory corresponding to the presentation topic information and the content text corresponding to each subdirectory, i.e., the target text. Furthermore, based on the parsing result file of the target presentation template, the elements and their interrelationships within the target presentation template can be obtained. Based on this interrelationship information and the internal relationships within the multi-level text, the matching relationship between the target text and each element in the target presentation template can be obtained. Finally, a presentation containing the target text is generated using this matching relationship. Predefined first and second prompt word templates can generate corresponding first and second prompt words for the document theme and various subdirectories, respectively. Based on different prompt words, the large model is called to generate corresponding content, improving the standardization and accuracy of the content text of the outline and subdirectories generated by the large model. Furthermore, since the complete target text generated by the large model is multi-level text, by obtaining the correlation information between elements in the target document template, the matching relationship between the target text and the elements in the target document template can be determined, allowing the target text to be accurately applied to the target document template, thereby obtaining the presentation corresponding to the document theme information and improving the efficiency of presentation production. Attached Figure Description
[0041] To more clearly illustrate the technical solutions in the embodiments or related technologies of this application, the accompanying drawings used in the description of the embodiments or related technologies will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0042] Figure 1 This is a diagram illustrating the application environment of a presentation generation method in one embodiment.
[0043] Figure 2 This is a flowchart illustrating a presentation document generation method in one embodiment;
[0044] Figure 3 This is a flowchart illustrating the steps of generating a presentation based on matching relationships in one embodiment;
[0045] Figure 4This is a flowchart illustrating a presentation document generation method in another embodiment;
[0046] Figure 5 This is a schematic diagram of a presentation document in one embodiment;
[0047] Figure 6 This is a structural block diagram of a presentation generation device in one embodiment;
[0048] Figure 7 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation
[0049] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0050] The presentation generation method provided in this application embodiment can be applied to, for example, Figure 1 In the application environment shown, terminal 102 communicates with server 104 via a network. A data storage system can store the data that server 104 needs to process. The data storage system can be integrated onto server 104, or it can be located in the cloud or on another network server.
[0051] The terminal 102 can receive document topic information input or selected by the user, and the server 104 can receive the document topic information sent by the terminal 102, perform entity recognition on the received information, and determine the document topic information. Further, the server 104 can call a first prompt word template to generate a first prompt word corresponding to the document topic information, and input the first prompt word into a preloaded large model to obtain an outline table of contents corresponding to the document topic information. For each subdirectory in the outline table of contents, the server 104 can also call a second prompt word template to generate a second prompt word corresponding to the subdirectory, and input the second prompt word into the preloaded large model to obtain the content text corresponding to the subdirectory, thereby obtaining a complete target text containing the outline table of contents and the content text corresponding to each subdirectory. Furthermore, for the determined target document template, server 104 obtains the corresponding parsing result file. Based on the parsing result file, it obtains the information about each element in the target document template and the relationships between elements. Since the complete target text generated by the large model belongs to multiple levels of text, the matching relationship between the target text and the elements in the target document template can be determined. Finally, based on the matching relationship, the target text is added to the target document template to obtain the presentation corresponding to the document topic information. Afterwards, server 104 can also send the obtained presentation to terminal 102 for display.
[0052] Furthermore, with the computing power support of the terminal 102, the terminal can also preload large models locally and generate the aforementioned presentation locally on the terminal 102.
[0053] The terminal 102 can be, but is not limited to, various personal computers, laptops, smartphones, tablets, IoT devices, and portable wearable devices. IoT devices can include smart TVs, smart in-vehicle systems, etc. Portable wearable devices can be head-mounted displays, etc. Head-mounted displays can be virtual reality (VR) devices, augmented reality (AR) devices, smart glasses, etc. The server 104 can be implemented using a standalone server or a server cluster consisting of multiple servers.
[0054] In one exemplary embodiment, such as Figure 2 As shown, a method for generating presentations is provided, which can be applied to... Figure 1 Taking server 104 as an example, the explanation includes the following steps S202 to S206. Wherein:
[0055] Step S202: After obtaining the manuscript topic information, generate the first prompt word corresponding to the manuscript topic information based on the predefined first prompt word template, and call the preloaded large model based on the first prompt word to generate the outline table of contents corresponding to the manuscript topic information.
[0056] The outline directory mentioned above includes at least two levels of directories, with the last level also referred to as a subdirectory. The document topic information can be a topic selected by the user from preset topics via the terminal, or a topic entered manually. A first prompt word template is used to generate a first prompt word based on the document topic information, and the first prompt word is used to generate the outline directory corresponding to the document topic information.
[0057] Specifically, the server receives the document topic information input by the user terminal through a guidance message. The server can perform entity recognition on the document topic information to obtain multiple entities corresponding to the document topic information. The server inputs the entities corresponding to the document topic information into a predefined first prompt word template, so that the entities corresponding to the document topic information replace the entity placeholders in the first prompt word template, and generate the first prompt word corresponding to the document topic information.
[0058] The server can use the first prompt word as input to a preloaded large model. Based on the content of the first prompt word, the large model outputs an outline corresponding to the document's topic information. The outline can be a combination of multiple levels of directories corresponding to the document's topic. For example, the outline can include multiple levels such as first-level, second-level, and third-level directories. The relationship between first-level and second-level directories can be one-to-one or one-to-many. Directories at the same level can be parallel or logically sequential. The last level target is a subdirectory; for example, in the case of first, second, and third-level directories, the third-level directory is a subdirectory. Similarly, the outline can contain even more levels of subdirectories; this embodiment does not limit this.
[0059] In one example, the entities for document topic information can include document topic, document page number, and document format. The first prompt template is a slide outline prompt template, such as "You are now a PPT (PowerPoint) outline generation expert. Generate a PPT outline with 'Document Topic' as the topic. The output language should be Chinese, the generated outline should have 'N' levels, the output should strictly follow the 'Document Format' format, and no other irrelevant information should be output." The server can replace the entity placeholders in the slide outline prompt with the document topic, table of contents level, and document format to obtain the slide outline prompt for the document topic information.
[0060] Step S204: For each subdirectory in the outline directory, generate a second prompt word corresponding to each subdirectory based on a predefined second prompt word template, and call the large model based on the second prompt word to generate the content text corresponding to each subdirectory.
[0061] The aforementioned subdirectories are the last level of the above at least two-level directories. The aforementioned second prompt word template is different from the aforementioned first prompt word template. The second prompt word template is used to generate corresponding second prompt words based on each subdirectory of the outline directory. The second prompt words are used to generate the content text corresponding to the subdirectories.
[0062] Specifically, the server splits the outline directory into multiple subdirectories. The server iterates through each subdirectory, inputting a predefined second prompt word template into the subdirectory. This causes the corresponding entity in the subdirectory to replace the entity placeholder in the second prompt word template, generating the second prompt word for each subdirectory. The server can then use the second prompt word as input to a preloaded main model. Based on the content of the second prompt word, the main model outputs the corresponding content text for the subdirectory. For example, a subdirectory could be "motor," "electronic control," or "battery," and the corresponding content text could be detailed descriptions of those components.
[0063] In one example, the entities for the subdirectory include the subdirectory itself and the number of text characters. The second prompt template is the slide content prompt template, such as "You are now a PPT content generation expert. Generate PPT content expanded with 'subdirectory' as the theme. The output language should be Chinese, the output content should be as concise and formal as possible, the number of output characters should not exceed 'text characters', and no other irrelevant information should be output." The server can replace the entity placeholders in the slide content prompt template with the corresponding subdirectory and text character count to obtain the slide content prompt for the subdirectory. If the subdirectory entity has not yet been assigned a value, a preset entity can be used as the default entity, and the entity placeholders in the slide content prompt can be replaced with the default entity.
[0064] Step S206: After obtaining the target text containing the outline directory and the content text corresponding to each of the subdirectories, based on the parsing result file of the target document template, obtain the elements contained in the target document template and the association information between the elements; based on the elements and the association information between the elements, obtain the matching relationship between the target text and the elements, and generate a presentation containing the target text based on the matching relationship.
[0065] The parsing result file is a file generated after parsing various document templates stored in the database. It contains all elements in the document templates, element attributes, and relationship information between elements. The relationship information indicates the hierarchical, positional, and other relationships between each element in the document template and its related elements. The matching relationship indicates the correspondence between the content text of each directory and subdirectory in the target text and each element in the target document template.
[0066] Specifically, the server can obtain the complete target text corresponding to the theme based on the subdirectories and their corresponding content text within the outline. The target text contains directory information and subdirectory content text, thus exhibiting a multi-level hierarchy. The server can obtain the elements and their relationships within the template from the parsing result file corresponding to the target document template. It can then map the various levels of directories and content text in the target text to the elements in the parsing result file, thereby obtaining the matching relationship between the text information in the target text and the elements in the template. Furthermore, based on this matching relationship, the server can apply the target text to the target document template to generate a presentation with the document's theme, the outline as its framework, the content text corresponding to the subdirectories as its content, and the target document template as its style.
[0067] In one example, the server can generate the document template for each page by replacing elements with corresponding text based on the matching relationship between the target text and elements in the template. The server then merges the multiple pages to obtain the presentation.
[0068] Optionally, if the number of elements on each page of the target document template does not match the number of text items in the target document template during the process of generating a presentation containing the target text through matching relationships, the elements in the target document template can be adjusted to obtain an adjusted target document template. The adjustment process includes at least one of adding elements, deleting elements, and adjusting element spacing. For example, if the number of elements on a page in the template is greater than the number of matching text items, the server can delete the redundant elements on that page and adjust the position information of the remaining elements according to the style of the target document template so that the element spacing meets the style. If the number of elements on a page in the template is less than the number of matching text items, the server can add elements to that page and adjust the position information of all elements according to the style of the target document template.
[0069] In the above presentation generation method, upon obtaining the presentation topic information, a first prompt word corresponding to the presentation topic information is generated using a predefined first prompt word template. This allows the preloaded large model to generate an outline directory corresponding to the presentation topic information based on the first prompt word. The outline directory can contain multiple levels of directories, with the last level being a subdirectory. For each subdirectory in the outline directory, a second prompt word corresponding to the subdirectory can be generated based on a predefined second prompt word template. This allows the preloaded large model to generate the content text corresponding to each subdirectory based on the second prompt word. Thus, a multi-level text consisting of the outline directory corresponding to the presentation topic information and the content text corresponding to each subdirectory can be obtained, i.e., the target text. Furthermore, based on the parsing result file of the target presentation template, the element and the relationship information between elements in the target presentation template can be obtained. Based on this relationship information and the internal connections within the multi-level text, the matching relationship between the target text and each element in the target presentation template can be obtained, and a presentation containing the target text can be generated through this matching relationship. Predefined first and second prompt word templates can generate corresponding first and second prompt words for the document theme and various subdirectories, respectively. Based on different prompt words, the large model is called to generate corresponding content, improving the standardization and accuracy of the content text of the outline and subdirectories generated by the large model. Furthermore, since the complete target text generated by the large model is multi-level text, by obtaining the correlation information between elements in the target document template, the matching relationship between the target text and the elements in the target document template can be determined, allowing the target text to be accurately applied to the target document template, thereby obtaining the presentation corresponding to the document theme information and improving the efficiency of presentation production.
[0070] In one exemplary embodiment, such as Figure 3 As shown, the elements include text placeholders and image placeholders. The specific implementation process of the step "generating a presentation containing the target text based on the above matching relationship" includes steps S302 to S310. Wherein:
[0071] Step S302: For the text placeholders in the target document template, determine the first text in the target text that corresponds to the text placeholders according to the matching relationship, and replace the text placeholders with the first text.
[0072] Specifically, the server iterates through the elements in the target document template. If the current element is a text placeholder, the server can determine the first text corresponding to the text placeholder in the target text based on the matching relationship. In one example, the target document template contains three text placeholders: placeholder A, placeholder B, and placeholder C, and the target text contains three texts: content text 1, table of contents text 2, and content text 3. The server can determine, through the matching relationship, that the first text corresponding to placeholder A is content text 1, the first text corresponding to placeholder B is table of contents text 2, and the first text corresponding to placeholder C is content text 3. The server inputs content text 1 into placeholder A and updates the text of placeholder A, thus replacing the text placeholder with the first text. Similarly, the server can input table of contents text 2 into placeholder B and update the text of placeholder B, and the server can input content text 3 into placeholder C and update the text of placeholder C.
[0073] It should be understood that replacing text placeholders will only change the text in the target document template and will not change the layout or style of other elements in the target document template.
[0074] Step S304: For the image placeholders in the target document template, based on the association information between the elements, determine the target text placeholder associated with the image placeholders, and determine the second text corresponding to the target text placeholders according to the matching relationship.
[0075] Specifically, the server iterates through the elements in the target document template. If the current element is an image placeholder, the server can determine the target text placeholder associated with that image placeholder based on the relationship between elements. Furthermore, based on the matching relationship, the server determines the second text corresponding to the target text placeholder within the target text. The image corresponding to the image placeholder is the image associated with the second text corresponding to the target text placeholder.
[0076] In one example, the target document template also contains an image placeholder D, and image placeholder D is associated with text placeholder A. The server can determine that placeholder A is the target text placeholder based on the association information. The server can determine that the content text corresponding to placeholder A is the second text corresponding to the target text placeholder based on the matching relationship.
[0077] Step S306: Generate a third prompt word corresponding to the second text based on a predefined third prompt word template, and call the large model based on the third prompt word to determine the text entity corresponding to the second text, and obtain the corresponding text feature vector from the text entity.
[0078] The third prompt word template is different from either the first or second prompt word template. The third prompt word is used to enable the pre-loaded large model to perform entity recognition on the second text contained in the third prompt word, thereby obtaining at least one text entity corresponding to the second text.
[0079] Specifically, the server can input the second text into the third prompt word template to obtain a third prompt word containing the second text. The server then uses the third prompt word as input to a preloaded large model. The preloaded large model analyzes and processes the third prompt word, outputting at least one text entity contained in the second text. The server can generate text feature vectors corresponding to the text entities using a natural language processing model, such as a large model, a bag-of-words model, a TF-IDF (Term Frequency-Inverse Document Frequency) model, or a Word2Vec model.
[0080] In one example, the second text could be "The key technology for new energy vehicles is to develop a new type of efficient and safe vehicle power battery system," and the third prompt word template is an entity extraction prompt word template, such as "Please extract entities from the following text content, keeping it as concise as possible and not outputting other related content. The following text includes: 'Second Text'." The server can replace the placeholders in the entity extraction prompt word template with the second text to obtain the entity extraction prompt words for the second text. The server performs entity recognition on the second text using a pre-loaded large model, and the recognition results can be "new energy vehicles" or "power battery".
[0081] Step S308: Determine the target image vector that matches the above text feature vector from the pre-constructed image vector database, and replace the above image placeholder with the image corresponding to the above target image vector.
[0082] The aforementioned image vector database stores image feature vectors corresponding to multiple preset images.
[0083] Specifically, the server iterates through at least one text feature vector corresponding to the second text, searches your pre-structured image vector database, and determines the image vector most similar to the text feature vector as the target image vector. The server retrieves the image corresponding to the target image vector and updates the image placeholder so that the image is displayed in the corresponding position of the image placeholder in the target document template.
[0084] Step S310: After replacing the text placeholders and image placeholders in the target document template, a presentation containing the target text is obtained.
[0085] Specifically, the server can replace the text placeholders and image placeholders in the target document template by traversing the elements, thereby obtaining the updated target document template and determining it as a presentation containing the target text.
[0086] In this embodiment, the text placeholders are replaced by replacing the first text corresponding to the text placeholders, and the image placeholders are replaced by replacing the image vector corresponding to the image placeholders. This completes the update of the text placeholders and image placeholders in the target document template, resulting in a presentation. It can update the target document template by replacing the target text and the image corresponding to the target text without changing the style of the target document template, thereby improving the accuracy and efficiency of the generated presentation.
[0087] In an exemplary embodiment, the method further includes: traversing multiple images pre-saved in the image library, calling the large model to determine the image feature vector corresponding to each image; establishing a correspondence between the storage addresses of multiple images and the image feature vectors corresponding to each image, and storing the image feature vectors corresponding to the images and the correspondence to the pre-constructed image vector database.
[0088] The image library can store various types of images that have been saved in advance, and each image type can contain multiple images.
[0089] Specifically, the server can iterate through the image library, generating image feature vectors for each image using a pre-loaded large model. The image feature vectors and text feature vectors should be calculated using the same large model or the same type of algorithm. The server can establish a mapping between the storage address of each image and its image feature vector, and store the image feature vectors and mappings in a pre-built image vector database. In one example, the server can create a mapping table and store the mapping between the storage address of each image and its image feature vector in the mapping table. The server then stores the mapping table in the image vector database.
[0090] Optionally, the server can generate image feature vectors (features) from a preloaded large model and normalize them using a preset normalization strategy, such as feature / ||feature||2. The server can create a vector database index with a preset vector dimension using the feature vector data. The server adds each image feature vector to the vector database index. Finally, the server calls a storage function to save the vector database index to a preset storage path, obtaining the image vector database. The server can then read the image vector database from the preset storage path and retrieve each image feature vector using the established vector database index.
[0091] In this embodiment, by traversing the image library, the image feature vector of each image is determined, as well as the correspondence between the image storage address and the image feature vector, and image vector data is established so that when determining the image corresponding to the text feature vector in the future, the efficiency of determining the target image vector can be improved.
[0092] In an exemplary embodiment, the specific implementation process of the step "determining the target image vector matching the above-mentioned text feature vector from a pre-built image vector database" includes:
[0093] In the aforementioned image vector database, determine the vector distance between each of the aforementioned image feature vectors and the aforementioned text feature vectors; and determine a predetermined number of image feature vectors as target image vectors that match the aforementioned text feature vectors in ascending order of the vector distances between them.
[0094] Specifically, for each text feature vector corresponding to a text entity, the server calculates the Euclidean distance between the text feature vector and each image feature vector in the image vector database, resulting in multiple Euclidean distance values. The image feature vectors are then sorted in ascending order of these Euclidean distance values, and a predetermined number of image feature vectors are selected from these sorted vectors as the target image vectors that match the text feature vectors.
[0095] In an exemplary embodiment, before the step "replacing the image placeholder with the image corresponding to the target image vector", the method further includes: determining the images corresponding to the predetermined number of image feature vectors as candidate images, randomly selecting one image from the candidate images as the target image, and replacing the image placeholder.
[0096] Specifically, the server obtains the number of images corresponding to the image placeholders, obtains the images corresponding to each target image vector and determines them as candidate images, and randomly selects at least one image corresponding to the number of images from the candidate images as the target image. In one example, if the number of images corresponding to the image placeholders is 1, the server can randomly select one image from the candidate images as the target image.
[0097] In this embodiment, the correlation between text feature vectors and image feature vectors is determined by Euclidean distance value, and the image feature vector with the highest correlation is selected as the target image vector. The image corresponding to the target image vector is then determined as the target image, thereby determining the target image. This can improve the acquisition of images that fit the placeholder image and improve the fit of the target image.
[0098] In an exemplary embodiment, the specific implementation process of the step "replacing the image placeholder with the image corresponding to the target image vector" includes:
[0099] Based on the size information of the image placeholder and the size information of the target image, the target image is adjusted, and the adjusted target image replaces the image placeholder.
[0100] Specifically, the server can obtain the size information of the image placeholder and the size information of the target image. Using the size information of the image placeholder as a reference, the server adjusts the length, width, and aspect ratio of the target image to match the size information of the image placeholder, resulting in an adjusted target image. The server then replaces the image placeholder with the adjusted target image.
[0101] In one example, if the aspect ratio of the image placeholder is the same as that of the target image, the target image is scaled proportionally to make its length and width the same as those of the image placeholder. If the aspect ratio of the image placeholder is different from that of the target image, the target image is scaled proportionally to make either its length or width the same as that of the image placeholder, resulting in the adjusted target image.
[0102] In this embodiment, the size of the target image is adjusted using the size information of the image placeholder to improve the adaptability of the target image in the presentation.
[0103] In an exemplary embodiment, the method further includes: parsing each page contained in the target document template to obtain elements in the pages and element attributes of each element; determining the association information between each element based on the hierarchy information and position information; and storing the elements, element attributes, and association information in each page contained in the target document template as a JSON file, according to the order of each page in the target document template, as the parsing result file of the target document template.
[0104] The aforementioned element attributes include hierarchy information and position information. Hierarchy information indicates the hierarchical relationship between elements, while position information can be the element's coordinates on the page. Association information can include the order of elements, hierarchical relationships between elements, and text / image associations.
[0105] Specifically, the server can pre-parse each page of the target document template, obtaining the elements on each page and the attributes they contain, thereby obtaining the hierarchical and positional information of each element. For each element, the server can determine the hierarchical information between elements on the current page based on the element's hierarchical information. For example, if element 1 has a first-level hierarchy and element 2 has a second-level hierarchy, then element 1 can be determined to be the parent of element 2, and element 2 to be the child of element 1.
[0106] Additionally, the server can determine the order of elements based on the traversal order. The server can determine the order of elements by first proceeding from top to bottom, and then from left to right. For example, if element 1 is in the top left corner of the page, element 2 is in the top right corner, element 3 is in the bottom left corner, and element 4 is in the bottom right corner, the order of elements on the page can be determined as element 1, element 2, element 3, and element 4.
[0107] If a page contains both text placeholders and image placeholders, the server can determine the corresponding text placeholder based on the location information of each text placeholder and image placeholder. In one example, the server can obtain the location information of the image placeholder and, based on the location information of multiple text placeholders and image placeholders on the page, determine the nearest text placeholder and the text-image association information between that text placeholder and the image placeholder.
[0108] The server can store the elements, element attributes, and related information of each page in the target document template in the form of a JSON file, according to the order of each page in the target document template, and use it as the parsing result file of the target document template.
[0109] In this embodiment, by parsing each page of the target document template, each element and its element attributes are obtained, and the relationship information between elements is determined based on the element attributes. Finally, the elements, element data, and relationship information are stored in a JSON file. This can optimize the content in the target document template, obtain a parsing result file containing relationship information, reduce the repeated parsing process, improve the efficiency of applying the target document template, and improve the efficiency of presentation generation.
[0110] In an exemplary embodiment, the specific implementation process of the step "obtaining the matching relationship between the target text and the elements based on the above elements and the association information between the elements" includes:
[0111] Based on the aforementioned JSON file, the elements in the target document template and the relationships between them are obtained as the first association information; based on the hierarchical relationship of the directories in the outline directory and the correspondence between each subdirectory and the content text, the second association relationship of the text in the target text is obtained; based on the first association relationship and the second association relationship, the matching relationship between the target text and the aforementioned elements is determined.
[0112] Specifically, the server can retrieve multiple subdirectories contained in the outline, read the JSON file, and determine the first association information between each element and each element on multiple pages in the target document template. The server can then determine the second association information between text elements in the target document based on the hierarchical relationship of the directories, the order of the subdirectories, and the content text corresponding to each subdirectory. For example, the server can determine the matching relationship between elements and subdirectories based on the hierarchical relationship between elements in the first association information and the hierarchical relationship between subdirectories in the second association information (e.g., subdirectories with the same parent). Finally, the server can determine the matching relationship between elements and content text based on the hierarchical relationship between elements in the first association information and the hierarchical relationship between subdirectories and content text in the second association information, thereby matching each element with its corresponding target text to obtain the matching relationship between elements and target text.
[0113] In this embodiment, the matching relationship between elements and subdirectories, and between elements and content text, is determined by the association between each element and the association between subdirectories and content text, which can improve the accuracy of determining the matching relationship.
[0114] like Figure 4 As shown, the following describes the specific execution process of the above presentation generation method in detail with reference to a specific embodiment, including the following steps:
[0115] Step 1, Preparation Stage. Prepare multiple (e.g., 30-50) PPT templates; collect offline image libraries, categorized by scene including natural scenery, people, architecture, cars, food, outdoor, and indoor images, with at least 500 images per category; use CLIP (Contrastive Language – Image Pretraining) multimodal large model to extract image features and store them in an image vector database, as follows:
[0116] Step 1.1: Download the pre-trained Chinese CLIP large model weights to your local machine, and call the ChineseCLIPModel.from_pretrained(pretrained_model_name_or_path) function to load the model weights, where the parameter pretrained_model_name_or_path is the local save path of the downloaded model;
[0117] Step 1.2: Iterate through the offline image library, read images, and call the get_image_features(self, pixel_values, output_attentionsNone, output_hidden_states=None, return_dict=None) function to perform forward inference of the model to encode and obtain the image feature vector. The pixel_values parameter is the image read. The obtained feature vector is normalized by the formula feature / ||feature||2.
[0118] Step 1.3: Create an image vector database using the Faiss vector data. The server can use the function `index=faiss.IndexFlatL2(768)` to build the vector database index, and use the function `index.add(feature)` to add the feature vectors from step 1.2 to the vector database index.
[0119] Where 768 represents the feature vector dimension, and IndexFlatL2 represents the Euclidean distance L2 for accurate retrieval.
[0120] Step 1.4: Call faiss.write_index(index, save_path) to save the vector database index to the local machine in the form of an image vector database, where index is the vector database index created in step 1.3, and save_path represents the local save path.
[0121] Step 2: Predefine the PPT outline prompt template (first prompt template) and the content generation prompt template (second prompt template).
[0122] The following is an example of the prompt for generating a PPT outline: "You are now a PPT outline generation expert. Generate a PPT outline with the theme xxx. The output language must be Chinese, the generated PPT must have xxx pages, the output must strictly follow the Markdown format, and no other irrelevant information must be output."
[0123] Here is an example of a prompt for generating PPT content: "You are now a PPT content generation expert. Generate PPT content that expands on the theme xxx. The output language should be Chinese, the output content should be as concise and formal as possible, the number of words should not exceed xxx, and no other irrelevant information should be output."
[0124] Step 3: Determine if the user has entered the theme for the PPT. If so, proceed to Step 4.
[0125] Step 4: Invoke the large model and combine it with the preset PPT outline prompts to generate the PPT outline table of contents. The PPT outline table of contents contains multiple levels of subheadings.
[0126] Step 5: For each level of the outline, call the large model and combine it with the preset PPT content prompts to generate the corresponding PPT content text in sequence.
[0127] Step 6: For the user-selected built-in PPT template, combined with the PPT outline and content text generated from the large model, use the python-pptx plugin to fill in the text and style the layout. Detailed layout steps include:
[0128] Step 6.1: Use the python-pptx plugin to read the preset PPT templates. Each PPT template consists of a cover page, title page, table of contents page, content pages, and end page. Read the element attributes of each element and nested elements on each page, such as background color, shape, position information, and placeholder information. Save the parsed elements and element attributes offline in JSON format.
[0129] Step 6.2: Based on the JSON file corresponding to the template selected by the user, and combined with the outline and content generated in Step 5, fill the placeholders on each page with text. If the number of elements in the template selected by the user is inconsistent with the number of elements in the generated outline and content text, dynamically adjust the spacing between objects according to the width and height of the PPT, increasing or decreasing the number of elements. If the current page contains image placeholders, proceed to Step 7;
[0130] Step 7: For illustrations in the PPT, the large model is used to determine the relevant subject matter of the corresponding text, such as new energy vehicles or architecture. The server uses an image vector database to quickly search for the offline image with the highest similarity to the relevant text, and then processes the image, including cropping and scaling. Detailed steps are as follows:
[0131] Step 7.1, define prompt words, for example: "Please extract entities from the following text content, requiring it to be as concise as possible and not output other related content. For example, if 'The key technology of new energy vehicles is to develop a new type of vehicle power battery system that is efficient and safe,' then the output should be 'new energy vehicles' and 'power battery'."
[0132] Step 7.2: Randomly select a set of text from the output of 7.1. The server uses the same method as in Step 1 to load the model weights of the word segmenter model `model_processor=ChineseCLIPModel.from_pretrained(pretrained_model_name_or_path)` function, and calls `output=model_processor.processor(text=text, padding=True, return_tensors="pt")` to perform word segmentation processing on the text to obtain the word segmentation token ID.
[0133] Where text represents the entity text, padding is True to pad the tokens to ensure consistent token length, return_tensors="pt" means to return tensors in PyTorch format, and output is returned in dictionary format.
[0134] Step 7.3: Call text_features=model.get_text_features(**output), pass the output obtained in the previous step to the function, perform forward inference, and obtain the encoded text feature vector.
[0135] Step 7.4 calls the `index.search(text_features, topk=3)` function of the image vector database. For example, if the parameter `topk` is set to 3, it returns the top 3 image feature vectors. The server calculates the Euclidean distance between each image feature vector in the image vector database and the text feature vector, returns the image feature vector corresponding to the nearest `topk`, and determines the image corresponding to the image feature vector.
[0136] Step 7.5: For the images output in Step 7.4, randomly select one image and call the OpenCV functions cv2.rezie & cv2.cv2.copymakeborder to scale and fill the image so that it meets the length and width requirements of the image placeholder in the PPT illustration. Then, insert the processed image into the corresponding position of the image placeholder in the PPT on that page.
[0137] Step 8: After the layout is completed, the PPT is synthesized page by page. The python-pptx plugin is used to render the JSON file into a PPT and the generated PPT file is saved locally.
[0138] like Figure 5 As shown, one page of the generated PPT file can include a partial outline, consisting of first-level and second-level headings, with each second-level heading containing corresponding text content. Based on this, elements on the page can contain a three-level hierarchy of information: first-level headings, second-level headings, and text content. Furthermore, the page can contain multiple image elements, each matched with corresponding text content.
[0139] In this embodiment, by leveraging the content generation capabilities of a large language model, along with technologies such as image vector databases, image matching, and PPT layout, users only need to input the document theme information of the presentation to be generated, and a PPT with the document theme information as the theme and the target document template as the style can be automatically generated, thereby improving the efficiency of presentation generation.
[0140] It should be understood that although the steps in the flowcharts of the above embodiments are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the above embodiments may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages in other steps.
[0141] Based on the same inventive concept, this application also provides a presentation generation apparatus for implementing the presentation generation method described above. The solution provided by this apparatus is similar to the implementation described in the above method; therefore, the specific limitations in one or more presentation generation apparatus embodiments provided below can be found in the limitations of the presentation generation method described above, and will not be repeated here.
[0142] In one exemplary embodiment, such as Figure 6 As shown, a presentation generation device 600 is provided, including: an outline generation module 601, a content generation module 602, and a document generation module 603, wherein:
[0143] The outline generation module 601 is used to generate first prompt words corresponding to the above-mentioned manuscript theme information based on a predefined first prompt word template when the manuscript theme information is obtained, and to call the preloaded large model based on the above-mentioned first prompt words to generate an outline directory corresponding to the above-mentioned manuscript theme information; the outline directory includes at least two levels of directories.
[0144] The content generation module 602 is used to generate a second prompt word for each subdirectory in the outline directory based on a predefined second prompt word template, and to call the large model based on the second prompt word to generate the content text for each subdirectory; the subdirectory is the last level directory in the at least two-level directory, and the second prompt word template is different from the first prompt word template.
[0145] The document generation module 603 is used to obtain the elements contained in the target document template and the relationship information between the elements based on the parsing result file of the target document template, after obtaining the target document containing the above outline directory and the content text corresponding to each of the above subdirectories; based on the above elements and the relationship information between the elements, determine the matching relationship between the target document and the above elements, and generate a presentation containing the target document based on the matching relationship.
[0146] Based on the aforementioned presentation generation device 600, the outline generation module 601 generates an outline table of contents corresponding to the presentation theme information based on the prompts corresponding to the outline, and the content generation module 602 generates the content text corresponding to the outline table of contents based on the prompts corresponding to each sub-directory in the outline table of contents. The presentation generation module 603 calls the parsing result file of the target presentation template to determine the association information between elements, determine the matching relationship between the target text and elements, and generate the presentation of the target text based on the matching relationship. It can generate the outline table of contents and content text corresponding to the presentation theme information through a large model when the presentation theme information is obtained, and apply the outline table of contents and content text to the target presentation template to obtain the presentation corresponding to the presentation theme information, thereby improving the efficiency of presentation production.
[0147] Furthermore, the elements include text placeholders and image placeholders. The document generation module 603 is specifically used for: for the text placeholders in the target document template, determining the first text corresponding to the text placeholder in the target text according to the matching relationship, and replacing the text placeholder with the first text; for the image placeholders in the target document template, determining the target text placeholder associated with the image placeholder based on the association information between the elements, and determining the second text corresponding to the target text placeholder according to the matching relationship; generating a third prompt word corresponding to the second text based on a predefined third prompt word template, and based on the above-mentioned... The three prompt words invoke the aforementioned large model to determine the text entity corresponding to the aforementioned second text, and obtain the corresponding text feature vector from the aforementioned text entity; the aforementioned third prompt word template is different from either the aforementioned first prompt word template or the aforementioned second prompt word template; from the pre-constructed image vector database, a target image vector matching the aforementioned text feature vector is determined, and the aforementioned image placeholder is replaced with the image corresponding to the aforementioned target image vector; the aforementioned image vector database stores image feature vectors corresponding to multiple preset images; after the aforementioned text placeholder and the aforementioned image placeholder in the aforementioned target document template are replaced, a presentation containing the aforementioned target text is obtained.
[0148] Furthermore, the above-mentioned device also includes a vector database construction module, specifically used for: traversing multiple images pre-saved in the image library, calling the above-mentioned large model to determine the image feature vector corresponding to each of the above-mentioned images; establishing the correspondence between the storage addresses of multiple images and the image feature vectors corresponding to each of the above-mentioned images, and storing the image feature vectors corresponding to the above-mentioned images and the above-mentioned correspondence into the pre-constructed image vector database.
[0149] Further, the content generation module 602 is specifically used to: determine the vector distance between each of the above image feature vectors and the above text feature vectors in the above image vector database; determine a predetermined number of image feature vectors as target image vectors that match the above text feature vectors in order of ascending distance between the above vectors; before replacing the above image placeholder with the image corresponding to the above target image vector, the above method further includes: determining the images corresponding to the above predetermined number of image feature vectors as candidate images, and randomly selecting one image from the above candidate images as the target image, and replacing the above image placeholder.
[0150] Furthermore, the content generation module 602 is specifically used to: adjust the target image according to the size information of the image placeholder and the size information of the target image, and replace the image placeholder with the adjusted target image.
[0151] Furthermore, the device also includes a template parsing module, specifically used for: parsing each page contained in the target document template to obtain the elements in the page and the element attributes of each element; the element attributes include hierarchy information and position information; determining the association information between each element based on the hierarchy information and position information; and storing the elements, element attributes, and association information in each page contained in the target document template as a JSON file according to the order of each page in the target document template, as the parsing result file of the target document template.
[0152] Furthermore, the document generation module 603 is specifically used to: obtain the elements in the target document template and the relationships between the elements based on the JSON file mentioned above, as the first association information; obtain the second association relationship of the text in the target text based on the hierarchical relationship of the directory in the outline directory and the correspondence between each subdirectory and the content text; and determine the matching relationship between the target text and the elements based on the first association relationship and the second association relationship.
[0153] Each module in the aforementioned presentation generation device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in the processor of a computer device in hardware form or independent of it, or stored in the memory of the computer device in software form, so that the processor can call and execute the operations corresponding to each module.
[0154] In one exemplary embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 7 As shown, this computer device includes a processor, memory, input / output interfaces (I / O), and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is also connected to the system bus via the I / O interfaces. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides the environment for the operating system and computer programs stored in the non-volatile storage media. The database stores data such as images, image vectors, and text templates for presentations. The I / O interfaces are used for exchanging information between the processor and external devices. The communication interface is used for communication with external terminals via a network connection. When the computer program is executed by the processor, it implements a presentation generation method.
[0155] Those skilled in the art will understand that Figure 7The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0156] In one exemplary embodiment, a computer device is also provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above-described method embodiments.
[0157] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon that, when executed by a processor, implements the steps in the above method embodiments.
[0158] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above method embodiments.
[0159] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of the relevant data must comply with relevant regulations.
[0160] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments described above. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.
[0161] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0162] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
Claims
1. A method for generating presentation slides, characterized in that, The method includes: Once the manuscript's theme information is obtained, a first prompt word corresponding to the manuscript's theme information is generated based on a predefined first prompt word template. Then, based on the first prompt word, a pre-loaded large model is called to generate an outline directory corresponding to the manuscript's theme information. The outline directory includes at least two levels of directories. For each subdirectory in the outline directory, a second prompt word is generated for each subdirectory based on a predefined second prompt word template, and the main model is called based on the second prompt word to generate the content text for each subdirectory; the subdirectory is the last level directory in the at least two-level directory, and the second prompt word template is different from the first prompt word template; Given the target text containing the outline directory and the content text corresponding to each of the subdirectories, based on the parsing result file of the target document template, the elements contained in the target document template and the association information between the elements are obtained; based on the elements and the association information between the elements, the matching relationship between the target text and the elements is determined, including: mapping each level of directory and each content text in the target text to each element in the parsing result file to obtain the matching relationship between the text information in the target text and the elements in the target document template; Based on the matching relationship, the target text is applied to the target document template to generate a presentation with the document topic information as the theme, the outline as the framework, the content text corresponding to the subdirectories as the content, and the target document template as the style.
2. The method according to claim 1, characterized in that, The elements include text placeholders and image placeholders; generating a presentation containing the target text based on the matching relationship includes: For the text placeholders in the target document template, determine the first text in the target text that corresponds to the text placeholders according to the matching relationship, and replace the text placeholders with the first text; For the image placeholders in the target document template, based on the association information between the elements, the target text placeholder associated with the image placeholder is determined, and the second text corresponding to the target text placeholder is determined according to the matching relationship; The third prompt word is generated based on a predefined third prompt word template, and the large model is called based on the third prompt word to determine the text entity corresponding to the second text. The corresponding text feature vector is obtained from the text entity. The third prompt word template is different from either the first prompt word template or the second prompt word template. From a pre-built image vector database, a target image vector matching the text feature vector is determined, and the image placeholder is replaced with the image corresponding to the target image vector; the image vector database stores image feature vectors corresponding to multiple preset images. After the text placeholders and image placeholders in the target document template are replaced, a presentation containing the target text is obtained.
3. The method according to claim 2, characterized in that, The method further includes: Iterate through multiple images pre-saved in the image library and call the large model to determine the image feature vector corresponding to each image; Establish a correspondence between the storage addresses of multiple images and the corresponding image feature vectors of each image, and store the image feature vectors corresponding to the images and the correspondence in a pre-constructed image vector database.
4. The method according to claim 2, characterized in that, The step of determining the target image vector that matches the text feature vector from a pre-built image vector database includes: Determine the vector distance between each image feature vector and the text feature vector in the image vector database; According to the order of the distances between the vectors from smallest to largest, a predetermined number of image feature vectors are determined as target image vectors that match the text feature vectors; Replacing the image placeholder with the image corresponding to the target image vector includes: The images corresponding to the predetermined number of image feature vectors are identified as candidate images, and one image is randomly selected from the candidate images as the target image, replacing the image placeholder.
5. The method according to claim 4, characterized in that, Replacing the image placeholder with the image corresponding to the target image vector includes: Based on the size information of the image placeholder and the size information of the target image, the target image is adjusted, and the adjusted target image is used to replace the image placeholder.
6. The method according to claim 1, characterized in that, The method further includes: The target document template is parsed to obtain the elements on the pages and the element attributes of each element; the element attributes include hierarchy information and position information. Based on the hierarchical and positional information, the association information between each element is determined; According to the order of each page in the target document template, the elements, element attributes and association information of each page contained in the target document template are stored as JSON files, which serve as the parsing result files of the target document template.
7. The method according to claim 6, characterized in that, The step of obtaining the matching relationship between the target text and the elements based on the elements and the association information between the elements includes: Based on the JSON file, the elements in the target document template and the relationships between the elements are obtained as the first association information; Based on the hierarchical relationship of the directories in the outline directory and the correspondence between each subdirectory and the content text, the second association relationship of the text in the target text is obtained; Based on the first association relationship and the second association relationship, the matching relationship between the target text and the element is determined.
8. A presentation generation device, characterized in that, The device includes: The outline generation module is used to generate a first prompt word corresponding to the document topic information based on a predefined first prompt word template when the document topic information is obtained, and to call a preloaded large model based on the first prompt word to generate an outline directory corresponding to the document topic information; the outline directory includes at least two levels of directories; The content generation module is used to generate a second prompt word for each subdirectory in the outline directory based on a predefined second prompt word template, and to call the large model based on the second prompt word to generate the content text for each subdirectory; the subdirectory is the last level directory in the at least two-level directory, and the second prompt word template is different from the first prompt word template; The document generation module is used to, upon obtaining a target text containing the outline and the content text corresponding to each of the subdirectories, obtain the elements contained in the target document template and the association information between the elements based on the parsing result file of the target document template; based on the elements and the association information between the elements, obtain the matching relationship between the target text and the elements, including: mapping each level of directory and each content text in the target text to each element in the parsing result file to obtain the matching relationship between the text information in the target text and the elements in the target document template; and based on the matching relationship, applying the target text to the target document template to generate a presentation document with the document theme information as the theme, the outline as the framework, the content text corresponding to the subdirectories as the content, and the target document template as the style.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Method and device for generating UI (User Interface) design draft and storage medium
CN116991406A
Powerpoint generation method and device, electronic equipment and storage medium
CN117436414A