Summary of the invention
This specification one or more embodiment describes a kind of conversation message processing method during instant messaging, dress
It sets and equipment, it can be to the question and answer during user session to effectively being identified.
In a first aspect, the conversation message processing method during providing a kind of instant messaging, comprising:
Receive the first conversation message that user inputs in the first session;
Obtain a plurality of dialog history message in first session;
By first conversation message and a plurality of dialog history message input dialogue analytic modell analytical model, described in prediction
The degree of association between the type of message of first conversation message and first conversation message and each dialog history message;
When the type of message is to reply type, it is based on the degree of association, is selected from a plurality of dialog history message
Take out the association messages of first conversation message;
First conversation message and the association messages are associated storage.
Second aspect provides the conversation message processing unit during a kind of instant messaging, comprising:
Receiving unit, the first conversation message inputted in the first session for receiving user;
Acquiring unit, for obtaining a plurality of dialog history message in first session;
Input unit, for obtaining received first conversation message of the receiving unit and the acquiring unit
The a plurality of dialog history message input dialogue analytic modell analytical model, to predict type of message and the institute of first conversation message
State the degree of association between the first conversation message and each dialog history message;
Selection unit, for the degree of association being based on, from a plurality of history when the type of message is to reply type
The association messages of first conversation message are selected in conversation message;
Storage unit, for choose received first conversation message of the receiving unit and the selection unit
The association messages are associated storage.
The third aspect provides the conversation message processing equipment during a kind of instant messaging, comprising:
Memory;
One or more processors;And
One or more programs wherein the storage of one or more of programs is in the memory, and are configured to
It is executed by one or more of processors, described program performs the steps of when being executed by the processor
Receive the first conversation message that user inputs in the first session;
Obtain a plurality of dialog history message in first session;
By first conversation message and a plurality of dialog history message input dialogue analytic modell analytical model, described in prediction
The degree of association between the type of message of first conversation message and first conversation message and each dialog history message;
When the type of message is to reply type, it is based on the degree of association, is selected from a plurality of dialog history message
Take out the association messages of first conversation message;
First conversation message and the association messages are associated storage.
This specification one or more embodiment provide instant messaging during conversation message processing method, device and
Equipment receives the first conversation message that user inputs in the first session.Obtain a plurality of dialog history message in the first session.
By the first conversation message and a plurality of dialog history message input dialogue analytic modell analytical model, to predict the message class of the first conversation message
The degree of association between type and the first conversation message and each dialog history message.When type of message is to reply type, it is based on
The degree of association selects the association messages of the first conversation message from a plurality of dialog history message.By the first conversation message be associated with
Message is associated storage.Namely this illustrates in the scheme provided, can identify user session mistake based on dialogue analytic modell analytical model
Question and answer pair in journey, thus, it is possible to greatly promote question and answer to the efficiency and accuracy of identification.
Specific embodiment
With reference to the accompanying drawing, the scheme provided this specification is described.
Fig. 1 is the conversation message processing method application scenarios schematic diagram during the instant messaging that this specification provides.Fig. 1
In, it is assumed that client A, client B and customer service C (hereafter referred to collectively as user) can be based on certain instant message applications and (e.g., follow closely, is micro-
Letter, Ali Wang Wang etc.) establish corresponding session, and it is each with per family Instant Messenger can be inputted in the session of respective terminal loads
Message is interrogated, to realize the dialogue between each user.In being described below of this specification, user is inputted in a session instant
Communication message is known as the conversation message between user.In the present specification, the conversation message each user inputted in a session point
For three types: puing question to type, reply type and other types.
In Fig. 1, during each user is engaged in the dialogue based on above-mentioned session, server can disappear from the dialogue of each user
The message (referred to as replying message) for replying type is identified in breath.Further, it is also possible to identify with it is above-mentioned reply message it is associated
Enquirement type message (referred to as put question to message), and storage is associated with message is putd question to replying message, to be convenient to visitor
C is taken again to reply above-mentioned enquirement message.The specific identification process of the server can be found in the processing of subsequent dialog message
The description of method.
Fig. 2 is the conversation message processing method flow chart during the instant messaging that this specification one embodiment provides.
The executing subject of the method can be the equipment with processing capacity: server or system or device, can be figure e.g.
Server etc. in 1.As shown in Fig. 2, the method can specifically include:
Step 202, the first conversation message that user inputs in the first session is received.
Here the first session can be is established based on two or more users.It is to be established in Fig. 1 with the first session
Session for for, the first conversation message can be by any user (e.g., client A, client B or customer service C etc.) In in Fig. 1
It is inputted in the session of corresponding terminal load.
Step 204, a plurality of dialog history message in the first session is obtained.
Here dialog history message can refer to transmitted conversation message before the first conversation message.This specification
The a plurality of dialog history message can be by any of Fig. 1 or multiple users transmission.It in one example, can be with
It is 10 nearest dialog history message of the sending time of acquisition the first conversation message of distance.
Step 206, by the first conversation message and a plurality of dialog history message input dialogue analytic modell analytical model, to predict first
The degree of association between the type of message of conversation message and the first conversation message and each dialog history message.
Dialogue analytic modell analytical model described in this specification may include bottom-layer network part and upper layer network part, upper layer network
Part may include again the first top section and the second top section.Under this kind of model structure, above-mentioned type of message can lead to
Bottom-layer network part and the prediction of the first top section are crossed, the above-mentioned degree of association can pass through bottom-layer network part and the second top section
Prediction.
In one example, above-mentioned bottom-layer network part may include term vector (Embedding) layer and deep learning net
Network layers.Here deep learning network can be two-way shot and long term memory network (Bi-directional Long Short-
Term Memory, BiLSTM), or LSTM-CRF etc..In addition, above-mentioned first top section may include Softmax
Layer, the second top section include at least full articulamentum.Certainly, in practical applications, the second top section can also include cos layers
(for calculating the cosine similarity between message).
In addition, the degree of association described in this specification can include but is not limited to cosine similarity, Euclidean distance and graceful Kazakhstan
Distance etc..In the following description, it is illustrated by cosine similarity of the degree of association.
It is each in model after the first conversation message and a plurality of dialog history message input dialogue analytic modell analytical model in step 206
The subsequent explanation of the processing operation of layer network part.
Step 208, when type of message is to reply type, it is based on the degree of association, is selected from a plurality of dialog history message
The association messages of first conversation message.
Such as, the highest dialog history message of the degree of association can be selected from a plurality of dialog history message as the first dialogue
The association messages of message.It is understood that association messages refer to the enquirement message namely the association of the first conversation message here
The type of message of message is to put question to type.
Step 210, the first conversation message and association messages are associated storage.
Here it is possible to be closed using the first conversation message and association messages as the answer of question and answer centering and problem
Connection storage.Question and answer after associated storage are to for assisting customer service in group chat or robot to the solution of same or similar problem
It answers.
Above-mentioned supporting process is illustrated below in conjunction with Fig. 1.In Fig. 1, it is assumed that user A has putd question to problem x, in customer service C
After making answer for this problem, it is assumed that customer service C gives answer y.The method so provided based on this specification, Ke Yiguan
Connection stores following question and answer pair: problem x and answer y.Later, when user B is putd question to again, above problem x's or problem x is similar
When problem, customer service C or robot can be based on pre-stored question and answer pair: problem x and answer y is directly replied, thus
Problem can be greatly promoted and reply efficiency.
To sum up, this specification embodiment provide instant messaging during conversation message processing method, can based on pair
Analytic modell analytical model is talked about, to identify the type of message and association messages of conversation message, thus, it is possible to greatly promote question and answer to identification
Accuracy rate and coverage rate.
It is to be solved to the overall description based on dialogue analytic modell analytical model to the treatment process of conversation message below in conjunction with dialogue above
The structure of analysis model is described further the treatment process of conversation message.
Fig. 3 is the dialogue analytic modell analytical model schematic diagram that this specification provides.In Fig. 3, for the first conversation message and a plurality of
Dialog history message can first carry out word segmentation processing respectively.Later, by after word segmentation processing the first conversation message and each item go through
History conversation message inputs bottom-layer network part.Embedding layer in bottom-layer network part, can by the first conversation message and
The corresponding participle of each dialog history message is converted to term vector sequence.BiLSTM layer in bottom-layer network part, can will be upper
It states the term vector sequence being converted to and is further encoded to a vector.Later, the sentence vector that coding can be obtained inputs upper layer
Network portion.
Specifically, sentence vector corresponding with the first conversation message can be inputted into Softmax layers and full articulamentum 1 respectively,
Sentence vector corresponding with each dialog history message is inputted into full articulamentum 2.At Softmax layers, can be obtained based on coding
Sentence vector, calculates the probability value that above-mentioned first conversation message belongs to default classification, and determines the based on the probability value being calculated
Classification belonging to one conversation message.Here default classification can refer to that the type of message of conversation message is e.g. putd question to type, replied
Type and other types etc..In full articulamentum 1 and full articulamentum 2, further calculating can be executed to the sentence vector of input,
With by the sentence DUAL PROBLEMS OF VECTOR MAPPING of two full articulamentums to the same space.It later, can be based on being mapped to the same space at cos layers
Sentence vector, further calculates the cosine similarity between the first conversation message and each dialog history message.
The output for the dialogue analytic modell analytical model that this specification provides it can be seen from above content may include two parts:
First part, the type of message of the first conversation message;Second part, between the first conversation message and each dialog history message
Cosine similarity.
It should be noted that predicting type of message and cosine similarity using it for above-mentioned dialogue analytic modell analytical model
Before, first it can be trained, namely each layer network part therein is trained.Its specific training process can be as
Shown in Fig. 4.In Fig. 4, which be may include steps of:
Step 402, first sample set is collected, the sample which concentrates includes sample dialogue message and the first mark
Label value.
Here the first label value indicates the type of message of above-mentioned sample dialogue message.
In one example, above-mentioned sample dialogue message can be to choose from preconfigured knowledge base and obtain.This is known
Knowing record in library has multiple question and answer pair, which forms to by title and answer.Specifically, the title of question and answer centering can be selected
It is taken as above-mentioned sample dialogue message, and its corresponding first label value is set are as follows: puts question to type.It can also be by question and answer centering
Answer is chosen for above-mentioned sample dialogue message, and its corresponding first label value is set are as follows: replys type.
In another example, the recognition result that above-mentioned sample dialogue message is also possible to the rule based on artificial settings obtains
It arrives.Specifically, the user that the question sentence template based on artificial settings is identified can be putd question to and is chosen for sample dialogue message, and will
Its corresponding first label value setting are as follows: put question to type.Further, it is also possible to which the reference message that the user puts question to is chosen for sample
Conversation message, and its corresponding first label value is set are as follows: reply type.
Step 404, collect the second sample set, second sample set include first sample message, the second sample message and
Second label value.First sample message is to reply the message of type, and the second sample message is the message for puing question to type.
Here the degree of association of the second label value instruction the second sample message and first sample message.Here first sample
Message can put question to for the user that the question sentence template based on artificial settings is identified.Above-mentioned second sample message may include two
Kind, wherein one kind can put question to referenced message to determine based on above-mentioned user;Another kind can be putd question to not based on above-mentioned user
Referenced conversation message determines.When the message that the second sample message is crossed based on first sample message reference determines, above-mentioned pass
Connection degree can be to indicate that the second label value is the first numerical value of positive example label, e.g., 1.When the second sample message is based on first sample
When the message of the unreferenced mistake of message determines, the above-mentioned degree of association can be negative the second value of a label for the second label value of instruction,
Such as, 0.
In the present specification, a kind of above-mentioned second sample message is referred to as positive sample, above-mentioned another second sample
Message is referred to as negative sample.
Step 406, using first sample set and second sample set, alternately analytic modell analytical model is talked in training.
Here alternating training detailed process is specifically as follows: using first sample set, training bottom-layer network part and the
One top section.Using the second sample set, training bottom-layer network part and the second top section.
It can thus be seen that bottom-layer network part is based on first sample set and the second sample in this specification embodiment
What this collection was trained jointly, it thus can not only reduce individualized training and concentrate the quantity of sample, but also model training can be greatly promoted
Accuracy.
It is described in detail below in conjunction with training process of the Fig. 5 to bottom-layer network part and the second top section.
Fig. 5 is the training process schematic diagram of bottom-layer network part and the second top section that this specification provides.In Fig. 5,
First sample message and three the second sample messages can be inputted to bottom-layer network part, wherein second sample message
For positive sample, other two second sample message is negative sample.It should be noted that first sample message is being passed through
After the processing (concrete processing procedure is as described above) of Embedding layers, BiLSTM layers and full articulamentum 1, acquired sentence
Vector can be input to cos layers.Second sample message is in the processing for passing through Embedding layers, BiLSTM layers and full articulamentum 2
Later, obtained sentence vector can also be input to cos layers.Later, it at cos layers, can be based on being each mapped to same space
Sentence vector, the cosine similarity between first sample message and three the second sample messages is calculated, to obtain three cosine phases
Like degree.After obtaining three cosine similarities, preset three the second label values can be based on, determine prediction error, and
Bottom-layer network part and the second top section are updated based on the prediction error.Here the number of the second label value is based on
The number of second sample message determines.
It is understood that Fig. 5 illustrates only a training process of bottom-layer network part and the second top section, In
In practical application, which is that iteration executes.
In addition, Fig. 5 is a kind of exemplary illustration, in practical applications, multiple groups sample can be inputted, wherein every group of sample
This includes a first sample message and multiple second sample messages.Multiple second sample messages can simultaneously comprising positive sample and
Negative sample.
Finally, it is to be noted that, can also first be based on general corpus, training before executing above-mentioned training operation
The Embedding layer of bottom-layer network part, namely Embedding layers of pre-training step is first carried out, this specification does not make this
It limits.
To sum up, the model training method that this specification provides, can be based on less sample, and training is accurately talked with
Analytic modell analytical model.In addition, this specification based on dialogue analytic modell analytical model conversation message is handled when, can be based on the anti-of user
Feedback is adjusted dialogue analytic modell analytical model, has achieved the purpose that function and data closed loop as a result, and then can make Product Experience
Obtain Continuous optimization.
Accordingly with the conversation message processing method during above-mentioned instant messaging, this specification one embodiment also provides
A kind of instant messaging during conversation message processing unit, as shown in fig. 6, the apparatus may include:
Receiving unit 602, the first conversation message inputted in the first session for receiving user.
Acquiring unit 604, for obtaining a plurality of dialog history message in the first session.
Input unit 606, for obtain received first conversation message of receiving unit 602 and acquiring unit 604
A plurality of dialog history message input dialogue analytic modell analytical model, to predict the type of message and the first conversation message of the first conversation message
With the degree of association between each dialog history message.
Here dialogue analytic modell analytical model may include bottom-layer network part and upper layer network part, and upper layer network part can be with
Including the first top section and the second top section.Above-mentioned type of message can pass through bottom-layer network part and the first top section
Prediction.The above-mentioned degree of association can be predicted by bottom-layer network part and the second top section.
Above-mentioned bottom-layer network part may include Embedding layers and deep learning network layer.Wherein, deep learning network
It may include following any: two-way shot and long term memory network BiLSTM and LSTM-CRF.Above-mentioned first top section can be with
Including Softmax layers, above-mentioned second top section includes at least full articulamentum.
In addition, the above-mentioned degree of association may include following any: cosine similarity, Euclidean distance and manhatton distance.
Selection unit 608, for the degree of association being based on, from a plurality of dialog history message when type of message is to reply type
In select the association messages of the first conversation message.
Storage unit 610, the pass for choosing received first conversation message of receiving unit 602 and selection unit 608
Connection message is associated storage.
Optionally, which can also include:
Training unit 612, for collecting first sample set.The sample that the first sample is concentrated include sample dialogue message with
And first label value.The type of message of first label value instruction sample dialogue message.The type of message, which includes at least, puts question to type
With reply type.
Collect the second sample set.Second sample set includes first sample message, the second sample message and the second label
Value, first sample message are to reply the message of type.Second sample message is the message for puing question to type.Second label value refers to
Show the degree of association of the second sample message Yu first sample message.
Using first sample set and the second sample set, alternately analytic modell analytical model is talked in training.
Training unit 612 specifically can be used for: use first sample set, training bottom-layer network part and the first upper layer part
Point.Using the second sample set, training bottom-layer network part and the second top section.
Optionally, when the message that the second sample message is crossed based on first sample message reference determines, the above-mentioned degree of association can
Think that the second label value of instruction is the first numerical value of positive example label.When the second sample message is based on the unreferenced mistake of first sample message
Message when determining, the above-mentioned degree of association is to indicate that the second label value is negative the second value of a label.
The function of each functional module of this specification above-described embodiment device can pass through each step of above method embodiment
Rapid to realize, therefore, the specific work process for the device that this specification one embodiment provides does not repeat again herein.
Conversation message processing unit during the instant messaging that this specification one embodiment provides, receiving unit 602
Receive the first conversation message that user inputs in the first session.Acquiring unit 604 obtains a plurality of history pair in the first session
Talk about message.Input unit 606 is by the first conversation message and a plurality of dialog history message input dialogue analytic modell analytical model, to predict
The degree of association between the type of message of one conversation message and the first conversation message and each dialog history message.Work as type of message
When to reply type, selection unit 608 is based on the degree of association, and the pass of the first conversation message is selected from a plurality of dialog history message
Join message.First conversation message and association messages are associated storage by storage unit 610.Thus, it is possible to greatly promote question and answer
To the efficiency and accuracy of identification.
Conversation message processing unit during the instant messaging that this specification one embodiment provides can be to take in Fig. 1
A module or unit for business device.
Accordingly with the conversation message processing method during above-mentioned instant messaging, this specification one embodiment also provides
A kind of instant messaging during conversation message processing equipment, as shown in fig. 7, the equipment may include: that the equipment can wrap
It includes: memory 702, one or more processors 704 and one or more programs.Wherein, which stores
In memory 702, and it is configured to be executed by one or more processors 704, it is real when which is executed by processor 704
Existing following steps:
Receive the first conversation message that user inputs in the first session.
Obtain a plurality of dialog history message in the first session.
By the first conversation message and a plurality of dialog history message input dialogue analytic modell analytical model, to predict the first conversation message
Type of message and the first conversation message and each dialog history message between the degree of association.
When type of message is to reply type, it is based on the degree of association, selects the first dialogue from a plurality of dialog history message
The association messages of message.
First conversation message and association messages are associated storage.
Conversation message processing equipment during the instant messaging that this specification one embodiment provides, can greatly promote
Efficiency and accuracy of the question and answer to identification.
All the embodiments in this specification are described in a progressive manner, same and similar portion between each embodiment
Dividing may refer to each other, and each embodiment focuses on the differences from other embodiments.Especially for equipment reality
For applying example, since it is substantially similar to the method embodiment, so being described relatively simple, related place is referring to embodiment of the method
Part explanation.
The step of method in conjunction with described in this disclosure content or algorithm can realize in a manner of hardware,
It can be and the mode of software instruction is executed by processor to realize.Software instruction can be made of corresponding software module, software
Module can be stored on RAM memory, flash memory, ROM memory, eprom memory, eeprom memory, register, hard
Disk, mobile hard disk, CD-ROM or any other form well known in the art storage medium in.A kind of illustrative storage Jie
Matter is coupled to processor, to enable a processor to from the read information, and information can be written to the storage medium.
Certainly, storage medium is also possible to the component part of processor.Pocessor and storage media can be located in ASIC.In addition, should
ASIC can be located in server.Certainly, pocessor and storage media can also be used as discrete assembly and be present in server.
Those skilled in the art are it will be appreciated that in said one or multiple examples, function described in the invention
It can be realized with hardware, software, firmware or their any combination.It when implemented in software, can be by these functions
Storage in computer-readable medium or as on computer-readable medium one or more instructions or code transmitted.
Computer-readable medium includes computer storage media and communication media, and wherein communication media includes convenient for from a place to another
Any medium of one place transmission computer program.Storage medium can be general or specialized computer can access it is any
Usable medium.
It is above-mentioned that this specification specific embodiment is described.Other embodiments are in the scope of the appended claims
It is interior.In some cases, the movement recorded in detail in the claims or step can be come according to the sequence being different from embodiment
It executes and desired result still may be implemented.In addition, process depicted in the drawing not necessarily require show it is specific suitable
Sequence or consecutive order are just able to achieve desired result.In some embodiments, multitasking and parallel processing be also can
With or may be advantageous.
Above-described specific embodiment has carried out into one the purpose of this specification, technical scheme and beneficial effects
Step is described in detail, it should be understood that being not used to limit this foregoing is merely the specific embodiment of this specification
The protection scope of specification, all any modifications on the basis of the technical solution of this specification, made, change equivalent replacement
Into etc., it should all include within the protection scope of this specification.