CN109830231B - Session processing method, device and storage medium - Google Patents
Session processing method, device and storage medium Download PDFInfo
- Publication number
- CN109830231B CN109830231B CN201811543826.7A CN201811543826A CN109830231B CN 109830231 B CN109830231 B CN 109830231B CN 201811543826 A CN201811543826 A CN 201811543826A CN 109830231 B CN109830231 B CN 109830231B
- Authority
- CN
- China
- Prior art keywords
- message
- expression
- current
- supplemented
- conversation message
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Images
Landscapes
- Machine Translation (AREA)
Abstract
The invention provides a session processing method, a session processing device and a storage medium, wherein the method comprises the following steps: if the present conversation message has the expression, acquiring the content to be supplemented of the present conversation message; supplementing the content to be supplemented of the current session message according to the historical session message, wherein the historical session message is a message with complete semantics; acquiring a response message of the current session message according to the complete semantic meaning of the current session message; and playing the response message. The invention supplements the contents to be supplemented in the current session message with reference expression through the historical session message, so that the semantics of the current session message is complete, and further the response message is returned to the user.
Description
Technical Field
The present invention relates to the field of voice interaction technologies, and in particular, to a session processing method, device and storage medium.
Background
With the rapid development of Artificial Intelligence (AI), more and more products and applications such as current intelligent customer service, intelligent assistant, vehicle navigation, and smart home introduce an interactive man-machine interaction mode. In the man-machine single-round interactive question answering, a plurality of single-round interactive templates are usually identified, and when the obtained questions of the user are the questions in the identified templates, the intentions of the user are obtained in a structured extraction mode; if the identified template is 'railway ticket from A place to B place', when the question of the user is 'help me to inquire the railway ticket from Beijing to Xian', the question accords with the identified template, the intention of the user in the question is extracted as 'inquiring the railway ticket', and the intention attribute is 'Beijing at the place of departure, Xian at the destination'.
In the prior art, a mode of labeling templates is used for realizing multi-round interactive question answering, a large number of templates need to be labeled in advance, the labeling difficulty of data is increased, meanwhile, a large number of data are often needed to achieve the effect, and meanwhile, labeled data can be applicable to a certain field and have poor migration capability. In multi-turn interactive question answering, a user establishes a corresponding context while asking questions, and the following questions in the context are often referred and omitted, so that the problem of single question semantic missing is caused, and a great deal of trouble is brought to retrieval.
Disclosure of Invention
The invention provides a session processing method, a session processing device and a storage medium, which solve the problem of large workload of pre-labeling in the prior art and are suitable for all technical fields.
A first aspect of the present invention provides a session processing method, including:
if the present conversation message has the expression, acquiring the content to be supplemented of the present conversation message;
supplementing the content to be supplemented of the current session message according to a historical session message, wherein the historical session message is a message with complete semantics;
acquiring a response message of the current session message according to the complete semantic meaning of the current session message;
and playing the response message.
Optionally, if the present session message has the reference expression, acquiring the content to be supplemented of the present session message, including:
if the current conversation message contains a preset meaning word, the preset meaning word in the current conversation message is the content to be supplemented;
the supplementing the content to be supplemented of the current session message according to the historical session message comprises the following steps:
determining a representative expression corresponding to the preset representative word in the historical conversation message according to the semantic meaning of the historical conversation message;
and replacing the preset pronouns in the current conversation message with the pronouns corresponding to the preset pronouns.
Optionally, if the present session message has the reference expression, acquiring the content to be supplemented of the present session message, including:
if the sentence pattern of the current conversation message belongs to a first preset sentence pattern, the common-finger referring word in the current conversation message is the content to be supplemented, the first preset sentence pattern is a sentence pattern with the common-finger referring word, and the common-finger referring word is used for representing that the expression with the semantic similarity of the common-finger referring word being greater than the similarity threshold exists in the historical conversation message;
the supplementing the content to be supplemented of the current session message according to the historical session message comprises the following steps:
performing word segmentation on the historical conversation message to obtain a plurality of first candidate expressions corresponding to the historical conversation message;
acquiring a first semantic similarity of each first candidate expression and the common finger referring words;
and if the maximum value of the first semantic similarity is greater than the similarity threshold value, replacing the common finger word with a first candidate expression corresponding to the maximum value of the first semantic similarity.
Optionally, if the present session message has the reference expression, acquiring the content to be supplemented of the present session message, including:
extracting the central expression of the historical conversation message according to the sentence pattern structure of the historical conversation message;
acquiring a second semantic similarity of the center expression and the current conversation message according to the center expression, the current conversation message and a preset corresponding relation of the semantic similarity of the center expression and the sample conversation message;
if the second semantic similarity is greater than a similarity threshold, a common-finger expression exists in the current session message, and the common-finger word in the current session message is the content to be supplemented;
the supplementing the content to be supplemented of the current session message according to the historical session message comprises the following steps:
replacing the common reference word in the current conversation message with the center expression.
Optionally, if the present session message has the reference expression, acquiring the content to be supplemented of the present session message, including:
if the sentence pattern of the current conversation message belongs to a second preset sentence pattern, the gap where the center expression in the current conversation message is located is the content to be supplemented, the second preset sentence pattern is a sentence pattern with zero reference, and the zero reference is used for representing that the center expression is omitted in the current conversation message;
the supplementing the content to be supplemented of the current session message according to the historical session message comprises the following steps:
extracting the central expression of the historical conversation message according to the sentence pattern structure of the historical conversation message;
filling the gap of the center expression in the current conversation message with the center expression of the historical conversation message.
Optionally, if the present session message has the reference expression, acquiring the content to be supplemented of the present session message, including:
acquiring the probability that a new word can be inserted between any two adjacent words in the current conversation message according to the current conversation message and a preset zero-reference model, wherein the preset zero-reference model is acquired by training the probability that a new word can be inserted between any two words in the sample conversation message and the sample conversation message;
if the first probability is greater than a probability threshold value, determining that zero-reference expression exists in the current conversation message, and taking a gap between two terms corresponding to the first probability as the content to be supplemented, wherein the first probability is the probability of inserting a new term between any two adjacent terms in the current conversation message;
the supplementing the content to be supplemented of the current session message according to the historical session message comprises the following steps:
extracting the central expression of the historical conversation message according to the sentence pattern structure of the historical conversation message;
filling the gap between the two words corresponding to the first probability with the center expression.
Optionally, the method further includes:
performing word segmentation on the current conversation message and the historical conversation message to obtain a plurality of corresponding first candidate expressions in the historical conversation message and a plurality of corresponding second candidate expressions in the current conversation message;
if a first candidate expression with the same semantic meaning as any second candidate expression exists in the plurality of first candidate expressions, replacing the corresponding second candidate expression with the first candidate expression with the same semantic meaning as the second candidate expression;
the obtaining of the response message of the current session message includes:
acquiring the complete semantic meaning of the replaced historical conversation message, and taking the complete semantic meaning of the replaced historical conversation message as the complete semantic meaning of the current conversation message;
and acquiring the response message of the current session message according to the complete semantic meaning of the current session message.
Optionally, after the content to be supplemented of the current session message is supplemented according to the historical session message, the method further includes:
if a plurality of supplemented current session messages exist, obtaining the semantics of each supplemented current session message;
obtaining the confidence level, the fluency, the confidence weight and the fluency weight of the semantics of each supplemented current conversation message according to the semantics of each supplemented current conversation message and the corresponding relationship between the semantics of the sample conversation message and the confidence level, the fluency, the confidence weight and the fluency weight;
obtaining the score of the semantics of each supplemented current session message according to the confidence, the fluency, the confidence weight and the fluency weight of the semantics of each supplemented current session message;
and taking the semanteme of the supplemented current session message corresponding to the highest score as the complete semanteme of the current session message.
A second aspect of the present invention provides a session processing apparatus including:
the module for obtaining the content to be supplemented is used for obtaining the content to be supplemented of the current conversation message if the reference expression exists in the current conversation message;
the supplement module is used for supplementing the content to be supplemented of the current session message according to a historical session message, wherein the historical session message is a message with complete semantics;
a response message obtaining module, configured to obtain a response message of the current session message according to a complete semantic meaning of the current session message;
and the playing module is used for playing the response message.
Optionally, the module for acquiring content to be supplemented is specifically configured to, if the current session message includes a preset pronoun, determine that the preset pronoun in the current session message is the content to be supplemented.
Optionally, the supplementary module is specifically configured to determine, according to the semantics of the historical conversation message, a representative expression corresponding to the preset representative word in the historical conversation message; and replacing the preset pronouns in the current conversation message with the pronouns corresponding to the preset pronouns.
Optionally, the content to be supplemented obtaining module is specifically configured to, if the sentence pattern of the current conversation message belongs to a first preset sentence pattern, use a common reference word in the current conversation message as the content to be supplemented, where the first preset sentence pattern is a sentence pattern in which a common reference word exists, and the common reference word is used to represent that an expression exists in the history conversation message, where semantic similarity between the common reference word and the common reference word is greater than a similarity threshold;
optionally, the supplementary module is specifically configured to perform word segmentation on the historical conversation message, and obtain a plurality of first candidate expressions corresponding to the historical conversation message; acquiring a first semantic similarity of each first candidate expression and the common finger referring words; and if the maximum value of the first semantic similarity is greater than the similarity threshold value, replacing the common finger word with a first candidate expression corresponding to the maximum value of the first semantic similarity.
Optionally, the module for acquiring content to be supplemented is specifically configured to extract a central expression of the historical conversation message according to a sentence structure of the historical conversation message; acquiring a second semantic similarity of the center expression and the current conversation message according to the center expression, the current conversation message and a preset corresponding relation of the semantic similarity of the center expression and the sample conversation message; if the second semantic similarity is greater than a similarity threshold, a common-finger expression exists in the current session message, and the common-finger word in the current session message is the content to be supplemented;
optionally, the supplementary module is specifically configured to replace the common reference word in the current session message with the center expression.
Optionally, the content to be supplemented obtaining module is specifically configured to, if the sentence pattern of the current session message belongs to a second preset sentence pattern, determine that a gap where a center expression in the current session message is located is the content to be supplemented, where the second preset sentence pattern is a sentence pattern with a zero reference, where the zero reference is used to characterize that the center expression is omitted in the current session message;
optionally, the supplementary module is specifically configured to extract a central expression of the historical conversation message according to a sentence pattern structure of the historical conversation message; filling the gap of the center expression in the current conversation message with the center expression of the historical conversation message.
Optionally, the module for acquiring content to be supplemented is specifically configured to acquire, according to the current conversation message and a preset zero-reference model, a probability that a new word can be inserted between any two adjacent words in the current conversation message, where the preset zero-reference model is acquired by training a sample conversation message and a probability that a new word can be inserted between any two words in the sample conversation message; if the first probability is greater than a probability threshold value, determining that zero-reference expression exists in the current conversation message, and taking a gap between two terms corresponding to the first probability as the content to be supplemented, wherein the first probability is the probability of inserting a new term between any two adjacent terms in the current conversation message;
optionally, the supplementary module is specifically configured to extract a central expression of the historical conversation message according to a sentence pattern structure of the historical conversation message; filling the gap between the two words corresponding to the first probability with the center expression.
Optionally, the apparatus further comprises: a candidate expression acquisition module;
the candidate expression obtaining module is configured to perform word segmentation on the current conversation message and the historical conversation message, and obtain a plurality of corresponding first candidate expressions in the historical conversation message and a plurality of corresponding second candidate expressions in the current conversation message.
Optionally, the apparatus further comprises: a replacement module;
the replacing module is configured to, if there is a first candidate expression having the same semantic meaning as any one of the second candidate expressions in the plurality of first candidate expressions, replace a corresponding second candidate expression with the first candidate expression having the same semantic meaning as the second candidate expression;
optionally, the response message acquiring module is specifically configured to acquire the complete semantic meaning of the replaced historical session message, and use the complete semantic meaning of the replaced historical session message as the complete semantic meaning of the current session message; and acquiring the response message of the current session message according to the complete semantic meaning of the current session message.
Optionally, the apparatus further comprises: a score acquisition module;
the score acquisition module is used for acquiring the semantics of each supplemented current session message if a plurality of supplemented current session messages exist; obtaining the confidence level, the fluency, the confidence weight and the fluency weight of the semantics of each supplemented current conversation message according to the semantics of each supplemented current conversation message and the corresponding relationship between the semantics of the sample conversation message and the confidence level, the fluency, the confidence weight and the fluency weight; obtaining the score of the semantics of each supplemented current session message according to the confidence, the fluency, the confidence weight and the fluency weight of the semantics of each supplemented current session message; and taking the semanteme of the supplemented current session message corresponding to the highest score as the complete semanteme of the current session message.
A third aspect of the present invention provides a session processing apparatus, including: at least one processor and memory;
the memory stores computer-executable instructions;
the at least one processor executes the computer-executable instructions stored by the memory to cause the session processing apparatus to perform the session processing method described above.
A fourth aspect of the present invention provides a computer-readable storage medium having stored thereon computer-executable instructions that, when executed by a processor, implement the above-described session processing method.
The invention provides a session processing method, a session processing device and a storage medium, wherein the method comprises the following steps: if the present conversation message has the expression, acquiring the content to be supplemented of the present conversation message; supplementing the content to be supplemented of the current session message according to the historical session message, wherein the historical session message is a message with complete semantics; acquiring a response message of the current session message according to the complete semantic meaning of the current session message; and playing the response message. The invention supplements the contents to be supplemented in the current session message with reference expression through the historical session message, so that the semantics of the current session message is complete, and further the response message is returned to the user.
Drawings
Fig. 1 is a first schematic flow chart of a session processing method provided by the present invention;
FIG. 2 is a flow chart illustrating a conversation processing method corresponding to the pronouns representation according to the present invention;
FIG. 3 is a first flowchart illustrating a session processing method corresponding to a common reference expression according to the present invention;
FIG. 4 is a second flowchart illustrating a session processing method corresponding to the common reference representation according to the present invention;
fig. 5 is a first flowchart illustrating a session processing method corresponding to zero-reference expression according to the present invention;
FIG. 6 is a second flowchart illustrating a session processing method corresponding to zero-reference expression according to the present invention;
fig. 7 is a flowchart illustrating a second session processing method according to the present invention;
FIG. 8 is a flowchart illustrating a session processing method according to the present invention, in which a plurality of supplemented current session messages exist;
FIG. 9 is a first schematic structural diagram of a session processing apparatus according to the present invention;
FIG. 10 is a second schematic structural diagram of a session processing apparatus according to the present invention;
fig. 11 is a schematic structural diagram of a session processing apparatus provided in the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The term of the present invention is defined as:
pronouns refer to: pronouns are used to refer to words or expressions in conversational messages, and the commonly used pronouns are: this, that, first, preceding, intermediate, etc.
Exemplary, such as "recommend 30-tuple 2GB traffic package, 50-tuple 3GB traffic package, 100-tuple 10GB traffic package for you, which one you want to do? "," when the first transaction is in effect? "where the pronoun" first "refers to a" 30-tuple 2GB traffic packet ".
Collectively refer to: different words or sentences are expressed to refer to the same object; common referents include: conventions are referred to by pronouns, terms, or abbreviations.
Illustratively, as noted in the beginning of a document, "Beijing university," in which the common reference may refer to words such as "Beijing", "this university", "her", and the like.
Zero refers to: the same object is not expressed by a specific pronoun in the conversation message, but the semantic meaning of the conversation message refers to the same object.
The following are exemplary: "recommend this washing machine for you", "how to use, no pronouns appear in the second session message, but the semantic of the session message means" how to use this washing machine? ".
With the rapid development of intelligent terminals, more and more products and applications such as intelligent customer service, intelligent assistants, vehicle navigation and intelligent home enter the life of a user, and the intelligent terminals can perform human-computer voice interaction with the user. In the multi-round voice interaction process, when a user asks a question, the phenomenon of referring and omitting often occurs, and therefore the problem of single question semantic missing is caused.
Illustratively, the conversation process between the user and the intelligent terminal is as follows:
the user: i want to handle traffic packets.
The intelligent terminal: recommend for you a 30-tuple 2GB traffic package, a 50-tuple 3GB traffic package, a 100-tuple 10GB traffic package, which do you want to do?
The following are four session messages for the user:
1. the user: is a 50-element 3GB traffic package available nationwide?
2. The user: can it be used nationwide?
3. The user: is the second one available nationwide?
4. The user: can a 50-membered one be used in the Shandong?
The intention of the user in the first round of voice interaction process is to handle the traffic packet, and the intelligent terminal inquires about the traffic packet which the user specifically wants to handle. And the user does not answer directly but further asks questions in the second round of voice interaction process, namely the user adds a new intention: and inquiring the use region of the traffic packet. The semantics of the first session message of the user is complete, namely asking the use region of a 50-element 3GB traffic packet; the subject is omitted from the second session message of the user, the third session message of the user adopts the word "second" to replace the "50-element 3GB flow packet" in the above, and the third session message of the user adopts the common word "50 element" to replace the "50-element 3GB flow packet" in the above, that is, a part of information is missing in the three session messages of the user, so that the semantics of the session messages is incomplete, and the intention of the user cannot be accurately obtained.
In order to solve the problems, the conversation message with the reference expression is supplemented, so that the semanteme of the supplemented conversation message is complete, and a more accurate response message is provided for a user. Fig. 1 is a first schematic flow chart of a session processing method provided by the present invention, and an execution main body of the method flow shown in fig. 1 may be a session processing device, and the session processing device may be implemented by any software and/or hardware. As shown in fig. 1, the session processing method provided in this embodiment may include:
s101, if the present conversation message has the reference expression, acquiring the content to be supplemented of the present conversation message.
In the embodiment, when the reference expression exists in the current conversation message, the incomplete semantics of the current conversation message is determined; wherein the presence of a reference expression may be one or more of a pronoun reference expression, a common reference expression, and a zero reference expression. Correspondingly, according to each type of reference expression, the content to be supplemented of the current session message can be obtained by adopting a corresponding rule.
Illustratively, as for pronoun reference expressions and pronoun reference expressions, corresponding pronoun reference words and common reference words exist in the current conversation message, and the corresponding pronoun reference words and common reference words make the semantics of the current conversation message incomplete, and the pronoun reference words and the common reference words are the contents to be supplemented of the corresponding current conversation message. And for zero to refer to pronouns, because pronouns do not exist in the current conversation message, in this case, sentence pattern structure analysis can be performed to obtain the position of the default center expression in the current conversation message, and the center expression at the position is used as the content to be supplemented in the current conversation message.
Specifically, when the session processing apparatus determines that the reference expression exists in the current session message, the session processing apparatus may determine whether the reference expression exists in the current session message according to a determination rule corresponding to the type of the reference expression.
For the pronoun reference expression, a pronoun reference dictionary can be preset, the pronoun reference dictionary comprises a plurality of pronoun reference expressions, if the conversation processing device determines that any pronoun reference expression in the pronoun reference dictionary exists in the current conversation message, the pronoun reference expression in the current conversation message is determined, and then the pronoun reference expression in the current conversation message is used as the content to be supplemented of the current conversation message.
Illustratively, the conversation messages in a voice interaction are: "recommend for you a 30-tuple 2GB traffic package, a 50-tuple 3GB traffic package, a 100-tuple 10GB traffic package, which do you want to do? "," is the second available nationwide? "; the conversation processing device determines that the pronoun in the current conversation message refers to the pronoun 'second', and determines that the pronoun refers to the pronoun 'second' as the content to be supplemented of the current conversation message.
For the expression of the common reference, a common reference expression may be preset, the common reference expression refers to a sentence pattern such as "xxx", and if the conversation processing apparatus determines that the sentence pattern of the current conversation message is the common reference expression, the common reference expression is taken as the content to be supplemented of the current conversation message.
For the zero-meaning expression, a zero-meaning sentence pattern may also be preset, where the zero-meaning sentence pattern is, for example, a sentence pattern conforming to "ADV, HED, MT", where ADV, HED, and MT are syntax labels, respectively, ADV represents adverb, HED represents verb, and MT represents a word of language, such as "how to use" and "how to handle" all conform to the zero-meaning sentence pattern, and specifically, the position of the central expression where the gap between the verb and the word of language is located is the content to be supplemented to the current conversation message.
It should be noted that the above examples of commonly-indicated expressions and zero-indicated expressions are merely exemplary, and in this embodiment, a plurality of expressions may be set for the commonly-indicated expressions and the zero-indicated expressions in advance.
And S102, supplementing the content to be supplemented of the current session message according to the historical session message, wherein the historical session message is a message with complete semantics.
The current conversation message in this embodiment is a conversation message of a non-first round in a multi-round conversation, that is, a history conversation message is provided before the current conversation message, wherein the history conversation message may be a conversation message of at least one round, and a round in this embodiment refers to "question and answer" performed by the user with the conversation message processing device.
Specifically, the historical conversation message in this embodiment is a message with complete semantics, if the historical conversation message is one round, the semantics of the historical conversation message are complete, if the historical conversation message is multiple rounds, the semantics of all the conversation messages are complete, or the conversation message with incomplete semantics has been supplemented completely by adopting the conversation message processing method in the present invention, and in any case, the historical conversation message in this embodiment is a conversation message with complete semantics.
In this embodiment, the content to be supplemented of the current session message is supplemented according to the historical session message, and specifically, a corresponding supplementing manner may be adopted according to a type of a specific reference expression in the current session message.
For pronoun reference expression and common reference expression, pronoun reference word and common reference word exist in the current conversation message, the conversation message processing device can obtain corresponding reference expression in the historical conversation message according to the pronoun reference word and the common reference word, and replace the pronoun reference word and the common reference word with the reference expression.
Exemplarily, the explanation is given by referring to pronouns, such as the conversation messages in the voice interaction: "recommend for you a 30-tuple 2GB traffic package, a 50-tuple 3GB traffic package, a 100-tuple 10GB traffic package, which do you want to do? "," is the second available nationwide? "; the session processing device determines that the pronoun meaning pronoun "the second" exists in the current session message and is the content to be supplemented of the current session message, then obtains the corresponding meaning expression "50 yuan 3GB traffic package" from the history session message, replaces the meaning pronoun with the meaning expression, namely is the supplemented current session message "50 yuan 3GB traffic package can be used nationwide? "
For the zero-reference expression, since there is no zero-reference pronoun in the current conversation message, but the current conversation message conforms to a certain sentence pattern structure, such as a sentence pattern conforming to "ADV, HED, MT", where the position of the central expression where the gap between the verb and the language word is located can be obtained as the content to be supplemented in the current conversation message, the conversation processing apparatus can obtain the central expression in the history conversation message, and fill the central expression in the history conversation message to the position corresponding to the gap between the verb and the language word.
Illustratively, the conversation messages in a voice interaction are: "recommend this washing machine for you", "how to use woolen cloth"; the session processing device determines that the content to be supplemented in the current session message is the position of the gap between the usage and the washing machine, and the session processing device can acquire that the center expression in the historical session message is the washing machine, and fill the center expression in the historical session message to the position corresponding to the gap between the verb and the language word, namely, the supplemented current session message is the washing machine usage mode.
The specific way in which the session processing device can acquire the center expression in the historical session message is as follows: and obtaining the historical conversation information according to the sentence pattern structure corresponding to the historical conversation information.
S103, acquiring the response message of the current session message according to the complete semantic meaning of the current session message.
In this embodiment, after the session processing device completes the supplement of the current session message, the current session message has complete semantics, and the session processing device can obtain the response message of the current session message according to the complete semantics of the current session message.
Specifically, the manner of acquiring the complete semantic meaning of the current session message by the session processing device may be: converting the current conversation message into characters, and performing word segmentation processing on the characters to obtain a plurality of words corresponding to the characters; and then acquiring a target word according to the part of speech of each word, and acquiring a response message corresponding to the current conversation message according to the semantics of the target word.
In this embodiment, a word segmentation tool, such as a Natural Language Processing (NLP) tool, may be used to perform word segmentation Processing on the text corresponding to the current conversation message, to obtain a plurality of words corresponding to the text, for example, the text corresponding to the current conversation message is "how the weather of beijing today" and the word segmentation tool is used to segment the text into a plurality of words, where the specific segmented words may be "today", "beijing", "weather" and "how".
In this embodiment, optionally, the target words corresponding to the valid information may be obtained according to the parts of speech of the obtained multiple words, for example, quantifier, adverb, adjective, and the like in the segmented conversation message are removed, the target words corresponding to the valid information, for example, noun, verb, and the like are obtained, for example, "how" and "in the segmentation result are removed, and the target words," today, "beijing," and "weather" corresponding to the valid information are obtained. The conversation processing device determines that the weather of today Beijing is asked by the user according to the acquired target words, and then the conversation processing device can return a response message about the weather of today Beijing, such as 'the air temperature is 20 degrees on the sunny day of today' to the user.
It should be noted that, when the text corresponding to the current conversation message is a multi-sentence text, the conversation processing apparatus may first perform sentence segmentation on the text, then perform word segmentation on each clause, then obtain a response message corresponding to each clause according to the semantics of the target word in each clause, and send the multiple response messages corresponding to the current conversation message to the terminal according to the sequence of the clauses in the text.
Illustratively, the text corresponding to the current session message is "what is fun to go to Beijing? Where is the accommodation cost performance high? "the conversation message processing means separates the text into two sub-sentences" what fun and playful place in beijing "and" where accommodation is high in cost performance ". And respectively acquiring target words corresponding to each clause, such as 'Beijing', 'funny', 'local', and 'accommodation', and 'cost performance ratio', respectively acquiring response messages corresponding to each clause, such as 'the place where Beijing is funny has a home palace, a great wall … …', and 'you can select xx hotels in the Beijing accommodation'.
And S104, playing the response message.
The session message processing device in this embodiment has functions of acquiring a session message and playing a response message, and can play the response message after acquiring the response message of the current session message. It is conceivable that, when the response message corresponds to a message of a plurality of clauses, the response message is played one by one according to the time sequence of receiving the response message.
The session processing method provided by the embodiment comprises the following steps: if the present conversation message has the expression, acquiring the content to be supplemented of the present conversation message; supplementing the content to be supplemented of the current session message according to the historical session message, wherein the historical session message is a message with complete semantics; acquiring a response message of the current session message according to the complete semantic meaning of the current session message; and playing the response message. According to the embodiment, the content to be supplemented in the current session message with the reference expression is supplemented through the historical session message, so that the semantics of the current session message is complete, and the response message is returned to the user.
The present description of the present session message includes three kinds of expressions, which are respectively: the specific processes of acquiring the content to be supplemented and supplementing the content to be supplemented in the session processing method provided by the present invention are described in detail below with reference to fig. 2 to 6.
In the following, referring to fig. 2, a description is given to a reference expression existing in a current conversation message as a pronoun reference expression, and fig. 2 is a schematic flow chart of a conversation processing method corresponding to the pronoun reference expression provided by the present invention, as shown in fig. 2, S101 in the foregoing embodiment may include:
s201, if the current conversation message contains the preset meaning pronouns, the preset meaning pronouns in the current conversation message are the content to be supplemented.
In this embodiment, a pronoun reference dictionary may be pre-constructed, where the pronoun reference dictionary includes a plurality of preset pronouns, which are simply referred to as preset pronouns; the preset pronouns are irrelevant to the constructed fields when being set, namely, the pronouns refer to the dictionary and are suitable for various fields.
The conversation processing device judges the current conversation message, determines that pronouns refer to expressions in the current conversation message if the fact that any one preset pronouns in a pronouns refer to dictionary exists in the current conversation message is determined, and then takes the preset pronouns as the content to be supplemented of the current conversation message.
S202, according to the semantics of the historical conversation message, determining the pronouncing expression corresponding to the preset pronouncing word in the historical conversation message.
Specifically, the historical session message in this embodiment is a message with complete semantics, and the way for the session message processing apparatus to acquire the semantics of the historical session message may be the same as the way for acquiring the complete semantics of the current session message in the above embodiment. Specifically, the mode of determining the pronouncing expression corresponding to the preset pronouncing word in the history session message is as follows: and obtaining the semantics corresponding to the preset representative words in the current session message, and obtaining the representative expressions which are the same as the semantics of the preset representative words in the historical session message.
Illustratively, the conversation messages in a voice interaction are: "recommend for you a 30-tuple 2GB traffic package, a 50-tuple 3GB traffic package, a 100-tuple 10GB traffic package, which do you want to do? "," is the second available nationwide? "; and the second one is a preset pronoun in the current conversation message, and the conversation processing device determines that the preset pronoun 'second one' acquires a corresponding reference expression in the historical conversation message and is expressed as a '50-element 3GB flow packet' according to the semantics of the preset pronoun and the semantics of the historical conversation message. If the preset pronouns are 'these', the session processing device determines that the preset pronouns 'these' acquire corresponding reference expressions '30-element 2GB traffic packet, 50-element 3GB traffic packet and 100-element 10GB traffic packet' in the history session message.
Correspondingly, S102 in the above embodiment may include:
s203, replacing the preset pronouns in the current conversation message with the pronouns corresponding to the preset pronouns.
In this embodiment, the pronouns corresponding to the preset pronouns in the historical conversation messages are substituted for the preset pronouns in the current conversation messages.
In the following, referring to fig. 3, a description is given to a case where a reference expression existing in a current session message is a common reference expression, and fig. 3 is a first flowchart of a session processing method corresponding to the common reference expression provided by the present invention, as shown in fig. 3, S101 in the foregoing embodiment may include:
s301, if the sentence pattern of the current conversation message belongs to the first preset sentence pattern, the common reference in the current conversation message is the content to be supplemented, and the first preset sentence pattern is the sentence pattern with the common reference.
In this embodiment, a first preset sentence pattern with common reference is preset in the session message processing apparatus, and the first preset sentence pattern may be a commonly used sentence pattern with common reference. Illustratively, such as "xxx wool". Specifically, co-referent refers to an expression used to characterize the presence of semantic similarity in historical conversational messages with co-referent words greater than a similarity threshold.
The conversation processing device judges the sentence pattern structure of the current conversation message, and if the sentence pattern of the current conversation message is determined to belong to a first preset sentence pattern, the common reference words in the current conversation message are the contents to be supplemented. Illustratively, a common reference in the first preset period "the tweed of xxx" refers to the word "xxx".
Correspondingly, S102 in the above embodiment may include:
s302, performing word segmentation on the historical conversation message, and acquiring a plurality of first candidate expressions corresponding to the historical conversation message.
In this embodiment, a word segmentation tool in the prior art may be used to perform word segmentation on the historical conversation message to obtain a plurality of first candidate expressions corresponding to the historical conversation message, and specifically, the first candidate expression may be a word or a sentence.
S303, acquiring the first semantic similarity of each first candidate expression and the co-referent.
In order to determine the index expression corresponding to the co-index word in the history session message, in this embodiment, a first semantic similarity between each first candidate expression and the co-index word is obtained, and since the co-index word has the same semantic meaning as the corresponding expression, the to-be-indicated expression corresponding to the co-index word is obtained in the embodiment in a semantic similarity manner. It should be noted that, in this embodiment, a specific manner of how to obtain the first semantic similarity between each first candidate expression and the co-designated pronoun is not limited.
S304, if the maximum value of the first semantic similarity is larger than the similarity threshold, replacing the common reference word with the first candidate expression corresponding to the maximum value of the first semantic similarity.
After the first semantic similarity between each first candidate expression and the co-referent word is obtained, sequencing the multiple first semantic similarities to obtain the maximum first semantic similarity, wherein the candidate expression corresponding to the maximum first semantic similarity is the expression with the highest semantic similarity with the co-referent word.
In order to make the candidate expression corresponding to the first semantic similarity with the maximum value obtained be the expression corresponding to the accurate co-referent word, in this embodiment, a similarity threshold is stored in advance in the session message processing apparatus, and if the maximum value of the first semantic similarity is greater than the similarity threshold, the candidate expression corresponding to the maximum value of the first semantic similarity is the expression corresponding to the co-referent word.
In this embodiment, the common reference word is replaced with the first candidate expression corresponding to the maximum value of the first semantic similarity, so as to complete the supplement of the content to be supplemented.
For the judgment that the session message processing apparatus judges whether the co-referent expression exists in the current session message, in addition to the above judgment of whether the sentence pattern of the current session message is the first preset sentence pattern, the method in fig. 4 may also be adopted to judge, specifically, fig. 4 is a second flowchart of the session processing method corresponding to the co-referent expression provided by the present invention, as shown in fig. 4, S101 in the above embodiment may include:
s401, extracting the central expression of the historical conversation message according to the sentence pattern structure of the historical conversation message.
According to the concept of the common reference, the common reference refers to an expression which is used for representing that the semantic similarity of the expression existing in the current conversation message and the representative expression in the historical conversation message is larger than a similarity threshold. Based on this, in this embodiment, the sentence structure of the historical conversation message is analyzed, and the central expression of the historical conversation message is extracted.
Optionally, the session message processing apparatus in this embodiment stores preset sentence structures, each preset sentence structure is correspondingly labeled with a central expression, an adverb, a word and the like, and the central expression of the historical session message can be obtained by comparing the sentence structure of the historical session message with the preset sentence structure.
S402, acquiring a second semantic similarity of the center expression and the current conversation message according to the center expression, the current conversation message and the corresponding relation of the semantic similarity of the preset center expression and the sample conversation message.
In this embodiment, the session message processing apparatus stores in advance a correspondence between the preset central expressions and the semantic similarities of the sample session messages, specifically, the correspondence may be a similarity model, and the similarity model is obtained by training using a plurality of preset central expressions and the semantic similarities between each central expression and the sample session messages as training parameters. In this embodiment, the specific training mode is not limited.
And inputting the central expression of the historical conversation message and the current conversation message into the similarity model, so as to obtain the second semantic similarity between the central expression and the current conversation message.
And S403, if the second semantic similarity is greater than the similarity threshold, the common-finger expression exists in the current session message, and the common-finger word in the current session message is the content to be supplemented.
The similarity threshold of this embodiment is the same as the similarity threshold in the foregoing embodiments, and specifically, if the second semantic similarity obtained through the similarity model is greater than the similarity threshold, the session message processing apparatus may determine that a co-reference expression exists in the current session message, and the co-reference expression in the current session message is the content to be supplemented.
Correspondingly, S102 in the above embodiment may include:
s404, replacing the common reference words in the current conversation message with the center expression.
Because the second semantic similarity between the center expression and the current session message is greater than the similarity threshold, the center expression indicates that the common-finger word in the current session message is in a common-finger relationship, and the session message processing device replaces the common-finger word in the current session message with the center expression to complete the supplement of the content to be supplemented.
In the following, referring to fig. 5, a description is given to a reference expression that exists in a current session message and is a zero reference expression, where fig. 5 is a first flowchart of a session processing method corresponding to the zero reference expression provided by the present invention, as shown in fig. 5, S101 in the foregoing embodiment may include:
s501, if the sentence pattern of the current conversation message belongs to a second preset sentence pattern, the gap where the center expression in the current conversation message is located is the content to be supplemented, and the second preset sentence pattern is a sentence pattern with zero.
In this embodiment, a second preset sentence pattern with zero may be preset in the conversation message processing apparatus, and the second preset sentence pattern may be a commonly used sentence pattern with zero. Exemplary, such as a sentence structure conforming to the "ADV, HED, MT" sentence structure, wherein ADV represents adverb, HED represents verb, and MT represents adverb. Zero is used for representing that the center expression is omitted in the current conversation message, namely, the keyword is in default, namely, the gap where the default center expression is located is the content to be supplemented. In this embodiment, a gap where a default center expression in the current session message is located needs to be acquired.
Specifically, the second preset sentence pattern may be labeled with a gap where the default center expression is located in advance, the conversation processing apparatus determines the sentence pattern structure of the current conversation message, and if it is determined that the sentence pattern of the current conversation message belongs to the second preset sentence pattern, the gap where the default center expression is located in the current conversation message may also be obtained.
Illustratively, if the current session message is "how to use wool", the sentence pattern of the current session message conforms to the second preset sentence pattern "ADV, HED, MT", and the gap in which the default central expression labeled in advance in the second preset sentence pattern is located is between HED and MT, the gap between the current session message "use" and "wool" is taken as the gap in which the default central expression is located.
Correspondingly, S102 in the above embodiment may include:
and S502, extracting the central expression of the historical conversation message according to the sentence pattern structure of the historical conversation message.
The implementation in S502 in this embodiment may specifically refer to the related description in S401 in the above embodiment, and is not described herein again.
And S503, filling the gap of the center expression in the current conversation message with the center expression of the historical conversation message.
In this embodiment, zero is present in the current session message, that is, the center expression is absent, so that after the center expression in the historical session message is acquired, the center expression in the historical session message fills a gap where the center expression in the current session message is located, so as to complete the supplement of the content to be supplemented.
For the judgment that the session message processing apparatus judges whether there is a zero-index expression in the current session message, in addition to adopting the above-mentioned judgment whether the sentence pattern of the current session message is the second preset sentence pattern, the judgment may also be carried out in the manner shown in fig. 6, specifically, fig. 6 is a second flow diagram of the session processing method corresponding to the zero-index expression provided by the present invention, as shown in fig. 6, S101 in the above-mentioned embodiment may include:
s601, according to the current conversation message and a preset zero reference model, obtaining the probability that a new word can be inserted between any two adjacent words in the current conversation message.
The conversation message processing apparatus in this embodiment stores a zero-reference model in advance, where the preset zero-reference model is obtained by training a sample conversation message and a probability that a new word can be inserted between any two words in the sample conversation message, and the zero-reference model is used to represent a probability that a new word can be inserted between two words in the conversation message, that is, when a conversation message is input into the zero-reference model, a probability that a new word can be inserted between two words in the conversation message can be obtained.
Accordingly, in this embodiment, the current conversation message is input into the zero-reference model, and the probability that a new word can be inserted between two words in the current conversation message can be obtained.
S602, if the first probability is larger than the probability threshold, determining that zero expression exists in the current conversation message, and taking a gap between two words corresponding to the first probability as content to be supplemented.
The conversation message processing device stores a probability threshold value in advance, the probability that a new word can be inserted between a plurality of two words exists in the current conversation message, if a first probability exists in the plurality of probabilities and is larger than the probability threshold value, it is determined that zero-indicated expression exists in the current conversation message, and the first probability is the probability in the probability that a new word can be inserted between any two adjacent words in the current conversation message.
Correspondingly, the gap between the two terms corresponding to the first probability is used as the content to be supplemented, that is, the gap between the two terms corresponding to the first probability is the gap in which the center expression is located by default in the current session message.
Correspondingly, S102 in the above embodiment may include:
and S603, extracting the central expression of the historical conversation message according to the sentence pattern structure of the historical conversation message.
And S604, filling the gap between the two words corresponding to the first probability with the center expression.
The implementation in S603-S604 in this embodiment may specifically refer to the related descriptions in S502-S503 in the above embodiment, which are not repeated herein.
It should be noted that the session message processing manners shown in fig. 2-6 in this embodiment may be performed simultaneously, and are not necessarily performed alternatively.
In the embodiment, when pronoun indication expression, common indication expression and zero indication expression exist in the current conversation message, the content to be supplemented of the current conversation message is obtained, and the content to be supplemented of the current conversation message is supplemented according to the historical conversation message so as to obtain the complete semantics of the current conversation message, and further, an accurate response message is returned to the user.
The zero reference manners in fig. 5-6 are all slot zero references, that is, a keyword, that is, a central expression, is absent in the current session message; the zero-referring mode also includes the intention zero-referring, that is, the expression which is repeated with the keyword in the historical conversation message exists in the current conversation message, that is, the keyword in the historical conversation message, that is, the central expression needs to be replaced.
In the following, referring to fig. 7, a description is given to a reference expression that is zero in a current session message, and fig. 7 is a flowchart illustrating a second session processing method provided by the present invention, as shown in fig. 7, the session processing method provided in this embodiment may include:
s701, performing word segmentation on the current conversation message and the historical conversation message, and acquiring a plurality of corresponding first candidate expressions and a plurality of corresponding second candidate expressions in the historical conversation message.
The specific word segmentation processing method in this embodiment may be the same as the word segmentation method in the above embodiment, where the first candidate expression and the second candidate expression may be a word or a sentence.
S702, if there is a first candidate expression having the same semantic meaning as any second candidate expression in the plurality of first candidate expressions, replacing the corresponding second candidate expression with the first candidate expression having the same semantic meaning as the second candidate expression.
In this embodiment, the session message processing apparatus obtains semantics of each first candidate expression and each second candidate expression, and if there is a first candidate expression having the same semantics as any one second candidate expression in the plurality of first candidate expressions, determines that there is an intention zero reference in the current session message, that is, it is necessary to replace the second candidate expression in the historical session message, and the session message processing apparatus replaces the corresponding second candidate expression with the first candidate expression having the same semantics as the second candidate expression.
Exemplary, for example, the voice interaction information is: the user: "help me find the airplane from beijing to xi' an 7 am today", the session message processing apparatus: "there are 3 seats in the economy class, the fare is xxx", user "8 wordings in the morning"; the intention of the user in the historical conversation message is to inquire the airplane from Beijing to Xian at 7 am, and the intention of the user in the current conversation message is to inquire the airplane from Beijing to Xian at 7 am; according to each first candidate expression in the current conversation message and the semantics of each second candidate expression in the historical conversation message, the semantics of 8 am and 7 am which are the same as the semantics of time can be obtained, and the existence of intention zero reference in the current conversation message is determined, namely the second candidate expression in the historical conversation message needs to be replaced. The conversation message processing means replaces "8 am" with "7 am" in the history conversation message.
S703, acquiring the complete semantic meaning of the replaced historical conversation message, and taking the complete semantic meaning of the replaced historical conversation message as the complete semantic meaning of the current conversation message.
In this embodiment, the first candidate expression having the same semantic meaning as the second candidate expression is replaced with the corresponding second candidate expression, so that the complete semantic meaning of the replaced history session message, that is, the complete semantic meaning of the updated history session message, can be obtained, and specifically, the complete semantic meaning of the replaced history session message is used as the complete semantic meaning of the current session message.
Illustratively, "help me find an airplane in beijing to west's security in the morning 8 am today" will be taken as the complete semantic of the current session message.
S704, according to the complete semantic meaning of the current conversation message, acquiring the response message of the current conversation message.
S705, the response message is played.
The implementation in S704-S705 in this embodiment may specifically refer to the related descriptions in S103-S104 in the above embodiments, which are not repeated herein.
In this embodiment, if there is a first candidate expression having the same semantic as any one second candidate expression in the plurality of first candidate expressions, the corresponding second candidate expression is replaced with the first candidate expression having the same semantic as the second candidate expression, and the complete semantic of the replaced historical conversation message is used as the complete semantic of the current conversation message, so that the complete semantic of the current conversation message is obtained, and an accurate response message is obtained.
After the current session message is processed by using the session message processing manners in fig. 2 to 6, if the current session message has a plurality of supplemented current session messages, if pronouns refer to expressions in the current session message and it is determined that the current session message has zero refer expressions according to the zero refer model, the current session message has a plurality of supplemented current session messages.
For this situation, the following further describes the session processing method provided by the present invention with reference to fig. 8, where fig. 8 is a schematic flow chart of the session processing method provided by the present invention and having a plurality of supplemented current session messages, as shown in fig. 8, in this embodiment, after supplementing the current session message, the method includes:
s801, if a plurality of supplemented current session messages exist, obtaining the semantics of each supplemented current session message.
In this embodiment, if there are multiple types of reference expressions in the current session message, the content to be supplemented in the current session message is supplemented according to the processing method of the corresponding type of reference expression, to obtain multiple supplemented current session messages, and in order to determine a supplemented current session message that is most suitable for the user's intention in the multiple supplemented current session messages, specifically, the session message processing device obtains the semantics of each supplemented current session message.
S802, obtaining the semantic confidence, fluency, confidence weight and fluency weight of each supplemented current conversation message according to the semantic of each supplemented current conversation message and the corresponding relation between the semantic of the sample conversation message and the confidence, fluency, confidence weight and fluency weight.
In this embodiment, the session message processing apparatus stores in advance a correspondence between semantics of the sample session message and the confidence level, the fluency, the confidence level weight, and the fluency weight, where the correspondence is specifically a language model in the prior art, and the supplemented current session message is input into the language model, so that the confidence level, the fluency, the confidence level weight, and the fluency weight of the supplemented current session message can be obtained.
Specifically, a plurality of supplemented current conversation messages are input into the language model, and the confidence, fluency, confidence weight and fluency weight of each supplemented current conversation message can be obtained.
And S803, obtaining the score of the semantics of each supplemented current session message according to the confidence, the fluency, the confidence weight and the fluency weight of the semantics of each supplemented current session message.
In this embodiment, after obtaining the confidence, the fluency, the confidence weight, and the fluency weight of the semantics of each supplemented current conversation message, specifically, the score of the semantics of each supplemented current conversation message is obtained according to the product of the confidence and the confidence weight of the semantics of each supplemented current conversation message and the product of the fluency and the fluency weight.
It is conceivable that other manners may be adopted, such as obtaining the score of the semantics of each supplemented current conversation message by using the confidence, fluency, confidence weight, and fluency weight of the semantics of each supplemented current conversation message.
S804, the semanteme of the supplemented current conversation message corresponding to the highest score is used as the complete semanteme of the current conversation message.
In this embodiment, after the score of the semantic meaning of each supplemented current session message is obtained, the semantic meaning of the supplemented current session message corresponding to the highest score is used as the complete semantic meaning of the current session message, that is, the semantic meaning of the supplemented current session message with the best integrated confidence and fluency is used as the complete semantic meaning of the current session message.
S805, acquiring the response message of the current session message according to the complete semantic meaning of the current session message.
And S806, playing the response message.
The implementation in S805 to S806 in this embodiment may specifically refer to the related descriptions in S103 to S104 in the foregoing embodiment, which are not described herein again.
In this embodiment, if there are multiple supplemented current session messages, the semantics of the supplemented current session message corresponding to the highest score is used as the complete semantics of the current session message according to the confidence and the fluency score of the semantics of each supplemented current session message, and a response message is obtained according to the complete semantics of the current session message, so that the obtained response message has high accuracy.
Fig. 9 is a schematic structural diagram of a session processing apparatus according to the present invention, as shown in fig. 9, the session message processing apparatus 900 includes: a content to be supplemented acquisition module 901, a supplement module 902, a response message acquisition module 903 and a play module 904.
A to-be-supplemented content obtaining module 901, configured to obtain to-be-supplemented content of the current session message if the reference expression exists in the current session message.
And a supplementing module 902, configured to supplement, according to the historical conversation message, content to be supplemented of the current conversation message, where the historical conversation message is a message with complete semantics.
A response message obtaining module 903, configured to obtain a response message of the current session message according to the complete semantic meaning of the current session message.
A playing module 904, configured to play the response message.
The principle and technical effect of the session processing apparatus provided in this embodiment are similar to those of the session processing method, and are not described herein again.
Fig. 10 is a schematic structural diagram of a session processing apparatus according to the second embodiment of the present invention, and as shown in fig. 10, the session message processing apparatus 900 further includes: a candidate expression obtaining module 905, a replacing module 906 and a score obtaining module 907.
The candidate expression obtaining module 905 is configured to perform word segmentation on the current conversation message and the historical conversation message, and obtain a plurality of first candidate expressions corresponding to the historical conversation message and a plurality of second candidate expressions corresponding to the current conversation message.
A replacing module 906, configured to, if there is a first candidate expression having a same semantic meaning as any one second candidate expression in the plurality of first candidate expressions, replace a corresponding second candidate expression with the first candidate expression having the same semantic meaning as the second candidate expression;
optionally, the response message obtaining module 903 is specifically configured to obtain the complete semantic meaning of the replaced history session message, and use the complete semantic meaning of the replaced history session message as the complete semantic meaning of the current session message; and acquiring the response message of the current session message according to the complete semantic meaning of the current session message.
A score obtaining module 907, configured to obtain semantics of each supplemented current session message if multiple supplemented current session messages exist; obtaining the confidence level, the fluency, the confidence weight and the fluency weight of the semantics of each supplemented current conversation message according to the semantics of each supplemented current conversation message and the corresponding relationship between the semantics of the sample conversation message and the confidence level, the fluency, the confidence weight and the fluency weight; obtaining the score of the semantics of each supplemented current session message according to the confidence, the fluency, the confidence weight and the fluency weight of the semantics of each supplemented current session message; and taking the semanteme of the supplemented current session message corresponding to the highest score as the complete semanteme of the current session message.
Optionally, the to-be-supplemented content obtaining module 901 is specifically configured to, if the current session message includes a preset token, determine that the preset token in the current session message is the to-be-supplemented content.
Optionally, the supplementing module 902 is specifically configured to determine, according to semantics of the historical conversation message, a pronouncing expression corresponding to a preset pronouncing word in the historical conversation message; and replacing the preset pronouns in the current conversation message with the pronouns corresponding to the preset pronouns.
Optionally, the to-be-supplemented content obtaining module 901 is specifically configured to, if the sentence pattern of the current conversation message belongs to a first preset sentence pattern, determine that a co-indicated word in the current conversation message is the to-be-supplemented content, where the first preset sentence pattern is a sentence pattern in which a co-indicated word exists, and the co-indicated word is used to represent that an expression in which semantic similarity with the co-indicated word in the historical conversation message is greater than a similarity threshold exists;
optionally, the supplementing module 902 is specifically configured to perform word segmentation on the historical conversation message, and obtain a plurality of first candidate expressions corresponding to the historical conversation message; acquiring first semantic similarity of each first candidate expression and a co-designated representative word; and if the maximum value of the first semantic similarity is greater than the similarity threshold value, replacing the first candidate expression corresponding to the maximum value of the first semantic similarity with the common reference word.
Optionally, the to-be-supplemented content obtaining module 901 is specifically configured to extract a central expression of the historical conversation message according to a sentence pattern structure of the historical conversation message; acquiring a second semantic similarity of the center expression and the current conversation message according to the center expression, the current conversation message and the corresponding relation of the semantic similarity of the preset center expression and the sample conversation message; if the second semantic similarity is larger than the similarity threshold, the common finger expression exists in the current session message, and the common finger expression in the current session message is the content to be supplemented;
optionally, the supplementary module 902 is specifically configured to replace the common reference word in the current session message with the central expression.
Optionally, the to-be-supplemented content obtaining module 901 is specifically configured to, if the sentence pattern of the current conversation message belongs to a second preset sentence pattern, determine that a gap where the center expression in the current conversation message is located is the to-be-supplemented content, where the second preset sentence pattern is a sentence pattern with a zero reference, and the zero reference is used to represent that the center expression is omitted in the current conversation message;
optionally, the supplementing module 902 is specifically configured to extract a central expression of the historical conversation message according to a sentence pattern structure of the historical conversation message; filling the gap of the central expression in the current conversation message with the central expression of the historical conversation message.
Optionally, the to-be-supplemented content obtaining module 901 is specifically configured to obtain, according to the current conversation message and a preset zero-reference model, a probability that a new word can be inserted between any two adjacent words in the current conversation message, where the preset zero-reference model is obtained by training a sample conversation message and a probability that a new word can be inserted between any two words in the sample conversation message; if the first probability is greater than the probability threshold, determining that zero-reference expression exists in the current conversation message, and taking a gap between two words corresponding to the first probability as content to be supplemented, wherein the first probability is the probability of inserting a new word between any two adjacent words in the current conversation message;
optionally, the supplementing module 902 is specifically configured to extract a central expression of the historical conversation message according to a sentence pattern structure of the historical conversation message; filling the gap between the two words corresponding to the first probability with the central expression.
Fig. 11 is a schematic structural diagram of a third session processing apparatus provided in the present invention, where the session processing apparatus may be, for example, a terminal device, such as a smart phone, a tablet computer, a computer, and the like. As shown in fig. 11, the session processing apparatus 1100 includes: a memory 1101 and at least one processor 1102.
A memory 1101 for storing program instructions.
The processor 1102 is configured to implement the session processing method in this embodiment when the program instruction is executed, and specific implementation principles may be referred to in the foregoing embodiments, which are not described herein again.
The session handling device 1100 may also include an input/output interface 1103.
The input/output interface 1103 may include a separate output interface and input interface, or may be an integrated interface that integrates input and output. The output interface is used for outputting data, the input interface is used for acquiring input data, the output data is a general name output in the method embodiment, and the input data is a general name input in the method embodiment.
The present invention also provides a readable storage medium, in which an execution instruction is stored, and when at least one processor of the session processing apparatus executes the execution instruction, the computer execution instruction, when executed by the processor, implements the session processing method in the above embodiments.
The present invention also provides a program product comprising execution instructions stored in a readable storage medium. The at least one processor of the session processing apparatus may read the execution instruction from the readable storage medium, and the execution of the execution instruction by the at least one processor causes the session processing apparatus to implement the session processing method provided in the above-described various embodiments.
In the embodiments provided in the present invention, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one logical division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, or in a form of hardware plus a software functional unit.
The integrated unit implemented in the form of a software functional unit may be stored in a computer readable storage medium. The software functional unit is stored in a storage medium and includes several instructions to enable a computer device (which may be a personal computer, a server, or a network device) or a processor (processor) to execute some steps of the methods according to the embodiments of the present invention. And the aforementioned storage medium includes: a U disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
In the foregoing embodiments of the network device or the terminal device, it should be understood that the Processor may be a Central Processing Unit (CPU), or may be other general-purpose processors, Digital Signal Processors (DSP), Application Specific Integrated Circuits (ASIC), etc. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of a method disclosed in connection with the present application may be embodied directly in a hardware processor, or in a combination of the hardware and software modules in the processor.
Finally, it should be noted that: the above embodiments are only used to illustrate the technical solution of the present invention, and not to limit the same; while the invention has been described in detail and with reference to the foregoing embodiments, it will be understood by those skilled in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some or all of the technical features may be equivalently replaced; and the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present invention.
Claims (9)
1. A session processing method, comprising:
if the present conversation message has the expression, acquiring the content to be supplemented of the present conversation message; wherein the expression is one or more of a pronoun expression, a common expression and a zero expression;
supplementing the content to be supplemented of the current session message according to a historical session message, wherein the historical session message is a message with complete semantics;
acquiring a response message of the current session message according to the complete semantic meaning of the current session message;
playing the response message;
after the content to be supplemented of the current session message is supplemented according to the historical session message, the method further comprises the following steps:
if a plurality of supplemented current session messages exist, obtaining the semantics of each supplemented current session message;
obtaining the confidence level, the fluency, the confidence weight and the fluency weight of the semantics of each supplemented current conversation message according to the semantics of each supplemented current conversation message and the corresponding relationship between the semantics of the sample conversation message and the confidence level, the fluency, the confidence weight and the fluency weight;
obtaining the score of the semantics of each supplemented current session message according to the confidence, the fluency, the confidence weight and the fluency weight of the semantics of each supplemented current session message;
and taking the semanteme of the supplemented current session message corresponding to the highest score as the complete semanteme of the current session message.
2. The method according to claim 1, wherein if there is a reference expression in the current session message, acquiring content to be supplemented of the current session message comprises:
if the current conversation message contains a preset meaning word, the preset meaning word in the current conversation message is the content to be supplemented;
the supplementing the content to be supplemented of the current session message according to the historical session message comprises the following steps:
determining a representative expression corresponding to the preset representative word in the historical conversation message according to the semantic meaning of the historical conversation message;
and replacing the preset pronouns in the current conversation message with the pronouns corresponding to the preset pronouns.
3. The method according to claim 1, wherein if there is a reference expression in the current session message, acquiring content to be supplemented of the current session message comprises:
if the sentence pattern of the current conversation message belongs to a first preset sentence pattern, the common-finger referring word in the current conversation message is the content to be supplemented, the first preset sentence pattern is a sentence pattern with the common-finger referring word, and the common-finger referring word is used for representing that the expression with the semantic similarity of the common-finger referring word being greater than the similarity threshold exists in the historical conversation message;
the supplementing the content to be supplemented of the current session message according to the historical session message comprises the following steps:
performing word segmentation on the historical conversation message to obtain a plurality of first candidate expressions corresponding to the historical conversation message;
acquiring a first semantic similarity of each first candidate expression and the common finger referring words;
and if the maximum value of the first semantic similarity is greater than the similarity threshold value, replacing the common finger word with a first candidate expression corresponding to the maximum value of the first semantic similarity.
4. The method according to claim 1, wherein if there is a reference expression in the current session message, acquiring content to be supplemented of the current session message comprises:
extracting the central expression of the historical conversation message according to the sentence pattern structure of the historical conversation message;
acquiring a second semantic similarity of the center expression and the current conversation message according to the center expression, the current conversation message and a preset corresponding relation of the semantic similarity of the center expression and the sample conversation message;
if the second semantic similarity is greater than a similarity threshold, a common-finger expression exists in the current session message, and the common-finger word in the current session message is the content to be supplemented;
the supplementing the content to be supplemented of the current session message according to the historical session message comprises the following steps:
replacing the common reference word in the current conversation message with the center expression.
5. The method according to claim 1, wherein if there is a reference expression in the current session message, acquiring content to be supplemented of the current session message comprises:
if the sentence pattern of the current conversation message belongs to a second preset sentence pattern, the gap where the center expression in the current conversation message is located is the content to be supplemented, the second preset sentence pattern is a sentence pattern with zero reference, and the zero reference is used for representing that the center expression is omitted in the current conversation message;
the supplementing the content to be supplemented of the current session message according to the historical session message comprises the following steps:
extracting the central expression of the historical conversation message according to the sentence pattern structure of the historical conversation message;
filling the gap of the center expression in the current conversation message with the center expression of the historical conversation message.
6. The method according to claim 1, wherein if there is a reference expression in the current session message, acquiring content to be supplemented of the current session message comprises:
acquiring the probability that a new word can be inserted between any two adjacent words in the current conversation message according to the current conversation message and a preset zero-reference model, wherein the preset zero-reference model is acquired by training the probability that a new word can be inserted between any two words in the sample conversation message and the sample conversation message;
if the first probability is greater than a probability threshold value, determining that zero-reference expression exists in the current conversation message, and taking a gap between two terms corresponding to the first probability as the content to be supplemented, wherein the first probability is the probability of inserting a new term between any two adjacent terms in the current conversation message;
the supplementing the content to be supplemented of the current session message according to the historical session message comprises the following steps:
extracting the central expression of the historical conversation message according to the sentence pattern structure of the historical conversation message;
filling the gap between the two words corresponding to the first probability with the center expression.
7. The method of claim 1, further comprising:
performing word segmentation on the current conversation message and the historical conversation message to obtain a plurality of corresponding first candidate expressions in the historical conversation message and a plurality of corresponding second candidate expressions in the current conversation message;
if a first candidate expression with the same semantic meaning as any second candidate expression exists in the plurality of first candidate expressions, replacing the corresponding second candidate expression with the first candidate expression with the same semantic meaning as the second candidate expression;
the obtaining of the response message of the current session message includes:
acquiring the complete semantic meaning of the replaced historical conversation message, and taking the complete semantic meaning of the replaced historical conversation message as the complete semantic meaning of the current conversation message;
and acquiring the response message of the current session message according to the complete semantic meaning of the current session message.
8. A session processing apparatus, comprising: at least one processor and memory;
the memory stores computer-executable instructions;
the at least one processor executing the computer-executable instructions stored by the memory causes the conversation processing apparatus to perform the method of any of claims 1-7.
9. A computer-readable storage medium having computer-executable instructions stored thereon which, when executed by a processor, implement the method of any one of claims 1-7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811543826.7A CN109830231B (en) | 2018-12-17 | 2018-12-17 | Session processing method, device and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811543826.7A CN109830231B (en) | 2018-12-17 | 2018-12-17 | Session processing method, device and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN109830231A CN109830231A (en) | 2019-05-31 |
CN109830231B true CN109830231B (en) | 2021-03-16 |
Family
ID=66859608
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201811543826.7A Active CN109830231B (en) | 2018-12-17 | 2018-12-17 | Session processing method, device and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109830231B (en) |
Families Citing this family (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110223692B (en) * | 2019-06-12 | 2021-08-13 | 思必驰科技股份有限公司 | Multi-turn dialogue method and system for voice dialogue platform cross-skill |
CN112800189A (en) * | 2019-11-14 | 2021-05-14 | 科沃斯商用机器人有限公司 | Human-computer interaction method and device, intelligent robot and storage medium |
CN112632251B (en) * | 2020-12-24 | 2023-12-29 | 北京百度网讯科技有限公司 | Reply content generation method, device, equipment and storage medium |
CN115064168B (en) * | 2022-08-17 | 2022-12-13 | 广州小鹏汽车科技有限公司 | Voice interaction method, server and storage medium |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2013073355A (en) * | 2011-09-27 | 2013-04-22 | Toshiba Corp | Conversation support device, method and program |
WO2016002000A1 (en) * | 2014-06-30 | 2016-01-07 | 楽天株式会社 | Information processing device, information processing method, and program for information processing device |
CN105589844A (en) * | 2015-12-18 | 2016-05-18 | 北京中科汇联科技股份有限公司 | Missing semantic supplementing method for multi-round question-answering system |
CN107402912A (en) * | 2016-05-19 | 2017-11-28 | 北京京东尚科信息技术有限公司 | Parse semantic method and apparatus |
CN107463553A (en) * | 2017-09-12 | 2017-12-12 | 复旦大学 | For the text semantic extraction, expression and modeling method and system of elementary mathematics topic |
CN107632979A (en) * | 2017-10-13 | 2018-01-26 | 华中科技大学 | The problem of one kind is used for interactive question and answer analytic method and system |
CN108549662A (en) * | 2018-03-16 | 2018-09-18 | 北京云知声信息技术有限公司 | The supplement digestion procedure and device of semantic analysis result in more wheel sessions |
-
2018
- 2018-12-17 CN CN201811543826.7A patent/CN109830231B/en active Active
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2013073355A (en) * | 2011-09-27 | 2013-04-22 | Toshiba Corp | Conversation support device, method and program |
WO2016002000A1 (en) * | 2014-06-30 | 2016-01-07 | 楽天株式会社 | Information processing device, information processing method, and program for information processing device |
CN105589844A (en) * | 2015-12-18 | 2016-05-18 | 北京中科汇联科技股份有限公司 | Missing semantic supplementing method for multi-round question-answering system |
CN107402912A (en) * | 2016-05-19 | 2017-11-28 | 北京京东尚科信息技术有限公司 | Parse semantic method and apparatus |
CN107463553A (en) * | 2017-09-12 | 2017-12-12 | 复旦大学 | For the text semantic extraction, expression and modeling method and system of elementary mathematics topic |
CN107632979A (en) * | 2017-10-13 | 2018-01-26 | 华中科技大学 | The problem of one kind is used for interactive question and answer analytic method and system |
CN108549662A (en) * | 2018-03-16 | 2018-09-18 | 北京云知声信息技术有限公司 | The supplement digestion procedure and device of semantic analysis result in more wheel sessions |
Also Published As
Publication number | Publication date |
---|---|
CN109830231A (en) | 2019-05-31 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109830231B (en) | Session processing method, device and storage medium | |
WO2020119075A1 (en) | General text information extraction method and apparatus, computer device and storage medium | |
US10242049B2 (en) | Method, system and storage medium for implementing intelligent question answering | |
WO2024207587A1 (en) | Question answering scoring method, question answering scoring apparatus, electronic device and storage medium | |
US11514034B2 (en) | Conversion of natural language query | |
CN114757176B (en) | Method for acquiring target intention recognition model and intention recognition method | |
CN112100332A (en) | Word embedding expression learning method and device and text recall method and device | |
CN112836057B (en) | Knowledge graph generation method, device, terminal and storage medium | |
CN111160041A (en) | Semantic understanding method and device, electronic equipment and storage medium | |
CN114492396A (en) | Text error correction method for automobile proper nouns and readable storage medium | |
CN113157887B (en) | Knowledge question and answer intention recognition method and device and computer equipment | |
RU2595531C2 (en) | Method and system for generating definition of word based on multiple sources | |
CN111274813A (en) | Language sequence marking method, device storage medium and computer equipment | |
CN113434631A (en) | Emotion analysis method and device based on event, computer equipment and storage medium | |
CN112287077A (en) | Statement extraction method and device for combining RPA and AI for document, storage medium and electronic equipment | |
CN117421413A (en) | Question-answer pair generation method and device and electronic equipment | |
CN111368553A (en) | Intelligent word cloud picture data processing method, device, equipment and storage medium | |
CN114417898B (en) | Data processing method, device, equipment and readable storage medium | |
CN114428788B (en) | Natural language processing method, device, equipment and storage medium | |
CN116701604A (en) | Question and answer corpus construction method and device, question and answer method, equipment and medium | |
CN104699675A (en) | Message translating method and device | |
CN113065333B (en) | Word segmentation language identification method and device | |
CN113487698B (en) | Form generation method and device based on two-channel neural network model | |
CN112949283B (en) | Text processing method, device, nonvolatile storage medium and processor | |
CN114841174A (en) | Method and apparatus for analyzing object paraphrases |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |