Disclosure of Invention
The present disclosure provides an interaction technical solution.
According to an aspect of the present disclosure, there is provided an interaction method, including:
receiving user input information;
determining a semantic vector corresponding to the user input information;
determining a matching template vector corresponding to the user input information, wherein the matching template vector represents a vector of a template matched with the user input information, and the template matched with the user input information at least comprises a preset basic template;
determining a matching template statistical vector corresponding to the user input information based on the matching template vector and the semantic vector;
and outputting an interaction result corresponding to the user input information at least based on the semantic vector and the matching template statistical vector.
In a possible implementation manner, the determining a matching template vector corresponding to the user input information includes:
and respectively determining the vector of each basic template as a matching template vector corresponding to the user input information.
In a possible implementation manner, the determining a matching template vector corresponding to the user input information includes:
if the user input information conforms to the sentence pattern of any non-basic template, determining the vector of the non-basic template as a matching template vector corresponding to the user input information; wherein, the user input information conforms to any sentence pattern of the non-basic template, including: the user input information includes entities of the set of entities in the sentence of the non-base template.
In one possible implementation manner, the determining, based on the matching template vector and the semantic vector, a matching template statistical vector corresponding to the user input information includes:
and processing the matching template vector and the semantic vector based on an attention mechanism to obtain a matching template statistical vector corresponding to the user input information.
In a possible implementation manner, the processing the matching template vector and the semantic vector based on the attention mechanism to obtain a matching template statistical vector corresponding to the user input information includes:
determining the weight of the matching template vector according to the similarity of the matching template vector and the semantic vector;
and weighting the matching template vector based on the weight of the matching template vector to obtain a matching template statistical vector corresponding to the user input information.
In a possible implementation manner, the determining the weight of the matching template vector according to the similarity between the matching template vector and the semantic vector includes:
and carrying out normalization processing on the similarity of the matching template vector and the semantic vector to obtain the weight of the matching template vector.
In one possible implementation manner, the outputting an interaction result corresponding to the user input information based on at least the semantic vector and the matching template statistical vector includes:
performing connection processing on the semantic vector and the matching template statistical vector to obtain a connection vector;
and outputting an interaction result corresponding to the user input information based on the connection vector.
In a possible implementation manner, the outputting an interaction result corresponding to the user input information based on the connection vector includes:
performing linear dimensionality reduction on the connecting vector to obtain a dimensionality reduction vector, wherein the dimensionality of the dimensionality reduction vector is the same as the classification number;
and inputting the dimension reduction vector into a softmax layer, and outputting an interaction result corresponding to the user input information through the softmax layer.
In one possible implementation, the user input information is voice input by a user.
According to another aspect of the present disclosure, there is provided an interaction method including:
receiving user input information;
determining a semantic vector corresponding to the user input information through a deep learning model;
determining a matching template vector corresponding to the user input information by searching a matching model, wherein the matching template vector represents a vector of a template matched with the user input information, and the template matched with the user input information at least comprises a preset basic template;
processing the matching template vector and the semantic vector based on an attention mechanism to obtain a matching template statistical vector corresponding to the user input information;
and outputting an interaction result corresponding to the user input information at least based on the semantic vector and the matching template statistical vector.
In a possible implementation manner, the determining, by searching a matching model, a matching template vector corresponding to the user input information includes:
and respectively determining the vector of each basic template as a matching template vector corresponding to the user input information.
In one possible implementation manner, the determining, by searching a matching model, a matching template vector corresponding to the user input information includes:
if the user input information conforms to the sentence pattern of any non-basic template, determining the vector of the non-basic template as a matching template vector corresponding to the user input information; wherein, the user input information conforms to any sentence pattern of the non-basic template, including: the user input information includes entities of the set of entities in the sentence of the non-base template.
In a possible implementation manner, the processing the matching template vector and the semantic vector based on the attention mechanism to obtain a matching template statistical vector corresponding to the user input information includes:
determining the weight of the matching template vector according to the similarity of the matching template vector and the semantic vector;
and weighting the matching template vector based on the weight of the matching template vector to obtain a matching template statistical vector corresponding to the user input information.
In a possible implementation manner, the determining the weight of the matching template vector according to the similarity between the matching template vector and the semantic vector includes:
and carrying out normalization processing on the similarity of the matching template vector and the semantic vector to obtain the weight of the matching template vector.
In one possible implementation manner, the outputting an interaction result corresponding to the user input information based on at least the semantic vector and the matching template statistical vector includes:
performing connection processing on the semantic vector and the matching template statistical vector to obtain a connection vector;
and outputting an interaction result corresponding to the user input information based on the connection vector.
In a possible implementation manner, the outputting an interaction result corresponding to the user input information based on the connection vector includes:
performing linear dimensionality reduction on the connecting vector to obtain a dimensionality reduction vector, wherein the dimensionality of the dimensionality reduction vector is the same as the classification number;
and inputting the dimension reduction vector into a softmax layer, and outputting an interaction result corresponding to the user input information through the softmax layer.
In one possible implementation, the user input information is voice input by a user.
According to another aspect of the present disclosure, there is provided an interaction apparatus including:
the receiving module is used for receiving user input information;
the first determining module is used for determining a semantic vector corresponding to the user input information;
a second determining module, configured to determine a matching template vector corresponding to the user input information, where the matching template vector represents a vector of a template matching the user input information, and the template matching the user input information at least includes a preset basic template;
a third determining module, configured to determine a matching template statistical vector corresponding to the user input information based on the matching template vector and the semantic vector;
and the output module is used for outputting an interaction result corresponding to the user input information at least based on the semantic vector and the matching template statistical vector.
In one possible implementation manner, the second determining module is configured to:
and respectively determining the vector of each basic template as a matching template vector corresponding to the user input information.
In one possible implementation manner, the second determining module is configured to:
if the user input information conforms to the sentence pattern of any non-basic template, determining the vector of the non-basic template as a matching template vector corresponding to the user input information; wherein, the user input information conforms to any sentence pattern of the non-basic template, including: the user input information includes entities of the set of entities in the sentence of the non-base template.
In one possible implementation manner, the third determining module is configured to:
and processing the matching template vector and the semantic vector based on an attention mechanism to obtain a matching template statistical vector corresponding to the user input information.
In one possible implementation manner, the third determining module is configured to:
determining the weight of the matching template vector according to the similarity of the matching template vector and the semantic vector;
and weighting the matching template vector based on the weight of the matching template vector to obtain a matching template statistical vector corresponding to the user input information.
In one possible implementation manner, the third determining module is configured to:
and carrying out normalization processing on the similarity of the matching template vector and the semantic vector to obtain the weight of the matching template vector.
In one possible implementation, the output module is configured to:
performing connection processing on the semantic vector and the matching template statistical vector to obtain a connection vector;
and outputting an interaction result corresponding to the user input information based on the connection vector.
In one possible implementation, the output module is configured to:
performing linear dimensionality reduction on the connecting vector to obtain a dimensionality reduction vector, wherein the dimensionality of the dimensionality reduction vector is the same as the classification number;
and inputting the dimension reduction vector into a softmax layer, and outputting an interaction result corresponding to the user input information through the softmax layer.
In one possible implementation, the user input information is voice input by a user.
According to another aspect of the present disclosure, there is provided an acoustic enclosure comprising:
the receiving module is used for receiving user input information;
the first determining module is used for determining a semantic vector corresponding to the user input information;
a second determining module, configured to determine a matching template vector corresponding to the user input information, where the matching template vector represents a vector of a template that matches the user input information, and the template that matches the user input information at least includes a preset basic template;
a third determining module, configured to determine a matching template statistical vector corresponding to the user input information based on the matching template vector and the semantic vector;
and the output module is used for outputting an interaction result corresponding to the user input information at least based on the semantic vector and the matching template statistical vector.
In one possible implementation manner, the second determining module is configured to:
and respectively determining the vector of each basic template as a matching template vector corresponding to the user input information.
In one possible implementation manner, the second determining module is configured to:
if the user input information conforms to the sentence pattern of any non-basic template, determining the vector of the non-basic template as a matching template vector corresponding to the user input information; wherein, the user input information conforms to any sentence pattern of the non-basic template, including: the user input information includes entities of the set of entities in the sentence of the non-base template.
In one possible implementation manner, the third determining module is configured to:
and processing the matching template vector and the semantic vector based on an attention mechanism to obtain a matching template statistical vector corresponding to the user input information.
In one possible implementation manner, the third determining module is configured to:
determining the weight of the matching template vector according to the similarity of the matching template vector and the semantic vector;
and weighting the matching template vector based on the weight of the matching template vector to obtain a matching template statistical vector corresponding to the user input information.
In one possible implementation manner, the third determining module is configured to:
and carrying out normalization processing on the similarity of the matching template vector and the semantic vector to obtain the weight of the matching template vector.
In one possible implementation, the output module is configured to:
performing connection processing on the semantic vector and the matching template statistical vector to obtain a connection vector;
and outputting an interaction result corresponding to the user input information based on the connection vector.
In one possible implementation, the output module is configured to:
performing linear dimensionality reduction on the connecting vector to obtain a dimensionality reduction vector, wherein the dimensionality of the dimensionality reduction vector is the same as the classification number;
and inputting the dimensionality reduction vector into a softmax layer, and outputting an interaction result corresponding to the user input information through the softmax layer.
In one possible implementation, the user input information is voice input by a user.
According to another aspect of the present disclosure, there is provided an electronic device including:
a processor;
a memory for storing processor-executable instructions;
wherein the processor is configured to invoke the memory-stored instructions to perform the above-described interaction method.
According to another aspect of the present disclosure, there is provided a computer readable storage medium having stored thereon computer program instructions which, when executed by a processor, implement the above-described interaction method.
In the embodiment of the disclosure, by receiving user input information, determining a semantic vector corresponding to the user input information, and determining a matching template vector corresponding to the user input information, wherein a template matched with the user input information at least includes a preset basic template, determining a matching template statistical vector corresponding to the user input information based on the matching template vector and the semantic vector, and outputting an interaction result corresponding to the user input information based on the semantic vector and the matching template statistical vector, the influence of dirty data on the interaction can be reduced, and the accuracy of a result returned to a user can be improved in the interaction.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Other features and aspects of the present disclosure will become apparent from the following detailed description of exemplary embodiments, which proceeds with reference to the accompanying drawings.
Detailed Description
Various exemplary embodiments, features and aspects of the present disclosure will be described in detail below with reference to the accompanying drawings. In the drawings, like reference numbers indicate functionally identical or similar elements. While the various aspects of the embodiments are presented in drawings, the drawings are not necessarily drawn to scale unless specifically indicated.
The word "exemplary" is used exclusively herein to mean "serving as an example, embodiment, or illustration. Any embodiment described herein as "exemplary" is not necessarily to be construed as preferred or advantageous over other embodiments.
The term "and/or" herein is merely an association describing an associated object, meaning that three relationships may exist, e.g., a and/or B, may mean: a exists alone, A and B exist simultaneously, and B exists alone. In addition, the term "at least one" herein means any one of a plurality or any combination of at least two of a plurality, for example, including at least one of a, B, and C, and may mean including any one or more elements selected from the group consisting of a, B, and C.
Furthermore, in the following detailed description, numerous specific details are set forth in order to provide a better understanding of the present disclosure. It will be understood by those skilled in the art that the present disclosure may be practiced without some of these specific details. In some instances, methods, means, elements and circuits that are well known to those skilled in the art have not been described in detail so as not to obscure the subject matter of the present disclosure.
Fig. 1 shows a flow chart of an interaction method according to an embodiment of the present disclosure. The execution subject of the interactive method may be an interactive device. For example, the interaction method may be performed by a terminal device or a server or other processing device. The terminal device may be a User Equipment (UE), a mobile device, a User terminal, a sound box, a cellular phone, a cordless phone, a Personal Digital Assistant (PDA), a handheld device, a computing device, a vehicle-mounted device, or a wearable device. In some possible implementations, the interaction method may be implemented by a processor invoking computer readable instructions stored in a memory. As shown in fig. 1, the interactive method includes steps S11 to S15.
In step S11, user input information is received.
In the disclosed embodiment, the user input information may be voice, text or other information input by the user.
In one possible implementation, the user input information is speech input by the user. For example, in an application scenario of voice interaction, the user input information may be voice input by the user.
In step S12, a semantic vector corresponding to the user input information is determined.
In one possible implementation, if the user input information is voice input by the user, ASR (Automatic Speech Recognition) technology may be used to convert the user input information into text. The text obtained by conversion can be input into the deep learning model, and a semantic vector corresponding to the user input information is output through the deep learning model. In this implementation, the deep learning model may be an NLU (Natural Language Understanding) based technology, where the NLU technology may be any technology capable of Understanding information such as semantics and intention of human Natural Language. In this implementation, the deep learning model may be an RNN (Recurrent Neural Network), a TextCNN (Convolutional Neural Network for text classification), a model based on a Transformer structure, or the like, which is not limited in this embodiment of the disclosure.
In another possible implementation manner, if the user input information is a text input by the user, the user input information may be directly input into the deep learning model, and the semantic vector corresponding to the user input information is output through the deep learning model.
In step S13, a matching template vector corresponding to the user input information is determined, where the matching template vector represents a vector of a template matching the user input information, and the template matching the user input information at least includes a preset basic template.
The matching template corresponding to the user input information represents a template matched with the user input information.
In one possible implementation, a matching template vector corresponding to the user input information may be determined by searching a matching model.
In the embodiment of the present disclosure, if the user input information is the voice input by the user, ASR technology may be adopted to convert the user input information into a text, and then a template matching the text obtained by conversion is determined; if the user input information is the text input by the user, the template matched with the user input information can be directly determined.
In embodiments of the present disclosure, the templates include a base template and a non-base template. The template that matches the user-entered information may include at least a base template and possibly a non-base template.
Fig. 2 illustrates a schematic diagram of a template matched with user input information in an interaction method according to an embodiment of the present disclosure. In FIG. 2, mbase Denotes a basic form, mu Representing non-base templates, the templates matching the user input information includebase template 1,base template 2,base template 3, andnon-base template 6.
In one possible implementation, determining a matching template vector corresponding to the user input information includes: and respectively determining the vectors of all the basic templates as matching template vectors corresponding to the input information of the user. In this implementation, all the basic templates are used as templates matched with the user input information, that is, vectors of all the basic templates are used as matching template vectors corresponding to the user input information. For example, in the example shown in fig. 2, the base template includesbase template 1,base template 2, andbase template 3, and then vectors ofbase template 1,base template 2, andbase template 3 are respectively determined as matching template vectors corresponding to the user input information.
In another possible implementation manner, determining a matching template vector corresponding to the user input information includes: if the user input information conforms to the sentence pattern of any non-basic template, determining the vector of the non-basic template as a matching template vector corresponding to the user input information; wherein, the user input information accords with the sentence pattern of any non-basic template, and comprises the following steps: the user input information contains entities of the set of entities in the sentence of the non-base template.
For example, the period ofnon-base template 1 is @ { song } of "@ { artist }", where @ { artist } represents the collection of entities of the artist and @ { song } represents the collection of entities of the song. For example, if the user input information is "i want to listen to celadon in zhou lungje", if the entity set @ { artist } contains the entity "zhou lungje", and the entity set @ { song } contains the entity "celadon", it may be determined that the user input information contains the entity set in the sentence pattern of thenon-base template 1, and thus it may be determined that the user input information conforms to the sentence pattern of thenon-base template 1. For another example, if the user input information is "success of three Zhao", if the entity set @ { artist } includes the entity "three Zhao", and the entity set @ { song } includes the entity "success", it may be determined that the user input information includes the entity set in the sentence pattern of thenon-basic template 1, and thus it may be determined that the user input information conforms to the sentence pattern of thenon-basic template 1.
In embodiments of the present disclosure, a set of entities may represent a set of entities of the same attribute. For example, the entities in the entity set @ artist are artists, and the entities in the entity set @ song are songs.
In step S14, a matching template statistical vector corresponding to the user input information is determined based on the matching template vector and the semantic vector.
In one possible implementation manner, determining a matching template statistical vector corresponding to the user input information based on the matching template vector and the semantic vector includes: and processing the matching template vector and the semantic vector based on an attention mechanism to obtain a matching template statistical vector corresponding to the user input information.
In a possible implementation manner, processing the matching template vector and the semantic vector based on an attention mechanism to obtain a matching template statistical vector corresponding to the user input information includes: determining the weight of the matching template vector according to the similarity of the matching template vector and the semantic vector; and weighting the matched template vector based on the weight of the matched template vector to obtain a matched template statistical vector corresponding to the user input information.
In fig. 2, the semantic vector vsentric corresponding to the vector of the template and the user input information is indicated by a line segment with an arrow. In the example shown in fig. 2, the vectors of thebase template 1, thebase template 2, thebase template 3 and thenon-base template 6 have a similarity of 0.1, 0.7, 0.1 and 0.1, respectively, to the semantic vector vsentric. For example, matching template statistics vector Vmemory = w1 ×mbase1 +w2 ×mbase2 +w3 ×mbase3 +w6 ×mu6 . Wherein w1 Shows a base form 1 (m)base1 ) Weight of (1), w2 Represents the basic form 2 (m)base2 ) Weight of (b), w3 Indicates the basic form 3 (m)base3 ) Weight of (1), w6 Represents a non-basic template 6 (m)u6 ) The weight of (c).
In one possible implementation manner, determining the weight of the matching template vector according to the similarity between the matching template vector and the semantic vector includes: and carrying out normalization processing on the similarity of the matching template vector and the semantic vector to obtain the weight of the matching template vector. For example, the templates that match the user input information include thebase template 1, thebase template 2, thebase template 3, and thenon-base template 6, i.e., the matching template vector includes the vector of thebase template 1, the vector of thebase template 2, the vector of thebase template 3, and the vector of thenon-base template 6. Wherein, the similarity between the vector of thebasic template 1 and the semantic vector is s1 The similarity between the vector of thebasic template 2 and the semantic vector is s2 The similarity between the vector of thebasic template 3 and the semantic vector is s3 The similarity between the vector of thenon-basic template 6 and the semantic vector is s6 Then the sum of similarity of the matching template vector and the semantic vector is sa =s1 +s2 +s3 +s6 . Weight w of thebase template 11 =s1 /sa Weight w of thebase template 22 =s2 /sa Weight w of thebase template 33 =s3 /sa Weight w ofnon-basic template 66 =s6 /sa 。
In the embodiment of the disclosure, because the basic template is added to calculate the statistical vector of the matching template, the influence of dirty data can be reduced, and even if the dirty data is hit by searching and matching, a more accurate interaction result can be obtained.
In step S15, an interaction result corresponding to the user input information is output based on at least the semantic vector and the matching template statistical vector.
In the disclosed embodiment, the semantic vector and the matching template statistical vector are combined to respond to the user.
In one possible implementation, outputting an interaction result corresponding to the user input information based on at least the semantic vector and the matching template statistical vector includes: performing connection processing on the semantic vector and the statistical vector of the matching template to obtain a connection vector; and outputting an interaction result corresponding to the user input information based on the connection vector. In this implementation, the join process may refer to a coordinate process.
In one possible implementation manner, outputting an interaction result corresponding to the user input information based on the connection vector includes: performing linear dimensionality reduction on the connecting vector to obtain a dimensionality reduction vector, wherein the dimensionality of the dimensionality reduction vector is the same as the classification number; and inputting the dimension reduction vector into the softmax layer, and outputting an interaction result corresponding to the user input information through the softmax layer.
In another possible implementation manner, outputting an interaction result corresponding to the user input information based on the semantic vector and the matching template statistical vector includes: adding the semantic vector and the statistical vector of the matching template to obtain a sum vector of the semantic vector and the statistical vector of the matching template; and outputting an interaction result corresponding to the user input information based on the sum vector. For example, performing linear dimensionality reduction on the sum vector to obtain a dimensionality reduction vector, wherein the dimensionality of the dimensionality reduction vector is the same as the classification number; and inputting the dimension reduction vector into the softmax layer, and outputting an interaction result corresponding to the user input information through the softmax layer.
In another possible implementation manner, outputting an interaction result corresponding to the user input information based on the semantic vector and the matching template statistical vector includes: multiplying the semantic vector by the statistical vector of the matching template to obtain a product vector of the semantic vector and the statistical vector of the matching template; and outputting an interaction result corresponding to the user input information based on the product vector. For example, performing linear dimensionality reduction on the product vector to obtain a dimensionality reduction vector, wherein the dimensionality of the dimensionality reduction vector is the same as the classification number; and inputting the dimension reduction vector into the softmax layer, and outputting an interaction result corresponding to the user input information through the softmax layer.
Fig. 3 shows a schematic diagram of an interaction method according to an embodiment of the present disclosure. In the example shown in fig. 3, the user input information is "celadon of zhorenjie". And searching and matching in the memory module, and determining a template matched with the information input by the user. In fig. 3, the templates matching the user input information include all basic templates and 3 non-basic templates. And processing the matching template vector and the semantic vector Vsemail based on an Attention mechanism to obtain a matching template statistical vector Vmemory corresponding to the user input information. The semantic vector Vsemantic with the same dimension as the statistical vector Vmemory of the matching template can be obtained through deep learning model (such as neural network) of the user input information, connection (linkage) processing and linear dimension reduction. Connecting the semantic vector Vsemail and the statistical vector Vmemory of the matching template to obtain a connecting vector; and performing linear reduction and softmax regression on the connection vector to obtain an interaction result.
In the embodiment of the disclosure, by receiving user input information, determining a semantic vector corresponding to the user input information, and determining a matching template vector corresponding to the user input information, wherein a template matching the user input information at least includes a preset basic template, determining a matching template statistical vector corresponding to the user input information based on the matching template vector and the semantic vector, and outputting an interaction result corresponding to the user input information based on the semantic vector and the matching template statistical vector, the influence of dirty data on the interaction can be reduced, and the accuracy of a result returned to a user in the interaction can be improved.
The interaction method provided by the embodiment of the disclosure can be modeled based on a Memory Network (Memory-Network), different templates (a basic template and a non-basic template) are used as Memory (Memory) modules, and the Memory modules provide characteristics for a neural Network (Network) module. By adopting the embodiment of the disclosure, a more accurate interaction result can still be obtained when the memory module contains noise.
Fig. 4 shows a schematic diagram of an interaction method according to an embodiment of the present disclosure. As shown in fig. 4, the interaction method provided by the embodiment of the present disclosure provides an end-to-end scheme, and changes a serial structure in the related art into a parallel and single structure, thereby reducing the maintenance difficulty.
In one possible implementation, the interaction method provided by the embodiment of the present disclosure may be implemented by a dialog system. Fig. 5 shows a schematic diagram of a dialog system performing an interaction method according to an embodiment of the present disclosure. As shown in fig. 5, after receiving the input user input information, if the user input information is voice input by the user, the ASR technology is adopted to convert the user input information into text; obtaining a semantic vector based on the text obtained by conversion by adopting a natural speech understanding technology; the service is executed again (i.e. steps S13 to S15 are executed), and a service reply (i.e. an interaction result) is obtained.
Fig. 6 shows a flow diagram of another interaction method according to an embodiment of the present disclosure. As shown in fig. 6, the method may include steps S21 to S25.
In step S21, user input information is received.
In one possible implementation, the user input information is speech input by the user.
In step S22, a semantic vector corresponding to the user input information is determined by the deep learning model.
In the embodiment of the present disclosure, the deep learning model may be RNN, textCNN, or a model based on a transform structure, and the like, which is not limited in the embodiment of the present disclosure.
In step S23, a matching template vector corresponding to the user input information is determined by searching the matching model, where the matching template vector represents a vector of templates matching the user input information, and the templates matching the user input information at least include a preset basic template.
In one possible implementation, determining a matching template vector corresponding to the user input information by searching the matching model includes: and respectively determining the vectors of all the basic templates as matching template vectors corresponding to the input information of the user.
In one possible implementation, determining a matching template vector corresponding to the user input information by searching the matching model includes: if the user input information conforms to the sentence pattern of any non-basic template, determining the vector of the non-basic template as a matching template vector corresponding to the user input information; wherein, the user input information accords with any sentence pattern of the non-basic template, including: the user input information contains entities of the set of entities in the sentence of the non-base template.
In step S24, the matching template vector and the semantic vector are processed based on the attention mechanism, and a matching template statistical vector corresponding to the user input information is obtained.
In a possible implementation manner, processing the matching template vector and the semantic vector based on an attention mechanism to obtain a matching template statistical vector corresponding to the user input information includes: determining the weight of the matching template vector according to the similarity of the matching template vector and the semantic vector; and weighting the matched template vector based on the weight of the matched template vector to obtain a matched template statistical vector corresponding to the user input information.
In one possible implementation manner, determining the weight of the matching template vector according to the similarity between the matching template vector and the semantic vector includes: and carrying out normalization processing on the similarity of the matching template vector and the semantic vector to obtain the weight of the matching template vector.
In step S25, an interaction result corresponding to the user input information is output based on at least the semantic vector and the matching template statistical vector.
In one possible implementation, outputting an interaction result corresponding to the user input information based on at least the semantic vector and the matching template statistical vector includes: performing connection processing on the semantic vector and the statistical vector of the matching template to obtain a connection vector; and outputting an interaction result corresponding to the input information of the user based on the connection vector.
In one possible implementation manner, outputting an interaction result corresponding to the user input information based on the connection vector includes: carrying out linear dimensionality reduction on the connecting vectors to obtain dimensionality reduction vectors, wherein the dimensionalities of the dimensionality reduction vectors are the same as the classification number; and inputting the dimension reduction vector into the softmax layer, and outputting an interaction result corresponding to the user input information through the softmax layer.
In the embodiment of the disclosure, by receiving user input information, determining a semantic vector corresponding to the user input information through a deep learning model, and determining a matching template vector corresponding to the user input information through searching a matching model, wherein a template matching the user input information at least comprises a preset basic template, determining a matching template statistical vector corresponding to the user input information based on the matching template vector and the semantic vector, and outputting an interaction result corresponding to the user input information based on the semantic vector and the matching template statistical vector, the influence of dirty data on the interaction can be reduced, so that the accuracy of a result returned to a user in the interaction can be improved.
It is understood that the above-mentioned embodiments of the method of the present disclosure can be combined with each other to form a combined embodiment without departing from the principle logic, which is limited by the space, and the detailed description of the present disclosure is omitted.
It will be understood by those of skill in the art that in the above method of the present embodiment, the order of writing the steps does not imply a strict order of execution and does not impose any limitations on the implementation, as the order of execution of the steps should be determined by their function and possibly inherent logic.
In addition, the present disclosure also provides an interaction device, a sound box, an electronic device, a computer-readable storage medium, and a program, which can be used to implement any one of the interaction methods provided by the present disclosure, and the corresponding technical solutions and descriptions and corresponding descriptions in the method sections are not repeated.
Fig. 7 shows a block diagram of an interaction device according to an embodiment of the present disclosure, which, as shown in fig. 7, includes: a receivingmodule 31, configured to receive user input information; a first determiningmodule 32, configured to determine a semantic vector corresponding to the user input information; the second determiningmodule 33 is configured to determine a matching template vector corresponding to the user input information, where the matching template vector represents a vector of a template matching the user input information, and the template matching the user input information at least includes a preset basic template; a third determiningmodule 34, configured to determine, based on the matching template vector and the semantic vector, a matching template statistical vector corresponding to the user input information; and theoutput module 35 is configured to output an interaction result corresponding to the user input information based on at least the semantic vector and the matching template statistical vector.
In one possible implementation, the second determiningmodule 33 is configured to: and respectively determining the vectors of all the basic templates as matching template vectors corresponding to the input information of the user.
In one possible implementation, the second determiningmodule 33 is configured to: if the user input information conforms to the sentence pattern of any non-basic template, determining the vector of the non-basic template as a matching template vector corresponding to the user input information; wherein, the user input information accords with any sentence pattern of the non-basic template, including: the user input information contains entities of the set of entities in the sentence of the non-base template.
In one possible implementation, the third determiningmodule 34 is configured to: and processing the matching template vector and the semantic vector based on an attention mechanism to obtain a matching template statistical vector corresponding to the user input information.
In one possible implementation, the third determiningmodule 34 is configured to: determining the weight of the matching template vector according to the similarity of the matching template vector and the semantic vector; and weighting the matched template vector based on the weight of the matched template vector to obtain a matched template statistical vector corresponding to the user input information.
In one possible implementation, the third determiningmodule 34 is configured to: and carrying out normalization processing on the similarity of the matching template vector and the semantic vector to obtain the weight of the matching template vector.
In one possible implementation, theoutput module 35 is configured to: performing connection processing on the semantic vector and the statistical vector of the matching template to obtain a connection vector; and outputting an interaction result corresponding to the input information of the user based on the connection vector.
In one possible implementation, theoutput module 35 is configured to: performing linear dimensionality reduction on the connecting vector to obtain a dimensionality reduction vector, wherein the dimensionality of the dimensionality reduction vector is the same as the classification number; and inputting the dimension reduction vector into the softmax layer, and outputting an interaction result corresponding to the user input information through the softmax layer.
In one possible implementation, the user input information is speech input by the user.
In the embodiment of the disclosure, by receiving user input information, determining a semantic vector corresponding to the user input information, and determining a matching template vector corresponding to the user input information, where a template matching the user input information at least includes a preset basic template, determining a matching template statistical vector corresponding to the user input information based on the matching template vector and the semantic vector, and outputting an interaction result corresponding to the user input information based on at least the semantic vector and the matching template statistical vector, the influence of dirty data on interaction can be reduced, and thus the accuracy of a result returned to a user in interaction can be improved.
Fig. 8 shows a block diagram of an acoustic enclosure according to an embodiment of the present disclosure, as shown in fig. 8, the acoustic enclosure comprising: a receivingmodule 41, configured to receive user input information; a first determiningmodule 42, configured to determine a semantic vector corresponding to the user input information; a second determiningmodule 43, configured to determine a matching template vector corresponding to the user input information, where the matching template vector represents a vector of a template matching the user input information, and the template matching the user input information at least includes a preset basic template; a third determiningmodule 44, configured to determine, based on the matching template vector and the semantic vector, a matching template statistical vector corresponding to the user input information; and theoutput module 45 is configured to output an interaction result corresponding to the user input information based on at least the semantic vector and the matching template statistical vector.
In one possible implementation, the second determiningmodule 43 is configured to: and respectively determining the vectors of all the basic templates as matching template vectors corresponding to the input information of the user.
In one possible implementation, the second determiningmodule 43 is configured to: if the user input information conforms to the sentence pattern of any non-basic template, determining the vector of the non-basic template as a matching template vector corresponding to the user input information; wherein, the user input information accords with the sentence pattern of any non-basic template, and comprises the following steps: the user input information contains entities of the set of entities in the sentence of the non-base template.
In one possible implementation, the third determiningmodule 44 is configured to: and processing the matching template vector and the semantic vector based on an attention mechanism to obtain a matching template statistical vector corresponding to the user input information.
In one possible implementation, the third determiningmodule 44 is configured to: determining the weight of the matching template vector according to the similarity of the matching template vector and the semantic vector; and weighting the matched template vector based on the weight of the matched template vector to obtain a matched template statistical vector corresponding to the user input information.
In one possible implementation, the third determiningmodule 44 is configured to: and carrying out normalization processing on the similarity of the matching template vector and the semantic vector to obtain the weight of the matching template vector.
In one possible implementation, theoutput module 45 is configured to: performing connection processing on the semantic vector and the statistical vector of the matching template to obtain a connection vector; and outputting an interaction result corresponding to the user input information based on the connection vector.
In one possible implementation, theoutput module 45 is configured to: performing linear dimensionality reduction on the connecting vector to obtain a dimensionality reduction vector, wherein the dimensionality of the dimensionality reduction vector is the same as the classification number; and inputting the dimension reduction vector into the softmax layer, and outputting an interaction result corresponding to the user input information through the softmax layer.
In one possible implementation, the user input information is speech input by the user.
In the embodiment of the disclosure, by receiving user input information, determining a semantic vector corresponding to the user input information, and determining a matching template vector corresponding to the user input information, wherein a template matching the user input information at least includes a preset basic template, determining a matching template statistical vector corresponding to the user input information based on the matching template vector and the semantic vector, and outputting an interaction result corresponding to the user input information based on the semantic vector and the matching template statistical vector, the influence of dirty data on the interaction can be reduced, and the accuracy of a result returned to a user in the interaction can be improved.
In some embodiments, the functions or included modules of the apparatus and the audio box provided in the embodiments of the present disclosure may be used to execute the method described in the above method embodiments, and for specific implementation, reference may be made to the description of the above method embodiments, and for brevity, details are not described here again.
Embodiments of the present disclosure also provide a computer-readable storage medium, on which computer program instructions are stored, and when executed by a processor, the computer program instructions implement the above method. The computer readable storage medium may be a non-volatile computer readable storage medium.
An embodiment of the present disclosure further provides an electronic device, including: a processor; a memory for storing processor-executable instructions; wherein the processor is configured as the above method.
The electronic device may be provided as a terminal, server, or other form of device.
Fig. 9 illustrates a block diagram of anelectronic device 800 in accordance with an embodiment of the disclosure. For example, theelectronic device 800 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, or the like terminal.
Referring to fig. 9,electronic device 800 may include one or more of the following components: processingcomponent 802,memory 804,power component 806,multimedia component 808,audio component 810, input/output (I/O)interface 812,sensor component 814, andcommunication component 816.
Theprocessing component 802 generally controls overall operation of theelectronic device 800, such as operations associated with display, telephone calls, data communications, camera operations, and recording operations. Theprocessing component 802 may include one ormore processors 820 to execute instructions to perform all or a portion of the steps of the methods described above. Further, theprocessing component 802 can include one or more modules that facilitate interaction between theprocessing component 802 and other components. For example, theprocessing component 802 can include a multimedia module to facilitate interaction between themultimedia component 808 and theprocessing component 802.
Thememory 804 is configured to store various types of data to support operations at theelectronic device 800. Examples of such data include instructions for any application or method operating on theelectronic device 800, contact data, phonebook data, messages, pictures, videos, and so forth. Thememory 804 may be implemented by any type or combination of volatile or non-volatile memory devices, such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disks.
Thepower supply component 806 provides power to the various components of theelectronic device 800. Thepower components 806 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for theelectronic device 800.
Themultimedia component 808 includes a screen that provides an output interface between theelectronic device 800 and a user. In some embodiments, the screen may include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive an input signal from a user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundary of a touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, themultimedia component 808 includes a front facing camera and/or a rear facing camera. The front camera and/or the rear camera may receive external multimedia data when theelectronic device 800 is in an operation mode, such as a shooting mode or a video mode. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
Theaudio component 810 is configured to output and/or input audio signals. For example, theaudio component 810 includes a Microphone (MIC) configured to receive external audio signals when theelectronic device 800 is in an operational mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signals may further be stored in thememory 804 or transmitted via thecommunication component 816. In some embodiments,audio component 810 also includes a speaker for outputting audio signals.
The I/O interface 812 provides an interface between theprocessing component 802 and peripheral interface modules, which may be keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to: a home button, a volume button, a start button, and a lock button.
Thesensor assembly 814 includes one or more sensors for providing various aspects of state assessment for theelectronic device 800. For example, thesensor assembly 814 may detect an open/closed state of theelectronic device 800, the relative positioning of components, such as a display and keypad of theelectronic device 800, thesensor assembly 814 may also detect a change in position of theelectronic device 800 or a component of theelectronic device 800, the presence or absence of user contact with theelectronic device 800, orientation or acceleration/deceleration of theelectronic device 800, and a change in temperature of theelectronic device 800.Sensor assembly 814 may include a proximity sensor configured to detect the presence of a nearby object without any physical contact. Thesensor assembly 814 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, thesensor assembly 814 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
Thecommunication component 816 is configured to facilitate wired or wireless communication between theelectronic device 800 and other devices. Theelectronic device 800 may access a wireless network based on a communication standard, such as WiFi,2G or 3G, or a combination thereof. In an exemplary embodiment, thecommunication component 816 receives broadcast signals or broadcast related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, thecommunication component 816 further includes a Near Field Communication (NFC) module to facilitate short-range communications. For example, the NFC module may be implemented based on Radio Frequency Identification (RFID) technology, infrared data association (IrDA) technology, ultra Wideband (UWB) technology, bluetooth (BT) technology, and other technologies.
In an exemplary embodiment, theelectronic device 800 may be implemented by one or more Application Specific Integrated Circuits (ASICs), digital Signal Processors (DSPs), digital Signal Processing Devices (DSPDs), programmable Logic Devices (PLDs), field Programmable Gate Arrays (FPGAs), controllers, micro-controllers, microprocessors, or other electronic components for performing the above-described methods.
In an exemplary embodiment, a non-transitory computer-readable storage medium, such as thememory 804, is also provided that includes computer program instructions executable by theprocessor 820 of theelectronic device 800 to perform the above-described methods.
Fig. 10 shows a block diagram of anelectronic device 1900 according to an embodiment of the disclosure. For example, theelectronic device 1900 may be provided as a server. Referring to fig. 10,electronic device 1900 includes aprocessing component 1922 further including one or more processors and memory resources, represented bymemory 1932, for storing instructions, e.g., applications, executable byprocessing component 1922. The application programs stored inmemory 1932 may include one or more modules that each correspond to a set of instructions. Further, theprocessing component 1922 is configured to execute instructions to perform the above-described method.
Theelectronic device 1900 may also include apower component 1926 configured to perform power management of theelectronic device 1900, a wired orwireless network interface 1950 configured to connect theelectronic device 1900 to a network, and an input/output (I/O)interface 1958. Theelectronic device 1900 may operate based on an operating system stored inmemory 1932, such as Windows Server, mac OS XTM, unixTM, linuxTM, freeBSDTM, or the like.
In an exemplary embodiment, a non-transitory computer readable storage medium, such as thememory 1932, is also provided that includes computer program instructions executable by theprocessing component 1922 of theelectronic device 1900 to perform the above-described methods.
The present disclosure may be systems, methods, and/or computer program products. The computer program product may include a computer-readable storage medium having computer-readable program instructions embodied thereon for causing a processor to implement various aspects of the present disclosure.
The computer readable storage medium may be a tangible device that can hold and store the instructions for use by the instruction execution device. The computer readable storage medium may be, for example, but not limited to, an electronic memory device, a magnetic memory device, an optical memory device, an electromagnetic memory device, a semiconductor memory device, or any suitable combination of the foregoing. More specific examples (a non-exhaustive list) of the computer readable storage medium would include the following: a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a Static Random Access Memory (SRAM), a portable compact disc read-only memory (CD-ROM), a Digital Versatile Disc (DVD), a memory stick, a floppy disk, a mechanical coding device, such as punch cards or in-groove projection structures having instructions stored thereon, and any suitable combination of the foregoing. Computer-readable storage media as used herein is not to be construed as transitory signals per se, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through a waveguide or other transmission medium (e.g., optical pulses through a fiber optic cable), or electrical signals transmitted through electrical wires.
The computer-readable program instructions described herein may be downloaded from a computer-readable storage medium to a respective computing/processing device, or to an external computer or external storage device via a network, such as the internet, a local area network, a wide area network, and/or a wireless network. The network may include copper transmission cables, fiber optic transmission, wireless transmission, routers, firewalls, switches, gateway computers and/or edge servers. The network adapter card or network interface in each computing/processing device receives computer-readable program instructions from the network and forwards the computer-readable program instructions for storage in a computer-readable storage medium in the respective computing/processing device.
The computer program instructions for carrying out operations of the present disclosure may be assembler instructions, instruction Set Architecture (ISA) instructions, machine-related instructions, microcode, firmware instructions, state setting data, or source or object code written in any combination of one or more programming languages, including an object oriented programming language such as Smalltalk, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The computer-readable program instructions may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider). In some embodiments, the electronic circuitry that can execute the computer-readable program instructions implements aspects of the present disclosure by utilizing the state information of the computer-readable program instructions to personalize the electronic circuitry, such as a programmable logic circuit, a Field Programmable Gate Array (FPGA), or a Programmable Logic Array (PLA).
Various aspects of the present disclosure are described herein with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the disclosure. It will be understood that each block of the flowchart illustrations and/or block diagrams, and combinations of blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer-readable program instructions.
These computer-readable program instructions may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions/acts specified in the flowchart and/or block diagram block or blocks. These computer readable program instructions may also be stored in a computer readable storage medium that can direct a computer, programmable data processing apparatus, and/or other devices to function in a particular manner, such that the computer readable medium storing the instructions comprises an article of manufacture including instructions which implement the function/act specified in the flowchart and/or block diagram block or blocks.
The computer readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other devices to cause a series of operational steps to be performed on the computer, other programmable apparatus or other devices to produce a computer implemented process such that the instructions which execute on the computer, other programmable apparatus or other devices implement the functions/acts specified in the flowchart and/or block diagram block or blocks.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of instructions, which comprises one or more executable instructions for implementing the specified logical function(s). In some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
Having described embodiments of the present disclosure, the foregoing description is intended to be exemplary, not exhaustive, and not limited to the disclosed embodiments. Many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The terms used herein were chosen in order to best explain the principles of the embodiments, the practical application, or technical improvements to the techniques in the marketplace, or to enable others of ordinary skill in the art to understand the embodiments disclosed herein.