CN115310426A - Poetry generation method and device, electronic equipment and readable storage medium - Google Patents

Poetry generation method and device, electronic equipment and readable storage medium Download PDF

Info

Publication number
CN115310426A
CN115310426A CN202210885016.XA CN202210885016A CN115310426A CN 115310426 A CN115310426 A CN 115310426A CN 202210885016 A CN202210885016 A CN 202210885016A CN 115310426 A CN115310426 A CN 115310426A
Authority
CN
China
Prior art keywords
poetry
candidate
clause
sequence
target
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210885016.XA
Other languages
Chinese (zh)
Inventor
蒋强
金澎
陈兴元
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Leshan Normal University
Original Assignee
Leshan Normal University
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Leshan Normal University filed Critical Leshan Normal University
Priority to CN202210885016.XA priority Critical patent/CN115310426A/en
Publication of CN115310426A publication Critical patent/CN115310426A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/205Parsing
    • G06F40/211Syntactic parsing, e.g. based on context-free grammar [CFG] or unification grammars

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Machine Translation (AREA)

Abstract

The application discloses a poetry generating method, a poetry generating device, electronic equipment and a readable storage medium, which are applied to the technical field of natural language processing, wherein the poetry generating method comprises the following steps: acquiring poetry description information; generating a theme white language sequence corresponding to the target poetry according to the poetry description information and a first preset poetry generator; inputting the subject whispering text sequence into the first preset poetry generator to obtain a candidate poetry clause set corresponding to the target poetry, wherein the candidate poetry clause set is a set of candidate clauses describing the subject of the target poetry; and carrying out iterative adjustment on a candidate poetry clause sequence corresponding to the candidate poetry clause set according to a second preset poetry generator and a poetry clause processing command input by a user to obtain the target poetry. The poetry creation efficiency and the poetry quality are hardly taken into account.

Description

Poetry generation method and device, electronic equipment and readable storage medium
Technical Field
The present application relates to the field of natural language processing technologies, and in particular, to a poetry generating method, an apparatus, an electronic device, and a readable storage medium.
Background
With the continuous development of artificial intelligence, deep learning technology is applied to more and more fields, poetry in the culture field is taken as an example, a text generator trained on the deep learning technology is used for generating a large amount of text contents in a short time, and poetry required by a user is further generated.
Disclosure of Invention
The application mainly aims to provide a poetry generating method, a poetry generating device, electronic equipment and a readable storage medium, and aims to solve the technical problem that the poetry creating efficiency and poetry quality are difficult to be considered in the prior art.
In order to achieve the above object, the present application provides a poetry generating method, including:
acquiring poetry description information;
generating a theme white language sequence corresponding to the target poetry according to the poetry description information and a first preset poetry generator;
inputting the subject whispering text sequence into the first preset poetry generator to obtain a candidate poetry clause set corresponding to the target poetry, wherein the candidate poetry clause set is a set of candidate clauses describing the subject of the target poetry;
and carrying out iterative adjustment on a candidate poetry clause sequence corresponding to the candidate poetry clause set according to a second preset poetry generator and a poetry clause processing command input by a user to obtain the target poetry.
In order to achieve the above object, the present application further provides a poetry generating apparatus, including:
the acquisition module is used for acquiring poetry description information;
the generating module is used for generating a theme white language sequence corresponding to the target poetry according to the poetry description information and a first preset poetry generator;
the input module is used for inputting the subject white language sequence into the first preset poetry generator to obtain a candidate poetry clause set corresponding to the target poetry, wherein the candidate poetry clause set is a set of candidate clauses describing the subject of the target poetry;
and the adjusting module is used for iteratively adjusting the candidate poetry clause sequence corresponding to the candidate poetry clause set according to a second preset poetry generator and a poetry clause processing command input by a user to obtain the target poetry.
The present application further provides an electronic device, including: a memory, a processor, and a program of the poetry generating method stored on the memory and executable on the processor, the program of the poetry generating method when executed by the processor implementing the steps of the poetry generating method as described above.
The present application also provides a computer-readable storage medium having stored thereon a program for implementing a poetry generating method, which when executed by a processor implements the steps of the poetry generating method as described above.
The present application also provides a computer program product comprising a computer program which when executed by a processor implements the steps of the poetry generating method as described above.
The application provides a poetry generating method, a poetry generating device, electronic equipment and a readable storage medium, namely poetry description information is obtained; generating a theme white language sequence corresponding to the target poetry according to the poetry description information and a first preset poetry generator; inputting the theme Chinese sequence to the first preset poetry generator to obtain a candidate poetry clause set corresponding to the target poetry, wherein the candidate poetry clause set is a set of candidate clauses describing the theme of the target poetry; and iteratively adjusting a candidate poetry clause sequence corresponding to the candidate poetry clause set according to a second preset poetry generator and a poetry clause processing command input by a user to obtain the target poetry. Because the set of candidate clauses describing the poetry theme can be obtained by the first preset poetry generator, namely, the purpose of generating the candidate clauses highlighting the target poetry theme can be realized by the first preset poetry generator, and the second preset poetry generator and the poetry clause processing command input by the user are further used, man-machine interactive adjustment is carried out on the candidate clauses to finally obtain a target poetry sentence corresponding to the target poetry, namely, poetry description information based on the target poetry, under the coordination of the first preset poetry generator, the second preset poetry generator and the user command, the purpose of obtaining the target poetry sentence corresponding to the poetry description information is realized, because the first preset poetry generator and the second preset poetry generator have the characteristics of high generation efficiency, low generation cost and the like, thereby ensuring the generation process of the candidate clauses corresponding to the target poetry sentence, namely, realizing the improvement of the creation efficiency of the candidate clauses, and simultaneously, since the user can more objectively evaluate the goodness and badness of the candidate clause than the text generator, further, the target poetry sentence obtained after iterative adjustment can better meet the market demand, namely, the candidate clauses are processed iteratively through a man-machine interaction cooperation mode between the text generator and the user, the goal of obtaining higher quality compared with the way of singly processing the candidate clauses by the text generator can be realized, therefore, the purpose of balancing poetry creation efficiency and poetry quality is realized, instead of only generating the poetry required by the user based on the text generator trained by the deep learning technology, therefore, the technical defect that the generated poetry has poorer theme property due to a poetry generating system constructed based on a text generator is overcome, and the poetry creation efficiency and poetry quality are realized.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and together with the description, serve to explain the principles of the application.
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious for those skilled in the art to obtain other drawings without inventive labor.
FIG. 1 is a schematic flow chart of a poetry generating method of the present application in accordance with a first embodiment;
FIG. 2 is a schematic flow chart of a second embodiment of a poetry generation method of the present application;
FIG. 3 is a schematic diagram of a device according to a third embodiment of the poetry generating method of the present application;
fig. 4 is a schematic structural diagram of a hardware operating environment related to a poetry generating method in the embodiment of the present application.
The objectives, features, and advantages of the present application will be further described with reference to the accompanying drawings.
Detailed Description
In order to make the aforementioned objects, features and advantages of the present invention comprehensible, embodiments accompanied with figures are described in detail below. It should be apparent that the described embodiments are only some embodiments of the present invention, and not all embodiments. All other embodiments, which can be obtained by a person skilled in the art without inventive step based on the embodiments of the present invention, are within the scope of protection of the present invention.
Example one
First, it should be understood that, in the field of natural language processing technology, especially poetry creation, both human and machine have unique advantages, poetry generator based on deep learning has high poetry generating efficiency, but human has universal subjectivity for poetry quality discrimination, that is, different people have differences in quality discrimination for different quality poetry, but have the same criterion for poetry with too large quality difference, for example, two poetry generations a "ten street deceased friends are generated based on poetry generator, high mountain and running water find out the sound" and B "are good days today, live in the sun in mind, the generator cannot make objective evaluation on the quality of poetry a and poetry B, but if the processes of creation and evaluation are both manually performed, the creation efficiency is low, meanwhile, poetry is logic, emotion and situation, a main body of a previous poetry creation and a later stage is not consistent, so that a theme creation is not efficient, and a method for generating poetry generation is not suitable for people, so that a poetry creation is a theme is not suitable for artificial learning.
In a first embodiment of the poetry generating method of the present application, referring to fig. 1, the poetry generating method includes:
step S10, acquiring poetry description information;
step S20, generating a theme white language sequence corresponding to the target poem according to the poem description information and a first preset poem generator;
in this embodiment, it should be noted that the poetry generation method is arranged in a poetry generation system, the poetry generation system can be installed on intelligent devices such as a mobile phone and a computer, the target poetry is a poetry which is obtained by a user through the poetry generation system and meets the expected requirement, the poetry description information is used for describing the requirement of the user on the poetry, when the user needs to create a poetry, the poetry description information can be input through the poetry generation system of the intelligent device, and then the poetry meeting the requirement is generated based on the simple interaction of the user and the poetry generation system.
Additionally, it should be noted that the first preset poetry generator is configured to generate poetry meeting the poetry small sentence specification and having a prominent theme commonly corresponding to each small sentence one by one, for example, in an implementable manner, a user inputs a plurality of keywords as poetry description information, wherein the poetry description information includes "the genre of the poetry is regular poetry", the first preset poetry generator specifies the number of sentences corresponding to the keywords of the user by generating poetry as white-language clauses, wherein each white-language clause is used for describing the poetry theme, and further generates corresponding candidate poetry clauses according to each white-language clause, wherein the white-language clauses are used for representing clauses meeting the poetry theme, the candidate poetry clauses are used for representing clauses meeting the poetry theme and the genre, for example, assuming that the genre of the poetry is seven-language, the number of the white-language clauses and the candidate poetry clauses are both 8, the sequence of the first preset poetry clauses is used for representing the poetry theme, and the overall poetry description parameter includes "the total poetry description of the implementable manner, wherein the poetry description information includes" a total poetry parameter of the set of the poetry 1 ”、“u 2 "and" u 3 ", that is, the number of the spoken clauses is 4 (k = 4), and the spoken clause is" e 1 ”、“e 2 ”、“e 3 "and" e 4 ", the subject dialect sequence may be (u) 1 ,u 2 ,u 3 ,#,e 1 ,e 2 ,e 3 ,e 4 ) Wherein "#" is a sequence middle spacer.
As an example, steps S10 to S20 include: acquiring poem description information of a target poem input by a user; and generating a theme white language sequence corresponding to the target poetry according to the poetry description information and a first preset poetry generator.
The poetry description information comprises poetry sentence quantity description information and poetry theme description information, and the step of generating the theme white language sequence corresponding to the target poetry according to the poetry description information and the first preset poetry generator comprises the following steps:
step A10, determining the target poetry quantity of the target poetry according to the poetry quantity description information;
step A20, determining a poetry theme sequence of the target poetry according to the poetry theme description information;
step A30, iteratively inputting the poetry theme sequence in the first preset poetry generator according to a candidate clause processing command input by a user until a candidate theme sequence corresponding to the candidate white clause sequence containing the target poetry sentence number is obtained;
and A40, preprocessing the candidate theme sequence to obtain the theme white language sequence.
In this embodiment, it should be noted that the poetry sentence number description information is used to describe the number of poetry clauses of the target poetry, the poetry topic description information is used to describe the topic represented by the poetry clauses of the target poetry, and specifically may be poetry keywords, for example, in an implementable manner, the poetry sentence number description information is assumed to be "4", the poetry topic information is two keywords of "send-other" and "friend", and further the target poetry is a five-language absolute with "send-other friend" as the topic, wherein the poetry sentence number description information is the number of the target poetry sentences, and the poetry topic sequence is a sequence determined by the poetry topic description information after initialization, for example, the poetry topic description information is assumed to be a poetry keyword "u" and u "is a top-language absolute 4 "and" u 5 ", the poetry subject sequence is (u) 1 ,u 2 ,#)。
Additionally, it should be noted that the candidate clause processing command is used to process a candidate clause of the poetry of the target poetry, the candidate white clause sequence is a sequence corresponding to the candidate white clause, and the candidate subject sequence is a sequence of a candidate subject of the target poetry, where the candidate subject is a candidate subject generated by the poetry generating system based on the poetry description informationThe text theme, for example, in one implementable manner, assumes that the genre of the target poetry is five-language absolute, with the poetry keyword "u" entered by the user 7 ”、“u 8 ”、“u 9 "and" u 10 ", poetry subject sequence is (u) 7 ,u 8 ,u 9 ,u 10 And #) after the poetry theme sequence corresponding to the poetry keyword is input into the first preset poetry generator, the first preset poetry generator generates a plurality of candidate white words sentences, wherein the candidate white words can be' r 1 ”、“r 2 ”、“r 3 ”……“r n ", then (r) 1 ),(r 2 ),(r 3 ) \8230; \8230orr n All can be used to characterize the candidate sequence of the spoken clause, if the finally selected target spoken clause is "r 1 ”、“r 2 ”、“r 3 "and" r 4 ", then the candidate topic sequence can be (u) 7 ,u 8 ,u 9 ,u 10 ,#,e 7 ,e 8 ) Or (u) 7 ,u 8 ,u 9 ,u 10 ,#,e 7 ,e 8 ,e 9 ) And the like.
As an example, steps a10 to a40 include: taking the quantity represented by the poetry quantity description information as the quantity of the target poetry; splicing a description sequence corresponding to the poetry theme description information into a poetry theme sequence of the target poetry, wherein the description sequence is used for representing the sequence corresponding to the description information, and the description information can be one or more; iteratively inputting the poetry theme sequence in the first preset poetry generator according to a candidate clause processing command input by a user until a candidate theme sequence corresponding to the candidate white clause sequence containing the target poetry sentence number is obtained; and inserting a preset sequence spacer into the candidate topic sequence to obtain the topic white language sequence, wherein the preset sequence spacer can be "&".
In an implementation mode, after receiving poetry description information input by a user, a poetry generating system firstly obtains a poetry topic sequence through initialization, then iteratively inputs the poetry topic sequence to a first preset poetry generator to obtain a preset number of candidate white-language clauses, further judges whether the candidate white-language clauses meet quality effects based on manual work, and then performs statement processing on the candidate white-language clauses meeting the quality effects to obtain a corresponding candidate white-language clause sequence which is inserted into the poetry topic sequence until the candidate topic sequence corresponding to the poetry topic sequence comprises the candidate white-language clause sequence corresponding to the poetry topic number description information, and finally performs interval processing (adding sequence interval symbols) on the candidate topic sequence to obtain a topic white-language clause sequence.
The step of iteratively inputting the poetry topic sequence in the first preset poetry generator according to the candidate clause processing command input by the user until a candidate topic sequence corresponding to the candidate white-language clause sequence containing the target poetry sentence number is obtained comprises the following steps:
step B10, inputting the poetry theme sequence into the first preset poetry generator to generate a candidate white-speech clause set;
step B20, detecting whether the candidate white-language clause set has a candidate white-language clause according to the candidate clause detection command;
step B30, if the candidate white clause does not exist, returning to the execution step: inputting the poetry theme sequence into the first preset poetry generator to generate a candidate white-speech clause set;
step B40, if the candidate white-language clause exists, modifying the candidate white-language clause according to the candidate clause modification command to obtain a target white-language clause;
and step B50, iteratively updating the poetry theme sequence according to the target white words, until the updated poetry theme sequence has the candidate white words clause sequence with the target poetry sentence number.
In this embodiment, it should be noted that the candidate clause detection command is used to detect whether the candidate white clause meets the quality effect requirement of the user on the target poetry, that is, detect whether the candidate white clause is a target white clause, the target white clause is a clause meeting the quality effect requirement of the user on the target poetry, the set of candidate white clauses is a set of candidate white clauses describing the subject of the target poetry, the candidate clause modification command is used to modify the candidate white clauses, and the specific modification degree is determined by the user, for example, in an implementable manner, the target white clause is "capable of standing long wind for surf despite the heavy obstacles, hanging a sail, crossing sea, and reaching an ideal bank", and the target white clause can be "capable of standing long wind for surf, hanging a high-height sentence", wherein the target white clause is a satisfactory sentence in order to improve the quality effect of the target poetry.
As an example, steps B10 to B50 include: inputting the poetry theme sequence into the first preset poetry generator to generate a plurality of candidate white words clauses; detecting whether the candidate white-language clause set has a candidate white-language clause or not according to the candidate clause detection command input by the user; if the candidate white language clause set is detected not to exist, returning to the execution step: inputting the poetry theme sequence into the first preset poetry generator to generate a candidate white-speech clause set; if the candidate white-language clause set is detected to have the candidate white-language clause, modifying the candidate white-language clause according to a candidate clause modification command input by a user to obtain a target white-language clause; and iteratively inserting the target white-language clause sequence corresponding to the target white-language clause into the poetry theme sequence to obtain a candidate theme sequence of the candidate white-language clause sequence with the target poetry clause number.
Step S30, inputting the subject white language sequence into the first preset poetry generator to obtain a candidate poetry clause set corresponding to the target poetry, wherein the candidate poetry clause set is a set of candidate clauses describing the subject of the target poetry;
and S40, carrying out iterative adjustment on a candidate poetry clause sequence corresponding to the candidate poetry clause set according to a second preset poetry generator and a poetry clause processing command input by a user to obtain the target poetry.
In this embodiment, it should be noted that the set of candidate poetry clauses is a set of candidate sentences describing the theme of the target poetry, that is, the set of candidate poetry clauses is a set of a plurality of candidate poetry clauses, and the second preset poetry generator is configured to optimize the poetry clauses sentence by sentence so as to generate poetry meeting the user requirements.
As an example, steps S30 to S40 include: inputting the subject whispering text sequence into the first preset poetry generator to obtain a candidate poetry clause set corresponding to the target poetry, wherein the candidate poetry clause set is a set of candidate clauses describing the subject of the target poetry; and iteratively adjusting a candidate poetry clause sequence corresponding to the candidate poetry clause set according to a second preset poetry generator and a poetry clause processing command input by a user to obtain the target poetry, wherein the poetry clause processing command is used for processing the candidate poetry clauses.
The method comprises the following steps of obtaining a target poetry, wherein a poetry clause processing command input by a user comprises a poetry clause detection command and a poetry clause evaluation command, and a poetry clause sequence corresponding to a candidate poetry clause set is iteratively adjusted according to a second preset poetry generator and the poetry clause processing command input by the user, so that the step of obtaining the target poetry comprises the following steps:
step C10, determining the number of target poetry sentences of the target poetry according to the candidate poetry clause sets;
step C20, detecting whether the candidate poetry clause set has a candidate poetry clause according to the poetry clause detection command;
step C30, if not, returning to execute the step: inputting the subject whispering text sequence into the first preset poetry generator to obtain a candidate poetry clause set corresponding to the target poetry, wherein the candidate poetry clause set is a set of candidate clauses describing the subject of the target poetry;
step C40, if the poetry clauses exist, carrying out iterative updating on the candidate poetry clause sequence according to the poetry clause evaluation command and the candidate poetry clauses until the updated candidate poetry clause sequence contains the target poetry clause sequence with the target poetry clause number;
and step C50, converting the target verse sequence in the updated candidate verse clause sequence into the target verse.
As an example, steps C10 to C50 include: taking the number of the candidate poetry clauses in the candidate poetry clause set as the number of the target poetry clauses of the target poetry; detecting whether the candidate poetry clause set has a candidate poetry clause or not according to the poetry clause detection command, wherein the poetry clause detection command is used for detecting whether the candidate poetry clause meets the quality effect requirement of a user on target poetry or not; if the candidate poetry clause set is detected to have no candidate poetry clause, returning to the execution step: inputting the subject whispering text sequence into the first preset poetry generator to obtain a candidate poetry clause set corresponding to the target poetry, wherein the candidate poetry clause set is a set of candidate clauses describing the subject of the target poetry; if the candidate poetry clause set is detected to have the candidate poetry clauses, iteratively updating the candidate poetry clause sequence according to the poetry clause evaluation command and the candidate poetry clauses until the updated candidate poetry clause sequence contains a target poetry clause sequence with the number of the target poetry clauses; and converting the target verse sequence in the updated candidate verse clause sequence into the target verse.
The step of iteratively updating the candidate poetry clause sequence according to the poetry clause evaluation command and the candidate poetry clauses until the updated candidate poetry clause sequence contains the target poetry clause sequence with the target poetry clause number comprises the following steps:
step D10, evaluating and editing the candidate poetry clauses according to the first poetry clause evaluation command to obtain the evaluated and edited candidate poetry clauses;
step D20, determining whether the candidate poetry sentence is a target poetry sentence according to the second poetry clause evaluation command;
step D30, if yes, updating the candidate poetry clause sequence according to the candidate poetry clauses;
step D40, if not, determining a candidate poetry clause sequence corresponding to the candidate poetry clause sequence;
step D50, processing the candidate poetry sentence sequence according to the clause serial number of the candidate poetry clause to obtain a processed candidate poetry sentence sequence;
step D60, inputting the processed candidate poetry sentence sequence into the second preset poetry generator to obtain a target poetry sentence clause, and returning to the execution step: and detecting whether the candidate poetry clause set has the candidate poetry clauses or not according to the poetry clause detection command.
In this embodiment, it should be noted that the first verse evaluation command is used to feed back an evaluation result of a user on a verse, the second verse evaluation command is used to feed back an evaluation result of a user on an entire verse, the clause sequence number is used to identify positions of different candidate verses in a target verse, and the candidate verse sequence is formed by splicing sequences of the candidate verses, for example, in an implementable manner, after a theme white language sequence is input to a first preset verse generator, a candidate verse is "p" and 1 ”、“p 2 ”、“p 3 ”……“p n "according to the first poetry clause evaluation command inputted by user obtaining the candidate poetry clause" s after evaluation and edition k "and then evaluating the edited candidate verse pairsAnd inserting the corresponding sequence into the subject white language sequence until the number of the target verses inserted into the subject white language sequence is consistent with the number represented by the verse number description information.
As an example, steps D10 to D60 include: evaluating and editing the candidate poetry clauses according to a first poetry clause evaluation command input by a user to obtain the evaluated and edited candidate poetry clauses; determining whether the candidate poetry sentence is a target poetry sentence according to a second poetry clause evaluation command input by a user; if the candidate poetry is determined to be the target poetry, splicing a candidate poetry sequence corresponding to the candidate poetry clause sequence; if the candidate poetry sentence is determined not to be the target poetry sentence, determining a candidate poetry sentence sequence corresponding to the candidate poetry sentence sequence; processing the candidate poetry sentence sequence according to the clause serial number of the candidate poetry clause to obtain a processed candidate poetry sentence sequence; inputting the processed candidate poetry sentence sequence into the second preset poetry generator to obtain a target poetry sentence clause, and returning to the executing step: and detecting whether the candidate poetry clause set has the candidate poetry clauses or not according to the poetry clause detection command.
Before the step of obtaining poetry description information, the poetry generating method further comprises the following steps:
step E10, acquiring a poetry keyword sequence corresponding to a poetry training corpus and a poetry theme sequence corresponding to a translation training corpus, wherein the poetry training corpus of the poetry training corpus corresponds to the translation training corpus of the translation training corpus one to one;
e20, splicing the poetry training corpus sequence, the poetry keyword sequence and the poetry theme sequence into a poetry training corpus sequence;
e30, splicing and adjusting the poetry training corpus sequence according to a first preset splicing mode to obtain a first training corpus sequence;
and E40, training the first generator to be trained according to the first training corpus sequence to obtain a first preset poetry generator.
In this embodiment, it should be noted that the poetry training corpus is a set of poetry training corpuses, the poetry training corpuses are used for characterizing poetry randomly extracted by a poetry generating system from a cloud database, the translation training corpuses are a set of translations of the poetry training corps, the poetry keyword sequence is a sequence corresponding to poetry keywords extracted by the poetry generating system from the poetry training corpus, the poetry topic sequence is used for characterizing a sequence corresponding to a translation training corpus description topic of the translation training corpus, the first preset splicing mode is a mode of splicing in a splicing sequence of keyword-topic-poetry clauses, the first training corpus sequence is used for training a first generator to be trained, and the first generator to be trained may be GTP-2 and the like.
As an example, steps E10 to E40 include: acquiring a poetry keyword sequence corresponding to a poetry training corpus and a poetry theme sequence corresponding to a translation training corpus, wherein poetry training corpuses of the poetry training corpus correspond to translation training corpuses of the translation training corpus one by one; splicing a poetry training corpus sequence, the poetry keyword sequence and the poetry theme sequence into a poetry training corpus sequence; splicing a poetry training corpus sequence, the poetry keyword sequence and the poetry subject sequence into a poetry training corpus sequence; and splicing and adjusting the poetry training corpus sequence according to a splicing mode taking keywords, themes and poetry clauses as a splicing sequence to obtain a first training corpus sequence.
In one practical approach, assume that the poetry training corpus is s 1 ,s 2 ,s 3 ,s 4 In which s is k The subscript k is used for representing the position of the poetry clauses corresponding to the poetry training corpus in the poetry, and then extracting the key words of the poetry training corpus to form a poetry key word sequence (u) 1 ,u 2 ,u 3 ……u s ) Wherein u is s The subscript "s" is used to represent the importance level, i.e., importance, etc., of the poetry keywords corresponding to the translated text corpusThe higher the level, the more advanced the key words in the corresponding key word sequence, wherein the extraction mode can be according to the translation or based on the manual extraction mode, and then the corresponding translation subject sequence after processing and editing the translation training material is obtained (e) 1 ,e 2 ,e 3 ……e k ) Splicing into a first corpus sequence (u) by a first preset splicing mode 1 ,u 2 ,u 3 ……u s ,#,e 1 ,e 2 ,e 3 ……e k ,&,s 1 ,s 2 ,s 3 ……s k ) And training a first generator to be trained based on the first training corpus sequence to obtain a first preset poetry generator.
The embodiment of the application provides a poetry generating method, namely poetry description information is obtained; generating a theme white language sequence corresponding to the target poetry according to the poetry description information and a first preset poetry generator; inputting the subject whispering text sequence into the first preset poetry generator to obtain a candidate poetry clause set corresponding to the target poetry, wherein the candidate poetry clause set is a set of candidate clauses describing the subject of the target poetry; and carrying out iterative adjustment on a candidate poetry clause sequence corresponding to the candidate poetry clause set according to a second preset poetry generator and a poetry clause processing command input by a user to obtain the target poetry. Because the set of candidate clauses describing the poetry theme can be obtained through the first preset poetry generator, namely, the purpose of generating the candidate clauses highlighting the target poetry theme can be realized through the first preset poetry generator, and further, through the second preset poetry generator and a poetry clause processing command input by a user, man-machine interactive adjustment is carried out on the candidate clauses to finally obtain a target poetry sentence corresponding to the target poetry, namely, poetry description information based on the target poetry, under the coordination of the first preset poetry generator, the second preset poetry generator and the user command, the purpose of obtaining the target poetry sentence corresponding to the poetry description information is realized, because the first preset poetry generator and the second preset poetry generator have the characteristics of high generation efficiency, low generation cost and the like, thereby ensuring the generation process of the candidate clauses corresponding to the target verse, namely, realizing the improvement of the creation efficiency of the candidate clauses, and simultaneously, since the user can more objectively evaluate the goodness and badness of the candidate clause than the text generator, further, the target poetry sentence obtained after iterative adjustment can better meet the market demand, namely, the candidate clauses are processed iteratively through a man-machine interaction cooperation mode between the text generator and the user, the goal of obtaining higher quality compared with the way of singly processing the candidate clauses by the text generator can be realized, therefore, the purpose of balancing poetry creation efficiency and poetry quality is realized, instead of only generating the poetry required by the user based on the text generator trained by the deep learning technology, therefore, the technical defect that the generated poetry has poorer theme property due to a poetry generating system constructed based on a text generator is overcome, and the poetry creation efficiency and poetry quality are realized.
Example two
Further, referring to fig. 2, in another embodiment of the present application, the same or similar contents as those in the first embodiment may refer to the above description, and are not repeated herein. On the basis, after the step of jointly splicing the poetry training corpus sequence, the poetry keyword sequence and the poetry subject sequence into the poetry training corpus sequence, the poetry generating method further comprises the following steps:
step F10, splicing and adjusting the poetry training corpus sequence according to a second preset splicing mode to obtain a second training corpus sequence;
step F20, performing mask processing on the second corpus sequence to obtain a target corpus sequence;
and F30, training a second generator to be trained according to the target training corpus sequence to obtain a second preset poetry generator.
In this embodiment, it should be noted that the second preset splicing manner is used to represent a manner of splicing a theme-poetry clause as a splicing sequence, where different sequences are separated by a middle spacer, and in an implementable manner, the second corpus sequence may be a corpus sequenceIs (e) 1 ,e 2 ,e 3 ……e k ,&,s 1 ,s 2 ,s 3 ……s k ) The target corpus sequence is a second corpus sequence masked by a preset training algorithm, for example, the target corpus sequence is assumed to be (e) 1 ,e 2 ,e 3 ……e k ,&,s 1 ,s 2 ,s 3 ……s k * ) Then s k * For masking the poetry clause, the shielding position k can be set to be consistent with the practical application 1 ,k 2 ……k m Wherein, M is used for representing the shielding quantity, M is more than or equal to 1 and less than or equal to M, and the value of M is as follows: five-language poetry is 4, seven-language poetry is 5, in order to guarantee the running efficiency of the poetry generating system and user psychology, the algorithm only works on the current clause s k * Performing mask processing, wherein the following cross entropy loss function is adopted when the generator to be trained is trained by the target training corpus sequence:
Figure BDA0003764439600000141
wherein s is, D 1 Training a corpus of poetry, K being a sequence number of the clauses, K being a number of target poetry clauses, i being characters of an occluded poetry clause, m being an occluded number, softmax (G) 2 (x k ),k i ) Is pair k i The occlusion character of the position is calculated by the softmax function,
Figure BDA0003764439600000142
because a certain part of the algorithm input is always kept unchanged, random shielding decoding is adopted on the basis of ensuring the advantage of machine translation, and mask processing can be carried out on non-adjacent words in a certain poetry clause.
As an example, steps F10 to F30 include: splicing and adjusting the poetry training corpus sequence according to a splicing mode taking the theme-poetry clauses as a splicing sequence to obtain a second training corpus sequence; performing mask processing on the second corpus sequence to obtain a target corpus sequence; and training a second generator to be trained according to the target training corpus sequence to obtain a second preset poetry generator, wherein the second generator to be trained can be a BERT-2 or other bidirectional generator.
The embodiment of the application provides a poetry generator training method, namely, according to a second preset splicing mode, splicing and adjusting a poetry training corpus sequence to obtain a second training corpus sequence, carrying out mask processing on the second training corpus sequence to obtain a target training corpus sequence, and training a second generator to be trained according to the target training corpus sequence to obtain a second preset poetry generator. Compared with the traditional text generation training method for training the second generator to be trained, the method and the device for generating the poetry sentence can carry out mask processing on the characters with the preset number of the current poetry clauses randomly, and only the current poetry clauses are subjected to mask processing, so that the aim of guaranteeing the efficiency of the poetry generator can be achieved.
EXAMPLE III
The embodiment of the present application further provides a poetry generating device, referring to fig. 3, the poetry generating device includes:
the acquisition module is used for acquiring poetry description information;
the generating module is used for generating a theme white language sequence corresponding to the target poetry according to the poetry description information and a first preset poetry generator;
the input module is used for inputting the subject white language sequence into the first preset poetry generator to obtain a candidate poetry clause set corresponding to the target poetry, wherein the candidate poetry clause set is a set of candidate clauses describing the subject of the target poetry;
and the adjusting module is used for iteratively adjusting the candidate poetry clause sequence corresponding to the candidate poetry clause set according to a second preset poetry generator and a poetry clause processing command input by a user to obtain the target poetry.
Optionally, the verse processing command input by the user includes a verse detection command and a verse evaluation command, and the adjusting module is further configured to:
determining the number of target poetry sentences of the target poetry according to the candidate poetry sentence clause set;
detecting whether the candidate poetry clause set has a candidate poetry clause or not according to the poetry clause detection command;
if not, returning to the execution step: inputting the theme Chinese sequence to the first preset poetry generator to obtain a candidate poetry clause set corresponding to the target poetry, wherein the candidate poetry clause set is a set of candidate clauses describing the theme of the target poetry;
if the poetry clause sequence exists, carrying out iterative updating on the candidate poetry clause sequence according to the poetry clause evaluation command and the candidate poetry clauses until the updated candidate poetry clause sequence contains the target poetry clause sequence with the number of the target poetry clauses;
and converting the target verse sequence in the updated candidate verse clause sequence into the target verse.
Optionally, the adjusting module is further configured to:
evaluating and editing the candidate poetry clauses according to the first poetry clause evaluation command to obtain the evaluated and edited candidate poetry clauses;
determining whether the candidate poetry sentence is a target poetry sentence or not according to the second poetry clause evaluation command;
if yes, updating the candidate poetry clause sequence according to the candidate poetry clauses;
if not, determining a candidate poetry clause sequence corresponding to the candidate poetry clause sequence;
processing the candidate poetry sentence sequence according to the clause serial number of the candidate poetry clause to obtain a processed candidate poetry sentence sequence;
inputting the processed candidate poetry sentence sequence into the second preset poetry generator to obtain a target poetry sentence clause, and returning to the executing step: detecting whether the candidate poetry clause set has the candidate poetry clause or not according to the poetry clause detection command
Optionally, the poetry description information includes poetry sentence number description information and poetry theme description information, and the generating module is further configured to:
determining the target poetry sentence number of the target poetry according to the poetry sentence number description information;
determining a poetry theme sequence of the target poetry according to the poetry theme description information;
iteratively inputting the poetry theme sequence in the first preset poetry generator according to a candidate clause processing command input by a user until a candidate theme sequence corresponding to the candidate white clause sequence containing the target poetry sentence number is obtained;
and preprocessing the candidate theme sequence to obtain the theme white language sequence.
Optionally, the candidate clause processing command input by the user includes a candidate clause detection command and a candidate clause modification command, and the generating module is further configured to:
inputting the poetry theme sequence into the first preset poetry generator to generate a candidate white-speech clause set;
detecting whether the candidate white words clause set has candidate white words clauses or not according to the candidate clause detection command;
if the candidate white language clause does not exist, returning to the execution step: inputting the poetry theme sequence into the first preset poetry generator to generate a candidate white-language clause set;
if the candidate white-language clause exists, modifying the candidate white-language clause according to the candidate clause modification command to obtain a target white-language clause;
and iteratively updating the poetry theme sequence according to the target white words clauses until the updated poetry theme sequence has the candidate white words clause sequences with the target poetry sentence number.
Optionally, the poetry generating means is further configured to:
acquiring a poetry keyword sequence corresponding to a poetry training corpus and a poetry theme sequence corresponding to a translation training corpus, wherein poetry training corpuses of the poetry training corpus correspond to translation training corpuses of the translation training corpus one by one;
splicing a poetry training corpus sequence, the poetry keyword sequence and the poetry theme sequence into a poetry training corpus sequence;
splicing and adjusting the poetry training corpus sequence according to a first preset splicing mode to obtain a first training corpus sequence;
and training a first generator to be trained according to the first training corpus sequence to obtain a first preset poetry generator.
Optionally, the poetry generating apparatus is further configured to:
splicing and adjusting the poetry training corpus sequence according to a second preset splicing mode to obtain a second training corpus sequence;
performing mask processing on the second corpus sequence to obtain a target corpus sequence;
and training a second generator to be trained according to the target training corpus sequence to obtain a second preset poetry generator.
The poetry generating device provided by the invention adopts the poetry generating method in the embodiment, so that the technical problem that the creation efficiency and the poetry quality of poetry are difficult to be considered at the same time is solved. Compared with the prior art, the beneficial effects of the poetry generating device provided by the embodiment of the invention are the same as the beneficial effects of the poetry generating method provided by the embodiment, and other technical characteristics in the poetry generating device are the same as the characteristics disclosed by the embodiment method, so that the details are not repeated herein.
Example four
An embodiment of the present invention provides an electronic device, including: at least one processor; and a memory communicatively coupled to the at least one processor; the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the electronic specification-based device control method in the first embodiment.
Referring now to FIG. 4, shown is a schematic diagram of an electronic device suitable for use in implementing embodiments of the present disclosure. The electronic devices in the embodiments of the present disclosure may include, but are not limited to, mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), in-vehicle terminals (e.g., car navigation terminals), and the like, and fixed terminals such as digital TVs, desktop computers, and the like. The electronic device shown in fig. 4 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present disclosure.
As shown in fig. 4, the electronic device may include a processing means 1001 (e.g., a central processing unit, a graphic processor, etc.) which can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 1002 or a program loaded from a storage means 1003 into a Random Access Memory (RAM) 1004. In the RAM1004, various programs and data necessary for the operation of the electronic apparatus are also stored. The processing device 1001, the ROM1002, and the RAM1004 are connected to each other via a bus 1005. An input/output (I/O) interface 1006 is also connected to the bus.
Generally, the following systems may be connected to the I/O interface 1006: an input device 1007 including, for example, a touch screen, a touch pad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, or the like; output devices 1008 including, for example, liquid Crystal Displays (LCDs), speakers, vibrators, and the like; a storage device 1003 including, for example, a magnetic tape, a hard disk, or the like; and a communication device 1009. The communication means may allow the electronic device to communicate wirelessly or by wire with other devices to exchange data. While the figures illustrate an electronic device with various systems, it is to be understood that not all illustrated systems are required to be implemented or provided. More or fewer systems may alternatively be implemented or provided.
In particular, according to an embodiment of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication means 1009, or installed from the storage means 1003, or installed from the ROM 1002. The computer program, when executed by the processing device 1001, performs the above-described functions defined in the methods of embodiments of the present disclosure.
According to the electronic equipment provided by the invention, the equipment control method based on the electronic specification in the embodiment solves the technical problem of low efficiency of controlling the electronic specification and the intelligent equipment operation interface to complete pairing. Compared with the prior art, the electronic device provided by the embodiment of the present invention has the same beneficial effects as the device control method based on the electronic specification provided by the above embodiment, and other technical features in the electronic device are the same as those disclosed in the method of the above embodiment, which are not described herein again.
It should be understood that portions of the present disclosure may be implemented in hardware, software, firmware, or a combination thereof. In the foregoing description of embodiments, the particular features, structures, materials, or characteristics may be combined in any suitable manner in any one or more embodiments or examples.
The above description is only for the specific embodiments of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present invention, and all the changes or substitutions should be covered within the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.
EXAMPLE five
The present embodiment provides a computer-readable storage medium having computer-readable program instructions stored thereon for executing the poetry generating method of the first embodiment described above.
The computer readable storage medium provided by the embodiments of the present invention may be, for example, a USB flash disk, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, or device, or any combination thereof. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present embodiment, the computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with a command execution system, or device. Program code embodied on a computer readable storage medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, optical cables, RF (radio frequency), etc., or any suitable combination of the foregoing.
The computer-readable storage medium may be embodied in an electronic device; or may be present alone without being incorporated into the electronic device.
The computer readable storage medium carries one or more programs which, when executed by the electronic device, cause the electronic device to: acquiring poetry description information; generating a theme white language sequence corresponding to the target poetry according to the poetry description information and a first preset poetry generator; inputting the subject whispering text sequence into the first preset poetry generator to obtain a candidate poetry clause set corresponding to the target poetry, wherein the candidate poetry clause set is a set of candidate clauses describing the subject of the target poetry; and iteratively adjusting a candidate poetry clause sequence corresponding to the candidate poetry clause set according to a second preset poetry generator and a poetry clause processing command input by a user to obtain the target poetry.
Computer program code for carrying out operations for aspects of the present disclosure may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, smalltalk, C + +, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The modules described in the embodiments of the present disclosure may be implemented by software or hardware. Wherein the names of the modules do not in some cases constitute a limitation of the unit itself.
The computer-readable storage medium provided by the invention stores the computer-readable program command for executing the poetry generating method, and solves the technical problem that the creation efficiency and poetry quality of poetry are difficult to be considered simultaneously. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided by the embodiment of the invention are the same as the beneficial effects of the poetry generation method provided by the embodiment, and are not repeated herein.
Example six
The present application also provides a computer program product comprising a computer program which when executed by a processor implements the steps of the poetry generating method as described above.
The computer program product solves the technical problem that the creation efficiency and the poetry quality of poetry are difficult to be considered. Compared with the prior art, the beneficial effects of the computer program product provided by the embodiment of the invention are the same as the beneficial effects of the poetry generating method provided by the embodiment, and are not repeated herein.
The above description is only a preferred embodiment of the present application, and not intended to limit the scope of the present application, and all modifications of equivalent structures and equivalent processes, which are made by the contents of the specification and the drawings, or which are directly or indirectly applied to other related technical fields, are included in the scope of the present application.

Claims (10)

1. A poetry generating method, characterized in that the poetry generating method comprises:
acquiring poetry description information;
generating a theme white language sequence corresponding to the target poetry according to the poetry description information and a first preset poetry generator;
inputting the subject whispering text sequence into the first preset poetry generator to obtain a candidate poetry clause set corresponding to the target poetry, wherein the candidate poetry clause set is a set of candidate clauses describing the subject of the target poetry;
and iteratively adjusting the candidate poetry clause sequence corresponding to the candidate poetry clause set according to a second preset poetry generator and a poetry clause processing command input by a user to obtain the target poetry.
2. The poetry generating method as claimed in claim 1, wherein said poetry clause processing commands input by the user include poetry clause detecting commands and poetry clause evaluating commands,
the step of iteratively adjusting the candidate poetry clause sequence corresponding to the candidate poetry clause set according to a second preset poetry generator and a poetry clause processing command input by a user to obtain the target poetry comprises the following steps:
determining the number of target poetry sentences of the target poetry according to the candidate poetry sentence clause set;
detecting whether the candidate poetry clause set has a candidate poetry clause or not according to the poetry clause detection command;
if not, returning to the execution step: inputting the theme Chinese sequence to the first preset poetry generator to obtain a candidate poetry clause set corresponding to the target poetry, wherein the candidate poetry clause set is a set of candidate clauses describing the theme of the target poetry;
if the poetry clause sequence exists, carrying out iterative updating on the candidate poetry clause sequence according to the poetry clause evaluation command and the candidate poetry clauses until the updated candidate poetry clause sequence contains the target poetry clause sequence with the number of the target poetry clauses;
and converting the target verse sequence in the updated candidate verse clause sequence into the target verse.
3. The poetry generating method as claimed in claim 2, wherein said step of iteratively updating the sequence of the candidate poetry clauses according to the poetry clause evaluation command and the candidate poetry clauses until the updated sequence of the candidate poetry clauses includes the sequence of the target poetry clauses with the number of the target poetry clauses comprises:
evaluating and editing the candidate poetry clauses according to the first poetry clause evaluation command to obtain the evaluated and edited candidate poetry clauses;
determining whether the candidate poetry sentence is a target poetry sentence according to the second poetry clause evaluation command;
if yes, updating the candidate poetry clause sequence according to the candidate poetry clauses;
if not, determining a candidate poetry sentence sequence corresponding to the candidate poetry sentence sequence;
processing the candidate poetry sentence sequence according to the clause serial number of the candidate poetry clause to obtain a processed candidate poetry sentence sequence;
inputting the processed candidate poetry sentence sequence into the second preset poetry generator to obtain a target poetry sentence clause, and returning to the executing step: and detecting whether the candidate poetry clause set has the candidate poetry clauses or not according to the poetry clause detection command.
4. The poetry generating method as claimed in claim 1, wherein said poetry description information includes poetry quantity description information and poetry theme description information,
the step of generating the theme white language sequence corresponding to the target poetry according to the poetry description information and the first preset poetry generator comprises the following steps:
determining the target poetry sentence number of the target poetry according to the poetry sentence number description information;
determining a poetry theme sequence of the target poetry according to the poetry theme description information;
iteratively inputting the poetry theme sequence in the first preset poetry generator according to a candidate clause processing command input by a user until a candidate theme sequence corresponding to the candidate white clause sequence containing the target poetry sentence number is obtained;
and preprocessing the candidate theme sequence to obtain the theme white language sequence.
5. The poetry generating method according to claim 4, wherein said user-inputted candidate clause processing commands include a candidate clause detecting command and a candidate clause modifying command,
the step of iteratively inputting the poetry theme sequence in the first preset poetry generator according to the candidate clause processing command input by the user until obtaining the candidate theme sequence corresponding to the candidate white clause sequence containing the target poetry sentence number comprises the following steps:
inputting the poetry theme sequence into the first preset poetry generator to generate a candidate white-speech clause set;
detecting whether the candidate white-language clause set has a candidate white-language clause or not according to the candidate clause detection command;
if the candidate white clause does not exist, returning to the execution step: inputting the poetry theme sequence into the first preset poetry generator to generate a candidate white-language clause set;
if the candidate white-language clause exists, modifying the candidate white-language clause according to the candidate clause modification command to obtain a target white-language clause;
and iteratively updating the poetry theme sequence according to the target white words, until the updated poetry theme sequence has the candidate white words clause sequence with the target poetry clause number.
6. The poetry generating method as claimed in claim 1, wherein before said step of obtaining poetry descriptive information, said poetry generating method further comprises:
acquiring a poetry keyword sequence corresponding to a poetry training corpus and a poetry theme sequence corresponding to a translation training corpus, wherein poetry training corpuses of the poetry training corpus correspond to translation training corpuses of the translation training corpus one by one;
splicing a poetry training corpus sequence, the poetry keyword sequence and the poetry theme sequence into a poetry training corpus sequence;
splicing and adjusting the poetry training corpus sequence according to a first preset splicing mode to obtain a first training corpus sequence;
and training a first generator to be trained according to the first training corpus sequence to obtain a first preset poetry generator.
7. The method of generating poetry as claimed in claim 1, wherein after said step of concatenating a poetry training corpus sequence, said poetry keyword sequence and said poetry topic sequence into a poetry training corpus sequence, said method of generating poetry further comprises:
splicing and adjusting the poetry training corpus sequence according to a second preset splicing mode to obtain a second training corpus sequence;
performing mask processing on the second corpus sequence to obtain a target corpus sequence;
and training a second generator to be trained according to the target training corpus sequence to obtain a second preset poetry generator.
8. A poetry generating apparatus, characterized in that the poetry generating apparatus comprises:
the acquisition module is used for acquiring poetry description information;
the generating module is used for generating a theme white language sequence corresponding to the target poetry according to the poetry description information and a first preset poetry generator;
the input module is used for inputting the subject white language sequence into the first preset poetry generator to obtain a candidate poetry clause set corresponding to the target poetry, wherein the candidate poetry clause set is a set of candidate clauses describing the subject of the target poetry;
and the adjusting module is used for iteratively adjusting the candidate poetry clause sequence corresponding to the candidate poetry clause set according to a second preset poetry generator and a poetry clause processing command input by a user to obtain the target poetry.
9. An electronic device, characterized in that the electronic device comprises:
at least one processor; and the number of the first and second groups,
a memory communicatively coupled to the at least one processor; wherein,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the steps of the poetry generation method of any of claims 1 to 7.
10. A computer-readable storage medium, characterized in that the computer-readable storage medium has stored thereon a program implementing a poetry generating method, which is executed by a processor to implement the steps of the poetry generating method as recited in any one of claims 1 to 7.
CN202210885016.XA 2022-07-26 2022-07-26 Poetry generation method and device, electronic equipment and readable storage medium Pending CN115310426A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210885016.XA CN115310426A (en) 2022-07-26 2022-07-26 Poetry generation method and device, electronic equipment and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210885016.XA CN115310426A (en) 2022-07-26 2022-07-26 Poetry generation method and device, electronic equipment and readable storage medium

Publications (1)

Publication Number Publication Date
CN115310426A true CN115310426A (en) 2022-11-08

Family

ID=83858582

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210885016.XA Pending CN115310426A (en) 2022-07-26 2022-07-26 Poetry generation method and device, electronic equipment and readable storage medium

Country Status (1)

Country Link
CN (1) CN115310426A (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110134968A (en) * 2019-05-22 2019-08-16 网易(杭州)网络有限公司 Poem generation method, device, equipment and storage medium based on deep learning
WO2019174186A1 (en) * 2018-03-15 2019-09-19 平安科技(深圳)有限公司 Automatic poem generation method and apparatus, and computer device and storage medium
CN111368056A (en) * 2020-03-04 2020-07-03 北京香侬慧语科技有限责任公司 Ancient poetry generation method and device
CN112101006A (en) * 2020-09-14 2020-12-18 中国平安人寿保险股份有限公司 Poetry generation method and device, computer equipment and storage medium

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2019174186A1 (en) * 2018-03-15 2019-09-19 平安科技(深圳)有限公司 Automatic poem generation method and apparatus, and computer device and storage medium
CN110134968A (en) * 2019-05-22 2019-08-16 网易(杭州)网络有限公司 Poem generation method, device, equipment and storage medium based on deep learning
CN111368056A (en) * 2020-03-04 2020-07-03 北京香侬慧语科技有限责任公司 Ancient poetry generation method and device
CN112101006A (en) * 2020-09-14 2020-12-18 中国平安人寿保险股份有限公司 Poetry generation method and device, computer equipment and storage medium

Similar Documents

Publication Publication Date Title
JP7421604B2 (en) Model pre-training method and device, text generation method and device, electronic equipment, storage medium and computer program
CN111260545B (en) Method and device for generating image
US10860289B2 (en) Flexible voice-based information retrieval system for virtual assistant
KR20180025121A (en) Method and apparatus for inputting information
CN104681023A (en) Information processing method and electronic equipment
CN104252861A (en) Video voice conversion method, video voice conversion device and server
TWI509432B (en) Electronic device and language analysis method thereof
CN110929094A (en) Video title processing method and device
US20230080230A1 (en) Method for generating federated learning model
CN111563390A (en) Text generation method and device and electronic equipment
JP2022006173A (en) Knowledge pre-training model training method, device and electronic equipment
CN113778419B (en) Method and device for generating multimedia data, readable medium and electronic equipment
CN113793398A (en) Drawing method and device based on voice interaction, storage medium and electronic equipment
CN114118417A (en) Multi-mode pre-training method, device, equipment and medium
CN117765132A (en) Image generation method, device, equipment and storage medium
US20210335357A1 (en) Method for controlling intelligent speech apparatus, electronic device and storage medium
CN113392197A (en) Question-answer reasoning method and device, storage medium and electronic equipment
CN118015144A (en) Image generation method and training method and device of image generation model
CN116913278B (en) Voice processing method, device, equipment and storage medium
CN117726720A (en) Image editing method, device, electronic equipment and readable storage medium
CN112988967A (en) Dialog generation method and device based on two-stage decoding, medium and computing equipment
US20220300717A1 (en) Method and apparatus for generating dialogue state
US20230015112A1 (en) Method and apparatus for processing speech, electronic device and storage medium
CN115310426A (en) Poetry generation method and device, electronic equipment and readable storage medium
CN116010899A (en) Multi-mode data processing and pre-training method of pre-training model and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination