Method and device for implanting advertisement in text, electronic equipment and storage medium
Through large -scale language model training targets to generate models, automatically extract advertising points and creativity from the text, solve the problem of low efficiency of artificial advertising points, and achieve efficient advertising implantation.
Patent Information
- Application Number
- CN202411344470.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-25
- Publication Date
- 2025-01-21
AI Technical Summary
In the prior art, the search for advertising points mainly relies on manual labor, resulting in low efficiency and long time.
Sample data is generated through large language models, training targets generate models, can extract advertising points and advertising ideas from the text, and automatically complete advertising implantation.
There is no need to manually insert advertisements. The system automatically finds advertising spots and generates advertising creatives, which improves the efficiency of advertising insertion, meets advertising needs and fits the text content.
Smart Images

Figure CN119338521A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of neural network technology, and in particular to a method, device, electronic device and storage medium for embedding advertisements in text. Background Art
[0002] In today's digital age, video websites have become one of the main channels for people to obtain entertainment content. An important source of profit for these platforms is advertising revenue. In order to maximize the advertising effect and maintain the user experience, it is necessary to find suitable advertising spots in the script for implantation. This process directly affects the effect of the advertisement and the user's viewing experience, so it is crucial to the operation of video websites.
[0003] At present, the search for advertising spots is mainly done manually. Professionals need to read the script carefully, and manually mark suitable locations for advertising and write down advertising ideas based on factors such as plot development and scene switching, as well as the needs and preferences of advertisers. However, manually reading and understanding scripts and advertising placements takes a lot of time, and the efficiency of advertising placement is low. Summary of the invention
[0004] In order to solve the above technical problem or at least partially solve the above technical problem, the present application provides a method, device, electronic device and storage medium for embedding advertisements in text.
[0005] In a first aspect, the present application provides a method for embedding advertisements in text, the method comprising: generating multiple sample data through a large language model, wherein each of the sample data comprises a sample text, a sample advertising demand, and advertising spots and advertising creativity marked in the sample text, the sample text is a script text, the advertising spots represent plot nodes suitable for inserting advertisements, and the advertising creativity represents advertising content that is related to the text content and can attract the attention of the audience; using the sample data to train an initial generation model to obtain a target generation model so that the target generation model learns the ability to extract advertising spots and advertising creativity from text; inputting the target text and the target advertising demand into the target generation model to obtain the target advertising spots and target advertising creativity in the target text output by the target generation model, wherein the target text is a script text to be identified, and the target advertising creativity meets the target advertising demand and fits the target text.
[0006] Optionally, generating multiple sample data through a large language model includes: using the large language model to process the initial text and the initial advertising demand, and outputting an advertising implantation result, wherein the advertising implantation result includes an advertising category, an advertising spot, and an advertising creative, and a negative plot advertisement in the initial text is used as a negative sample; determining whether the advertising category is consistent with the category in the advertising demand, whether the advertising creative is reasonable, and whether a negative plot advertisement appears; if the advertising category is consistent with the category in the advertising demand, the advertising creative is reasonable, and no negative plot advertisement appears, then generating sample data according to the initial text, the initial advertising demand, the advertising spot, and the advertising creative in the advertising implantation result.
[0007] Optionally, the large language model is used to process the initial text and the initial advertising demand, and the output advertising implantation result includes: if the content of the initial advertising demand is empty, the large language model is used to extract a first entity whose exposure frequency is higher than a set frequency from the initial text, wherein the first entity is used for advertising investment; the advertising creativity is determined by combining the characteristics of the first entity and the plot of the initial text, and the advertising location is determined according to the location where the first entity appears.
[0008] Optionally, the large language model is used to process the initial text and initial advertising demand, and the output advertising implantation result includes: if the initial advertising demand contains an advertising category, extracting a second entity related to the advertising category from the initial text; determining the advertising creative by combining the characteristics of the second entity and the plot of the initial text, and determining the advertising location according to the location where the second entity appears.
[0009] Optionally, the large language model is used to process the initial text and initial advertising demand, and the output advertising implantation result includes: if the initial advertising demand contains advertiser preferences and advertising categories, extracting a third entity related to the advertiser preferences and the advertising category from the initial text; determining the advertising creative by combining the characteristics of the third entity and the plot of the initial text, and determining the advertising location according to the location where the third entity appears.
[0010] Optionally, the sample data is used to train the initial generation model to obtain the target generation model, including: setting model parameters of the initial generation model; using the sample data to train the initial generation model, if the annotation result output by the initial generation model is different from the annotation content in the sample text, adjusting the model parameters until the annotation result is the same as the annotation content in the sample text; using a test data set to test the trained model, and using the ROUGE score to generate an evaluation indicator; if the evaluation indicator meets the preset indicator requirements, the target generation model is obtained.
[0011] Optionally, before using the large language model to process the initial text, the method further includes: parsing the document of the initial text to extract text content and format information; and converting the extracted text content and format information into a set format that can be recognized by the large language model.
[0012] In a second aspect, the present application provides a device for embedding advertisements in text, the device comprising: a generation module, which is used to generate multiple sample data through a large language model, wherein each of the sample data comprises a sample text, a sample advertising demand, and advertising spots and advertising creativity marked in the sample text, the sample text is a script text, the advertising spots represent plot nodes suitable for inserting advertisements, and the advertising creativity represents advertising content that is related to the text content and can attract the attention of the audience; an acquisition module, which is used to use the sample data to train an initial generation model to obtain a target generation model so that the target generation model learns the ability to extract advertising spots and advertising creativity from text; an input and output module, which is used to input the target text and the target advertising demand into the target generation model to obtain the target advertising spots and target advertising creativity in the target text output by the target generation model, wherein the target text is a script text to be identified, and the target advertising creativity meets the target advertising demand and fits the target text.
[0013] According to a third aspect, an electronic device is provided, comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus; the memory is used to store computer programs; and the processor is used to implement any of the steps of the method for embedding advertisements in text when executing the program stored in the memory.
[0014] In a fourth aspect, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the computer program implements any of the steps of the method for embedding advertisements in text.
[0015] The above technical solution provided by the embodiment of the present application has the following advantages compared with the prior art:
[0016] The method provided in the embodiment of the present application obtains multiple sample data through a large language model, and then uses the sample data to obtain a target generation model. In the actual use of the model, the user inputs the target text and target advertising requirements, and the model can directly output the target advertising location and target advertising creativity. The advertising implantation generated in this way not only meets the advertising requirements but also fits the target text. The present application does not require manual advertising implantation, and the system automatically searches for advertising locations and generates advertising creativity, thereby improving the efficiency of advertising implantation. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.
[0018] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0019] Figure 1 A schematic diagram of the hardware environment of a method for embedding advertisements in text provided in an embodiment of the present application;
[0020] Figure 2 A flowchart of a method for embedding advertisements in text provided in an embodiment of the present application;
[0021] Figure 3 A system block diagram for embedding advertisements in text provided in an embodiment of the present application;
[0022] Figure 4 A schematic diagram of the structure of a device for embedding advertisements in text provided in an embodiment of the present application;
[0023] Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0024] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.
[0025] In the following description, the suffixes such as "module", "component" or "unit" used to represent elements are only used to facilitate the description of the present application and have no specific meaning. Therefore, "module" and "component" can be used interchangeably.
[0026] In order to solve the problem mentioned in the background technology, according to one aspect of the embodiments of the present application, an embodiment of a method for embedding advertisements in text is provided.
[0027] Optionally, in the embodiment of the present application, the above method of embedding advertisements in text can be applied to: Figure 1 In the hardware environment composed of the terminal 101 and the server 103 shown in FIG. Figure 1 As shown, the server 103 is connected to the terminal 101 via a network, and can be used to provide services for the terminal or a client installed on the terminal. A database 105 can be set on the server or independently of the server to provide data storage services for the server 103. The above-mentioned network includes but is not limited to: a wide area network, a metropolitan area network or a local area network, and the terminal 101 includes but is not limited to a PC, a mobile phone, a tablet computer, etc.
[0028] The embodiment of the present application provides a method for embedding advertisements in text, which can be applied to a server to improve the efficiency of embedding advertisements in text.
[0029] The following will describe in detail a method for embedding advertisements in text provided by an embodiment of the present application in conjunction with a specific implementation method. Figure 2 As shown, the specific steps are as follows:
[0030] Step 201: Generate multiple pieces of sample data through a large language model, wherein each piece of sample data includes a sample text, a sample advertising demand, and an advertising point and an advertising creative marked in the sample text. The sample text is a script text, the advertising point indicates a plot node suitable for inserting an advertisement, and the advertising creative indicates an advertising content that is related to the text content and can attract the audience's attention.
[0031] Step 202: using sample data to train an initial generation model to obtain a target generation model, so that the target generation model learns the ability to extract advertising spots and advertising creativity from text;
[0032] Step 203: Input the target text and target advertising requirements into the target generation model to obtain the target advertising spots and target advertising creatives in the target text output by the target generation model, wherein the target text is the script text to be identified, and the target advertising creatives meet the target advertising requirements and fit the target text.
[0033] A large language model is used to obtain multiple sample data, and then the sample data is used to obtain a target generation model. In the actual use of the model, the user inputs the target text and target advertising requirements, and the model can directly output the target advertising location and target advertising creativity. The advertising implantation generated in this way not only meets the advertising requirements but also fits the target text. This application does not require manual advertising implantation. The system automatically searches for advertising locations and generates advertising creativity, thereby improving the efficiency of advertising implantation.
[0034] Alternatively, an ad spot refers to a plot point suitable for inserting a commercial advertisement, and the selection of the spot is often based on a variety of factors, including natural pauses in the plot, predicted audience engagement, and relevance to the content of the advertisement. For example, in a TV series, an ad spot may be located between scene changes, after a tense plot, or at a natural break in dialogue.
[0035] Alternatively, advertising creativity refers to the creation of original advertising ideas that are related to the content, theme, characters or situations of the script. These ideas should resonate with the target audience, while using the unique background or plot points provided by the script to increase the appeal and memorability of the advertisement. Advertising creativity can achieve a deep integration of advertising and plot, which means that the advertisement is not just placed at a certain time in the plot, but its content, form and display method are essentially related to the plot. This deep integration may involve naturally embedding products or services into the storyline, such as characters using a brand's product to solve problems, or the advertising storyline is intertwined with the main plot line.
[0036] Reasonable advertising placement and advertising creativity can not only attract audiences more effectively, but also help enhance the overall entertainment experience, avoid interrupting the plot flow, and thus reduce the audience's resistance to advertising.
[0037] Optionally, a large language model refers to a language model containing hundreds of billions (or more) parameters, which are trained on a large amount of text data. The large language model in the embodiment of the present application can adopt GPT-4, Claude, etc. The embodiment of the present application does not limit the specific type of the large language model.
[0038] By automatically determining the advertising spots and creative ideas in the script, the speed of advertising spot identification can be greatly improved, allowing advertisers to complete advertising placement planning more quickly, reducing the need for manual script review and reducing the labor cost of advertising planning. In addition, through intelligent analysis, more suitable advertising placement points and more natural advertising placement can be found, reducing the audience's negative emotions, improving the overall viewing experience, and improving advertising effectiveness. Through more accurate advertising delivery, the advertising value can be increased and the platform revenue can be increased.
[0039] In step 201, a plurality of sample data are generated by a large language model including the following contents.
[0040] Step 2011: Use a large language model to process the initial text and initial advertising demand, and output advertising implantation results, where the advertising implantation results include advertising categories, advertising spots, and advertising creativity. Negative plot advertisements are used as negative samples in the initial text.
[0041] Step 2012: Determine whether the advertisement category is consistent with the category in the advertisement demand, whether the advertisement creativity is reasonable, and whether there is any negative plot advertisement.
[0042] Step 2013: If the advertisement category is consistent with the category in the advertisement demand, the advertisement creativity is reasonable, and there is no negative plot advertisement, then sample data is generated according to the initial text, initial advertisement demand, advertisement spots and advertisement creativity in the advertisement implantation result.
[0043] In step 211, after the large language model obtains the initial text and initial advertising requirements, the written prompt is used to guide the generation of advertising spots and advertising creatives. Prompt is an instruction or question input to the large language model, which is used to guide the identification of advertising spots in the script and generate corresponding advertising creatives. When writing prompts, the task requirements must be clarified first, such as advertising spot extraction, advertiser categories, named entity recognition, advertiser preferences, etc., and then the tasks that need to be completed by the model are described in detail in the prompt, including specific operation steps and expected outputs. For example, for the advertising spot extraction task, the following prompt can be designed: "Please extract all possible advertising spots from the script and generate advertising creatives about cosmetics." In addition, prompts can guide the model to understand complex contextual information, such as the plot development of the script and the relationship between characters. The prompt contains all the necessary details to ensure that the model can accurately complete the task. For example, different prompts can be designed according to different advertiser types (such as cosmetics, cars, etc.).
[0044] Large language models should avoid producing negative plot advertisements, which may cause sadness or discomfort to the audience. If not handled properly, negative plot advertisements may damage the brand image and cause negative emotions among the public. Therefore, when large language models process text, negative plot advertisements should be used as negative samples to avoid large language models outputting negative plot advertisements.
[0045] Optionally, the advertising demand includes the advertiser's category and the advertiser's preference, such as a preferred role in a script, a preferred advertisement appearance method, a preferred advertisement appearance duration, a preferred advertisement appearance time point, etc.
[0046] The terminal uses OpenAI's GPT-4API or Anthropic's Claude API to input the initial text and initial advertising needs (such as the advertiser's category and the advertiser's preference for a certain role) into a large language model. The large language model deeply understands the context of the script, plot development, and character relationships, thereby identifying the most suitable location for advertising and generating advertising ideas that are deeply integrated with the plot, thereby improving the naturalness and effectiveness of the advertising.
[0047] For example, in a TV series about urban life, there is a character who often uses a certain brand of smartphone. Each episode of the series revolves around the life of this character, and the character uses this phone in almost all important conversations and plot turning points. In this case, the brand's mobile phone advertisement can be inserted at the key dialogue moments of each episode. Such placement is not only natural but also efficient, because the audience already has a deep emotional connection with this character and the phone. At the same time, this placement method also meets the advertiser's desire to increase brand awareness through frequent exposure.
[0048] In step 202 to step 203, the advertising implantation results output by the large language model may not meet the set conditions, so screening is required. First, determine whether the advertising category is consistent with the category in the advertising demand, whether the advertising creativity is reasonable, and whether there are negative plot ads. If one of the above conditions is not met, it indicates that the output of the large language model is incorrect and the result needs to be re-output. If the advertising category is inconsistent or the advertising creativity is unreasonable, then the instructions must be regenerated in the prompt and the advertising implantation results must be output; if negative plot ads appear, the negative samples must be reset and the advertising implantation results must be output, so as to determine whether the results output by the large language model meet the set conditions.
[0049] The advertising implantation results meet the set conditions when: the advertising category is consistent with the category in the advertising demand, the advertising creativity is reasonable, and there are no negative plot ads. At this time, the advertising category, advertising location and advertising creativity can be marked in the initial text, and then the initial text can be used as sample text, the initial advertising demand as sample advertising demand, and the advertising location and advertising creativity as annotations to generate sample data.
[0050] Specifically, we need to conduct a preliminary screening first. 1. Check the consistency of advertising categories: For example, if the advertising demand is about sports shoes, but the model generates an advertisement about food, the categories are inconsistent. 2. Check the rationality of advertising creativity: The rationality here includes but is not limited to whether the advertising content is close to reality and whether it conforms to the audience's cognitive habits. 3. Check negative plots: For example, the advertisement should not contain violence, horror or other content that is not suitable for dissemination.
[0051] Secondly, error handling is required. 1. Inconsistent advertising categories: If it is found that the advertising category does not meet the needs, it is necessary to modify the instructions (Prompt) for generating advertisements and regenerate the advertising implantation results. This step ensures that the advertising content matches customer needs. 2. The advertising creativity is not in line with common sense: If the advertising creativity is unreasonable, it is also necessary to adjust the Prompt and regenerate the advertising implantation results. The purpose is to make the advertising content closer to reality and easier to be accepted by the target audience. 3. Negative plot ads appear: If negative plots appear in the advertising content, it is necessary to reset the negative sample set for model training to prevent the reappearance of such ads and regenerate the advertising implantation results.
[0052] Finally, the results are confirmed. If the advertising placement results meet the set conditions, that is, the advertising category is consistent with the demand, the advertising creativity is reasonable, and there is no negative plot, then the output of the model can be considered correct. In this case, relevant information about the advertisement can be annotated in the initial text, including the advertising point (that is, the insertion position of the advertisement in the text) and the advertising creativity. Using these annotated texts as part of the sample data, the model can be further trained to generate higher quality advertising placement results in the future.
[0053] For example, assuming that you need to generate advertising placement results for a sports shoe brand, the following are the specific steps:
[0054] Preliminary screening: Check whether the advertisement category is sports shoes; confirm whether the advertisement creativity is in line with common sense, for example, whether it describes the functional characteristics of sports shoes, whether it highlights comfort and durability, etc.; confirm whether the advertisement content contains negative information, such as misleading statements or exaggerated propaganda.
[0055] Error handling: If the ad category is inconsistent (for example, a food ad is generated), the prompt needs to be adjusted, for example: "Please generate an ad copy for a sports shoe brand." If the ad creative is unreasonable (for example, too abstract or unrealistic), the prompt also needs to be adjusted to make it more specific and practical. If the ad content contains negative information (for example, exaggeration or denigration of competitors), the negative sample set in the initial text needs to be adjusted to ensure that the model can generate more appropriate ad content in the future.
[0056] The results confirm that: if all of the above conditions are met, for example, the advertising content describes the characteristics of sports shoes and does not contain negative information, the advertising location and advertising creative mark can be included in the initial text and used as part of the sample data.
[0057] Through the above steps, the quality of advertising implantation results can be ensured, and the output of the model can be improved through continuous iteration to ultimately obtain advertising content that better meets actual needs.
[0058] Optionally, a large language model is used to process the initial text and the initial advertising demand, and outputting the advertising implantation result includes three embodiments.
[0059] In a first embodiment, if the content of the initial advertising demand is empty, a large language model is used to extract a first entity whose exposure frequency is higher than a set frequency from the initial text, wherein the first entity is used for advertising investment promotion; the advertising creativity is determined by combining the characteristics of the first entity and the plot of the initial text, and the advertising spot is determined according to the location where the first entity appears.
[0060] The content of the initial advertising demand is empty, which means that the server does not know the categories and preferences of the advertiser. It can also be considered that there are no advertisers and advertising content yet. At this time, in order to find advertisers, entities can be extracted from the text to determine the advertising spots and advertising creatives, and then the advertising spots and advertising creatives are combined to find advertisers. The specific steps include the following.
[0061] 1. Extract first entities with high exposure frequency: First, use a large language model to extract high-frequency first entities from the initial text. First entities refer to those things or concepts that appear frequently in the text and are representative. "Set frequency" is a predefined threshold used to filter out entities with high exposure frequency. This threshold can be adjusted according to the specific situation to ensure that the selected entities have sufficient exposure and importance. For example, if the script is about city life, then "wine", "mobile phone" or "cafe" may be first entities with high exposure frequency.
[0062] 2. Determine the characteristics of the first entity: Understand and analyze the characteristics of the extracted first entity, including its attributes, functions, usage scenarios, etc., to facilitate the design of subsequent advertising creatives. For example, "café" may be an ideal advertising investment entity due to its comfortable environment, convenient location and rich beverage selection.
[0063] 3. Determine the advertising creative idea by combining the characteristics of the first entity and the plot of the initial text: After clarifying the characteristics of the first entity, design advertising creative ideas that are in line with the context of the text in combination with the plot development of the initial text. Advertising creative ideas should be integrated into the plot of the text as much as possible, so that the advertising content looks natural and not abrupt. For example, if the initial text describes that people like to go to a cafe to relax after a busy day at work, then the advertising creative idea can be developed around the casual atmosphere of the cafe, emphasizing the relaxing space it provides for busy urban people. The creative design should also consider the interests and behavior patterns of the target audience to ensure that the advertising content is attractive.
[0064] 4. Determine the advertising location: The advertising location is determined based on the location of the first entity in the initial text. This means that the advertising content will be embedded in the context related to the entity in the text. For example, if "cafe" is mentioned many times in the article and appears in paragraphs describing people's activities after get off work, then advertisements related to cafes can be inserted near these paragraphs.
[0065] For example, assuming that the script is about urban workplace and life, through large language model analysis, it is found that "cafe" is an entity with a high frequency of occurrence. Setting the frequency threshold to 5 times means that only entities that appear at least 5 times in the text will be considered as the first entity for advertising investment. In this article, "cafe" appears 6 times, so this entity becomes a potential advertising investment entity, and the characteristics of the first entity are determined: "cafe": a place for leisure and relaxation, and a social gathering. The script describes that people like to go to a cafe to relax and enjoy a cup of fragrant coffee after a busy day at work. Based on this, an advertisement for a cafe can be inserted next to the paragraph that mentions that people like to go to a cafe to relax after get off work, and the brand of the cafe can be indicated on the cafe to attract users to experience the brand's coffee shop. Through the above steps, even if the advertising demand content is empty, it is possible to extract high-frequency entities from the initial text and design a naturally integrated advertising creative in combination with the text plot, thereby achieving effective advertising implantation.
[0066] In a second embodiment, if the initial advertising demand includes an advertising category, a second entity related to the advertising category is extracted from the initial text; the advertising creative is determined by combining the characteristics of the second entity and the plot of the initial text, and the advertising location is determined based on the location where the second entity appears.
[0067] 1. Extracting second entities related to the advertising category from the initial text: First, a large language model is used to identify entities related to the advertising category specified in the advertising demand from the initial text. Second entities refer to things or concepts that are directly or indirectly related to the advertising category. For example, if the advertising demand is about the branding of sports shoes, then words such as "running", "gym", and "sports" can be considered as second entities.
[0068] 2. Determine the characteristics of the second entity: Analyze the characteristics of the extracted second entity, including their attributes, functions, usage scenarios, etc., to facilitate the design of subsequent advertising creatives. For example, "gym" may become an ideal advertising investment entity because it provides fitness equipment, coaching guidance and other services.
[0069] 3. Determine the advertising creative by combining the characteristics of the second entity and the plot of the initial text: After clarifying the characteristics of the second entity, combine the plot development of the initial text to design advertising creative that fits the context. Advertising creativity should be integrated into the plot of the text as much as possible, so that the advertising content looks natural and not abrupt. For example, if the initial text describes people choosing to wear comfortable sneakers when exercising in the gym, then the advertising creative can revolve around the comfort and professionalism of the sneakers, emphasizing their superior performance in sports. Creative design should also take into account the interests and behavior patterns of the target audience to ensure that the advertising content is attractive.
[0070] 4. Determine the advertising location: The advertising location is determined based on the location where the second entity appears in the initial text. This means that the advertising content will be embedded in the context related to the entity in the text. For example, if "gym" is mentioned many times in the article and appears in paragraphs describing people's fitness exercises, then advertisements related to sports shoes can be inserted near these paragraphs.
[0071] For example, if the initial advertising demand includes an advertising category, such as sports shoe brand promotion, the following steps can be used to generate advertising placement results. Assuming that the script is a professional basketball game and athlete training, through large language model analysis, it is found that "running" and "basketball" are entities related to sports shoe brand promotion. The characteristics of running emphasize speed and endurance, and the characteristics of basketball emphasize movement. In the script, it is mentioned that many professional players will choose to wear professional sports shoes during training to protect their feet from injury in order to pursue better results. Therefore, an advertisement can be designed to emphasize that sports shoes provide excellent protection and comfort when running, highlighting the characteristics of professional running shoes, and insert an advertisement for sports shoe brands next to the paragraph in the script that mentions that players choose professional sports shoes during training. Through the above steps, the advertising category has been specified in the advertising demand. Then, by extracting entities related to the advertising category from the initial text and designing naturally integrated advertising ideas in combination with the text plot, effective advertising placement can be achieved.
[0072] In the third embodiment, if the initial advertising demand includes the advertiser's preference and the advertising category, a third entity related to the advertiser's preference and the advertising category is extracted from the initial text; the advertising creativity is determined by combining the characteristics of the third entity and the plot of the initial text, and the advertising spot is determined according to the location where the third entity appears. The advertiser's preference includes but is not limited to a preferred role in the script, a preferred advertising appearance method, a preferred advertising appearance duration, a preferred advertising appearance time point, etc.
[0073] When the initial advertising demand includes advertiser preferences and advertising categories, the following steps can be followed to generate advertising placement results.
[0074] 1. Extract third entities related to advertiser preferences and advertising categories from the initial text: First, use a large language model to identify entities related to advertiser preferences and advertising categories from the initial text. Third entities refer to things or concepts that are directly or indirectly related to advertiser preferences and advertising categories. For example, if the advertiser prefers a certain athlete character xx in the script, and the advertising category is sports drinks, then words such as "sports", "game", and "athlete xx" can be regarded as third entities.
[0075] 2. Determine the characteristics of the third entity: Analyze the characteristics of the extracted third entities, including their attributes, functions, usage scenarios, etc., to facilitate the design of subsequent advertising creatives. For example, "sports" and "athlete xx" may become ideal advertising investment entities due to their fierce competition and audience attention.
[0076] 3. Determine the advertising creative idea by combining the characteristics of the third entity and the plot of the initial text: After clarifying the characteristics of the third entity, design an advertising creative idea that fits the context and combines it with the plot development of the initial text. The advertising creative idea should be integrated into the plot of the text as much as possible, so that the advertising content looks natural and not abrupt. For example, if the initial text describes the athlete xx fighting hard in the game, then the advertising creative idea can be centered around sports drinks replenishing energy for athletes at critical moments, emphasizing their role in high-intensity exercise.
[0077] 4. Determine the advertising location: The advertising location is determined based on the appearance position of the third entity in the initial text, which means that the advertising content will be embedded in the context related to the entity in the text, for example, inserting an advertisement related to sports drinks near the paragraph about athlete xx drinking water after the game.
[0078] For example, if the advertiser prefers a certain role in the script (such as the protagonist), and the advertising category is sports drinks, the following steps can be used to generate advertising placement results: Assuming that the initial text is about a football match, through large language model analysis, it is found that "sports" and "athlete xx" are high-frequency words related to the advertiser's preferred role (protagonist) and sports drink brand promotion. "Sports": emphasizes health and vitality, "athlete xx": professional players participating in the game, representing hard work and struggle. The text mentions that the protagonist is a football player. In order to win the game, he keeps running and fighting, and his sweat soaks his jersey. Therefore, an advertisement can be designed to emphasize that sports drinks replenish energy for athletes at critical moments of the game, highlighting its important role in high-intensity sports. The text also describes the plot of the protagonist drinking sports drinks during the game. Taking this opportunity, an advertisement can be made that emphasizes that sports drinks quickly replenish physical energy to attract the audience's attention, and an advertisement for sports drink brands can be inserted near the paragraph where the protagonist drinks sports drinks during rest. Through the above steps, even if the advertiser preferences and advertising categories have been specified in the advertising requirements, effective advertising placement can be achieved by extracting entities related to the advertiser preferences and advertising categories from the initial text and designing naturally integrated advertising creatives based on the text plot.
[0079] This application flexibly adjusts the extraction strategy according to different advertising needs (such as unknown advertisers, known advertiser categories, known advertiser preferences and categories) to meet diverse advertising needs. In addition, the language model can deeply understand the content of the script, determine the context of the script, plot development and character relationships, thereby identifying the most suitable location for advertising, and can also generate advertising ideas that are deeply integrated with the plot, improving the naturalness and effectiveness of the advertisement.
[0080] As an optional implementation, the sample data is used to train the initial generation model, and obtaining the target generation model includes: setting the model parameters of the initial generation model; using the sample data to train the initial generation model, if the annotation result output by the initial generation model is different from the annotation content in the sample text, the model parameters are adjusted until the annotation result is the same as the annotation content in the sample text; using the test data set to test the trained model, and using the ROUGE score to generate an evaluation indicator; if the evaluation indicator meets the preset indicator requirements, the target generation model is obtained.
[0081] In the process of building the target generation model, it is necessary to first set the initial parameters of the model, which include but are not limited to the structural configuration of the model (such as the number of layers, the number of neurons), the learning rate, the batch size, etc. In addition, it is also necessary to define the loss function (such as the cross entropy loss function) and the evaluation index (ROUGE score), which will affect the training process and final performance of the model. The embodiment of the present application uses the Transformers library of Hugging Face and performs fine-tuning training based on the Qwen-32B model, and the training process is implemented using the PyTorch framework.
[0082] Next, use the prepared sample data set to train the initial generation model. The sample data set contains sample advertising requirements and annotated sample texts. The annotated content includes advertising spots and advertising creatives. By learning these annotated data, the model learns how to correctly identify and annotate the location of advertising implants, creative content, and the advertising requirements met. During the training process, the model will output a series of annotation results. If these annotation results are inconsistent with the actual annotation content in the sample data set, the model parameters need to be adjusted so that the model can gradually approach the correct annotation results. This process is iterated repeatedly until the annotation results output by the model are consistent with the annotation content in the sample data set.
[0083] Once the model training is completed, it is necessary to evaluate the model using a test data set. During the evaluation process, the ROUGE score metric can be used to measure the similarity between the ad placement results generated by the model and the standard answer. The ROUGE score is mainly used in text generation tasks. It evaluates the performance of the model by calculating the ratio of n-grams that overlap between the text generated by the model and the reference text. If the evaluation indicator meets the preset requirements, it means that the model has achieved the expected effect. At this time, the final target generation model is obtained, and the target generation model is used to deploy the local model. If the evaluation indicator fails to meet the preset requirements, it is necessary to further adjust the model parameters or change the training strategy until the performance of the model meets expectations.
[0084] The attention mechanism plays an important role in this process. In model training and use, the attention mechanism helps the model allocate resources more intelligently when processing input data. Specifically, when processing text data, the attention mechanism allows the model to focus on the most relevant parts. For example, in the task of generating advertising placement results, the model can pay more attention to entities and contexts that are closely related to advertising needs, thereby improving the relevance and effectiveness of advertising creativity.
[0085] In summary, by setting the model parameters of the initial generation model and using sample data for model training, combined with the application of the attention mechanism, the performance of the model in the task of generating advertising placement results can be effectively improved. Through continuous model training and evaluation, a closed-loop optimization process is formed to ensure that the system performance is continuously improved, and ultimately a target generation model that can accurately identify advertising locations and generate creative content that meets advertising needs can be obtained.
[0086] Large language models are commercial models. This application solves the data security issues that may arise from using commercial model APIs by training local models, which is particularly suitable for processing sensitive text content. In the early stage, commercial models are used for rapid startup, and later local models are used to reduce operating costs, achieving the best balance between effect and cost. In addition, the system can continuously learn from new scripts and manual feedback, continuously improve model performance, and adapt to changing advertising needs and script styles.
[0087] In this application, the core algorithm of model training is a language model based on the Transformer architecture. The attention mechanism is the key to achieving context understanding. The calculation formula of the attention mechanism is as follows:
[0088]
[0089] Among them, Q, K, V represent query, key, and value respectively, dk is the dimension of the key vector, and KT represents the transpose of K.
[0090] During model training, the cross entropy loss function is used:
[0091]
[0092] Among them, L is the loss function, N is the number of samples, C is the number of categories, yij is the true label, and pij is the predicted probability.
[0093] After the model training is completed, the model is deployed locally, and the local model extracts the advertising spots and advertising creativity, and the results are visualized. Specifically, the Flask framework can be used to build a Web application, and Vue.js can be used on the front end to implement an interactive interface.
[0094] As an optional implementation, before the large language model is used to process the initial text, the method further includes: parsing the document of the initial text to extract the text content and format information; converting the extracted text content and format information into a set format that can be recognized by the large language model. The set format can be JSON format or other formats.
[0095] The server uses Python's docx library to parse the initial text document, extract the plain text content in the document, and also obtain the style information of paragraphs and tables, such as font size, color, alignment, etc. These are all part of the format information and are very important for subsequent data processing and display. The JSON library is used to convert the extracted text content and format information into JSON format, which makes it easier for the server to identify and read the content of the initial text.
[0096] Based on the same technical concept, the embodiment of the present application also provides a system block diagram for embedding advertisements in text, such as Figure 3 As shown, it includes the following five modules.
[0097] 1. Script preprocessing module: Convert Word format text into structured JSON text.
[0098] Use Python's docx library to parse the Word document, extract the text content and formatting information, and then use the json library to convert the extracted information into JSON format.
[0099] 2. Advertising spot extraction module: Use a large language model to extract advertising spots and generate advertising creatives according to different needs.
[0100] Use OpenAI's GPT-4 API or Anthropic's Claude API to guide the model through prompts to extract advertising spots and generate advertising creatives.
[0101] 1. Use a large language model to input the initial text and initial advertising needs into the large language model, and output advertising categories, advertising locations, and advertising creativity.
[0102] There are three ways to handle advertising needs:
[0103] 1) If the content of the initial advertising demand is empty, a large language model is used to extract the first entity with a high exposure frequency from the initial text, and advertising is implanted and investment is solicited based on the characteristics of the first entity.
[0104] 2) If the initial advertising demand includes advertising categories, such as cosmetics, automobiles, etc., the second entity related to the advertising category is extracted based on the content of the initial text for advertising placement and investment promotion.
[0105] 3) If the initial advertising demand contains advertiser preferences (such as specified roles) and advertising categories, third entities related to the advertising categories are extracted based on the content of the initial text for advertising placement and investment promotion.
[0106] 2. Determine whether the advertising category is consistent with the category in the initial advertising demand, whether the advertising creativity is reasonable, and whether there are any negative plot advertisements.
[0107] 3. If the advertising category is consistent with the category in the initial advertising demand, the advertising creativity is reasonable, and there is no negative plot advertising, sample data is generated based on the initial text, initial advertising demand, advertising spots and advertising creativity.
[0108] 3. Local model training module: Based on the output results of large commercial models, train locally deployed self-developed models.
[0109] Large language models are commercial models, which have disadvantages such as data security and high prices. Therefore, it is necessary to train self-developed models deployed locally. Sample data can be collected by manual annotation or by using authorized commercial models to output results. Local model training solves the problems of data security and cost of commercial models.
[0110] 4. Model evaluation module: evaluate and deploy the trained model.
[0111] Use the ROUGE library to calculate the ROUGE score. After the evaluation passes, deploy the local model.
[0112] 5. Advertising location display module: Use the local model to extract advertising locations and advertising creatives, and display them visually.
[0113] The web application is built using the Flask framework, and the front-end uses Vue.js to implement an interactive interface. The target text and target advertising requirements entered by the user are received, and the results are generated as advertising spots and advertising creatives. The generated results are visualized and an interactive interface is provided for users to modify and confirm.
[0114] The system adopts a modular design to facilitate future functional expansion and performance optimization.
[0115] Based on the same technical concept, the embodiment of the present application also provides a device for embedding advertisements in text, such as Figure 4 As shown, the device comprises:
[0116] The generating module 401 is used to generate a plurality of sample data by using a large language model, wherein each sample data includes a sample text, a sample advertising demand, and an advertising point and an advertising creative marked in the sample text. The sample text is a script text, the advertising point indicates a plot node suitable for inserting an advertisement, and the advertising creative indicates an advertising content that is related to the text content and can attract the audience's attention.
[0117] Obtaining module 402, for training the initial generation model using sample data to obtain a target generation model, so that the target generation model learns the ability to extract advertisement spots and advertisement creativity from the text;
[0118] The input-output module 403 is used to input the target text and target advertising requirements into the target generation model to obtain the target advertising spots and target advertising creativity in the target text output by the target generation model, wherein the target text is the script text to be identified, and the target advertising creativity meets the target advertising requirements and fits the target text.
[0119] Optionally, the generating module 401 is used for:
[0120] A large language model is used to process the initial text and initial advertising demand, and the advertising placement results are output. The advertising placement results include advertising categories, advertising locations, and advertising creativity. Negative plot advertisements are used as negative samples in the initial text.
[0121] Determine whether the advertising category is consistent with the category in the advertising demand, whether the advertising creativity is reasonable, and whether there are any negative plot ads;
[0122] If the advertising category is consistent with the category in the advertising demand, the advertising creativity is reasonable, and there are no negative plot ads, sample data will be generated based on the initial text, initial advertising demand, advertising spots and advertising creativity in the advertising implantation results.
[0123] Optionally, the generating module 401 is used for:
[0124] If the content of the initial advertising demand is empty, a large language model is used to extract a first entity with an exposure frequency higher than a set frequency from the initial text, wherein the first entity is used for advertising investment promotion;
[0125] The advertising creative is determined by combining the features of the first entity and the plot of the initial text, and the advertising spot is determined according to the position where the first entity appears.
[0126] Optionally, the generating module 401 is used for:
[0127] If the initial advertising demand includes an advertising category, extracting a second entity related to the advertising category from the initial text;
[0128] The advertising creative is determined by combining the characteristics of the second entity and the plot of the initial text, and the advertising spot is determined according to the position where the second entity appears.
[0129] Optionally, the generating module 401 is used for:
[0130] If the initial advertising demand includes advertiser preference and advertising category, extracting a third entity related to the advertiser preference and the advertising category from the initial text;
[0131] The advertising creative is determined by combining the characteristics of the third entity and the plot of the initial text, and the advertising spot is determined according to the location where the third entity appears.
[0132] Optionally, the obtaining module 402 is used to:
[0133] Set the model parameters of the initial generation model;
[0134] The sample data is used to train the initial generation model. If the annotation result output by the initial generation model is different from the annotation content in the sample text, the model parameters are adjusted until the annotation result is the same as the annotation content in the sample text.
[0135] Use the test data set to test the trained model, and use the ROUGE score to generate evaluation indicators;
[0136] If the evaluation index meets the preset index requirements, the target generation model is obtained.
[0137] Optionally, the device is also used for:
[0138] Parse the original text document and extract text content and format information;
[0139] Convert the extracted text content and format information into a set format that can be recognized by large language models.
[0140] Based on the same technical concept, an embodiment of the present invention further provides an electronic device, such as Figure 5 As shown, it includes a processor 501, a communication interface 502, a memory 503 and a communication bus 504, wherein the processor 501, the communication interface 502, and the memory 503 communicate with each other through the communication bus 504.
[0141] Memory 503, used for storing computer programs;
[0142] The processor 501 is used to implement the above steps when executing the program stored in the memory 503.
[0143] The communication bus mentioned in the above electronic device can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
[0144] The communication interface is used for communication between the above electronic device and other devices.
[0145] The memory may include a random access memory (RAM) or a non-volatile memory (NVM), such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.
[0146] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0147] In another embodiment of the present invention, a computer-readable storage medium is provided, in which a computer program is stored. When the computer program is executed by a processor, the steps of any of the above methods are implemented.
[0148] In another embodiment of the present invention, a computer program product including instructions is provided, which enables the computer to execute any one of the methods in the above embodiments when the computer program product is executed on the computer.
[0149] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented by software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present invention is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk Solid State Disk (SSD)), etc.
[0150] It should be noted that, in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device that includes a series of elements includes not only those elements, but also other elements that are not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a..." do not exclude the existence of other identical elements in the process, method, article or device that includes the elements.
[0151] The foregoing is merely a specific embodiment of the present invention, which enables those skilled in the art to understand or implement the present invention. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features claimed herein.
Claims
1. A method for embedding advertisement in text, characterized in that: The method comprises: Generate multiple pieces of sample data through a large language model, wherein each piece of sample data includes a sample text, a sample advertising demand, and an advertising point and an advertising creative marked in the sample text, the sample text is a script text, the advertising point represents a plot node suitable for inserting an advertisement, and the advertising creative represents an advertising content that is related to the text content and can attract the audience's attention; The sample data is used to train an initial generation model to obtain a target generation model, so that the target generation model learns the ability to extract advertising spots and advertising creativity from text; The target text and target advertising requirements are input into the target generation model to obtain target advertising spots and target advertising creatives in the target text output by the target generation model, wherein the target text is a script text to be identified, and the target advertising creatives meet the target advertising requirements and fit the target text.
2. The method according to claim 1, characterized in that Generate multiple sample data through large language models including: The large language model is used to process the initial text and the initial advertising demand, and an advertising implantation result is output, wherein the advertising implantation result includes advertising categories, advertising spots, and advertising creativity, and negative plot advertisements in the initial text are used as negative samples; Determine whether the advertisement category is consistent with the category in the advertisement demand, whether the advertisement creativity is reasonable, and whether there is any negative plot advertisement; If the advertising category is consistent with the category in the advertising demand, the advertising creativity is reasonable, and no negative plot advertisements appear, sample data is generated based on the initial text, the initial advertising demand, the advertising spots and advertising creativity in the advertising implantation results.
3. The method according to claim 2, characterized in that The large language model is used to process the initial text and the initial advertising demand, and the output advertising implantation results include: If the content of the initial advertising demand is empty, extracting a first entity having an exposure frequency higher than a set frequency from the initial text using the large language model, wherein the first entity is used for advertising investment promotion; The advertising creative is determined by combining the features of the first entity and the plot of the initial text, and the advertising spot is determined according to the position where the first entity appears.
4. The method according to claim 2, characterized in that: The large language model is used to process the initial text and the initial advertising demand, and the output advertising implantation results include: If the initial advertisement demand includes an advertisement category, extracting a second entity related to the advertisement category from the initial text; The advertising creative is determined by combining the features of the second entity and the plot of the initial text, and the advertising spot is determined according to the position where the second entity appears.
5. The method according to claim 2, characterized in that: The large language model is used to process the initial text and the initial advertising demand, and the output advertising implantation results include: If the initial advertisement demand includes advertiser preference and advertisement category, extracting a third entity related to the advertiser preference and the advertisement category from the initial text; The advertising creative is determined by combining the characteristics of the third entity and the plot of the initial text, and the advertising spot is determined according to the position where the third entity appears.
6. The method according to claim 1, characterized in that The sample data is used to train the initial generation model to obtain the target generation model, including: Set the model parameters of the initial generation model; The sample data is used to perform model training on the initial generation model, and if the annotation result output by the initial generation model is different from the annotation content in the sample text, the model parameters are adjusted until the annotation result is the same as the annotation content in the sample text; Use the test data set to test the trained model, and use the ROUGE score to generate evaluation indicators; If the evaluation index meets the preset index requirement, the target generation model is obtained.
7. The method according to claim 2, characterized in that: Before using the large language model to process the initial text, the method further includes: Parsing the document of the initial text to extract text content and format information; The extracted text content and the format information are converted into a set format that can be recognized by the large language model.
8. A device for embedding advertisements in text, characterized in that: The device comprises: A generation module, used to generate multiple pieces of sample data through a large language model, wherein each piece of sample data includes a sample text, a sample advertising demand, and an advertising point and an advertising creative marked in the sample text, wherein the sample text is a script text, the advertising point represents a plot node suitable for inserting an advertisement, and the advertising creative represents an advertising content that is related to the text content and can attract the audience's attention; An obtaining module is used to train an initial generation model using the sample data to obtain a target generation model, so that the target generation model can learn the ability to extract advertising spots and advertising creativity from text; An input-output module is used to input the target text and target advertising requirements into the target generation model to obtain the target advertising spots and target advertising creatives in the target text output by the target generation model, wherein the target text is the script text to be identified, and the target advertising creatives meet the target advertising requirements and fit the target text.
9. An electronic device, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; Memory, used to store computer programs; A processor, for implementing the method steps described in any one of claims 1 to 7 when executing a program stored in a memory.
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 by a processor, the method steps described in any one of claims 1 to 7 are implemented.