Summary of the invention
The embodiment of the present invention provides a kind of dialogue generation method and device, to improve flexibility with user session and lively
Property, promote user experience.
For this purpose, the invention provides the following technical scheme:
A kind of dialogue generation method, which comprises
Receive user's current input information;
Generate the original revert statement based on the input information;
The affective state of user is determined according to the input information;
According to the identity personality of the input information, the affective state of the user and the preparatory user excavated offline
Portrait information, determines and replys type;
According to the reply type and the original revert statement, the revert statement for having identity emotion is generated;
The output revert statement for having identity emotion.
Optionally, described generate includes: based on the original revert statement for inputting information
Identify that the attribute of entity word and the entity word in the input information is believed using the entity library pre-established
Breath;
Determine user's current dialogue states;
System dialog state is updated according to user's current dialogue states;
Obtain revert statement template corresponding with updated system dialog state;
The attribute information of the entity word and the entity word is filled into the revert statement template, is obtained based on institute
State the original revert statement of input information.
Optionally, the affective state that user is determined according to the input information includes:
The emotion classifiers that the input information input is trained in advance, determine according to the output of the emotion classifiers and use
The affective state at family.
Optionally, the method also includes training the emotion classifiers in the following manner:
Set affective style;
The data of different emotions type are collected from the dialog history corpus of user as training data;
The emotion classifiers are obtained using training data training.
Optionally, the affective style includes: neutrality, and it is following any one or more: it is glad, sad, angry, low
It falls.
Optionally, the identity personality portrait information includes the tag set for describing user characteristics, the label packet
It includes: character attribute class label, and/or interest class label.
Optionally, the method also includes excavating the identity personality of user portrait information offline in the following way:
The dialog history corpus and historical behavior data of the user are obtained respectively;
According to the dialog history corpus and historical behavior data, the use is determined using attributive classification device trained in advance
The character attribute class label at family;
Historical behavior information is extracted from the historical behavior data;
According to the entity library that the historical behavior information matches pre-establish, the entity word that matching is obtained is as the use
The interest class label at family.
Optionally, the method also includes training attributive classification device in the following way:
Setting is directed to the classification of particular persons attribute;
Collect the dialogue corpus and behavioral data of different user;
Corresponding different classes of data are extracted from the dialogue corpus and the behavioral data respectively as training data;
Obtain corresponding to the attributive classification device of the particular persons attribute using training data training.
Optionally, the historical behavior data of the user include: the inquiry log of the user.
Optionally, described according to the input information, the affective state of the user and the preparatory use excavated offline
The identity personality portrait information at family determines that replying type includes:
The identity personality of the input information, the affective state of the user and the preparatory user excavated offline is drawn
As the reply type sorter that information input is trained in advance, is determined according to the output for replying type sorter and reply type.
Optionally, the method also includes training the reply type sorter in the following manner:
Type is replied in setting;
The different data for replying type are collected from the dialog history corpus of user as training data;
The reply type sorter is obtained using training data training.
Optionally, the reply type includes: neutral type and any one or more following type: lovely type, adult form,
Actively optimism type.
Optionally, described according to the reply type and the original revert statement, generate the reply for having identity emotion
Sentence includes:
Slot position decomposition is carried out to the original revert statement, obtains each slot position and the corresponding content of the slot position;
For the corresponding content of the affiliated slot position of non-physical word after decomposition, preset style corpus is inquired, is obtained and institute
It states and replys corpus content that type is consistent, corresponding with the slot position, and be institute's predicate by the corresponding content modification of the slot position
Expect content;
The revert statement for having identity emotion is generated according to the corresponding content of slot position each after modification.
Optionally, described according to the reply type and the original revert statement, generate the reply for having identity emotion
Sentence further include:
Obtain corresponding with replys type decoration information, and by the decoration information be added to described in have identity feelings
In the revert statement of sense.
Optionally, the decoration information includes any of the following or a variety of: modal particle, emoticon decoration information.
Optionally, according to the reply type and the original revert statement, the revert statement for having identity emotion is generated
Include:
Style statement model corresponding with the reply type trained using the original revert statement and in advance, obtains
Revert statement with identity emotion.
A kind of dialogue generating means, described device include:
Receiving module, for receiving user's current input information;
Sentence generation module, for generating the original revert statement based on the input information;
Affective state determining module, for determining the affective state of user according to the input information;
Determination type module is replied, for inputting information, the affective state of the user and offline digging in advance according to described
The identity personality portrait information of the user of pick, determines and replys type;
Sentence modified module, for generating and having identity emotion according to the reply type and the original revert statement
Revert statement;
Output module, for exporting the revert statement for having identity emotion.
Optionally, the sentence generation module includes:
Information identificating unit, for identifying entity word and institute in the input information using the entity library pre-established
State the attribute information of entity word;
Dialogue state determination unit, for determining user's current dialogue states;
State updating unit, for updating system dialog state according to user's current dialogue states;
Template acquiring unit, for obtaining revert statement template corresponding with updated system dialog state;
Fills unit, for the attribute information of the entity word and the entity word to be filled into the revert statement template
In, obtain the original revert statement based on the input information.
Optionally, the affective state determining module, specifically for the emotion for training the input information input in advance
Classifier determines the affective state of user according to the output of the emotion classifiers.
Optionally, described device further include:
Emotion classifiers training module, for training the emotion classifiers;The emotion classifiers training module includes:
Affective style setup unit, for setting affective style;
First training data collector unit, for collecting the data of different emotions type from the dialog history corpus of user
As training data;
First training unit, for obtaining the emotion classifiers using training data training.
Optionally, the affective style includes: neutrality, and it is following any one or more: it is glad, sad, angry, low
It falls.
Optionally, the identity personality portrait information includes the tag set for describing user characteristics, the label packet
It includes: character attribute class label, and/or interest class label.
Optionally, described device further include:
Information excavating module, for excavating the identity personality portrait information of the user offline;The information excavating module
Include:
Information acquisition unit, for obtaining the dialog history corpus and historical behavior data of the user respectively;
Character attribute class tag determination unit, for according to the dialog history corpus and historical behavior data, using pre-
First trained attributive classification device determines the character attribute class label of the user;
Behavioural information extraction unit, for extracting historical behavior information from the historical behavior data;
Interest class tag determination unit, the entity library for being pre-established according to the historical behavior information matches, general
Interest class label with obtained entity word as the user.
Optionally, described device further include:
Attributive classification device training module, for training attributive classification device;The attributive classification device training module includes:
Attribute classification setup unit, for setting the classification for being directed to particular persons attribute;
Second data collection module, for collecting the dialogue corpus and behavioral data of different user;
Data extracting unit, it is different classes of for extracting correspondence from the dialogue corpus and the behavioral data respectively
Data are as training data;
Second training unit, for obtaining corresponding to the attribute point of the particular persons attribute using training data training
Class device.
Optionally, the historical behavior data of the user include: the inquiry log of the user.
Optionally, the reply determination type module, specifically for by it is described input information, the user affective state
And the reply type sorter that the identity personality portrait information input of the user excavated offline in advance is trained in advance, according to institute
State the determining reply type of output for replying type sorter.
Optionally, described device further include:
Type sorter training module is replied, for training the reply type sorter;The reply type sorter
Training module includes:
Type set unit is replied, replys type for setting;
Third data collection module, for collecting the different data conducts for replying type from the dialog history corpus of user
Training data;
Third training unit, for obtaining the reply type sorter using training data training.
Optionally, the reply type include: neutral type and it is following any one or more: lovely type, adult form, actively
Optimistic type.
Optionally, the sentence modified module includes:
Slot position decomposition unit obtains each slot position and the slot position for carrying out slot position decomposition to the original revert statement
Corresponding content;
Content modifying unit, for inquiring preset wind for the corresponding content of the affiliated slot position of non-physical word after decomposing
Lattice corpus, obtain and it is described reply type is consistent, corresponding with slot position corpus content, and it is the slot position is corresponding
Content modification is the corpus content;
Content assembled unit, for generating the reply language for having identity emotion according to the corresponding content of slot position each after modification
Sentence.
Optionally, the sentence modified module further include:
Unit is modified, for obtaining decoration information corresponding with the reply type, and the decoration information is added to
In the revert statement with identity emotion.31. device according to claim 30, which is characterized in that the modification
Information include it is following any one or more: modal particle, emoticon.
Optionally, the sentence modified module, specifically for using the original revert statement and in advance training with institute
It states and replys the corresponding style statement model of type, obtain the revert statement with identity emotion.
A kind of electronic equipment, comprising: one or more processors, memory;
For the memory for storing computer executable instructions, the processor is executable for executing the computer
Instruction, to realize mentioned-above method.
A kind of readable storage medium storing program for executing, is stored thereon with instruction, and described instruction is performed to realize mentioned-above method.
Dialogue generation method provided in an embodiment of the present invention and device consider not only user's input when talking with generation
Conversation content, and in view of user real-time affective state and user identity character trait, currently inputted according to user
The identity personality portrait information of information, the real-time affective state of user and the user excavated offline in advance, determines and replys class
Original revert statement based on input information is revised as the revert statement with identity emotion according to the reply type by type,
So as to the identical information for different user input, different revert statements is generated, that is to say, that make the reply language generated
Sentence can vary with each individual, and keep revert statement more humanized, improve flexibility and vividness with user session, mention significantly
User experience is risen.
Specific embodiment
The scheme of embodiment in order to enable those skilled in the art to better understand the present invention with reference to the accompanying drawing and is implemented
Mode is described in further detail the embodiment of the present invention.
For the dialogue for the same content that existing conversational system exports different user, the revert statement of generation lacks spirit
Activity and the problem of vividness, the embodiment of the present invention provides a kind of dialogue generation method and device is not only examined in dialogue generation
Consider the conversation content of user's input, and in view of the identity character trait of the real-time affective state of user and user.Specifically
Ground determines the affective state of user according to user's current input information, according to the input information, the affective state of the user
And the identity personality portrait information of the user excavated offline in advance, it determines and replys type, according to the reply type by base
It is revised as the revert statement with identity emotion in the original revert statement of the input information, then output is described has identity
The revert statement of emotion.
As shown in Figure 1, being the flow chart of dialogue generation method of the embodiment of the present invention, comprising the following steps:
Step 101, user's current input information is received.
The input information can be voice messaging by voice input, can be through the input methods such as phonetic, hand-written
The text information of input, without limitation to this embodiment of the present invention.Certainly, it if it is voice messaging, in subsequent processing, also needs
Corresponding text information is obtained, is then carried out again based on the text information first by the voice messaging by speech recognition
Subsequent processing.
Step 102, the original revert statement based on the input information is generated.
The original revert statement can be generated using the prior art.In addition, the embodiment of the present invention also provides a kind of generation
The method of the original revert statement, as shown in Figure 2, comprising the following steps:
Step 201, the entity word and the entity word in the input information are identified using the entity library pre-established
Attribute information.
For example, searching the entity library using dictionary tree finding algorithm, identify real included in the input information
The attribute information of pronouns, general term for nouns, numerals and measure words and the entity word.
The entity library can be constructed based on documents such as corpus, such as inquiry log, advertisement base message.Specifically,
It does not carry out the excavation of entity word and its attribute information based on the document classification, verification sieve is then carried out by manually mark
Choosing, it is final establish include multiple classifications entity library, for example entity class can include but is not limited to: makeups, electronics, clothes,
Star, video display etc..Based on the corpus, it can use the modes such as template matching and/or disaggregated model and excavated offline, it is raw
At the attribute information of each entity word of correspondence.In embodiments of the present invention, the attribute information can be divided into: general-purpose attribute and spy
Different attribute.Wherein, the general-purpose attribute corresponds to the attributes such as the entity, such as gender, crowd, season of all categories;The spy
Different attribute corresponds to the entity of particular category, and by taking makeups class as an example, specific properties have makeups brand, effect, ingredient, type, production
The attributes such as ground.Moreover, the corresponding specific properties of different classes of entity are different.
These above-mentioned general-purpose attributes and specific properties are manually to be arranged based on experience, such as crowd's attribute is divided into baby a bit
Child, pregnant woman, student etc.;Some attributes be based on inquiry log using template matching method offline excavates generation, such as
Query word in inquiry log is " replenishing water and preserving moisture facial mask ranking list ", " whitening mask ranking list ", manually sets template with passing through
" XXX facial mask ranking list " is matched, so that it may excavate " replenishing water and preserving moisture ", " whitening " the two functional attributes.
It may include the entity word of multiple classifications in the entity library, each entity word has generic and the entity
The corresponding attribute information of word.For some ambiguity entity words, multiple and different classifications can be corresponded to.
Furthermore, it is contemplated that the presence of synonym and alias (for convenience, subsequent to be referred to as synonym), in institute
Stating in entity library can also go back comprising corresponding to the synonym of some entity words or some attribute informations when searching the entity library
It needs simultaneously match to determine the entity word and described inputted in information these synonyms with the input information
The attribute information of entity word.
Step 202, user's current dialogue states are determined.
The dialogue state can be divided into the states such as greeting, inquiry, notice, confirmation, negative, such as can be according to corresponding
Dialogue state classifier determines user's current dialogue states, and the dialogue state classifier can pass through the history for collecting user
Dialogue corpus training obtains, and training process is similar with the conventional training process of classifier, and details are not described herein.
Step 203, system dialog state is updated according to user's current dialogue states.
That is, system dialog state needs are adjusted in real time according to user's current dialogue states, it is current with user
Dialogue state is consistent.
Step 204, revert statement template corresponding with updated system dialog state is obtained.
In practical applications, the revert statement template of corresponding different system dialog states can be set, such as:
Correspondence system dialogue state is that the revert statement template of greeting state can have: " you are good ", " OK recently " etc.;
Correspondence system dialogue state is that the revert statement template of acknowledgement state can have: " good, your XXX has placed an order "
Deng.
Step 205, the attribute information of the entity word and the entity word is filled into the revert statement template, is obtained
To the original revert statement based on the input information.
It should be noted that in need can be filled out in corresponding revert statement template according to the difference of system dialog state
The slot position filled, the slot position that can also be filled without needs, when carrying out information filling, according to the reality of the revert statement template of selection
Depending on border needs.
For example the input information of user is " I wants to buy a cup of Java ", it is determined that the dialogue state of current system is confirmation shape
State, and then it is based on revert statement template " good, your XXX has placed an order ", the entity word " coffee " in the input information is filled out
It is charged to corresponding slot position, generating original revert statement is " good, your coffee has placed an order ".
User input information is " you have seen science fiction sheet multiple-series? " for another example, reality can be matched to according to entity library
Body alias " multiple-series " finds the corresponding entity word of the alias " avenger alliance " and is matched to the attribute " science fiction " of the entity word,
The dialogue state for determining current system is inquiry state, and then " what you said is nearest hot broadcast { film based on revert statement template
Type } film { movie property word }? ", by the entity word " avenger alliance " inputted in information and its attribute information " section
It is unreal " be filled into corresponding slot position respectively, generate original revert statement be " you say be nearest hot broadcast science fiction movies avenger connection
Alliance? ".
In embodiments of the present invention, it needs to incorporate the identity character trait of the affective state of user and user generated above
Original revert statement in, and then obtain the revert statement with identity emotion.It continues with and the process is said referring to Fig.1
It is bright.
Step 103, the affective state of user is determined according to the input information.
Specifically, emotion classifiers trained in advance be can use to determine the affective state of user, i.e., by the input
The emotion classifiers that information input is trained in advance determine the affective state of user according to the output of the emotion classifiers.
It in training emotion classifiers, needs to preset affective style, for example, during the affective style may include:
It is vertical, and it is following any one or more: it is glad, sad, angry, low.
Training data can be collected from the dialog history corpus of user, for example, according to the affective style of setting, from described
The data for different emotions type are collected in the dialog history corpus of user as training data, then utilize the trained number
The emotion classifiers are obtained according to training.The training process class of the training process of the emotion classifiers and conventional classifier
Classifier is trained, details are not described herein.
The emotion classifiers can based on the user's input information respectively give a mark to each affective style, select highest scoring
Affective style as the real-time affective state of user.
Step 104, according to the input information, the affective state of the user and the preparatory user excavated offline
Identity personality portrait information, determines and replys type.
In embodiments of the present invention, the identity personality portrait information of the user is the information for portraying user characteristics,
It can specifically include the tag set for describing user characteristics, further may also include the related information between different labels.
The label can specifically include: character attribute class label, and/or interest class label.Wherein, the character attribute
Class label such as may include: age, gender etc.;The interest class label can be characterized with a series of entity words, such as certain
The interest class label of user includes: " Zhao Liying ", " poplar power ", " Gao Yuanyuan ", " knowing no ", " costume piece ", " palace bucket is acute ", " basket
Ball ", " NBA league matches ", " in library ".
The identity personality portrait information of the user needs offline excavation in advance, for example, can be from the dialog history of user
It is excavated in the information such as corpus and historical behavior data, this will be described in detail later.
In embodiments of the present invention, the input information based on the user, the affective state of the user and the user
Identity personality draw a portrait information, can use in advance trained reply type sorter to determine for user's current input information
Reply type.Specifically, by the identity personality of the input information of the user, the affective state of the user and the user
Type sorter is replied described in portrait information input, the reply type sorter can give a mark respectively to all types of, select score value
The highest reply type for replying type as corresponding user's current input information.
The building process for replying type sorter is similar with the building process of general classification device, and detailed process is as follows:
Type is replied in setting, and the different data for replying type are collected from the dialog history corpus of user as training data;Using institute
It states training data training and obtains the reply type sorter.
In embodiments of the present invention, two or more can be set by the reply type, for example includes: neutrality
Type and any one or more following type: lovely type, adult form, actively optimistic type.
Respective decoration information, such as common modal particle, emoticon etc. can be equipped under each reply type, these can be with
It is determined by artificially collecting screening.For example, preposition modal particle or postposition modal particle have " rattling away ", " stick is rattled away " etc..
Step 105, according to the reply type and the original revert statement, the reply language for having identity emotion is generated
Sentence.
In a kind of implementation, slot position decomposition can be carried out to original revert statement, and for each slot position after decomposing
Corresponding content inquires preset style corpus, finds from style corpus and currently replys type is consistent and each slot
The corresponding corpus content in position, and be the corpus content by the corresponding content modification of the slot position, according to slot position pair each after modification
The content answered generates the revert statement for having identity emotion.The style corpus can store each style class in the form of a label
The corpus of type, such as: movement class-basketball-{ NBA, NBA league matches, court star.}.
Further, decoration information corresponding with the reply type can also be obtained, and the decoration information is added
Into the revert statement with identity emotion.
Such as: the identity portrait information of user includes: " 10~25 years old male ", has many Japanese youth dynamic in interest tags
It is unrestrained, similar " SA is special eugenic ", " guarding sweetie ", " angel in love " etc..Reply input information, use of the type sorter according to user
The reply type " lovely type " that the affective state at family and the identity portrait information of user determine;Original revert statement be " you are good, you
Latte placed an order ", slot position decomposition is carried out to it, obtains the first slot position [address] " you are good ";Based on currently determining reply class
Type is " lovely type ", searches style corpus, and the available address for meeting lovely type can be " small elder brother " etc.;Obtain the wind
Lattice call " small elder brother ", are backfilling into [address] slot position of original revert statement, replace " you are good ";The rest may be inferred for other slot positions.
Finally obtaining based on the modified revert statement with identity emotion of original revert statement may be " small elder brother, your latte
It has placed an order." etc..
It should be noted that when carrying out the replacement of slot position content, since the entity word in original revert statement directly reflects
Topic intention, therefore the content of slot position is not replaced where entity word, such as " latte " in above-mentioned example to guarantee modification after
Revert statement correctness.
In another implementation, it can obtain meeting the current revert statement for replying type based on style statement model,
Have the revert statement of identity emotion.
Wherein, the style statement model can use corpus and the corresponding original reply of each corpus of each stylistic category
Sentence training obtains.
When generating the revert statement for having identity emotion using the style statement model, by the original revert statement
In the corresponding current style statement model for replying type of input, the reply with identity emotion can be obtained according to the output of model
Sentence.
It should be noted that for it is same reply type revert statement template can have it is multiple, it is correspondingly, available
Multiple revert statements with identity emotion.In such a case, it is possible to be beaten based on language model these revert statements
Point, select the revert statement of highest scoring as final revert statement.
Step 106, the output revert statement for having identity emotion.
In practical applications, the revert statement of textual form can be directly exported, can also be led to according to application environment needs
Corresponding speech synthesis system is crossed, the revert statement is converted into voice output, without limitation to this embodiment of the present invention.
As shown in figure 3, be excavated offline in the embodiment of the present invention user identity personality portrait information flow chart, including
Following steps:
Step 301, the dialog history corpus and historical behavior data of user are obtained respectively.
The historical behavior data of user mainly include the inquiry log of user, naturally it is also possible to including be able to reflect user its
Some historical datas of its behavior, such as browsing webpage information, comment information etc., without limitation to this embodiment of the present invention.
It should be noted that the identity of user can be uniquely determined by User ID, User ID is usually tied up with application terminal
It is fixed.Therefore, in practical applications, the dialog history corpus of the user and historical behavior data refer to the corresponding user and remember
Record corpus and data in same terminal.
Step 302, true using attributive classification device trained in advance according to the dialog history corpus and historical behavior data
The character attribute class label of the fixed user.
It should be noted that character attribute can there are many, such as: age, gender etc., to this need in advance training being directed to
The attributive classification device of each particular persons attribute, for example, being directed to the attributive classification device at age, the other attributive classification device of specific aim etc..
When training is directed to the attributive classification device of some character attribute, need to set the classification for being directed to particular persons attribute;
Collect the dialogue corpus and behavioral data of different user;It extracts and corresponds to not from the dialogue corpus and the behavioral data respectively
Generic data are as training data;Obtain corresponding to the attribute point of the particular persons attribute using training data training
Class device.
By taking the attributive classification device for the age as an example, for example the section of age characteristics can be set are as follows: 0~10 years old, 10~
25 years old, 25~40 years old, 40~60 years old, 60 years old or more.When carrying out age of user judgement using the attributive classification device for the age,
Inquiry log based on user then utilizes it is found that relevant content of buying house often occurs buying car or in the query information of the user
For the attributive classification device at age, the age is obtained in the score in 25~40 years old section higher than other sections, therefore may determine that this
The age of user is between 25~40.
Similarly, when carrying out user's Sexual discriminating using the other attributive classification device of specific aim, the inquiry log based on user
It is found that the content relevant to women such as one-piece dress, lipstick often occurs in the query information of the user, then the other category of specific aim is utilized
Property classifier, judges the gender of the user for women.
Step 303, historical behavior information is extracted from the historical behavior data.
The historical behavior information such as can be query word, query statement, comment sentence etc., to this embodiment of the present invention
Without limitation.
Step 304, the entity library pre-established according to the historical behavior information matches, the entity word that matching is obtained are made
For the interest class label of the user.
Historical behavior information based on user carries out Entities Matching by dictionary tree method, the entity word matched is made
For the interest class label of the user, these interest class labels can be used to characterize the hobby feature of user.For example, user
It queried " Zhao Liying knows no online viewing ", " marriage of the peak Zhao Liying Feng Shao ", " Zhao Liying produce surviving of son " etc., known by entity storehouse matching
Not Chu entity word " Zhao Liying ", " Feng Shaofeng ", " knowing no ", use these entity words as the hobby feature of the user, i.e. institute
State interest class label.
It should be noted that in practical applications, can be drawn a portrait according to the difference of application scenarios to the identity personality of user
It is characterized with varigrained label, correspondingly, replying type has different granularities, such as is all lovely type, can also continue to
It is divided into the lovely, maiden's type lovely etc. of child form.In addition, can not only be examined in the identity personality portrait for determining user
Consider the personality of user, and it is also possible to consider the mood of user, viewpoint, the event of concern, age etc., uses such information for more complete
The identity character trait of each user is portrayed to face, the characteristics of so as to preferably characterize each user.
Dialogue generation method provided in an embodiment of the present invention considers not only the dialogue of user's input when talking with generation
Content, and in view of the identity character trait of the real-time affective state of user and user, according to user's current input information, use
The identity personality of the real-time affective state at family and the user excavated offline in advance portrait information, determine and reply type, according to
Original revert statement based on input information is revised as having the revert statement of identity emotion by the type of replying, so as to
For different user input identical information, generate different revert statements, that is to say, that allow generate revert statement because
People and it is different, and keep revert statement more humanized, improve flexibility and vividness with user session, greatly improve user
Experience.
For example, when user input " I wants to buy one glass of hot latte " after, the original revert statement of generation be " you are good, you
Latte has placed an order ".Using the present invention program, determine that replying type is " lovely type ", then is revised as " small brother for original revert statement
Brother is good, your latte has placed an order, bear with~";
For another example the original revert statement of generation is " to adjust when user's input " today is said that mood is bad saturating by leader "
Whole mood once ", since the current affective state of user is low state, determines that replying type is using the present invention program
Original revert statement is then revised as " adjusting mood, refuel parent~" by " actively optimism type ".
As it can be seen that the identical input to different identity user may be implemented, provide different situations type using the present invention program
Reply, the experience of user can be promoted in this way, make its experience dialogue side be more than an ice-cold robot.
It should be noted that the scheme of the embodiment of the present invention can be applied to session operational scenarios, user session experience is promoted.
Further, can also scheme slightly modification to the embodiment of the present invention, be applied to other scenes.For example,
In information recommendation application, it can use the identity personality portrait information of determining user, recommendation information rewritten, makes to change
Recommendation information after writing is more attractive and cordial feeling, to be easier to be easily accepted by a user.For example, user's input content includes
" facial mask ", provide associated recommendation advertisement title be " buy facial mask, with regard to upper Jingdone district, it is preferential the more ".Utilize the present invention program, output
Meet the title of active user's style and features are as follows: " parent recommends a few money popularity facial masks, remolds skin beauty."
Correspondingly, the embodiment of the present invention also provides a kind of dialogue generating means, as shown in figure 4, being a kind of knot of the device
Structure block diagram.
In this embodiment, the dialogue generating means include following module:
Receiving module 401, for receiving user's current input information;The input information can be by voice input
Voice messaging can be the text information inputted by the input methods such as phonetic, hand-written, without limitation to this embodiment of the present invention.
Sentence generation module 402, for generating the original revert statement based on the input information;
Affective state determining module 403, for determining the affective state of user according to the input information;
Determination type module 404 is replied, for according to the affective state of the input information, the user and offline in advance
The identity personality portrait information of the user excavated, determines and replys type;
Sentence modified module 405, for generating and having identity feelings according to the reply type and the original revert statement
The revert statement of sense;
Output module 406 specifically can be according to application environment need for exporting the revert statement for having identity emotion
It wants, directly exports the revert statement of textual form, can also be converted the revert statement by corresponding speech synthesis system
At voice output, without limitation to this embodiment of the present invention.
In embodiments of the present invention, the original revert statement can be generated using the prior art.In addition, the present invention is implemented
Example also provides a kind of specific structure of sentence generation module, as shown in figure 5, including following each unit:
Information identificating unit 421, for identifying the entity word in the input information using the entity library pre-established
With the attribute information of the entity word;
Dialogue state determination unit 422, for determining user's current dialogue states;
State updating unit 423, for updating system dialog state according to user's current dialogue states;Namely
It says, needs to keep system dialog state consistent with user's current dialogue states in real time;
Template acquiring unit 424, for obtaining revert statement template corresponding with updated system dialog state;
Fills unit 425, for the attribute information of the entity word and the entity word to be filled into the revert statement
In template, the original revert statement based on the input information is obtained.
The building process in the entity library has been described in detail in embodiment of the present invention method in front, no longer superfluous herein
It states.It may include the entity word of multiple classifications in the entity library, each entity word has generic and the entity word pair
The attribute information answered.For some ambiguity entity words, multiple and different classifications can be corresponded to.Correspondingly, above- mentioned information recognition unit
421, which can use dictionary tree finding algorithm, searches the entity library, identifies entity word included in the input information.
In embodiments of the present invention, the dialogue state can be divided into the states such as greeting, inquiry, notice, confirmation, negative,
For example user's current dialogue states can be determined according to corresponding dialogue state classifier, the dialogue state classifier can be with
Dialog history corpus training by collecting user obtains, and training process is similar with the conventional training process of classifier, herein
It repeats no more.
In practical applications, the revert statement template that corresponding different system dialog states can be set, moreover, according to system
The difference of dialogue state, in corresponding revert statement template can filling in need slot position and also without needing to fill
Slot position.Correspondingly, above-mentioned fills unit 425, can be according to the reality of the revert statement template of selection when carrying out information filling
Depending on needing.
With continued reference to Fig. 4, above-mentioned affective state determining module 403 can use emotion classifiers trained in advance to determine
The affective state of user, i.e., the emotion classifiers trained the input information input in advance, according to the emotion classifiers
Export the affective state for determining user.
In one implementation, the emotion classifiers can be advanced with by corresponding emotion classifiers training module
Training data training obtains.The emotion classifiers training module can be used as a part of apparatus of the present invention, can also be independent
In the device, without limitation to this present invention.
A kind of specific structure of the emotion classifiers training module may include following each unit:
Affective style setup unit, for setting affective style;The affective style may include: neutrality, and following
Any one or more: it is glad, sad, angry, low etc.;
First training data collector unit is directed to above-mentioned different emotions class for collecting from the dialog history corpus of user
The data of type are as training data;
First training unit, for obtaining the emotion classifiers, specific training process using training data training
It is similar with the conventional training process of classifier, for example trained point using multilayer perceptron MLP classification method commonly used in the trade
Class device, details are not described herein.
The emotion classifiers can based on the user's input information respectively give a mark to each affective style, correspondingly, described
Affective state determining module 403 selects the affective style of highest scoring as the real-time affective state of user.
In embodiments of the present invention, the identity personality portrait information of the user is the information for portraying user characteristics,
It can specifically include the tag set for describing user characteristics, further may also include the related information between different labels.
The label can specifically include: character attribute class label, and/or interest class label.Wherein, the character attribute
Class label such as may include: age, gender etc.;The interest class label can be characterized with a series of entity words.
The identity personality portrait information of the user needs offline excavation in advance, for example, can be by corresponding information excavating
Module is excavated from the information such as the dialog history corpus of user and historical behavior data.Equally, the information excavating module
It can be used as a part of apparatus of the present invention, it can also be independently of the device, without limitation to this present invention.
As shown in fig. 6, being a kind of structural block diagram of information excavating module in the embodiment of the present invention, in this embodiment, institute
Stating information excavating module 600 includes following each unit:
Information acquisition unit 601, for obtaining the dialog history corpus and historical behavior data of the user respectively;
Character attribute class tag determination unit 602, for utilizing according to the dialog history corpus and historical behavior data
Trained attributive classification device determines the character attribute class label of the user in advance;
Behavioural information extraction unit 603, for extracting historical behavior information from the historical behavior data;
Interest class tag determination unit 604, the entity library for being pre-established according to the historical behavior information matches will
Interest class label of the obtained entity word as the user is matched, these interest class labels can be used to characterize the interest of user
Like feature.
Wherein, the historical behavior data of user mainly include the inquiry log of user, naturally it is also possible to including being able to reflect
Some historical datas of the other behaviors of user, such as browsing webpage information, comment information etc..Correspondingly, the historical behavior letter
Breath such as can be query word, query statement, comment sentence etc., without limitation to this embodiment of the present invention.
It is previously noted that the identity personality portrait information of the user may include the tally set for describing user characteristics
It closes, the label can specifically include: character attribute class label, and/or interest class label.Wherein, the character attribute category
Label such as may include: age, gender etc., that is to say, that character attribute can there are many, accordingly, it is desirable in advance train needle
To the attributive classification device of each particular persons attribute, for example, being directed to attributive classification device, the other attributive classification device of specific aim at age
Deng.
The attributive classification device can by corresponding attributive classification device training module by collect different user to language
Material and behavioral data training obtain.Similarly, the attributive classification device training module can be used as a part of apparatus of the present invention,
It can also be independently of the device, without limitation to this present invention.
A kind of specific structure of the attributive classification device training module may include following each unit:
Attribute classification setup unit, for setting the classification for being directed to particular persons attribute;
Second data collection module, for collecting the dialogue corpus and behavioral data of different user;The history of the user
Behavioral data mainly includes the inquiry log of user, naturally it is also possible to some history numbers including being able to reflect the other behaviors of user
According to, such as browsing webpage information, comment information etc., without limitation to this embodiment of the present invention;
Data extracting unit, it is different classes of for extracting correspondence from the dialogue corpus and the behavioral data respectively
Data are as training data;
Second training unit, for obtaining corresponding to the attribute point of the particular persons attribute using training data training
Class device, specific training process is similar with the conventional training process of classifier, for example utilizes multilayer perceptron MLP commonly used in the trade
Classification method trains classifier, and details are not described herein.
It should be noted that in practical applications, can be drawn a portrait according to the difference of application scenarios to the identity personality of user
It is characterized with varigrained label, correspondingly, replying type has different granularities, such as is all lovely type, can also continue to
It is divided into the lovely, maiden's type lovely etc. of child form.In addition, can not only be examined in the identity personality portrait for determining user
Consider the personality of user, and it is also possible to consider the mood of user, viewpoint, the event of concern, age etc., uses such information for more complete
The identity character trait of each user is portrayed to face, the characteristics of so as to preferably characterize each user.
With continued reference to Fig. 4, above-mentioned reply determination type module 404 specifically can be by the input information, the user
The reply classification of type that the identity personality of affective state and the user excavated offline in advance portrait information input are trained in advance
Device determines according to the output for replying type sorter and replys type.
The type sorter of replying can collect the history pair of user by replying type sorter training module accordingly
The training of language material obtains.Similarly, the type sorter training module of replying can be used as a part of apparatus of the present invention,
It can be independently of the device, without limitation to this present invention.
A kind of specific structure for replying type sorter training module may include following each unit:
Type set unit is replied, replys type for setting;It in embodiments of the present invention, can be by the reply type
It is set as two or more, for example includes: neutral type and any one or more following type: lovely type, adult form, product
Blissful sight type etc.;
Third data collection module, for collecting the different data conducts for replying type from the dialog history corpus of user
Training data;
Third training unit, for obtaining the reply type sorter using training data training, specific training
Process is similar with the conventional training process of classifier, for example utilizes multilayer perceptron MLP classification method training commonly used in the trade
Classifier out, details are not described herein.
It should be noted that being designed with respective decoration information under each reply type, such as common modal particle, emoticon
Number etc..
In one implementation, the sentence modified module 405 can be by carrying out slot to the original revert statement
The mode that position is decomposed obtains the revert statement with identity emotion.Correspondingly, one kind of the sentence modified module 405 is specific
Structure may include following each unit:
Slot position decomposition unit obtains each slot position and the slot position for carrying out slot position decomposition to the original revert statement
Corresponding content;
Content modifying unit, for inquiring preset wind for the corresponding content of the affiliated slot position of non-physical word after decomposing
Lattice corpus, obtain and it is described reply type is consistent, corresponding with slot position corpus content, and it is the slot position is corresponding
Content modification is the corpus content;
Content assembled unit, for generating the reply language for having identity emotion according to the corresponding content of slot position each after modification
Sentence.
It is previously noted that respective decoration information can be equipped under each reply type, such as common modal particle, emoticon
Deng, these can by artificially collect screening determine.For example, preposition modal particle or postposition modal particle have " rattling away ", " stick
Rattle away " etc..It correspondingly, not only may include above-mentioned each unit in another specific structure of the sentence modified module 405, also
Can further comprise: modification unit for obtaining decoration information corresponding with the reply type, and the decoration information be added
It is added in the revert statement with identity emotion.
In another implementation, the sentence modified module 405 can use the original revert statement and in advance
Trained style statement model corresponding with the reply type obtains the revert statement with identity emotion.
Wherein, the style statement model can use corpus and the corresponding original reply of each corpus of each stylistic category
Sentence training obtains.
When generating the revert statement for having identity emotion using the style statement model, the sentence modified module
405 correspond to the original revert statement input in the current style statement model for replying type, according to the output of model
Obtain the revert statement with identity emotion.
It should be noted that for it is same reply type revert statement template can have it is multiple, it is correspondingly, available
Multiple revert statements with identity emotion.In such a case, it is possible to be based on by corresponding sentence screening module (not shown)
Language model gives a mark to these revert statements, selects the revert statement of highest scoring as final revert statement.
It should be noted that for above-mentioned each embodiment of dialogue generating means, since each module, the function of unit are real
It is now similar with corresponding method, therefore describe fairly simple to each embodiment of the dialogue generating means, related place can
Referring to the corresponding portion explanation of embodiment of the method.
Dialogue generating means provided in an embodiment of the present invention consider not only the dialogue of user's input when talking with generation
Content, and in view of the identity character trait of the real-time affective state of user and user, according to user's current input information, use
The identity personality of the real-time affective state at family and the user excavated offline in advance portrait information, determine and reply type, according to
Original revert statement based on input information is revised as having the revert statement of identity emotion by the type of replying, so as to
For different user input identical information, generate different revert statements, that is to say, that allow generate revert statement because
People and it is different, and keep revert statement more humanized, improve flexibility and vividness with user session, greatly improve user
Experience.
Fig. 7 is shown according to an exemplary embodiment a kind of for talking with the block diagram of the device 800 of generation method.Example
Such as, device 800 can be mobile phone, computer, digital broadcasting terminal, messaging device, game console, and plate is set
It is standby, Medical Devices, body-building equipment, personal digital assistant etc..
Referring to Fig. 7, device 800 may include following one or more components: processing component 802, memory 804, power supply
Component 806, multimedia component 808, audio component 810, the interface 812 of input/output (I/O), sensor module 814, and
Communication component 816.
The integrated operation of the usual control device 800 of processing component 802, such as with display, telephone call, data communication, phase
Machine operation and record operate associated operation.Processing element 802 may include that one or more processors 820 refer to execute
It enables, to perform all or part of the steps of the methods described above.In addition, processing component 802 may include one or more modules, just
Interaction between processing component 802 and other assemblies.For example, processing component 802 may include multi-media module, it is more to facilitate
Interaction between media component 808 and processing component 802.
Memory 804 is configured as storing various types of other data to support the operation in equipment 800.These data are shown
Example includes the instruction of any application or method for operating on device 800, contact data, and telephone book data disappears
Breath, picture, video etc..Memory 804 can be by the volatibility or non-volatile memory device or their group of any classification
It closes and realizes, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM) is erasable to compile
Journey read-only memory (EPROM), programmable read only memory (PROM), read-only memory (ROM), magnetic memory, flash
Device, disk or CD.
Electric power assembly 806 provides electric power for the various assemblies of device 800.Electric power assembly 806 may include power management system
System, one or more power supplys and other with for device 800 generate, manage, and distribute the associated component of electric power.
Multimedia component 808 includes the screen of one output interface of offer between described device 800 and user.One
In a little embodiments, screen may include liquid crystal display (LCD) and touch panel (TP).If screen includes touch panel, screen
Curtain may be implemented as touch screen, to receive input signal from the user.Touch panel includes one or more touch sensings
Device is to sense the gesture on touch, slide, and touch panel.The touch sensor can not only sense touch or sliding action
Boundary, but also detect duration and pressure associated with the touch or slide operation.In some embodiments, more matchmakers
Body component 808 includes a front camera and/or rear camera.When equipment 800 is in operation mode, such as screening-mode or
When video mode, front camera and/or rear camera can receive external multi-medium data.Each front camera and
Rear camera can be a fixed optical lens system or have focusing and optical zoom capabilities.
Audio component 810 is configured as output and/or input audio signal.For example, audio component 810 includes a Mike
Wind (MIC), when device 800 is in operation mode, when such as call mode, recording mode, and voice recognition mode, microphone is matched
It is set to reception external audio signal.The received audio signal can be further stored in memory 804 or via communication set
Part 816 is sent.In some embodiments, audio component 810 further includes a loudspeaker, is used for output audio signal.
I/O interface 812 provides interface between processing component 802 and peripheral interface module, and above-mentioned peripheral interface module can
To be keyboard, click wheel, button etc..These buttons may include, but are not limited to: home button, volume button, start button and lock
Determine button.
Sensor module 814 includes one or more sensors, and the state for providing various aspects for device 800 is commented
Estimate.For example, sensor module 814 can detecte the state that opens/closes of equipment 800, and the relative positioning of component, for example, it is described
Component is the display and keypad of device 800, and sensor module 814 can be with 800 1 components of detection device 800 or device
Position change, the existence or non-existence that user contacts with device 800,800 orientation of device or acceleration/deceleration and device 800
Temperature change.Sensor module 814 may include proximity sensor, be configured to detect without any physical contact
Presence of nearby objects.Sensor module 814 can also include optical sensor, such as CMOS or ccd image sensor, at
As being used in application.In some embodiments, which can also include acceleration transducer, gyro sensors
Device, Magnetic Sensor, pressure sensor or temperature sensor.
Communication component 816 is configured to facilitate the communication of wired or wireless way between device 800 and other equipment.Device
800 can access the wireless network based on communication standard, such as WiFi, 2G or 3G or their combination.In an exemplary implementation
In example, communication component 816 receives broadcast singal or broadcast related information from external broadcasting management system via broadcast channel.
In one exemplary embodiment, the communication component 816 further includes near-field communication (NFC) module, to promote short range communication.Example
Such as, NFC module can be based on radio frequency identification (RFID) technology, Infrared Data Association (IrDA) technology, ultra wide band (UWB) technology,
Bluetooth (BT) technology and other technologies are realized.
In the exemplary embodiment, device 800 can be believed by one or more application specific integrated circuit (ASIC), number
Number processor (DSP), digital signal processing appts (DSPD), programmable logic device (PLD), field programmable gate array
(FPGA), controller, microcontroller, microprocessor or other electronic components are realized, for executing the above method.
In the exemplary embodiment, a kind of non-transitorycomputer readable storage medium including instruction, example are additionally provided
It such as include the memory 804 of instruction, above-metioned instruction can be completed above-mentioned key by the execution of the processor 820 of device 800, and accidentally touching is entangled
Wrong method.For example, the non-transitorycomputer readable storage medium can be ROM, random access memory (RAM), CD-
ROM, tape, floppy disk and optical data storage devices etc..
The present invention also provides a kind of non-transitorycomputer readable storage mediums, when the instruction in the storage medium is by moving
When the processor of dynamic terminal executes, so that mobile terminal is able to carry out all or part of step in aforementioned present invention embodiment of the method
Suddenly.
Fig. 8 is the structural schematic diagram of server in the embodiment of the present invention.The server 1900 can be different because of configuration or performance
And generate bigger difference, may include one or more central processing units (Central Processing Units,
CPU) 1922 (for example, one or more processors) and memory 1932, one or more storage application programs
1942 or data 1944 storage medium 1930 (such as one or more mass memory units).Wherein, memory 1932
It can be of short duration storage or persistent storage with storage medium 1930.Be stored in storage medium 1930 program may include one or
More than one module (diagram does not mark), each module may include to the series of instructions operation in server.Further
Ground, central processing unit 1922 can be set to communicate with storage medium 1930, and storage medium 1930 is executed on server 1900
In series of instructions operation.
Server 1900 can also include one or more power supplys 1926, one or more wired or wireless nets
Network interface 1950, one or more input/output interfaces 1958, one or more keyboards 1956, and/or, one or
More than one operating system 1941, such as Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM
Etc..
Obviously, embodiment described above only a part of the embodiments of the present invention, instead of all the embodiments.
Based on the embodiments of the present invention, obtained by those of ordinary skill in the art without making creative efforts all
Other embodiments should fall within the scope of the present invention.
It should be noted that description and claims of this specification and term " first " in above-mentioned attached drawing, "
Two " etc. be to be used to distinguish similar objects, without being used to describe a particular order or precedence order.It should be understood that using in this way
Data be interchangeable under appropriate circumstances, so as to the embodiment of the present invention described herein can in addition to illustrating herein or
Sequence other than those of description is implemented.In addition, term " includes " and " having " and their any deformation, it is intended that cover
Cover it is non-exclusive include, for example, the process, method, system, product or equipment for containing a series of steps or units are not necessarily limited to
Step or unit those of is clearly listed, but may include be not clearly listed or for these process, methods, product
Or other step or units that equipment is intrinsic.
Those skilled in the art after considering the specification and implementing the invention disclosed here, will readily occur to of the invention its
Its embodiment.The present invention is directed to cover any variations, uses, or adaptations of the invention, these modifications, purposes or
Person's adaptive change follows general principle of the invention and including the undocumented common knowledge in the art of the disclosure
Or conventional techniques.The description and examples are only to be considered as illustrative, and true scope and spirit of the invention are by following
Claim is pointed out.
It should be understood that the present invention is not limited to the precise structure already described above and shown in the accompanying drawings, and
And various modifications and changes may be made without departing from the scope thereof.The scope of the present invention is limited only by the attached claims.
The foregoing is merely presently preferred embodiments of the present invention, is not intended to limit the invention, it is all in spirit of the invention and
Within principle, any modification, equivalent replacement, improvement and so on be should all be included in the protection scope of the present invention.