| CPC G06F 40/279 (2020.01) | 15 Claims |

|
1. A method for generating a text, comprising:
receiving an original text and an element tag;
generating, based on the original text, an encoded text feature vector and an encoded sentence feature vector of each sentence in the original text using a pre-trained encoder; and
performing, using a decoder that is pre-trained, following decoding steps:
determining, based on a hidden state vector of the decoder at a current moment and the encoded text feature vector, a word attention weight of each word in the original text at the current moment; determining a sentence attention weight of each sentence in the original text at the current moment, based on the hidden state vector of the decoder at the current moment, the encoded sentence feature vector and the element tag; determining a normalized word attention weight of each word in the original text at the current moment based on the sentence attention weight and the word attention weight; and estimating a target word at the current moment based on the encoded text feature vector and normalized word attention weights of words in the original text at the current moment,
wherein the method further comprises: generating a target text based on target words outputted by the decoder at moments.
|