IP Library › Granted Patent US 11,928,434
Granted Patent B2
US 11,928,434 · App. 17/444,693 · Granted Mar 12, 2024

Method for text generation, device and storage medium

Inventors: Jiachen Liu (Beijing, CN); Xinyan Xiao (Beijing, CN); Hua Wu (Beijing, CN); Haifeng Wang (Beijing, CN)
Assignee: BEIJING BAIDU NETCOM SCIENCE AND TECHNOLOGY CO., LTD.
G06F40/295G06N5/022G06N20/00G06F40/56
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 11,928,434
App. No.
17/444,693
Granted
Mar 12, 2024
Kind
B2
Abstract

A method for text generation, relates to a field of natural language processing, including: obtaining corpus data; labeling the corpus data to obtain a first constraint element; obtaining a first generation target; and generating a first text matching the first generation target by inputting the corpus data and the first constraint element into a generation model.

Claims (79)

1. A text generation method, comprising:

obtaining corpus data;

labeling the corpus data to obtain a first constraint element;

obtaining a first generation target; and

generating a first text matching the first generation target by inputting the corpus data and the first constraint element into a generation model;

wherein generating the first text matching the first generation target by inputting the corpus data and the first constraint element into the generation model comprises:

obtaining a first sub model matching the first generation target from the generation model according to the first generation target; and

inputting the corpus data and the first constraint element into the first sub model, and generating the first text by the first sub model,

after generating the first text matching the first generation target, the method further comprises:

obtaining a second sub model associated with the first sub model, wherein corpus data of the second sub model is the first text;

labeling the first text to obtain a second constraint element corresponding to the second sub model; and

generating a second text by inputting the first text and the second constraint element into the second sub model.

2. The text generation method of claim 1 , further comprising:

obtaining a plurality of training corpora and training texts corresponding to the training corpora;

labeling the training corpora to obtain training constraint elements of the training corpora; and

generating the generation model by taking the training corpora, the training constraint elements and the training texts as training samples and inputting the training samples into an initial generation model for training.

3. The text generation method of claim 1 , wherein inputting the corpus data and the first constraint element into the first sub model and generating the first text by the first sub model comprises:

obtaining a first material of the first sub model according to the corpus data, and generating the first text according to the first material and the first constraint element.

4. The text generation method of claim 3 , wherein the first sub model is an outline generation sub model, and the corpus data is a first corpus text, wherein obtaining the first material of the first sub model according to the corpus data comprises:

performing type recognition on content of each paragraph in the first corpus text to obtain a type feature of each paragraph;

obtaining a paragraph collection by classifying the paragraph according to the type feature of the paragraph; and

determining the paragraph collection and the type feature of the paragraph collection as the first material.

5. The text generation method of claim 3 , wherein the first sub model is a text element generation sub model, and the corpus data is a second corpus text, wherein obtaining the first material of the first sub model according to the corpus data comprises:

obtaining a text theme and a main sentence of the second corpus text, and determining the text theme and the main sentence as the first material.

6. The text generation method of claim 3 , wherein the first sub model is a text generation sub model, and the corpus data is a key word, wherein obtaining the first material of the first sub model according to the corpus data comprises:

generating a search rule according to the keyword, and performing a material search using the key word according to the search rule to obtain the first material.

7. The text generation method of claim 3 , wherein the first sub model is a theme generation sub model, and the corpus data is a seed word, wherein obtaining the first material of the first sub model according to the corpus data comprises:

extracting a first entity from the seed word;

obtaining a second entity associated with the first entity from a preset knowledge graph according to the first entity; and

obtaining an association relationship between the first entity and the second entity, and determining the second entity and the association relationship as the first material.

8. The text generation method of claim 3 , wherein the first sub model is a text continuation sub model, and the corpus data is a generated text, wherein obtaining the first material of the first sub model according to the corpus data comprises:

segmenting the generated text to form segmented corpora as the first material.

9. The text generation method of claim 3 , wherein the first sub model is a text polishing sub model, and the corpus data is a generated text, wherein obtaining the first material of the first sub model according to the corpus data comprises:

segmenting content of the generated text to obtain at least one segmentation; and

identifying part of speech of the at least one segmentation, and selecting a target segmentation from the at least one segmentation as the first material according to the part of speech.

10. The text generation method of claim 3 , wherein the first sub model is a text rhetoric sub model, and the corpus data is a generated text, wherein obtaining the first material of the first sub model according to the corpus data comprises:

extracting a sentence from the generated text, and identifying an entity and a concept from the extracted sentence as the first material.

11. The text generation method of claim 3 , wherein the first sub model is a text reuse sub model, and the corpus data is a generated text, wherein obtaining the first material of the first sub model according to t the corpus data comprises:

extracting paragraphs from the generated text;

obtaining summary information of the generated text, and obtaining a first paragraph similar to the summary information from the paragraphs according to the summary information; and/or,

identifying data content of the paragraphs, and selecting a second paragraph from the paragraphs, wherein the amount of the data content in the second paragraph exceeds a preset amount; and

determining the first paragraph and the second paragraph as the first material.

12. An electrical device, comprising:

at least one processor, and

a memory communicatively coupled to the at least one processor; wherein,

the memory is configured to store instructions executable by the at least one processor, and the instructions are executed by at least one processor to cause at least one processor to execute a text generation method, comprising:

obtaining corpus data;

labeling the corpus data to obtain a first constraint element;

obtaining a first generation target; and

generating a first text matching the first generation target by inputting the corpus data and the first constraint element into a generation model;

wherein generating the first text matching the first generation target by inputting the corpus data and the first constraint element into the generation model comprises:

obtaining a first sub model matching the first generation target from the generation model according to the first generation target; and

inputting the corpus data and the first constraint element into the first sub model, and generating the first text by the first sub model,

after generating the first text matching the first generation target, the method further comprises:

obtaining a second sub model associated with the first sub model, wherein corpus data of the second sub model is the first text;

labeling the first text to obtain a second constraint element corresponding to the second sub model; and

generating a second text by inputting the first text and the second constraint element into the second sub model.

13. The electrical device of claim 12 , wherein the method further comprises:

obtaining a plurality of training corpora and training texts corresponding to the training corpora;

labeling the training corpora to obtain training constraint elements of the training corpora; and

generating the generation model by taking the training corpora, the training constraint elements and the training texts as training samples and inputting the training samples into an initial generation model for training.

14. The electrical device of claim 12 , wherein inputting the corpus data and the first constraint element into the first sub model and generating the first text by the first sub model comprises:

obtaining a first material of the first sub model according to the corpus data, and generating the first text according to the first material and the first constraint element.

15. The electrical device of claim 14 , wherein the first sub model is an outline generation sub model, and the corpus data is a first corpus text, wherein obtaining the first material of the first sub model according to the corpus data comprises:

performing type recognition on content of each paragraph in the first corpus text to obtain a type feature of each paragraph;

obtaining a paragraph collection by classifying the paragraph according to the type feature of the paragraph; and

determining the paragraph collection and the type feature of the paragraph collection as the first material.

16. A non-transitory computer-readable storage medium having computer instructions stored thereon, wherein the computer instructions are configured to make a computer execute a text generation method, comprising:

obtaining corpus data;

labeling the corpus data to obtain a first constraint element;

obtaining a first generation target; and

generating a first text matching the first generation target by inputting the corpus data and the first constraint element into a generation model;

wherein generating the first text matching the first generation target by inputting the corpus data and the first constraint element into the generation model comprises:

obtaining a first sub model matching the first generation target from the generation model according to the first generation target; and

inputting the corpus data and the first constraint element into the first sub model, and generating the first text by the first sub model,

after generating the first text matching the first generation target, the method further comprises:

obtaining a second sub model associated with the first sub model, wherein corpus data of the second sub model is the first text;

labeling the first text to obtain a second constraint element corresponding to the second sub model; and

generating a second text by inputting the first text and the second constraint element into the second sub model.

Assignments (1)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Aug 9, 2021
From: LIU, JIACHEN; XIAO, XINYAN; WU, HUA; WANG, HAIFENG
To: BEIJING BAIDU NETCOM SCIENCE AND TECHNOLOGY CO., LTD.
Reel/Frame 057121/0056 →
Priority Claims (1)
CN 202010991790.X · Sep 21, 2020 · national
Continuity (1)
Related Publication 20210374349A1 · Dec 2, 2021