IP Library › Granted Patent US 10,762,305
Granted Patent B2
US 10,762,305 · App. 16/005,779 · Granted Sep 1, 2020

Method for generating chatting data based on artificial intelligence, computer device and computer-readable storage medium

Inventors: Yi Liu (Beijing, CN); Daxiang Dong (Beijing, CN); Dianhai Yu (Beijing, CN)
Assignee: BEIJING BAIDU NETCOM SCIENCE AND TECHNOLOGY CO., LTD.
G06F40/56G06F17/18G06F40/279G06F40/35G06F40/49G06N3/006G06N3/0445G06N3/0454G06N3/08H04L51/02G06F16/35G06F16/5846G06N5/041
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 10,762,305
App. No.
16/005,779
Granted
Sep 1, 2020
Kind
B2
Abstract

Embodiments of the present disclosure relate to a method for generating chatting data based on AI, a computer device and a computer-readable storage medium. The method includes: converting chatting data inputted by a user into an input word sequence; converting a tag of the user into a tag word sequence; based on a preset encoding-decoding model with an attention model, predicting according to the input word sequence and the tag word sequence to obtain a target word sequence; and converting the target word sequence into reply data of the chatting data.

Claims (91)

1. A method for generating chatting data based on artificial intelligence, comprising:

converting, with one or more processors, chatting data inputted by a user on a device into an input word sequence;

converting, with the one or more processors, a tag of the user into a tag word sequence;

based on a preset encoding-decoding model with an attention model, predicting, with the one or more processors, according to the input word sequence and the tag word sequence to obtain a target word sequence; and

converting the target word sequence into reply data of the chatting data;

wherein based on the preset encoding-decoding model with the attention model, predicting according to the input word sequence and the tag word sequence to obtain the target word sequence, comprises:

encoding the input word sequence to obtain a first corpus sequence;

encoding the tag word sequence to obtain a reference corpus sequence;

determining a preset word in the first corpus sequence as an initial word;

determining first context information corresponding to the initial word based on the first corpus sequence;

determining second context information corresponding to the initial word based on the reference corpus sequence;

determining a target word based on the initial word, the first context information and the second context information; and

when the target word does not meet a cut-off condition, iterating by using the target word as the initial word to return acts of determining the first context information and determining the second context information; and

wherein determining the target word based on the initial word, the first context information and the second context information, comprises:

inputting the initial word, the first context information and the second context information into the attention model to obtain hidden layer information;

projecting the hidden layer information into a word list space by linear transformation;

predicting a probability that a first word in the word list space is a next word, the first word being any one word in the word list space; and

determining the target word based on the probability.

2. The method according to claim 1 , wherein

determining the first context information corresponding to the initial word based on the first corpus sequence, comprises: determining first weight information corresponding to the initial word, and performing weighted sum on the first corpus sequence based on the first weight information;

determining the second context information corresponding to the initial word based on the reference corpus sequence, comprises: determining second weight information corresponding to the initial word, and performing weighted sum on the reference corpus sequence based on the second weight information.

3. The method according to claim 1 , wherein the cut-off condition comprises:

the target word being a preset ending word; and/or,

the number of the target words that have been obtained reaching a preset length.

4. The method according to claim 1 , further comprising:

obtaining, with the one or more processors, a plurality of conversation records;

performing, with the one or more processors, word segmentation on each of sentences in the plurality of conversation records to obtain a plurality of segmentation words;

obtaining, with the one or more processors, a probability that each of the plurality of segmentation words appears; and

determining, with the one or more processors, the word list space based on the probability that each of the plurality of segmentation words appears.

5. A computer device, comprising:

a processor;

a memory; and

computer programs stored in the memory and executable by the processor,

wherein the processor is configured to execute the computer programs to perform acts of:

converting chatting data inputted by a user into an input word sequence;

converting a tag of the user into a tag word sequence;

based on a preset encoding-decoding model with an attention model, predicting according to the input word sequence and the tag word sequence to obtain a target word sequence; and

converting the target word sequence into reply data of the chatting data;

wherein the processor is configured to, based on the preset encoding-decoding model with the attention model, predict according to the input word sequence and the tag word sequence to obtain the target word sequence by acts of:

encoding the input word sequence to obtain a first corpus sequence;

encoding the tag word sequence to obtain a reference corpus sequence;

determining a preset word in the first corpus sequence as an initial word;

determining first context information corresponding to the initial word based on the first corpus sequence;

determining second context information corresponding to the initial word based on the reference corpus sequence;

determining a target word based on the initial word, the first context information and the second context information; and

when the target word does not meet a cut-off condition, iterating by using the target word as the initial word to return acts of determining the first context information and determining the second context information; and

wherein the processor is configured to determine the target word based on the initial word, the first context information and the second context information by acts of:

inputting the initial word, the first context information and the second context information into the attention model to obtain hidden layer information;

projecting the hidden layer information into a word list space by linear transformation;

predicting a probability that a first word in the word list space is a next word, the first word being any one word in the word list space; and

determining the target word based on the probability.

6. The computer device according to claim 5 ,

wherein the processor is configured to determine the first context information corresponding to the initial word based on the first corpus sequence by acts of: determining first weight information corresponding to the initial word, and performing weighted sum on the first corpus sequence based on the first weight information;

wherein the processor is configured to determine the second context information corresponding to the initial word based on the reference corpus sequence by acts of: determining second weight information corresponding to the initial word, and performing weighted sum on the reference corpus sequence based on the second weight information.

7. The computer device according to claim 5 , wherein the cut-off condition comprises:

the target word being a preset ending word; and/or,

the number of the target words that have been obtained reaching a preset length.

8. The computer device according to claim 7 , wherein the processor is further configured to perform acts of:

obtaining a plurality of conversation records;

performing word segmentation on each of sentences in the plurality of conversation records to obtain a plurality of segmentation words;

obtaining a probability that each of the plurality of segmentation words appears; and

determining the word list space based on the probability that each of the plurality of segmentation words appears.

9. A non-transitory computer-readable storage medium, having computer programs stored therein, wherein when the computer programs are executed by a processor, a method for generating chatting data based on artificial intelligence is realized, the method comprising:

converting chatting data inputted by a user into an input word sequence;

converting a tag of the user into a tag word sequence;

based on a preset encoding-decoding model with an attention model, predicting according to the input word sequence and the tag word sequence to obtain a target word sequence; and

converting the target word sequence into reply data of the chatting data;

wherein based on the preset encoding-decoding model with the attention model, predicting according to the input word sequence and the tag word sequence to obtain the target word sequence, comprises:

encoding the input word sequence to obtain a first corpus sequence;

encoding the tag word sequence to obtain a reference corpus sequence;

determining a preset word in the first corpus sequence as an initial word;

determining first context information corresponding to the initial word based on the first corpus sequence;

determining second context information corresponding to the initial word based on the reference corpus sequence;

determining a target word based on the initial word, the first context information and the second context information; and

when the target word does not meet a cut-off condition, iterating by using the target word as the initial word to return acts of determining the first context information and determining the second context information; and

wherein determining the target word based on the initial word, the first context information and the second context information, comprises:

inputting the initial word, the first context information and the second context information into the attention model to obtain hidden layer information;

projecting the hidden layer information into a word list space by linear transformation;

predicting a probability that a first word in the word list space is a next word, the first word being any one word in the word list space; and

determining the target word based on the probability.

10. The non-transitory computer-readable storage medium according to claim 9 , wherein

determining the first context information corresponding to the initial word based on the first corpus sequence, comprises: determining first weight information corresponding to the initial word, and performing weighted sum on the first corpus sequence based on the first weight information;

determining the second context information corresponding to the initial word based on the reference corpus sequence, comprises: determining second weight information corresponding to the initial word, and performing weighted sum on the reference corpus sequence based on the second weight information.

11. The non-transitory computer-readable storage medium according to claim 9 , wherein the cut-off condition comprises:

the target word being a preset ending word; and/or,

the number of the target words that have been obtained reaching a preset length.

12. The non-transitory computer-readable storage medium according to claim 9 , wherein the method further comprises:

obtaining a plurality of conversation records;

performing word segmentation on each of sentences in the plurality of conversation records to obtain a plurality of segmentation words;

obtaining a probability that each of the plurality of segmentation words appears; and

determining the word list space based on the probability that each of the plurality of segmentation words appears.

Assignments (1)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Jun 12, 2018
From: LIU, YI; DONG, DAXIANG; YU, DIANHAI
To: BEIJING BAIDU NETCOM SCIENCE AND TECHNOLOGY CO., LTD.
Reel/Frame 046051/0727 →
Priority Claims (1)
CN 2017 1 0444259 · Jun 13, 2017 · national
Continuity (1)
Related Publication 20180357225A1 · Dec 13, 2018