Poem text generation method and device, storage medium and computer device
By constructing a poetry and copywriting library, and using vowel matching and scene features to train a model to generate high-quality poetry copywriting, the problems of low generation efficiency and limited scene coverage in existing technologies are solved, and efficient and diversified poetry copywriting generation is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- RAJAX NETWORK &TECHNOLOGY (SHANGHAI) CO LTD
- Filing Date
- 2023-05-23
- Publication Date
- 2026-05-22
AI Technical Summary
Existing technologies for generating poetry copy are inefficient and have a limited scope of application, making it difficult to meet diverse application needs.
By constructing a poetry database and a copywriting database, the first pre-selected poetry copywriting is generated by matching the vowels of pre-selected poetry and copywriting. The poetry copywriting generation model is then trained by combining scene features to select poetry copywriting with high matching degree.
It improved the efficiency of generating poetry copy, expanded the scope of application scenarios, and ensured the quality of the generated copy.
Smart Images

Figure CN116467431B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of Internet technology, and in particular to a method, apparatus, storage medium, and computer equipment for generating poetic text. Background Technology
[0002] In recent years, scenario cards have gradually emerged in search, recommendation, and marketing scenarios. Some copywriting combined with classical Chinese poetry, such as "Life is only 30,000 days long, with wine and meat, one can be a little immortal," has greatly attracted users, especially young users. Such copywriting is also known as "poetic copywriting." In some software products, the combination of poetic copywriting and products can greatly enhance the appeal of the products.
[0003] In existing technologies, poetry copywriting is mainly generated through pre-trained text generation models based on user-inputted topic information, keyword information, and poetry type. However, the efficiency of generating poetry copywriting based on specific information is relatively low, and the scenarios involved in poetry copywriting are also relatively limited. This greatly restricts the speed of poetry copywriting generation and the scope of scenarios covered by poetry copywriting. Summary of the Invention
[0004] In view of this, this application provides a method, apparatus, storage medium and computer equipment for generating poetry copy, the main purpose of which is to solve the technical problems of slow poetry copy generation speed and small scene coverage.
[0005] According to a first aspect of the present invention, a method for generating poetic text is provided, the method comprising:
[0006] Based on pre-collected poetry and copywriting materials, a poetry library and a copywriting library are constructed respectively. The poetry library includes multiple pre-selected poems, and the copywriting library includes multiple pre-selected copywriting materials.
[0007] Based on the final vowel of the last character of the pre-selected poem and the final vowel of the last character of the pre-selected text, generate multiple first pre-selected poem texts;
[0008] Based on the pre-selected poems and preset scene features, a number of second pre-selected poems are obtained using a pre-trained poetry copywriting generation model. The poetry copywriting generation model is trained based on the first pre-selected poems and the scene features corresponding to the first pre-selected poems.
[0009] At least one poem copy is selected based on the copy matching degree of the first pre-selected poem copy and / or the copy matching degree of the second pre-selected poem copy.
[0010] Optionally, the pre-selected text includes a first pre-selected text and a second pre-selected text; then, the step of constructing a poetry library and a text library based on pre-collected poetry materials and text materials respectively includes: selecting multiple pre-selected poems from the poetry materials based on preset poetry filtering conditions, wherein the poetry filtering conditions include at least one of the following: the number of characters in the poetry material is a preset number of characters, the poetry type of the poetry material is a preset poetry type, the poetry material does not contain preset intention words, and the poetry material is set with popularity tags; selecting multiple first pre-selected texts from the text materials based on the number of exposures and clicks of the text materials, and generating multiple second pre-selected texts based on preset prefix and suffix templates and entity names; constructing the poetry library according to the pre-selected poems and the position tags corresponding to the pre-selected poems, and constructing the text library according to the first pre-selected texts and the second pre-selected texts.
[0011] Optionally, the step of selecting multiple first pre-selected copywritings from the copywriting materials based on the number of exposures and clicks, and generating multiple second pre-selected copywritings based on preset prefix and suffix templates and entity names, includes: calculating the click-through rate of the copywriting materials based on the number of clicks and exposures, and calculating the exposure rate of the copywriting materials based on the number of exposures; calculating the exposure score of the copywriting materials based on the exposure rate and click-through rate; sorting the copywriting materials in descending order according to the exposure score, and determining multiple first pre-selected copywritings from the copywriting materials according to the sorting order; assembling the prefix and suffix templates and the entity names to obtain multiple second pre-selected copywritings, wherein the number of words in the second pre-selected copywritings is the preset number of words.
[0012] Optionally, generating multiple first pre-selected poem texts based on the final vowel of the last character of the pre-selected poem and the final vowel of the last character of the pre-selected text includes: using a preset hash algorithm to extract the final vowel or a combination of auxiliary vowels and final vowels of the last character of the pre-selected poem, and generating a hash key corresponding to the pre-selected poem based on the final vowel or the combination of auxiliary vowels and final vowels; using the hash algorithm to extract the final vowel or a combination of auxiliary vowels and final vowels of the last character of the pre-selected text, and generating a hash key corresponding to the pre-selected text based on the final vowel or the combination of auxiliary vowels and final vowels; and combining the pre-selected poem and the pre-selected text based on the hash key corresponding to the pre-selected poem and the hash key corresponding to the pre-selected text to obtain multiple first pre-selected poem texts.
[0013] Optionally, the training method of the poetry copywriting generation model includes: generating multiple first poetry copywriting samples based on pre-selected verses in the first pre-selected poetry copywriting, scene features corresponding to the first pre-selected poetry copywriting, and pre-selected copywriting in the first pre-selected poetry copywriting; training a preset encoder and decoder based on the multiple first poetry copywriting samples; and obtaining the poetry copywriting generation model when the loss functions of the encoder and the decoder reach a preset loss value.
[0014] Optionally, the step of selecting at least one poem based on the matching degree of the first pre-selected poem and / or the matching degree of the second pre-selected poem includes: inputting the first pre-selected poem and the second pre-selected poem into a pre-trained quality classification model to obtain the matching degree of the first pre-selected poem and the matching degree of the second pre-selected poem; comparing the matching degree of the first pre-selected poem and the matching degree of the second pre-selected poem with preset matching degree thresholds, and selecting at least one poem based on the comparison results.
[0015] Optionally, the training method of the quality classification model includes: selecting multiple second poetry copy samples from the first pre-selected poetry copy and / or the second pre-selected poetry copy, wherein each second poetry copy sample corresponds to a matching degree label; iteratively training a preset classification model based on the multiple second poetry copy samples and the matching degree labels corresponding to the second poetry copy samples; and obtaining the quality classification model when the classification accuracy of the classification model reaches a preset accuracy threshold.
[0016] According to a second aspect of the present invention, an apparatus for generating poetic text is provided, the apparatus comprising:
[0017] The poetry and copywriting library construction module is used to construct a poetry library and a copywriting library based on pre-collected poetry and copywriting materials, respectively. The poetry library includes multiple pre-selected poems, and the copywriting library includes multiple pre-selected copywriting materials.
[0018] The poetry copywriting pre-generation module is used to generate multiple first pre-selected poetry copywritings based on the final vowel of the last character of the pre-selected poem and the final vowel of the last character of the pre-selected copywriting.
[0019] The poetry copywriting pre-generation module is also used to obtain multiple second pre-selected poetry copywritings based on the pre-selected poems and preset scene features, using a pre-trained poetry copywriting generation model, wherein the poetry copywriting generation model is trained based on the first pre-selected poetry copywritings and the scene features corresponding to the first pre-selected poetry copywritings.
[0020] The poetry copywriting generation module is used to filter and obtain at least one poetry copywriting based on the copywriting matching degree of the first pre-selected poetry copywriting and / or the copywriting matching degree of the second pre-selected poetry copywriting.
[0021] Optionally, the pre-selected text includes a first pre-selected text and a second pre-selected text; the poetry text library construction module is specifically used to filter multiple pre-selected poems from the poetry materials based on preset poetry filtering conditions, wherein the poetry filtering conditions include at least one of the following: the number of characters in the poems of the poetry materials is a preset number of characters, the poetry type of the poems ...
[0022] Optionally, the poetry and copywriting library construction module is specifically used to calculate the click-through rate of the copywriting material based on the number of clicks and exposures, and to calculate the exposure rate of the copywriting material based on the number of exposures; to calculate the exposure score of the copywriting material based on the exposure rate and click-through rate; to sort the copywriting material in descending order according to the exposure score, and to determine multiple first pre-selected copywriting materials from the copywriting material according to the sorting order; and to assemble the prefix and suffix templates and the entity name to obtain multiple second pre-selected copywriting materials, wherein the number of words in the second pre-selected copywriting materials is the preset number of words.
[0023] Optionally, the poetry text pre-generation module is specifically used to: extract the final vowel or auxiliary vowel and final vowel combination of the last character of the pre-selected poem line using a preset hash algorithm; generate a hash primary key corresponding to the pre-selected poem line based on the final vowel or auxiliary vowel and final vowel combination; extract the final vowel or auxiliary vowel and final vowel combination of the last character of the pre-selected text using the hash algorithm; generate a hash primary key corresponding to the pre-selected text based on the final vowel or auxiliary vowel and final vowel combination; and combine the pre-selected poem line and the pre-selected text based on the hash primary key corresponding to the pre-selected poem line and the hash primary key corresponding to the pre-selected text to obtain multiple first pre-selected poetry texts.
[0024] Optionally, the device further includes a poetry copywriting generation model training module; the poetry copywriting generation model training module is specifically used to generate multiple first poetry copywriting samples based on pre-selected verses in the first pre-selected poetry copywriting, scene features corresponding to the first pre-selected poetry copywriting, and pre-selected copywriting in the first pre-selected poetry copywriting; based on the multiple first poetry copywriting samples, a preset encoder and decoder are trained; when the loss functions of the encoder and the decoder reach a preset loss value, the poetry copywriting generation model is obtained.
[0025] Optionally, the poetry copywriting generation module is specifically used to input the first pre-selected poetry copywriting and the second pre-selected poetry copywriting into a pre-trained quality classification model to obtain the copywriting matching degree of the first pre-selected poetry copywriting and the copywriting matching degree of the second pre-selected poetry copywriting; compare the copywriting matching degree of the first pre-selected poetry copywriting and the copywriting matching degree of the second pre-selected poetry copywriting with a preset copywriting matching degree threshold respectively, and select at least one poetry copywriting based on the comparison result.
[0026] Optionally, the device further includes a quality classification model training module; the quality classification model training module is specifically used to select multiple second poetry text samples from the first pre-selected poetry texts and / or the second pre-selected poetry texts, wherein each second poetry text sample corresponds to a matching degree label; to iteratively train a preset classification model based on the multiple second poetry text samples and the matching degree labels corresponding to the second poetry text samples; and to obtain the quality classification model when the classification accuracy of the classification model reaches a preset accuracy threshold.
[0027] According to a third aspect of the present invention, a storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the above-described method for generating poetic text.
[0028] According to a fourth aspect of the present invention, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the above-described method for generating poetic text.
[0029] This invention provides a method, apparatus, storage medium, and computer device for generating poetry copy. On one hand, it can generate multiple first-selection poetry copy in a "mining" manner by analyzing the rhyme schemes of pre-selected verses and pre-selected copy. On the other hand, it can combine pre-selected verses with specific scene features and utilize a pre-trained poetry copy generation model to "generate" multiple second-selection poetry copy. Furthermore, it can filter the generated first and second-selection poetry copy based on copy matching degree, ultimately obtaining poetry copy that meets practical needs. The above method, through both "mining" and "generative" approaches to generate pre-selected poetry copy, can effectively improve the efficiency of poetry copy generation and expand the application scenarios of poetry copy. Moreover, filtering the pre-selected poetry copy through copy matching degree can also ensure the quality of the generated poetry copy.
[0030] The above description is only an overview of the technical solution of this application. In order to better understand the technical means of this application and to implement it in accordance with the contents of the specification, and to make the above and other objects, features and advantages of this application more obvious and understandable, the following are specific embodiments of this application. Attached Figure Description
[0031] The accompanying drawings, which are included to provide a further understanding of the invention and form part of this application, illustrate exemplary embodiments of the invention and, together with their description, serve to explain the invention and do not constitute an undue limitation thereof. In the drawings:
[0032] Figure 1 A flowchart illustrating a method for generating poetry text according to an embodiment of the present invention is shown.
[0033] Figure 2 A flowchart illustrating a method for generating poetry text according to an embodiment of the present invention is shown.
[0034] Figure 3 A flowchart illustrating a method for generating poetry text according to an embodiment of the present invention is shown.
[0035] Figure 4 A flowchart illustrating a method for constructing a poetry database according to an embodiment of the present invention is shown.
[0036] Figure 5 The diagram illustrates a flowchart of a method for constructing a document library according to an embodiment of the present invention.
[0037] Figure 6 The diagram illustrates a flowchart of a method for generating a first pre-selected poem text according to an embodiment of the present invention.
[0038] Figure 7The diagram illustrates a flowchart of a method for generating a second pre-selected poem text according to an embodiment of the present invention.
[0039] Figure 8 This diagram illustrates a process for screening poetry texts according to an embodiment of the present invention.
[0040] Figure 9 A flowchart illustrating a training method for a quality classification model provided in an embodiment of the present invention is shown.
[0041] Figure 10 A schematic diagram of the structure of a poetry copy generation device provided in an embodiment of the present invention is shown;
[0042] Figure 11 The diagram shows a structural schematic of a poetry copy generation device provided in an embodiment of the present invention. Detailed Implementation
[0043] The present invention will be described in detail below with reference to the accompanying drawings and embodiments. It should be noted that, unless otherwise specified, the embodiments and features described in the present application can be combined with each other.
[0044] In one embodiment, such as Figure 1 As shown, a method for generating poetry text is provided. Taking the application of this method to computer devices such as servers as an example, the method includes the following steps:
[0045] 101. Based on the pre-collected poetry and copywriting materials, construct a poetry library and a copywriting library respectively. The poetry library includes multiple pre-selected poems, and the copywriting library includes multiple pre-selected copywritings.
[0046] Poetic material refers to sentences or paragraphs from poems that can be obtained through public channels. For example, there are tens of thousands of poems and millions of lines in Chinese history, all of which fall within the scope of poetic material. Textual material refers to sentences or paragraphs from texts other than poetry that can be obtained through public channels. For example, in software application scenarios, textual material can originate from publicly available reviews and / or merchant descriptions of a particular application.
[0047] Specifically, not all collected poetry and copywriting materials are suitable for creating poetry copywriting. Therefore, the collected poetry materials can be filtered based on preset poetry filtering criteria, and a poetry library can be built based on the filtered poetry materials. Similarly, the collected copywriting materials can be filtered based on preset copywriting filtering criteria, and a copywriting library can be built based on the filtered copywriting materials. The poetry materials in the poetry library are referred to as pre-selected poetry, and the copywriting materials in the copywriting library are referred to as pre-selected copywriting. In this embodiment, the poetry filtering criteria may include the number of characters in the poem, the type of poem, the words and phrases in the poem, and the poem's popularity, etc. The copywriting filtering criteria may include the number of characters in the copywriting, the type of copywriting, the words and phrases in the copywriting, and the copywriting's exposure, etc. It is understood that the specific content and filtering methods of the poetry and copywriting filtering criteria can be determined according to the actual production needs of the poetry copywriting; this embodiment does not impose specific limitations here.
[0048] For example, suppose the requirements for creating a poem copy are: the poem copy should be light and cheerful, with each line containing five or seven characters, and the completed poem copy should be used in a product recommendation scenario. Based on these requirements, the poem selection criteria could include: the poem should contain five or seven characters; the poem type should be "nostalgic poem," "poem on objects," or "landscape and pastoral poem," the poem should not contain negative words such as "sorrow," "illness," or "grief," and the poem should be a well-known famous line. The copywriting selection criteria could include: the copywriting should contain five or seven characters; the copywriting should contain product information and / or scenario information related to the product recommendation scenario; the copywriting should not contain negative words such as "bad," "inferior," or "incompetent," and the copywriting should have a high exposure and click-through rate. Based on the above poetry selection criteria, multiple pre-selected poems can be selected from the poetry materials, and a poetry library can be built based on the selected pre-selected poems. Similarly, based on the above copywriting selection criteria, multiple pre-selected copywritings can be selected from the copywriting materials, and a copywriting library can be built based on the selected pre-selected copywritings.
[0049] 102. Generate multiple first-selection poem texts based on the final vowel of the last character of the pre-selected poem and the final vowel of the last character of the pre-selected text.
[0050] Specifically, for each pre-selected poem in the poetry database and each pre-selected text in the text database, the final vowel of the last character in the pre-selected poem and the final vowel of the last character in the pre-selected text can be extracted. In addition, if the final character of the pre-selected poem contains an auxiliary vowel, the combination of the auxiliary vowel and the final vowel in that pinyin can also be extracted. Similarly, if the final character of the pre-selected text contains an auxiliary vowel, the combination of the auxiliary vowel and the final vowel in that pinyin can also be extracted. Then, pre-selected poems and texts with the same final vowel or the same combination of auxiliary vowel and final vowel can be labeled with the same tag. Finally, pre-selected poems and texts with the same tag can be paired to generate multiple first pre-selected poems and texts.
[0051] For example, the last character of the pre-selected poem lines "There are houses deep in the white clouds" and "Moored at night on the Qinhuai River near a tavern," as well as the pre-selected copywriting "When it's hot, eat crayfish" and "When it's hot, eat crayfish," all share the same auxiliary vowel and final vowel combination: "ia." Therefore, these pre-selected poems and copywriting can be labeled with the same tag. When combining pre-selected poems and copywriting in pairs, various poetic copywriting can be generated, such as "There are houses deep in the white clouds, when it's hot, eat crayfish," "Moored at night on the Qinhuai River near a tavern, when it's hot, eat crayfish," "There are houses deep in the white clouds, when it's hot, eat crayfish," "Moored at night on the Qinhuai River near a tavern, when it's hot, eat crayfish," "Moored at night on the Qinhuai River near a tavern, when it's hot, eat crayfish," "When it's hot, eat crayfish, there are houses deep in the white clouds," and "Moored at night on the Qinhuai River near a tavern." All of these poetic copywriting belong to the first pre-selected poetic copywriting. In this embodiment, by combining the final vowels of the pinyin of the pre-selected poem lines and the final vowels of the pinyin of the pre-selected text lines, tens of thousands of first pre-selected poem text lines can be obtained. These first pre-selected poem text lines can provide hundreds of thousands or millions of training samples for the subsequent training of the poem text line generation model, thereby improving the model quality of the poem text line generation model.
[0052] 103. Based on pre-selected poems and preset scene features, a pre-trained poetry copywriting generation model is used to obtain multiple second pre-selected poems. The poetry copywriting generation model is trained based on the first pre-selected poems and the scene features corresponding to the first pre-selected poems.
[0053] The scene features can include at least one of the following: time features, spatial features, and seasonal features. For example, time features can be time-related features such as morning, afternoon, evening, birthday, or Qixi Festival; spatial features can be location-related features such as Beijing, Kintetsu Plaza, or train station; and seasonal features can be seasonal features such as unbearable heat, cool summer, or snowy weather. It is understood that the specific scope and content of the scene features can be set according to the scene in which the poem is applied, and this embodiment does not impose specific limitations on them.
[0054] Specifically, the pre-selected texts in the text library may or may not carry information related to time, space, and season. In this embodiment, for pre-selected texts carrying information related to time, space, and season, the scene features corresponding to the time, space, and season information in the pre-selected texts can all be used as the scene features corresponding to the pre-selected texts. Furthermore, the scene features corresponding to the pre-selected texts can also be used as the scene features corresponding to the first pre-selected poem text composed of the pre-selected texts. Therefore, based on the scene feature-related information carried in the pre-selected texts, the scene features corresponding to the first pre-selected poem text can be determined. For pre-selected texts not carrying any time, space, or season-related information, the preset scene features can all be used as the scene features corresponding to the first pre-selected poem text; that is, based on the preset scene features, the scene features corresponding to the first pre-selected poem text can be directly determined.
[0055] For example, the pre-selected copy "hot weather and crayfish" carries information related to time and season. Therefore, the scene features corresponding to the first pre-selected poem copy composed of "hot weather and crayfish" can include multiple scene features such as "hot", "summer", "sweltering heat", "night", and "late-night snack". In contrast, the pre-selected copy "have a bowl of beef noodles" does not carry any information related to time, space, or season. Therefore, the scene features corresponding to the first pre-selected poem copy composed of "have a bowl of beef noodles" can include all the preset scene features.
[0056] Furthermore, after obtaining the first pre-selected poem text and its corresponding scene features, training samples for the poem text generation model can be obtained based on these features. Using these training samples, the pre-defined generative model can be iteratively trained to ultimately obtain the poem text generation model. In this embodiment, the poem text generation model can be implemented using an Encoder-Decoder framework. The encoder and decoder in this framework can be implemented using various models such as CNN, RNN, LSTM, GRU, and Attention; this embodiment does not impose specific limitations on these models. Furthermore, by training the poetry copywriting generation model, pre-selected verses from the poetry library can be combined with preset scene features in pairs. The combined pre-selected verses and scene features are then input into the poetry copywriting generation model one by one to obtain pre-selected copywriting corresponding to the combined pre-selected verses and scene features. By concatenating the pre-selected verses with the generated pre-selected copywriting, a second pre-selected poetry copywriting can be obtained. Based on this, by continuously changing the combination of pre-selected verses and scene features, a large number of second pre-selected poetry copywriting can be generated.
[0057] Understandably, the number of first-selection poem texts is already quite large, and for each first-selection poem text, there are usually multiple corresponding scene features. Therefore, by cross-multiplying the first-selection poem texts with their corresponding scene features, hundreds of thousands or even millions of training samples can be generated. These training samples can effectively improve the model quality of the poem text generation model, thereby improving the text quality of the second-selection poem texts.
[0058] 104. Based on the matching degree of the first pre-selected poem copy and / or the matching degree of the second pre-selected poem copy, at least one poem copy is selected.
[0059] In this embodiment, text matching degree refers to the degree of matching between pre-selected verses and pre-selected text within the pre-selected poetry text. The pre-selected poetry text referred to in this embodiment includes a first pre-selected poetry text and / or a second pre-selected poetry text. In this embodiment, the definition of text matching degree can be set manually. For example, the text matching degree can be defined based on multiple dimensions such as the type similarity between pre-selected verses and pre-selected text, the repetition of pre-selected verses and / or pre-selected text, and the rhythmic matching between pre-selected verses and pre-selected text. That is, in this embodiment, the text matching degree of the pre-selected poetry text can be determined based on the type similarity, rhythmic matching, and repetition of pre-selected verses and / or pre-selected text.
[0060] Specifically, by predefined criteria for judging text matching across multiple dimensions, the scores of each pre-selected poem text can be determined. Based on these scores, a pre-defined calculation formula can be used to calculate the matching degree of each pre-selected poem text. By comparing the matching degree of the pre-selected poem text with a pre-defined matching degree threshold, pre-selected poem texts with matching degrees higher than the threshold can be selected and used as the final output poem text.
[0061] In this embodiment, the matching degree of a portion of the pre-selected poetry texts can be calculated first, and the calculated matching degree can be used as the matching degree label for this portion of the pre-selected poetry texts. Then, based on this portion of the pre-selected poetry texts and their corresponding matching degree labels, a preset binary classification model or multi-classification model can be iteratively trained to obtain a quality classification model. Furthermore, the trained quality classification model can predict all the first and / or second pre-selected poetry texts, thereby obtaining the text matching degree of each first and / or each second pre-selected poetry text. Further, by comparing the matching degree of each first and / or each second pre-selected poetry text with a preset matching degree threshold, the pre-selected poetry texts with higher matching degrees can be selected as the final output poetry texts.
[0062] The method for generating poetry copy provided in this embodiment can, on the one hand, generate multiple first-selection poetry copy in a "mining" manner by analyzing the rhyme scheme of pre-selected verses and pre-selected copy. On the other hand, it can combine pre-selected verses with specific scene features and use a pre-trained poetry copy generation model to "generate" multiple second-selection poetry copy. Furthermore, the generated first and second-selection poetry copy can be filtered based on copy matching degree to ultimately obtain poetry copy that meets practical needs. This method, through both "mining" and "generative" approaches, effectively improves the efficiency of poetry copy generation and expands the application scenarios of poetry copy. Moreover, filtering the pre-selected poetry copy through copy matching degree ensures the quality of the generated poetry copy.
[0063] Furthermore, as a refinement and extension of the specific implementation of the above embodiments, and to fully illustrate the implementation process of this embodiment, a method for generating poetry text is provided, such as... Figure 2 As shown, the method includes the following steps:
[0064] 201. Based on the pre-collected poetry and copywriting materials, construct a poetry library and a copywriting library respectively. The poetry library includes multiple pre-selected poems, and the copywriting library includes multiple pre-selected copywritings.
[0065] Specifically, pre-collected poetry and text materials typically cannot be used directly but need to be refined and selected to meet the requirements of poetry copywriting. Furthermore, preliminary screening of the poetry and text materials can, to a certain extent, ensure the quality of the generated poetry copywriting and avoid excessive data processing pressure on the server, thereby improving the speed of poetry copywriting generation. In this embodiment, the screening criteria for pre-selected poetry and text can be determined according to the actual production needs of the poetry copywriting. For example, the screening criteria for pre-selected poetry may include the number of characters in the poem, the type of poem, the words and phrases in the poem, and the poem's popularity, etc. The screening criteria for pre-selected text may include the number of characters in the text, the type of text, the words and phrases in the text, and the text's exposure, etc. This embodiment does not impose specific limitations here.
[0066] In an optional implementation, for pre-collected poetry materials, multiple pre-selected poems can be selected from a large number of poems based on preset poetry filtering conditions. These filtering conditions may include at least one of the following: the number of characters in the poems is a preset number; the poem type is a preset poem type; the poems do not contain preset keywords; or the poems have a popularity tag. In this embodiment, the above-mentioned multiple poetry filtering conditions can be used in combination according to a certain logical relationship, for example, referring to... Figure 4 For pre-collected poetry materials, those with popularity tags can be filtered out and saved as pre-selected poems in the poetry library. Among them, the poetry materials with popularity tags are usually those with high popularity and popularity. These kinds of poems are generally easy to recite and well-known to the public, so they are suitable for making poetry copy. Therefore, these kinds of poems can be filtered into the poetry library.
[0067] Furthermore, besides filtering out poems with trending tags as pre-selected poems, you can also filter out poems that don't meet the preset word count by sentence structure and syntax, poems containing certain preset words by using a semantic vocabulary library, and poems of certain specific types by using type tags. Finally, the filtered poems can be saved as pre-selected poems in the poem library. For example, if you need to select cheerful and grand poems of 5 or 7 characters to create a poem copy, you can set the preset word count to 5 or 7, set the preset words in the semantic vocabulary library to negative words such as "sorrow," "melancholy," and "illness," and set the preset poem type to any type other than mournful poems, poems of lament, or farewell poems. By setting these filtering conditions, you can select pre-selected poems that meet the requirements of the poem copy. Furthermore, for each pre-selected poem in the poetry database, a corresponding position tag is set. The position tag refers to the position of the pre-selected poem in the original poem, including information such as which line it is, whether it is the first or second line, etc. Finally, the poetry database can be completed based on the pre-selected poems and their corresponding position tags.
[0068] In one alternative implementation, refer to Figure 5 For pre-collected copywriting materials, multiple first-selection copywriting materials can be selected from the existing materials based on their exposure and click counts. Alternatively, multiple second-selection copywriting materials can be directly generated based on preset prefix and suffix templates and entity names. Finally, the copywriting library is constructed based on the first and second-selection copywriting materials. In this embodiment, the exposure score of each copywriting material can be calculated using a preset formula based on its exposure and click counts. Then, multiple first-selection copywriting materials are selected from the materials based on their exposure scores, or based on a comparison between their exposure scores and a preset exposure score threshold. This method can filter out copywriting materials with higher user attention, thereby improving the quality of the pre-selected copywriting materials. In addition, pre-selected copy can be obtained by assembling preset prefix and suffix templates and entity names. The prefix and suffix templates can carry some scene information, such as "hot weather", "evening" and "suburbs", which are related to time, space and season. The entity names can be category words, product words, content words, dish words, etc. By assembling the pre-selected copy, the scene adaptability of the pre-selected copy can be improved, so that the generated poetry copy is more in line with the needs of the scene, thereby improving the quality of the generated poetry copy.
[0069] In an optional implementation, the first pre-selected copy in the copy library can be generated by: calculating the click-through rate (CTR) of the copy material based on the number of clicks and impressions, and calculating the impression rate of the copy material based on the number of impressions; then calculating the impression score of the copy material based on the impression rate and CTR; further, sorting the copy materials in descending order according to the impression score; and finally, determining the top-ranked first pre-selected copy from the copy materials according to the sorting order. The impression score of the copy material can be calculated using the following formula:
[0070] score = a * f (number of impressions) + b * (number of clicks / number of impressions)
[0071] Wherein, a and b are preset weighting coefficients, the values of a and b can be set according to actual conditions. Click count refers to the number of times a pre-selected text is clicked, or the number of times images, icons, links, etc., attached to a pre-selected text are clicked. Exposure count refers to the number of times a pre-selected text is displayed, or the number of times images, icons, links, etc., attached to a pre-selected text are displayed. f(exposure count) refers to a preset function with exposure count as input, and the exposure rate can be calculated based on the exposure count. In this embodiment, both click count and exposure count can be obtained statistically. By filtering pre-selected schemes in this way, a large number of high-quality texts can be obtained. After these pre-selected texts are combined with pre-selected poems, some unexpected effects can often be achieved.
[0072] In an optional implementation, the second pre-selected texts in the text library can be generated by assembling preset prefix and suffix templates and entity names to obtain multiple second pre-selected texts with a preset word count. The second pre-selected texts are expressed as follows:
[0073] len(prefix / suffix template) + len(entity name) = preset character count
[0074] In this embodiment, by setting prefix and suffix templates and entity names of different lengths, and combining each prefix and suffix template with different entity names in pairs, multiple pre-selected texts can be quickly obtained. For example, if the preset prefix and suffix template is "It's hot" and the entity name is "crayfish," then the assembled second pre-selected text is "It's hot, crayfish." There are many similar pre-selected schemes. This embodiment obtains pre-selected texts through assembly, which can improve the scene adaptability of the pre-selected texts, making the generated poetry texts more in line with the needs of the scene, thereby improving the quality of the generated poetry texts.
[0075] 202. Generate multiple first-selection poem texts based on the final vowel of the last character of the pre-selected poem and the final vowel of the last character of the pre-selected text.
[0076] Specifically, based on the final vowel of the last character of the pre-selected poem and the final vowel of the last character of the pre-selected text, multiple first pre-selected poem texts can be generated. By generating pre-selected poem texts in this way, the pre-selected poem texts can be rhymed and easy to read aloud. In this embodiment, the final vowel of the last character of the pre-selected poem and the final vowel of the last character of the pre-selected text can be extracted in various ways. For example, the final vowel can be extracted by deconstructing the final character of each pre-selected poem and each pre-selected text one by one. Alternatively, a hash algorithm can be used to extract the final vowel of the final character of each pre-selected poem and each pre-selected text. By extracting the final vowel of the last character of the pre-selected poem and the final vowel of the last character of the pre-selected text, a large number of rhyming pre-selected poems and pre-selected texts can be found. Furthermore, by combining the rhyming pre-selected poems and pre-selected texts in pairs, multiple first pre-selected poems and texts can be generated.
[0077] In one alternative implementation, refer to Figure 6 The efficiency of extracting the final vowels of the pinyin of each pre-selected poem line and each pre-selected text can be improved by using a hash algorithm. Specifically, a preset hash algorithm can be used to extract the final vowel or auxiliary vowel and final vowel combination of the last character of the pre-selected poem line, and a hash key corresponding to the pre-selected poem line can be generated based on the final vowel or auxiliary vowel and final vowel combination. Then, the hash algorithm can be used to extract the final vowel or auxiliary vowel and final vowel combination of the last character of the pre-selected text, and a hash key corresponding to the pre-selected text can be generated based on the final vowel or auxiliary vowel and final vowel combination. Finally, the pre-selected poem lines and pre-selected text can be combined based on the hash key of the pre-selected poem lines and the hash key of the pre-selected text to obtain multiple first pre-selected poem texts.
[0078] In this embodiment, it should be noted that the composition of Chinese Pinyin is as follows: Pinyin = initial consonant + auxiliary vowel (simple vowel) + final vowel. Based on this, there are two types of Pinyin to be extracted: a final vowel and a combination of an auxiliary vowel (simple vowel) and a final vowel. That is, the last character of the pre-selected poem and the pre-selected text differs only in its initial consonant, and they will rhyme when read aloud. The hash algorithm proposed in this embodiment is an algorithm adapted to this paper and is not a standard traditional algorithm. The mapping formula of the hash algorithm is defined as follows:
[0079] Hash key = g(z(h(f(x))))
[0080] Here, x represents the input pre-selected poem or pre-selected text. The functions in the formula are as follows: f: removes the last character from the sentence; h: extracts the pinyin of the last character; z: performs structured parsing of the pinyin, extracting vowels or combinations of auxiliary vowels and vowels; g: generates a hash key from the result extracted by z. The hash key is also called the bucket number or key; therefore, this process is called bucketing. Further, by processing the pre-selected poem and pre-selected text using a hash algorithm, we can obtain the hash key for each pre-selected poem and each pre-selected text. Using the hash key, we can find many pre-selected poems and pre-selected texts that share a common rhyming last character. Theoretically, they can be combined pairwise to form the first pre-selected poem / text. In this way, we can obtain tens of thousands of first pre-selected poem / texts. These first pre-selected poem / texts can provide hundreds of thousands or even millions of training samples for the subsequent poem / text generation model, thereby improving the model quality.
[0081] 203. Based on the pre-selected verses in the first pre-selected poem copy, the scene features corresponding to the first pre-selected poem copy, and the pre-selected copy in the first pre-selected poem copy, train the preset encoder and decoder to obtain the poem copy generation model.
[0082] Specifically, multiple first-selection poem samples can be generated based on the pre-selected verses in the first-selection poem sample, the scene features corresponding to the first-selection poem sample, and the pre-selected text in the first-selection poem sample. That is, the first-selection poem sample used for training the poem sample generation model can come from the first-selection poem sample generated by "mining". There are tens of thousands of first-selection poem samples, which is sufficient to train the poem sample generation model. Based on this, the first-selection poem sample can be expressed as follows: <pre-selected verses in the first-selection poem sample, scene features corresponding to the first-selection poem sample, and pre-selected text in the first-selection poem sample>.
[0083] Understandably, the number of first-selection poem texts is already quite large, and for each first-selection poem text, there are usually multiple corresponding scene features. Therefore, by cross-multiplying the first-selection poem texts with their corresponding scene features, hundreds of thousands or even millions of training samples can be generated. These training samples can effectively improve the model quality of the poem text generation model, thereby improving the text quality of the second-selection poem texts.
[0084] Furthermore, based on the generated first poetry sample, a pre-defined encoder and decoder can be trained. When the loss functions of the encoder and decoder reach the pre-defined loss values, the trained poetry generation model is obtained. In this embodiment, the encoder and decoder in the encoder-decoder framework can be implemented using various models such as CNN, RNN, LSTM, GRU, and Attention; no specific limitation is made here. By incorporating pre-defined scene features into the model training samples, this embodiment avoids the model generating monotonous results. Furthermore, the poetry generation model can generate different second pre-selected poetry samples for different scene features. Therefore, the above method can effectively improve the richness and scene adaptability of the poetry samples.
[0085] 204. Based on the pre-selected verses and preset scene features, a poetry copywriting generation model is used to obtain multiple second pre-selected poetry copywritings.
[0086] Specifically, refer to Figure 7 After obtaining the poetry copywriting generation model, pre-selected verses and preset scene features can be combined in pairs. The combined pre-selected verses and scene features are then input into the poetry copywriting generation model to obtain multiple second pre-selected poetry copywritings. In this embodiment, scene features can include at least one of the following: time features, spatial features, and seasonal features. The combined pre-selected verses and scene features can be expressed as "pre-selected verses #scene features". For example, an input text could be "There are houses deep in the white clouds #the sweltering heat is unbearable". By concatenating the pre-selected verses and scene features, multiple input texts can be generated, effectively enriching the content of the second pre-selected poetry copywritings. Furthermore, before inputting the combined pre-selected verses and scene features into the poetry copywriting generation model, the input text needs to be vectorized. Specifically, this can be done using an existing pre-trained model to perform feature vectorization of the combined pre-selected verses and scene features. This embodiment uses a poetry copywriting generation model to generate pre-selected copywriting based on pre-selected verses and preset scene features, and then generates a second pre-selected poetry copywriting. In this way, the richness and scene adaptability of the second pre-selected poetry copywriting can be effectively improved.
[0087] 205. Based on a matching degree label corresponding to the first pre-selected poem text and / or a matching degree label corresponding to the second pre-selected poem text, iteratively train the preset classification model to obtain a quality classification model.
[0088] Specifically, refer to Figure 8After obtaining multiple first-selection and multiple second-selection poetry texts, multiple second-selection poetry text samples can be selected from the first-selection and / or second-selection poetry texts. Each second-selection poetry text sample corresponds to a matching degree label. Then, based on the multiple second-selection poetry text samples and the matching degree labels corresponding to each second-selection poetry text sample, the preset classification model can be iteratively trained. When the classification accuracy of the classification model reaches the preset accuracy threshold, the trained quality classification model can be obtained.
[0089] In this embodiment, refer to Figure 9 The quality classification model is a multi-classification model similar to the dual-tower model. It is a supervised training model. During training, a batch of pre-selected poetry texts can be manually labeled according to a set text matching standard. For example, 10,000 pre-selected poetry texts can be labeled. For each selected pre-selected poetry text, a corresponding matching label can be set according to a predefined quality standard. For example, for pre-selected poetry texts with different matching degrees, their matching labels can be set to three levels: 0, 1, and 2. The labeled pre-selected poetry texts can then be stored as samples in the training set for the quality classification model. Furthermore, based on the labeled second batch of pre-selected poetry text samples, the pre-set classification model can be iteratively trained. When the classification accuracy of the model reaches a preset accuracy threshold, such as above 95%, the trained quality classification model is obtained.
[0090] 206. Input the first and second pre-selected poem texts into the quality classification model respectively to obtain the text matching degree of the first and second pre-selected poem texts.
[0091] Specifically, after obtaining the quality classification model, each first and second pre-selected poem text can be input into the trained quality classification model to obtain the text matching degree of each first and second pre-selected poem text. In this embodiment, for the trained quality classification model, whenever a new pre-selected poem text is input, the model can classify the input pre-selected poem text according to its quality and predict the text matching degree of the pre-selected poem text. In this way, the pre-selected poem text can be effectively classified, thereby achieving the purpose of identifying the quality of the pre-selected poem text.
[0092] 207. Compare the matching degree of the first pre-selected poem copy and the matching degree of the second pre-selected poem copy with the preset matching degree threshold respectively, and select at least one poem copy based on the comparison results.
[0093] Specifically, refer to Figure 8After obtaining the matching degree of each pre-selected poem copy, the matching degree of each pre-selected poem copy can be compared with a preset matching degree threshold. When the matching degree of a pre-selected poem copy is less than the preset matching degree threshold, it means that the matching degree of the pre-selected poem copy is low, and in this case, it can not be output as a poem copy. When the matching degree of a pre-selected poem copy is greater than or equal to the preset matching degree threshold, it means that the matching degree of the pre-selected poem copy is high, and in this case, it can be output as a poem copy, thus obtaining at least one poem copy. It is understandable that after the threshold comparison, the poem copy can also be manually reviewed to further filter the poem copy. This process is not specifically limited here.
[0094] The method for generating poetry text provided in this embodiment refers to... Figure 3 This method generates pre-selected poetry texts using both "mining" and "generative" approaches. The first pre-selected poetry texts obtained through "mining" are used to generate samples for a poetry text generation model. Then, the poetry text generation model, based on pre-selected verses and preset scene features, generates a second pre-selected poetry text that conforms to the preset scene features. Finally, a quality classification model is used to predict and filter the first and second pre-selected poetry texts to obtain the final poetry text. This approach effectively improves the efficiency of poetry text generation, expands the application scenarios of poetry texts, and effectively ensures the quality of generated poetry texts.
[0095] Furthermore, as Figures 1 to 9 The specific implementation of the method shown in this embodiment provides a device for generating poetry copy, such as... Figure 10 As shown, the device includes: a poetry copywriting library construction module 31, a poetry copywriting pre-generation module 32, and a poetry copywriting generation module 33, wherein:
[0096] The poetry and copywriting library construction module 31 can be used to construct a poetry library and a copywriting library based on pre-collected poetry and copywriting materials, respectively. The poetry library includes multiple pre-selected poems, and the copywriting library includes multiple pre-selected copywriting materials.
[0097] The poetry copy pre-generation module 32 can be used to generate multiple first pre-selected poetry copy based on the final vowel of the last character of the pre-selected poem and the final vowel of the last character of the pre-selected copy.
[0098] The poetry copywriting pre-generation module 32 can be used to obtain multiple second pre-selected poetry copywritings based on the pre-selected poems and preset scene features, using a pre-trained poetry copywriting generation model. The poetry copywriting generation model is trained based on the first pre-selected poetry copywritings and the scene features corresponding to the first pre-selected poetry copywritings.
[0099] The poetry copywriting generation module 33 can be used to filter and obtain at least one poetry copywriting based on the copywriting matching degree of the first pre-selected poetry copywriting and / or the copywriting matching degree of the second pre-selected poetry copywriting.
[0100] In a specific application scenario, the poetry and copywriting library construction module 31 can be used to select multiple pre-selected poems from the poetry materials based on preset poetry filtering conditions. The poetry filtering conditions include at least one of the following: the number of characters in the poems is a preset number; the poem type is a preset poem type; the poems do not contain preset keywords; and the poems are tagged with popularity tags. Based on the exposure and click counts of the copywriting materials, multiple first pre-selected copywritings are selected from the copywriting materials, and multiple second pre-selected copywritings are generated based on preset prefix and suffix templates and entity names. The poetry library is constructed according to the pre-selected poems and their corresponding position tags, and the copywriting library is constructed according to the first and second pre-selected copywritings.
[0101] In a specific application scenario, the poetry and copywriting library construction module 31 can be used to calculate the click-through rate of the copywriting material based on the number of clicks and exposures, and to calculate the exposure rate of the copywriting material based on the number of exposures; to calculate the exposure score of the copywriting material based on the exposure rate and click-through rate; to sort the copywriting material in descending order according to the exposure score, and to determine multiple first pre-selected copywriting materials from the copywriting material according to the sorting order; and to assemble the prefix and suffix templates and the entity name to obtain multiple second pre-selected copywriting materials, wherein the number of words in the second pre-selected copywriting materials is the preset number of words.
[0102] In a specific application scenario, the poetry text pre-generation module 32 can be used to extract the final vowel or auxiliary vowel and final vowel combination of the last character of the pre-selected poem using a preset hash algorithm, and generate a hash primary key corresponding to the pre-selected poem based on the final vowel or auxiliary vowel and final vowel combination; use the hash algorithm to extract the final vowel or auxiliary vowel and final vowel combination of the last character of the pre-selected text, and generate a hash primary key corresponding to the pre-selected text based on the final vowel or auxiliary vowel and final vowel combination; combine the pre-selected poem and the pre-selected text based on the hash primary key corresponding to the pre-selected poem and the hash primary key corresponding to the pre-selected text to obtain multiple first pre-selected poetry texts.
[0103] In specific application scenarios, such as Figure 11As shown, this device also includes a poetry copywriting generation model training module 34, wherein the poetry copywriting generation model training module 34 is specifically used to generate multiple first poetry copywriting samples based on the pre-selected verses in the first pre-selected poetry copywriting, the scene features corresponding to the first pre-selected poetry copywriting, and the pre-selected copywriting in the first pre-selected poetry copywriting; to train a preset encoder and decoder based on the multiple first poetry copywriting samples; and to obtain the poetry copywriting generation model when the loss function of the encoder and the decoder reaches a preset loss value.
[0104] In a specific application scenario, the poetry copywriting generation module 33 can be used to input the first pre-selected poetry copywriting and the second pre-selected poetry copywriting into a pre-trained quality classification model to obtain the copywriting matching degree of the first pre-selected poetry copywriting and the copywriting matching degree of the second pre-selected poetry copywriting; compare the copywriting matching degree of the first pre-selected poetry copywriting and the copywriting matching degree of the second pre-selected poetry copywriting with a preset copywriting matching degree threshold respectively, and select at least one poetry copywriting based on the comparison result.
[0105] In specific application scenarios, such as Figure 11 As shown, the device further includes a quality classification model training module 35, which is specifically used to select multiple second poetry text samples from the first pre-selected poetry texts and / or the second pre-selected poetry texts, wherein each second poetry text sample corresponds to a matching degree label; to iteratively train a preset classification model based on the multiple second poetry text samples and the matching degree labels corresponding to the second poetry text samples; and to obtain the quality classification model when the classification accuracy of the classification model reaches a preset accuracy threshold.
[0106] It should be noted that other corresponding descriptions of the functional units involved in the poetry copy generation device provided in this embodiment can be found in [reference needed]. Figures 1 to 9 The corresponding description in [the document] will not be repeated here.
[0107] Based on the above, Figures 1 to 9 Accordingly, this embodiment also provides a storage medium storing a computer program that, when executed by a processor, implements the above-described method. Figures 1 to 9 The method for generating poetry copy is shown.
[0108] Based on this understanding, the technical solution of this application can be embodied in the form of a software product. The software product to be identified can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, or portable hard drive), including several instructions to cause a computer device (such as a personal computer, server, or network device) to execute the methods described in the various implementation scenarios of this application.
[0109] Based on the above, Figures 1 to 9 The method shown, and Figure 10 and Figure 11 The illustrated embodiment of the poetry copy generation device, in order to achieve the above objectives, also provides a computer device for generating poetry copy, specifically a personal computer, server, smartphone, tablet computer, smartwatch, or other network device, etc. This computer device includes a storage medium and a processor; the storage medium is used to store computer programs and an operating system; the processor is used to execute the computer program to achieve the above-described... Figures 1 to 9 The method shown.
[0110] Optionally, the computer device may also include internal memory, a communication interface, a network interface, a camera, radio frequency (RF) circuitry, sensors, audio circuitry, a Wi-Fi module, a display screen, and input devices such as a keyboard. The communication interface may also include a USB interface, a card reader interface, etc. The network interface may optionally include a standard wired interface or a wireless interface (such as a Wi-Fi interface).
[0111] Those skilled in the art will understand that the computer device structure for recognizing operational actions provided in this embodiment does not constitute a limitation on the computer device, and may include more or fewer components, or combine certain components, or have different component arrangements.
[0112] The storage medium may also include an operating system and a network communication module. The operating system is a program that manages the aforementioned computer hardware and the software resources to be identified, supporting the operation of information processing programs and other software and / or programs to be identified. The network communication module is used to enable communication between the various components within the storage medium, as well as communication with other hardware and software in the information processing computer device.
[0113] Through the above description of the embodiments, those skilled in the art can clearly understand that this application can be implemented using software plus necessary general-purpose hardware platforms, or it can be implemented using hardware. By applying the technical solution of this application, on the one hand, multiple first pre-selected poem texts can be generated "mining-style" by utilizing the rhyme scheme of pre-selected verses and pre-selected texts; on the other hand, multiple second pre-selected poem texts can be generated "genetically" by combining pre-selected verses with specific scene features and using a pre-trained poem text generation model. In addition, the generated first and second pre-selected poem texts can be filtered by text matching degree to finally obtain poem texts that meet actual needs. Compared with the prior art, the above method can effectively improve the efficiency of poem text generation, expand the coverage of application scenarios for poem texts, and ensure the quality of generated poem texts.
[0114] Those skilled in the art will understand that the accompanying drawings are merely schematic diagrams of a preferred embodiment, and the modules or processes shown in the drawings are not necessarily essential for implementing this application. Those skilled in the art will understand that the modules in the apparatus of the embodiment can be distributed within the apparatus of the embodiment as described, or can be modified to be located in one or more apparatuses different from this embodiment. The modules of the above-described embodiment can be combined into one module, or further divided into multiple sub-modules.
[0115] The serial numbers in this application are for descriptive purposes only and do not represent the superiority or inferiority of any particular implementation scenario. The above disclosures are merely a few specific implementation scenarios of this application; however, this application is not limited thereto, and any variations conceived by those skilled in the art should fall within the protection scope of this application.
Claims
1. A method for generating poetic copy, characterized in that, The method includes: Based on pre-collected poetry and copywriting materials, a poetry library and a copywriting library are constructed respectively. The poetry library includes multiple pre-selected poems, and the copywriting library includes multiple pre-selected copywriting materials. Based on the final vowel of the last character of the pre-selected poem and the final vowel of the last character of the pre-selected text, multiple first pre-selected poem texts are generated. Specifically, this includes: using a preset hash algorithm to extract the final vowel or a combination of auxiliary vowels and final vowels of the last character of the pre-selected poem, and generating a hash key corresponding to the pre-selected poem based on the final vowel or the combination of auxiliary vowels and final vowels; using the hash algorithm to extract the final vowel or a combination of auxiliary vowels and final vowels of the last character of the pre-selected text, and generating a hash key corresponding to the pre-selected text based on the final vowel or the combination of auxiliary vowels and final vowels; and combining the pre-selected poem and the pre-selected text based on the hash key corresponding to the pre-selected poem and the hash key corresponding to the pre-selected text to obtain multiple first pre-selected poem texts. Based on the pre-selected poems and preset scene features, a number of second pre-selected poems are obtained using a pre-trained poetry copywriting generation model. The poetry copywriting generation model is trained based on the first pre-selected poems and the scene features corresponding to the first pre-selected poems. At least one poem copy is selected based on the copy matching degree of the first pre-selected poem copy and / or the copy matching degree of the second pre-selected poem copy.
2. The method according to claim 1, characterized in that, The pre-selected text includes a first pre-selected text and a second pre-selected text; then, the construction of a poetry library and a text library based on pre-collected poetry materials and text materials respectively includes: Based on preset poetry filtering conditions, multiple pre-selected poetry lines are selected from the poetry materials. The poetry filtering conditions include at least one of the following: the number of characters in the poetry materials is a preset number of characters; the poetry type of the poetry materials is a preset poetry type; the poetry materials do not contain preset intention words; and the poetry materials are set with popularity tags. Based on the number of exposures and clicks of the copywriting materials, multiple first pre-selected copywriting materials are selected from the copywriting materials, and multiple second pre-selected copywriting materials are generated based on preset prefix and suffix templates and entity names; The poem library is constructed based on the pre-selected poems and their corresponding position tags, and the copy library is constructed based on the first pre-selected copy and the second pre-selected copy.
3. The method according to claim 2, characterized in that, Based on the exposure and click counts of the copywriting materials, multiple first pre-selected copywriting materials are selected from the copywriting materials, and multiple second pre-selected copywriting materials are generated based on preset prefix and suffix templates and entity names, including: Based on the number of clicks and impressions of the copywriting material, calculate the click-through rate of the copywriting material, and based on the number of impressions of the copywriting material, calculate the impression rate of the copywriting material; Based on the exposure rate and click-through rate of the copywriting material, calculate the exposure score of the copywriting material; Based on the exposure score of the copywriting materials, the copywriting materials are sorted in descending order, and multiple first pre-selected copywriting materials are determined from the copywriting materials according to the sorting order of the copywriting materials; The prefix and suffix templates and the entity name are assembled to obtain multiple second pre-selected texts, wherein the number of words in the second pre-selected texts is the preset number of words.
4. The method according to any one of claims 1 to 3, characterized in that, The training method for the poetry copywriting generation model includes: Based on the pre-selected verses in the first pre-selected poem copy, the scene features corresponding to the first pre-selected poem copy, and the pre-selected copy in the first pre-selected poem copy, multiple first poem copy samples are generated; Based on multiple samples of the first poem text, a preset encoder and decoder are trained; When the loss functions of the encoder and the decoder reach a preset loss value, the poetry copywriting generation model is obtained.
5. The method according to claim 1, characterized in that, The step of selecting at least one poem based on the matching degree of the first pre-selected poem and / or the matching degree of the second pre-selected poem includes: The first and second pre-selected poem texts are respectively input into a pre-trained quality classification model to obtain the text matching degree of the first and second pre-selected poem texts. The matching degree of the first pre-selected poem copy and the matching degree of the second pre-selected poem copy are compared with the preset matching degree threshold, and at least one poem copy is selected based on the comparison results.
6. The method according to claim 5, characterized in that, The training method for the quality classification model includes: Multiple second poetry copy samples are selected from the first pre-selected poetry copy and / or the second pre-selected poetry copy, wherein each second poetry copy sample corresponds to a matching degree tag; Based on multiple samples of the second poem text and the matching degree labels corresponding to the second poem text samples, the preset classification model is iteratively trained; When the classification accuracy of the classification model reaches a preset accuracy threshold, the quality classification model is obtained.
7. A device for generating poetic text, characterized in that, The device includes: The poetry and copywriting library construction module is used to construct a poetry library and a copywriting library based on pre-collected poetry and copywriting materials, respectively. The poetry library includes multiple pre-selected poems, and the copywriting library includes multiple pre-selected copywriting materials. The poetry copywriting pre-generation module is used to generate multiple first pre-selected poetry copywritings based on the final vowel of the last character of the pre-selected poem and the final vowel of the last character of the pre-selected copywriting. The poetry copywriting pre-generation module is also used to obtain multiple second pre-selected poetry copywritings based on the pre-selected poems and preset scene features, using a pre-trained poetry copywriting generation model, wherein the poetry copywriting generation model is trained based on the first pre-selected poetry copywritings and the scene features corresponding to the first pre-selected poetry copywritings. The poetry copywriting generation module is used to filter and obtain at least one poetry copywriting based on the copywriting matching degree of the first pre-selected poetry copywriting and / or the copywriting matching degree of the second pre-selected poetry copywriting. Specifically, the poetry text pre-generation module is used to extract the final vowel or auxiliary vowel and final vowel combination of the last character of the pre-selected poem line using a preset hash algorithm, and generate a hash primary key corresponding to the pre-selected poem line based on the final vowel or auxiliary vowel and final vowel combination; to extract the final vowel or auxiliary vowel and final vowel combination of the last character of the pre-selected text using the hash algorithm, and generate a hash primary key corresponding to the pre-selected text based on the final vowel or auxiliary vowel and final vowel combination; and to combine the pre-selected poem line and the pre-selected text based on the hash primary key corresponding to the pre-selected poem line and the hash primary key corresponding to the pre-selected text to obtain multiple first pre-selected poetry texts.
8. The apparatus according to claim 7, characterized in that, The pre-selected text includes a first pre-selected text and a second pre-selected text; The poetry and copywriting library construction module is specifically used to filter multiple pre-selected poems from the poetry materials based on preset poetry filtering conditions. The poetry filtering conditions include at least one of the following: the number of characters in the poems is a preset number; the poem type is a preset poem type; the poems do not contain preset keywords; and the poems have popularity tags. Based on the exposure and click counts of the copywriting materials, multiple first pre-selected copywritings are filtered from the copywriting materials, and multiple second pre-selected copywritings are generated based on preset prefix and suffix templates and entity names. The poetry library is constructed according to the pre-selected poems and their corresponding position tags, and the copywriting library is constructed according to the first and second pre-selected copywritings.
9. The apparatus according to claim 8, characterized in that, The poetry and copywriting library construction module is specifically used to calculate the click-through rate of the copywriting material based on the number of clicks and exposures of the copywriting material, and to calculate the exposure rate of the copywriting material based on the number of exposures of the copywriting material; Based on the exposure rate and click-through rate of the copywriting material, calculate the exposure score of the copywriting material; Based on the exposure score of the copywriting materials, the copywriting materials are sorted in descending order, and multiple first pre-selected copywriting materials are determined from the copywriting materials according to the sorting order of the copywriting materials; The prefix and suffix templates and the entity name are assembled to obtain multiple second pre-selected texts, wherein the number of words in the second pre-selected texts is the preset number of words.
10. The apparatus according to any one of claims 7 to 9, characterized in that, The device also includes a poetry copywriting generation model training module; The poetry copywriting generation model training module is specifically used to generate multiple first poetry copywriting samples based on the pre-selected verses in the first pre-selected poetry copywriting, the scene features corresponding to the first pre-selected poetry copywriting, and the pre-selected copywriting in the first pre-selected poetry copywriting. Based on multiple samples of the first poem text, a preset encoder and decoder are trained; When the loss functions of the encoder and the decoder reach a preset loss value, the poetry copywriting generation model is obtained.
11. The apparatus according to claim 7, characterized in that, The poetry copywriting generation module is specifically used to input the first pre-selected poetry copywriting and the second pre-selected poetry copywriting into a pre-trained quality classification model to obtain the copywriting matching degree of the first pre-selected poetry copywriting and the copywriting matching degree of the second pre-selected poetry copywriting. The matching degree of the first pre-selected poem copy and the matching degree of the second pre-selected poem copy are compared with the preset matching degree threshold, and at least one poem copy is selected based on the comparison results.
12. The apparatus according to claim 11, characterized in that, The device also includes a quality classification model training module; The quality classification model training module is specifically used to select multiple second poetry copy samples from the first pre-selected poetry copy and / or the second pre-selected poetry copy, wherein each second poetry copy sample corresponds to a matching degree label; Based on multiple samples of the second poem text and the matching degree labels corresponding to the second poem text samples, the preset classification model is iteratively trained; When the classification accuracy of the classification model reaches a preset accuracy threshold, the quality classification model is obtained.
13. A 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 6.
14. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, 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 6.