| Controllable sentiment text generation refers to the generation of text with specified positive or negative sentiment attributes.With the advancement of technology,it has been possible to generate fluent text using pre-trained language models,however,this text generation is not sentiment-controllable.One reason is that the pre-trained language model does not have control functions and it is difficult to change the architecture;the second reason is the absence of parallel datasets;the third reason is that the text attributes are entangled and it is difficult to extract the text sentiment attributes accurately by machine methods.Based on the above problems,this thesis conducts research on controlled sentiment text generation in terms of both prompt learning and transfer learning respectively.The main innovations and work in this thesis are as follows:(1)A prefix prompt learning method that integrates text topic and sentiment is proposed.For the problem of uncontrollable sentiment of generated text,the algorithm is based on the Prefix-Tuning method,by extracting the topic and sentiment information of the text as discrete prefix hints,while using the model to calculate the reserved prefix trainable matrix as continuous prefix hints,through the joint constraint of these two aspects,the model is guided to focus on the topic and sentiment content of the text to achieve the purpose of controllable sentiment of the text.The experimental results show that the text generated by this method can achieve both text sentiment dimension and topic level control,alleviate the problem of text drift,and have certain effect in generating content diversity.(2)A Transformer-based text sentiment style transfer method is proposed.The method addresses the problem that the generated text does not have the specified sentiment,and is based on the delete-retrieve-generate framework.First,the retained text content is obtained by deleting the sentiment factors of the text through the N-gram model based on statistical principles,and then Sentence-BERT is used for sentence similarity calculation to retrieve the corpus with the target sentiment to obtain sentences with similar content and obtain the target sentiment of the sentence Finally,combine the retained text content and target sentiment attributes,construct input templates using cue information,and generate text modeling in the Transformer-based model.The experimental results show that the method greatly improves the time efficiency of retrieval and the accuracy of sentiment migration in generating text by 2.3%,while alleviating the problem of inconsistent content before and after the text to a certain extent.(3)A controlled sentiment text generation system is designed and implemented.Based on the two sentimental text generation methods proposed in this thesis,the controlled sentiment text generation system is implemented through the steps of system architecture design,function design and development implementation.The test results show that the system can run stably.In this thesis,the research on the generation of multiple sentiment texts and the sentiment transfer of a single text is carried out for text sentiment control,and the research results can be applied to the fields of opinion control and intelligent Q&A. |