Semantic analysis method, device and equipment based on human-computer interaction and storage medium
1. A semantic analysis method based on human-computer interaction is characterized by comprising the following steps:
obtaining a conversation sample, wherein the conversation sample comprises a conversation sentence and a slot position label, and obtaining a first preset network, and the first preset network comprises a first network layer, a second network layer, a third network layer and a fourth network layer;
analyzing the dialogue statement based on the first network layer to obtain an output vector, wherein the output vector comprises a semantic vector;
performing intention identification on the semantic vector based on the second network layer to obtain an intention vector;
performing self-attention analysis on each statement participle in the dialogue statement based on the output vector and the intention vector of the third network layer to obtain slot position characteristics of each statement participle;
analyzing the slot position characteristics based on the fourth network layer to obtain a first prediction label of the first preset network for the conversation statement;
compressing the first preset network to obtain a second preset network, and inputting the dialogue sentences into the second preset network to obtain a second prediction label;
calculating a first loss value of the second preset network according to the first prediction tag and the second prediction tag, and calculating a second loss value of the second preset network according to the slot position tag and the second prediction tag;
determining a target loss value of the second preset network according to the first loss value and the second loss value, and adjusting parameters in the second preset network according to the target loss value until the target loss value is not reduced any more, so as to obtain a semantic analysis model;
when a semantic analysis request is received, obtaining a statement to be analyzed according to the semantic analysis request, and inputting the statement to be analyzed into the semantic analysis model to obtain semantic information of the target statement, wherein the semantic information comprises target intention and slot position information.
2. The human-computer interaction based semantic parsing method according to claim 1, wherein the analyzing the dialog sentence based on the first network layer to obtain an output vector comprises:
performing word segmentation processing on the dialogue sentences to obtain a plurality of sentence word segments;
determining the word segmentation position and the word segmentation paragraph of each sentence word in the dialogue sentence;
acquiring a vector mapping table, and coding each sentence participle according to the vector mapping table to obtain a coding vector of each sentence participle;
splicing the coding vector, the word segmentation position and the word segmentation paragraph to obtain an input vector;
processing the input vector according to a forward long-short term memory network to obtain a first vector, and processing the input vector according to a reverse long-short term memory network to obtain a second vector;
and splicing the first vector and the second vector to obtain the output vector.
3. The human-computer interaction based semantic analysis method according to claim 1, wherein the self-attention analysis of each sentence segmentation in the conversational sentence based on the output vector and the intention vector by the third network layer to obtain a slot feature of each sentence segmentation comprises:
extracting a participle characterization vector of each sentence participle from the output vector;
performing context analysis on the word segmentation characterization vectors according to the output vectors to obtain a context characterization vector of each sentence word segmentation;
splicing each context representation vector and the intention vector to obtain a spliced vector;
performing linear transformation on the splicing vector to obtain a gating vector;
and calculating the product of each word segmentation characterization vector and the gating vector to obtain the slot position characteristics of each sentence word segmentation.
4. The human-computer interaction based semantic analysis method according to claim 1, wherein the analyzing the slot features based on the fourth network layer to obtain a first predictive tag of the dialog sentence by the first preset network comprises:
acquiring a configuration matrix and configuration parameters in the fourth network layer;
multiplying the slot position features by the configuration matrix, and adding the configuration parameters to obtain a fractional vector of each statement word;
normalizing the fraction vector by adopting an activation function to obtain a probability vector of each sentence word segmentation;
and determining the category corresponding to the element with the largest value in the probability vector as the first prediction label.
5. The human-computer interaction based semantic analysis method according to claim 1, wherein the calculating a first loss value of the second predetermined network according to the first predictive tag and the second predictive tag comprises:
wherein L isdistillIs the first loss value, N is the number of dialog samples,outputting a Logit value for the ith output corresponding to the first prediction label output by the first preset network to the ith dialogue sample, wherein T is temperature,outputting a Logit value for the kth corresponding to the first prediction label output by the first preset network for the kth dialogue sample,an ith network Logit value corresponding to a second prediction label output by the second preset network for the ith dialogue sample,and outputting a kth network Logit value corresponding to a second prediction label for the kth dialogue sample by the second preset network.
6. The human-computer interaction based semantic analysis method according to claim 1, wherein the determining the target loss value of the second predetermined network according to the first loss value and the second loss value comprises:
determining an optimal hyper-parameter point from the dialogue sample by adopting a hyper-parameter grid search method, wherein the optimal hyper-parameter point comprises a target statement and a target label;
inputting the target statement into the second preset network to obtain a statement prediction tag;
vectorizing the target label to obtain a first vector, and vectorizing the prediction label to obtain a second vector;
calculating the similarity of the first vector and the second vector as a loss weight;
and carrying out weighted sum operation on the first loss value and the second loss value according to the loss weight to obtain the target loss value.
7. The human-computer interaction based semantic analysis method according to claim 1, wherein the semantic analysis model includes a second sub-layer and a fourth sub-layer, the sentence to be analyzed is input into the semantic analysis model to obtain semantic information of the target sentence, and the semantic information includes target intention and slot position information, including:
acquiring the second sublayer in the semantic analysis model as an intention identification layer;
acquiring an output result corresponding to the statement to be analyzed from the intention identification layer as a statement intention vector;
taking an intention corresponding to the element with the largest value in the statement intention vector as the target intention;
acquiring the fourth sublayer in the semantic analysis model as a slot position identification layer;
and acquiring an output result corresponding to the statement to be analyzed from the slot position identification layer as the slot position information.
8. A semantic analysis device based on human-computer interaction is characterized in that the semantic analysis device based on human-computer interaction comprises:
the device comprises an acquisition unit, a processing unit and a processing unit, wherein the acquisition unit is used for acquiring a conversation sample, the conversation sample comprises a conversation sentence and a slot position label, and acquiring a first preset network, and the first preset network comprises a first network layer, a second network layer, a third network layer and a fourth network layer;
the analysis unit is used for analyzing the dialogue statement based on the first network layer to obtain an output vector, and the output vector comprises a semantic vector;
the identification unit is used for carrying out intention identification on the semantic vector based on the second network layer to obtain an intention vector;
the analysis unit is further configured to perform self-attention analysis on each statement participle in the dialog statement based on the output vector and the intention vector by the third network layer to obtain a slot position feature of each statement participle;
the analysis unit is further configured to analyze the slot position feature based on the fourth network layer to obtain a first prediction tag of the first preset network for the conversation statement;
the processing unit is used for compressing the first preset network to obtain a second preset network and inputting the conversation statement into the second preset network to obtain a second prediction label;
a calculating unit, configured to calculate a first loss value of the second preset network according to the first prediction tag and the second prediction tag, and calculate a second loss value of the second preset network according to the slot position tag and the second prediction tag;
an adjusting unit, configured to determine a target loss value of the second preset network according to the first loss value and the second loss value, and adjust a parameter in the second preset network according to the target loss value until the target loss value is no longer reduced, so as to obtain a semantic analysis model;
the input unit is used for acquiring a statement to be analyzed according to a semantic analysis request when the semantic analysis request is received, and inputting the statement to be analyzed into the semantic analysis model to obtain semantic information of the target statement, wherein the semantic information comprises target intention and slot position information.
9. An electronic device, characterized in that the electronic device comprises:
a memory storing computer readable instructions; and
a processor executing computer readable instructions stored in the memory to implement the human-computer interaction based semantic parsing method of any one of claims 1 to 7.
10. A computer-readable storage medium characterized by: the computer-readable storage medium stores computer-readable instructions, which are executed by a processor in an electronic device to implement the human-computer interaction based semantic parsing method according to any one of claims 1 to 7.
Background
In the current human-computer dialogue system, the semantic information of the sentences in the dialogue scene is mainly analyzed through the spoken language understanding model constructed by the pre-training network, however, the structure of the spoken language understanding model constructed by the pre-training network is complex, and the analysis efficiency of the semantic information is low.
In order to improve the analysis efficiency, a lightweight neural network is adopted to construct a spoken language understanding model, however, the spoken language understanding model constructed by the method can only capture coarse-grained statement information, and cannot focus on fine-grained information among sequences and dimensions, so that the analysis accuracy is low.
Therefore, on the premise of ensuring the parsing efficiency, how to accurately parse the semantic information becomes a problem which needs to be solved urgently.
Disclosure of Invention
In view of the foregoing, it is desirable to provide a semantic analysis method, device, apparatus and storage medium based on human-computer interaction, which can accurately analyze semantic information while ensuring analysis efficiency.
On one hand, the invention provides a semantic analysis method based on human-computer interaction, which comprises the following steps:
obtaining a conversation sample, wherein the conversation sample comprises a conversation sentence and a slot position label, and obtaining a first preset network, and the first preset network comprises a first network layer, a second network layer, a third network layer and a fourth network layer;
analyzing the dialogue statement based on the first network layer to obtain an output vector, wherein the output vector comprises a semantic vector;
performing intention identification on the semantic vector based on the second network layer to obtain an intention vector;
performing self-attention analysis on each statement participle in the dialogue statement based on the output vector and the intention vector of the third network layer to obtain slot position characteristics of each statement participle;
analyzing the slot position characteristics based on the fourth network layer to obtain a first prediction label of the first preset network for the conversation statement;
compressing the first preset network to obtain a second preset network, and inputting the dialogue sentences into the second preset network to obtain a second prediction label;
calculating a first loss value of the second preset network according to the first prediction tag and the second prediction tag, and calculating a second loss value of the second preset network according to the slot position tag and the second prediction tag;
determining a target loss value of the second preset network according to the first loss value and the second loss value, and adjusting parameters in the second preset network according to the target loss value until the target loss value is not reduced any more, so as to obtain a semantic analysis model;
when a semantic analysis request is received, obtaining a statement to be analyzed according to the semantic analysis request, and inputting the statement to be analyzed into the semantic analysis model to obtain semantic information of the target statement, wherein the semantic information comprises target intention and slot position information.
According to a preferred embodiment of the present invention, the analyzing the dialog statement based on the first network layer to obtain an output vector includes:
performing word segmentation processing on the dialogue sentences to obtain a plurality of sentence word segments;
determining the word segmentation position and the word segmentation paragraph of each sentence word in the dialogue sentence;
acquiring a vector mapping table, and coding each sentence participle according to the vector mapping table to obtain a coding vector of each sentence participle;
splicing the coding vector, the word segmentation position and the word segmentation paragraph to obtain an input vector;
processing the input vector according to a forward long-short term memory network to obtain a first vector, and processing the input vector according to a reverse long-short term memory network to obtain a second vector;
and splicing the first vector and the second vector to obtain the output vector.
According to a preferred embodiment of the present invention, the performing, by the third network layer, self-attention analysis on each sentence segmentation in the conversational sentence based on the output vector and the intention vector to obtain a slot feature of each sentence segmentation includes:
extracting a participle characterization vector of each sentence participle from the output vector;
performing context analysis on the word segmentation characterization vectors according to the output vectors to obtain a context characterization vector of each sentence word segmentation;
splicing each context representation vector and the intention vector to obtain a spliced vector;
performing linear transformation on the splicing vector to obtain a gating vector;
and calculating the product of each word segmentation characterization vector and the gating vector to obtain the slot position characteristics of each sentence word segmentation.
According to a preferred embodiment of the present invention, the analyzing the slot feature based on the fourth network layer to obtain a first prediction tag of the dialog statement by the first preset network includes:
acquiring a configuration matrix and configuration parameters in the fourth network layer;
multiplying the slot position features by the configuration matrix, and adding the configuration parameters to obtain a fractional vector of each statement word;
normalizing the fraction vector by adopting an activation function to obtain a probability vector of each sentence word segmentation;
and determining the category corresponding to the element with the largest value in the probability vector as the first prediction label.
According to a preferred embodiment of the present invention, the calculating a first loss value of the second predetermined network according to the first prediction tag and the second prediction tag comprises:
wherein L isdistillIs the first loss value, N is the number of dialog samples,outputting a Logit value for the ith output corresponding to the first prediction label output by the first preset network to the ith dialogue sample, wherein T is temperature,outputting a Logit value for the kth corresponding to the first prediction label output by the first preset network for the kth dialogue sample,an ith network Logit value corresponding to a second prediction label output by the second preset network for the ith dialogue sample,and outputting a kth network Logit value corresponding to a second prediction label for the kth dialogue sample by the second preset network.
According to a preferred embodiment of the present invention, the determining the target loss value of the second predetermined network according to the first loss value and the second loss value comprises:
determining an optimal hyper-parameter point from the dialogue sample by adopting a hyper-parameter grid search method, wherein the optimal hyper-parameter point comprises a target statement and a target label;
inputting the target statement into the second preset network to obtain a statement prediction tag;
vectorizing the target label to obtain a first vector, and vectorizing the prediction label to obtain a second vector;
calculating the similarity of the first vector and the second vector as a loss weight;
and carrying out weighted sum operation on the first loss value and the second loss value according to the loss weight to obtain the target loss value.
According to a preferred embodiment of the present invention, the semantic analysis model includes a second sub-layer and a fourth sub-layer, the sentence to be analyzed is input into the semantic analysis model to obtain semantic information of the target sentence, and the semantic information including the target intention and slot position information includes:
acquiring the second sublayer in the semantic analysis model as an intention identification layer;
acquiring an output result corresponding to the statement to be analyzed from the intention identification layer as a statement intention vector;
taking an intention corresponding to the element with the largest value in the statement intention vector as the target intention;
acquiring the fourth sublayer in the semantic analysis model as a slot position identification layer;
and acquiring an output result corresponding to the statement to be analyzed from the slot position identification layer as the slot position information.
On the other hand, the invention also provides a semantic analysis device based on human-computer interaction, which comprises:
the device comprises an acquisition unit, a processing unit and a processing unit, wherein the acquisition unit is used for acquiring a conversation sample, the conversation sample comprises a conversation sentence and a slot position label, and acquiring a first preset network, and the first preset network comprises a first network layer, a second network layer, a third network layer and a fourth network layer;
the analysis unit is used for analyzing the dialogue statement based on the first network layer to obtain an output vector, and the output vector comprises a semantic vector;
the identification unit is used for carrying out intention identification on the semantic vector based on the second network layer to obtain an intention vector;
the analysis unit is further configured to perform self-attention analysis on each statement participle in the dialog statement based on the output vector and the intention vector by the third network layer to obtain a slot position feature of each statement participle;
the analysis unit is further configured to analyze the slot position feature based on the fourth network layer to obtain a first prediction tag of the first preset network for the conversation statement;
the processing unit is used for compressing the first preset network to obtain a second preset network and inputting the conversation statement into the second preset network to obtain a second prediction label;
a calculating unit, configured to calculate a first loss value of the second preset network according to the first prediction tag and the second prediction tag, and calculate a second loss value of the second preset network according to the slot position tag and the second prediction tag;
an adjusting unit, configured to determine a target loss value of the second preset network according to the first loss value and the second loss value, and adjust a parameter in the second preset network according to the target loss value until the target loss value is no longer reduced, so as to obtain a semantic analysis model;
the input unit is used for acquiring a statement to be analyzed according to a semantic analysis request when the semantic analysis request is received, and inputting the statement to be analyzed into the semantic analysis model to obtain semantic information of the target statement, wherein the semantic information comprises target intention and slot position information.
In another aspect, the present invention further provides an electronic device, including:
a memory storing computer readable instructions; and
a processor executing computer readable instructions stored in the memory to implement the human-computer interaction based semantic parsing method.
In another aspect, the present invention further provides a computer-readable storage medium, where computer-readable instructions are stored in the computer-readable storage medium, and the computer-readable instructions are executed by a processor in an electronic device to implement the human-computer interaction based semantic parsing method.
According to the technical scheme, the sentence to be analyzed is input into the second preset network compressed by the first preset network to be subjected to semantic analysis, so that the generation efficiency of the semantic information can be improved, and meanwhile, the first preset network performs joint adjustment on the first prediction tag of the dialogue sentence and the slot position tag corresponding to the dialogue sentence per se on the parameters in the second preset network, so that the analysis accuracy of the semantic analysis model can be improved, and the generation accuracy of the semantic information is improved.
Drawings
FIG. 1 is a flow chart of a preferred embodiment of the semantic parsing method based on human-computer interaction according to the invention.
FIG. 2 is a functional block diagram of a semantic analysis device based on human-computer interaction according to a preferred embodiment of the present invention.
FIG. 3 is a schematic structural diagram of an electronic device implementing a semantic analysis method based on human-computer interaction according to a preferred embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention will be described in detail with reference to the accompanying drawings and specific embodiments.
FIG. 1 is a flow chart of a preferred embodiment of the semantic parsing method based on human-computer interaction according to the present invention. The order of the steps in the flow chart may be changed and some steps may be omitted according to different needs.
The semantic analysis method based on human-computer interaction is applied to one or more electronic devices, where the electronic devices are devices capable of automatically performing numerical calculation and/or information processing according to preset or stored computer-readable instructions, and hardware thereof includes, but is not limited to, microprocessors, Application Specific Integrated Circuits (ASICs), Programmable Gate arrays (FPGAs), Digital Signal Processors (DSPs), embedded devices, and the like.
The electronic device may be any electronic product capable of performing human-computer interaction with a user, for example, a Personal computer, a tablet computer, a smart phone, a Personal Digital Assistant (PDA), a game machine, an interactive Internet Protocol Television (IPTV), a smart wearable device, and the like.
The electronic device may include a network device and/or a user device. Wherein the network device includes, but is not limited to, a single network electronic device, an electronic device group consisting of a plurality of network electronic devices, or a Cloud Computing (Cloud Computing) based Cloud consisting of a large number of hosts or network electronic devices.
The network in which the electronic device is located includes, but is not limited to: the internet, a wide area Network, a metropolitan area Network, a local area Network, a Virtual Private Network (VPN), and the like.
S10, obtaining a conversation sample, wherein the conversation sample comprises a conversation sentence and a slot position label, and obtaining a first preset network, and the first preset network comprises a first network layer, a second network layer, a third network layer and a fourth network layer.
In at least one embodiment of the present invention, the dialogue sample may be a training sample obtained from a human-computer interaction system.
The first predetermined network is constructed by a plurality of the first network layers, a plurality of the second network layers, a plurality of the third network layers, and a plurality of the fourth network layers.
S11, analyzing the dialogue statement based on the first network layer to obtain an output vector, wherein the output vector comprises a semantic vector.
In at least one embodiment of the invention, the first network layer is configured to analyze the conversational utterances.
The output vector includes the semantic vector and a participle characterization vector for each sentence participle in the conversational sentence.
The semantic vector is used to indicate the semantics of the dialog statement.
In at least one embodiment of the present invention, the analyzing, by the electronic device, the dialog statement based on the first network layer to obtain an output vector includes:
performing word segmentation processing on the dialogue sentences to obtain a plurality of sentence word segments;
determining the word segmentation position and the word segmentation paragraph of each sentence word in the dialogue sentence;
acquiring a vector mapping table, and coding each sentence participle according to the vector mapping table to obtain a coding vector of each sentence participle;
splicing the coding vector, the word segmentation position and the word segmentation paragraph to obtain an input vector;
processing the input vector according to a forward long-short term memory network to obtain a first vector, and processing the input vector according to a reverse long-short term memory network to obtain a second vector;
and splicing the first vector and the second vector to obtain the output vector.
And the vector mapping table stores coding values corresponding to a plurality of preset words.
The forward long-short term memory network and the reverse long-short term memory network are pre-constructed networks, and the construction mode of the forward long-short term memory network and the construction mode of the reverse long-short term memory network are not particularly limited.
Through the embodiment, the generation of the output vector not only considers the word segmentation position and the word segmentation paragraph of each sentence word segmentation, but also considers the influence of the forward direction and the reverse direction on the semantics in the dialogue sentences, so that the semantic representation accuracy of the output vector on the dialogue sentences can be improved.
And S12, performing intention identification on the semantic vector based on the second network layer to obtain an intention vector.
In at least one embodiment of the invention, the second network layer is used to analyze the intent of the statement.
The intent vector refers to a characterization of the intent of the dialog statement.
In at least one embodiment of the present invention, the electronic device performs intent recognition on the semantic vector based on the second network layer, and obtaining an intent vector includes:
acquiring a weight matrix and a bias parameter in the second network layer;
calculating the product of the semantic vector and the weight matrix to obtain a product vector;
and calculating the sum of the product vector and the bias parameter to obtain the intention vector.
The weight matrix and the bias parameter may be adjusted according to a loss value of the first predetermined network.
By the weight matrix and the bias parameters, the semantic vectors can be accurately classified and identified, and the intention vectors capable of representing the intention can be accurately generated.
And S13, performing self-attention analysis on each sentence participle in the dialogue sentence based on the output vector and the intention vector by the third network layer to obtain the slot position characteristic of each sentence participle.
In at least one embodiment of the present invention, the third network layer is configured to analyze slot information of each sentence segmentation in the conversational sentence.
The slot position feature refers to the representation of the slot position in the dialogue statement, and the slot position feature is represented by a vector. The number of dimensions of the slot features is the same as the number of categories of slot tags. For example, the number of categories of slot tags is 100, and the slot features are vectors of 100 dimensions.
In at least one embodiment of the present invention, the performing, by the electronic device, self-attention analysis on each sentence segmentation in the dialog sentence based on the output vector and the intention vector by the third network layer to obtain a slot position feature of each sentence segmentation includes:
extracting a participle characterization vector of each sentence participle from the output vector;
performing context analysis on the word segmentation characterization vectors according to the output vectors to obtain a context characterization vector of each sentence word segmentation;
splicing each context representation vector and the intention vector to obtain a spliced vector;
performing linear transformation on the splicing vector to obtain a gating vector;
and calculating the product of each word segmentation characterization vector and the gating vector to obtain the slot position characteristics of each sentence word segmentation.
Through the implementation mode, each sentence participle can be interacted with participles except the sentence participle in the dialogue sentence, and therefore the slot position characteristics can be accurately determined.
Specifically, the performing, by the electronic device, context analysis on the word segmentation characterization vector according to the output vector to obtain a context characterization vector of each sentence word segmentation includes:
combining elements except the word segmentation characterization vector in the output vector into a feature vector;
acquiring a self-attention layer in the third network layer;
and inputting the feature vector to the self-attention layer to obtain the context characterization vector.
S14, analyzing the slot position characteristics based on the fourth network layer to obtain a first prediction label of the first preset network to the conversation sentence.
In at least one embodiment of the present invention, the fourth network layer is configured to determine a corresponding tag according to a slot characteristic.
The first prediction tag is slot position information obtained after the first preset network analyzes the conversation statement.
In at least one embodiment of the present invention, the analyzing, by the electronic device, the slot feature based on the fourth network layer to obtain the first prediction tag of the dialog statement by the first preset network includes:
acquiring a configuration matrix and configuration parameters in the fourth network layer;
multiplying the slot position features by the configuration matrix, and adding the configuration parameters to obtain a fractional vector of each statement word;
normalizing the fraction vector by adopting an activation function to obtain a probability vector of each sentence word segmentation;
and determining the category corresponding to the element with the largest value in the probability vector as the first prediction label.
By normalizing the fraction vector, the first prediction label can be quickly determined according to the probability vector.
S15, compressing the first preset network to obtain a second preset network, and inputting the dialogue statement into the second preset network to obtain a second prediction label.
In at least one embodiment of the present invention, the second predetermined network refers to a student network of the first predetermined network.
The second prediction tag is slot position information obtained after the second preset network analyzes the conversation statement.
In at least one embodiment of the present invention, the compressing, by the electronic device, the first preset network to obtain a second preset network includes:
sub-layers with the number of preset values are extracted from the first network layer, and a first sub-layer is obtained;
sub-layers with the number of layers being the preset value are extracted from the second network layer, and a second sub-layer is obtained;
sub-layers with the number of layers being the preset value are extracted from the third network layer, and a third sub-layer is obtained;
sub-layers with the number of layers being the preset value are extracted from the fourth network layer, and a fourth sub-layer is obtained;
and splicing the first sublayer, the second sublayer, the third sublayer and the fourth sublayer to obtain the second preset network.
Wherein the preset value may be 1.
The second preset network can be quickly generated by directly extracting sublayers with the number of layers being the preset value from each network layer in the first preset network, and meanwhile, because the second preset network contains the information of each network layer in the first preset network, the characteristics in the first preset network are reserved in the second preset network, so that the conversation sentences can be predicted through the second preset network.
S16, calculating a first loss value of the second predetermined network according to the first prediction tag and the second prediction tag, and calculating a second loss value of the second predetermined network according to the slot tag and the second prediction tag.
In at least one embodiment of the present invention, the first loss value is determined according to a prediction result of the first predetermined network on the conversational sentence and a prediction result of the second predetermined network on the conversational sentence.
And the second loss value is determined according to the prediction result of the second preset network on the conversation sentence and the labeling result of the conversation sentence.
In at least one embodiment of the present invention, the electronic device calculating the first loss value of the second predetermined network according to the first prediction tag and the second prediction tag comprises:
wherein L isdistillIs the first loss value, N is the number of dialog samples,outputting a Logit value for the ith output corresponding to the first prediction label output by the first preset network to the ith dialogue sample, wherein T is temperature,outputting a Logit value for the kth corresponding to the first prediction label output by the first preset network for the kth dialogue sample,an ith network Logit value corresponding to a second prediction label output by the second preset network for the ith dialogue sample,and outputting a kth network Logit value corresponding to a second prediction label for the kth dialogue sample by the second preset network.
The first loss value can be accurately determined through the first prediction label and the second prediction label.
In at least one embodiment of the present invention, the calculating, by the electronic device, the second loss value of the second predetermined network according to the slot tag and the second prediction tag includes:
wherein L isCEY is a slot tag in the ith dialog sample for the second loss value,and when the temperature is the same, the second preset network outputs a second prediction label to the ith dialogue sample.
The second loss value can be accurately determined through the slot position tag and the second prediction tag.
S17, determining a target loss value of the second preset network according to the first loss value and the second loss value, and adjusting parameters in the second preset network according to the target loss value until the target loss value is not reduced any more, so as to obtain a semantic analysis model.
In at least one embodiment of the invention, the target loss value is determined from an optimal superparametric point in the dialogue sample.
The semantic analysis model is a second preset network when the target loss value is not reduced any more.
In at least one embodiment of the present invention, the determining, by the electronic device, the target loss value of the second preset network according to the first loss value and the second loss value includes:
determining an optimal hyper-parameter point from the dialogue sample by adopting a hyper-parameter grid search method, wherein the optimal hyper-parameter point comprises a target statement and a target label;
inputting the target statement into the second preset network to obtain a statement prediction tag;
vectorizing the target label to obtain a first vector, and vectorizing the prediction label to obtain a second vector;
calculating the similarity of the first vector and the second vector as a loss weight;
and carrying out weighted sum operation on the first loss value and the second loss value according to the loss weight to obtain the target loss value.
The sentence prediction label can be quickly obtained by inputting the target sentence into the second preset network, so that the loss weight can be quickly determined, and the target loss value can be quickly determined.
In at least one embodiment of the present invention, the electronic device adjusts parameters in the second preset network according to the target loss value until the target loss value is no longer reduced, and obtaining the semantic analysis model includes:
and adjusting parameters in the second sublayer, the third sublayer and the fourth sublayer according to the target loss value until the target loss value is not reduced any more, so as to obtain a semantic analysis model.
Parameters in the second preset network are adjusted through the target loss value, and the target loss value is determined according to sentence prediction labels and the similarity of the target labels, which are obtained by predicting the optimal hyper-parameter points through the second preset network, so that the analysis accuracy of the semantic analysis model can be improved.
S18, when a semantic analysis request is received, obtaining a statement to be analyzed according to the semantic analysis request, inputting the statement to be analyzed into the semantic analysis model, and obtaining semantic information of the target statement, wherein the semantic information comprises target intention and slot position information.
In at least one embodiment of the present invention, the semantic analysis request may be triggered by a user in charge of statement analysis, where the semantic analysis request carries information such as a target path.
The statement to be analyzed refers to a statement needing semantic analysis.
It is emphasized that, in order to further ensure the privacy and security of the semantic information, the semantic information may also be stored in a node of a block chain.
In at least one embodiment of the present invention, the obtaining, by the electronic device, the statement to be parsed according to the semantic parsing request includes:
analyzing the message of the semantic analysis request to obtain data information carried by the message;
acquiring information indicating a path from the data information as a target path;
and extracting any dialogue information from the target path to be used as the statement to be analyzed.
Through the embodiment, only the message needs to be analyzed, so that the data information can be quickly acquired, and the statement to be analyzed can be quickly acquired.
In at least one embodiment of the present invention, the electronic device inputs the sentence to be parsed into the semantic parsing model to obtain semantic information of the target sentence, where the semantic information includes target intent and slot position information, and the semantic information includes:
acquiring the second sublayer in the semantic analysis model as an intention identification layer;
acquiring an output result corresponding to the statement to be analyzed from the intention identification layer as a statement intention vector;
taking an intention corresponding to the element with the largest value in the statement intention vector as the target intention;
acquiring the fourth sublayer in the semantic analysis model as a slot position identification layer;
and acquiring an output result corresponding to the statement to be analyzed from the slot position identification layer as the slot position information.
The semantic information can be quickly and accurately determined through the intention identification layer and the slot position identification layer.
In at least one embodiment of the present invention, after obtaining semantic information of the target sentence, the method further includes:
acquiring a request number of the semantic analysis request;
generating prompt information according to the request number and the semantic information;
encrypting the prompt information by adopting a symmetric encryption technology to obtain a ciphertext;
and sending the ciphertext to the terminal equipment of the appointed contact person.
By the embodiment, the safety of the semantic information can be improved.
According to the technical scheme, the sentence to be analyzed is input into the second preset network compressed by the first preset network to be subjected to semantic analysis, so that the generation efficiency of the semantic information can be improved, and meanwhile, the first preset network performs joint adjustment on the first prediction tag of the dialogue sentence and the slot position tag corresponding to the dialogue sentence per se on the parameters in the second preset network, so that the analysis accuracy of the semantic analysis model can be improved, and the generation accuracy of the semantic information is improved.
FIG. 2 is a functional block diagram of a semantic analysis device based on human-computer interaction according to a preferred embodiment of the present invention. The semantic analysis device 11 based on human-computer interaction comprises an acquisition unit 110, an analysis unit 111, a recognition unit 112, a processing unit 113, a calculation unit 114, an adjustment unit 115, an input unit 116, a generation unit 117, an encryption unit 118 and a transmission unit 119. The module/unit referred to herein is a series of computer readable instruction segments that can be accessed by the processor 13 and perform a fixed function and that are stored in the memory 12. In the present embodiment, the functions of the modules/units will be described in detail in the following embodiments.
The obtaining unit 110 obtains a dialog sample, where the dialog sample includes a dialog statement and a slot tag, and obtains a first preset network, where the first preset network includes a first network layer, a second network layer, a third network layer, and a fourth network layer.
In at least one embodiment of the present invention, the dialogue sample may be a training sample obtained from a human-computer interaction system.
The first predetermined network is constructed by a plurality of the first network layers, a plurality of the second network layers, a plurality of the third network layers, and a plurality of the fourth network layers.
The analysis unit 111 analyzes the dialogue statement based on the first network layer to obtain an output vector, where the output vector includes a semantic vector.
In at least one embodiment of the invention, the first network layer is configured to analyze the conversational utterances.
The output vector includes the semantic vector and a participle characterization vector for each sentence participle in the conversational sentence.
The semantic vector is used to indicate the semantics of the dialog statement.
In at least one embodiment of the present invention, the analyzing unit 111 analyzes the dialog statement based on the first network layer, and obtaining an output vector includes:
performing word segmentation processing on the dialogue sentences to obtain a plurality of sentence word segments;
determining the word segmentation position and the word segmentation paragraph of each sentence word in the dialogue sentence;
acquiring a vector mapping table, and coding each sentence participle according to the vector mapping table to obtain a coding vector of each sentence participle;
splicing the coding vector, the word segmentation position and the word segmentation paragraph to obtain an input vector;
processing the input vector according to a forward long-short term memory network to obtain a first vector, and processing the input vector according to a reverse long-short term memory network to obtain a second vector;
and splicing the first vector and the second vector to obtain the output vector.
And the vector mapping table stores coding values corresponding to a plurality of preset words.
The forward long-short term memory network and the reverse long-short term memory network are pre-constructed networks, and the construction mode of the forward long-short term memory network and the construction mode of the reverse long-short term memory network are not particularly limited.
Through the embodiment, the generation of the output vector not only considers the word segmentation position and the word segmentation paragraph of each sentence word segmentation, but also considers the influence of the forward direction and the reverse direction on the semantics in the dialogue sentences, so that the semantic representation accuracy of the output vector on the dialogue sentences can be improved.
The identification unit 112 performs intent identification on the semantic vector based on the second network layer to obtain an intent vector.
In at least one embodiment of the invention, the second network layer is used to analyze the intent of the statement.
The intent vector refers to a characterization of the intent of the dialog statement.
In at least one embodiment of the present invention, the identifying unit 112 performs intent identification on the semantic vector based on the second network layer, and obtaining an intent vector includes:
acquiring a weight matrix and a bias parameter in the second network layer;
calculating the product of the semantic vector and the weight matrix to obtain a product vector;
and calculating the sum of the product vector and the bias parameter to obtain the intention vector.
The weight matrix and the bias parameter may be adjusted according to a loss value of the first predetermined network.
By the weight matrix and the bias parameters, the semantic vectors can be accurately classified and identified, and the intention vectors capable of representing the intention can be accurately generated.
The analysis unit 111 performs self-attention analysis on each sentence segmentation in the conversational sentence based on the output vector and the intention vector by the third network layer, and obtains a slot position feature of each sentence segmentation.
In at least one embodiment of the present invention, the third network layer is configured to analyze slot information of each sentence segmentation in the conversational sentence.
The slot position feature refers to the representation of the slot position in the dialogue statement, and the slot position feature is represented by a vector. The number of dimensions of the slot features is the same as the number of categories of slot tags. For example, the number of categories of slot tags is 100, and the slot features are vectors of 100 dimensions.
In at least one embodiment of the present invention, the analyzing unit 111 performs self-attention analysis on each sentence segmentation in the conversational sentence based on the output vector and the intention vector by the third network layer, and obtaining a slot feature of each sentence segmentation includes:
extracting a participle characterization vector of each sentence participle from the output vector;
performing context analysis on the word segmentation characterization vectors according to the output vectors to obtain a context characterization vector of each sentence word segmentation;
splicing each context representation vector and the intention vector to obtain a spliced vector;
performing linear transformation on the splicing vector to obtain a gating vector;
and calculating the product of each word segmentation characterization vector and the gating vector to obtain the slot position characteristics of each sentence word segmentation.
Through the implementation mode, each sentence participle can be interacted with participles except the sentence participle in the dialogue sentence, and therefore the slot position characteristics can be accurately determined.
Specifically, the analyzing unit 111 performs context analysis on the word segmentation characterization vector according to the output vector, and obtaining a context characterization vector of each sentence word segmentation includes:
combining elements except the word segmentation characterization vector in the output vector into a feature vector;
acquiring a self-attention layer in the third network layer;
and inputting the feature vector to the self-attention layer to obtain the context characterization vector.
The analyzing unit 111 analyzes the slot position feature based on the fourth network layer to obtain a first prediction tag of the dialog statement by the first preset network.
In at least one embodiment of the present invention, the fourth network layer is configured to determine a corresponding tag according to a slot characteristic.
The first prediction tag is slot position information obtained after the first preset network analyzes the conversation statement.
In at least one embodiment of the present invention, the analyzing unit 111 analyzes the slot feature based on the fourth network layer, and obtaining the first predicted tag of the dialog statement by the first preset network includes:
acquiring a configuration matrix and configuration parameters in the fourth network layer;
multiplying the slot position features by the configuration matrix, and adding the configuration parameters to obtain a fractional vector of each statement word;
normalizing the fraction vector by adopting an activation function to obtain a probability vector of each sentence word segmentation;
and determining the category corresponding to the element with the largest value in the probability vector as the first prediction label.
By normalizing the fraction vector, the first prediction label can be quickly determined according to the probability vector.
The processing unit 113 compresses the first preset network to obtain a second preset network, and inputs the dialogue statement into the second preset network to obtain a second prediction tag.
In at least one embodiment of the present invention, the second predetermined network refers to a student network of the first predetermined network.
The second prediction tag is slot position information obtained after the second preset network analyzes the conversation statement.
In at least one embodiment of the present invention, the processing unit 113 performs compression processing on the first preset network to obtain a second preset network includes:
sub-layers with the number of preset values are extracted from the first network layer, and a first sub-layer is obtained;
sub-layers with the number of layers being the preset value are extracted from the second network layer, and a second sub-layer is obtained;
sub-layers with the number of layers being the preset value are extracted from the third network layer, and a third sub-layer is obtained;
sub-layers with the number of layers being the preset value are extracted from the fourth network layer, and a fourth sub-layer is obtained;
and splicing the first sublayer, the second sublayer, the third sublayer and the fourth sublayer to obtain the second preset network.
Wherein the preset value may be 1.
The second preset network can be quickly generated by directly extracting sublayers with the number of layers being the preset value from each network layer in the first preset network, and meanwhile, because the second preset network contains the information of each network layer in the first preset network, the characteristics in the first preset network are reserved in the second preset network, so that the conversation sentences can be predicted through the second preset network.
The calculating unit 114 calculates a first loss value of the second predetermined network according to the first prediction tag and the second prediction tag, and calculates a second loss value of the second predetermined network according to the slot tag and the second prediction tag.
In at least one embodiment of the present invention, the first loss value is determined according to a prediction result of the first predetermined network on the conversational sentence and a prediction result of the second predetermined network on the conversational sentence.
And the second loss value is determined according to the prediction result of the second preset network on the conversation sentence and the labeling result of the conversation sentence.
In at least one embodiment of the present invention, the calculating unit 114 calculates the first loss value of the second predetermined network according to the first prediction tag and the second prediction tag comprises:
wherein L isdistillIs the first loss value, N is the number of dialog samples,outputting a Logit value for the ith output corresponding to the first prediction label output by the first preset network to the ith dialogue sample, wherein T is temperature,outputting a Logit value for the kth corresponding to the first prediction label output by the first preset network for the kth dialogue sample,an ith network Logit value corresponding to a second prediction label output by the second preset network for the ith dialogue sample,and outputting a kth network Logit value corresponding to a second prediction label for the kth dialogue sample by the second preset network.
The first loss value can be accurately determined through the first prediction label and the second prediction label.
In at least one embodiment of the present invention, the calculating unit 114 calculates a second loss value of the second predetermined network according to the slot tag and the second prediction tag includes:
wherein L isCEY is a slot tag in the ith dialog sample for the second loss value,and when the temperature is the same, the second preset network outputs a second prediction label to the ith dialogue sample.
The second loss value can be accurately determined through the slot position tag and the second prediction tag.
The adjusting unit 115 determines a target loss value of the second preset network according to the first loss value and the second loss value, and adjusts parameters in the second preset network according to the target loss value until the target loss value is not reduced any more, so as to obtain a semantic analysis model.
In at least one embodiment of the invention, the target loss value is determined from an optimal superparametric point in the dialogue sample.
The semantic analysis model is a second preset network when the target loss value is not reduced any more.
In at least one embodiment of the present invention, the determining, by the adjusting unit 115, the target loss value of the second predetermined network according to the first loss value and the second loss value includes:
determining an optimal hyper-parameter point from the dialogue sample by adopting a hyper-parameter grid search method, wherein the optimal hyper-parameter point comprises a target statement and a target label;
inputting the target statement into the second preset network to obtain a statement prediction tag;
vectorizing the target label to obtain a first vector, and vectorizing the prediction label to obtain a second vector;
calculating the similarity of the first vector and the second vector as a loss weight;
and carrying out weighted sum operation on the first loss value and the second loss value according to the loss weight to obtain the target loss value.
The sentence prediction label can be quickly obtained by inputting the target sentence into the second preset network, so that the loss weight can be quickly determined, and the target loss value can be quickly determined.
In at least one embodiment of the present invention, the adjusting unit 115 adjusts the parameters in the second preset network according to the target loss value until the target loss value is no longer reduced, and obtaining the semantic analysis model includes:
and adjusting parameters in the second sublayer, the third sublayer and the fourth sublayer according to the target loss value until the target loss value is not reduced any more, so as to obtain a semantic analysis model.
Parameters in the second preset network are adjusted through the target loss value, and the target loss value is determined according to sentence prediction labels and the similarity of the target labels, which are obtained by predicting the optimal hyper-parameter points through the second preset network, so that the analysis accuracy of the semantic analysis model can be improved.
When receiving a semantic analysis request, the input unit 116 acquires a sentence to be analyzed according to the semantic analysis request, and inputs the sentence to be analyzed into the semantic analysis model to obtain semantic information of the target sentence, where the semantic information includes target intent and slot position information.
In at least one embodiment of the present invention, the semantic analysis request may be triggered by a user in charge of statement analysis, where the semantic analysis request carries information such as a target path.
The statement to be analyzed refers to a statement needing semantic analysis.
It is emphasized that, in order to further ensure the privacy and security of the semantic information, the semantic information may also be stored in a node of a block chain.
In at least one embodiment of the present invention, the obtaining, by the input unit 116, the statement to be parsed according to the semantic parsing request includes:
analyzing the message of the semantic analysis request to obtain data information carried by the message;
acquiring information indicating a path from the data information as a target path;
and extracting any dialogue information from the target path to be used as the statement to be analyzed.
Through the embodiment, only the message needs to be analyzed, so that the data information can be quickly acquired, and the statement to be analyzed can be quickly acquired.
In at least one embodiment of the present invention, the input unit 116 inputs the sentence to be parsed into the semantic parsing model, so as to obtain semantic information of the target sentence, where the semantic information includes target intent and slot position information, and includes:
acquiring the second sublayer in the semantic analysis model as an intention identification layer;
acquiring an output result corresponding to the statement to be analyzed from the intention identification layer as a statement intention vector;
taking an intention corresponding to the element with the largest value in the statement intention vector as the target intention;
acquiring the fourth sublayer in the semantic analysis model as a slot position identification layer;
and acquiring an output result corresponding to the statement to be analyzed from the slot position identification layer as the slot position information.
The semantic information can be quickly and accurately determined through the intention identification layer and the slot position identification layer.
In at least one embodiment of the present invention, after obtaining the semantic information of the target sentence, the obtaining unit 110 obtains the request number of the semantic analysis request;
generating section 117 generates presentation information from the request number and the semantic information;
the encryption unit 118 encrypts the prompt message by using a symmetric encryption technology to obtain a ciphertext;
the sending unit 119 sends the ciphertext to the terminal device of the designated contact.
By the embodiment, the safety of the semantic information can be improved.
According to the technical scheme, the sentence to be analyzed is input into the second preset network compressed by the first preset network to be subjected to semantic analysis, so that the generation efficiency of the semantic information can be improved, and meanwhile, the first preset network performs joint adjustment on the first prediction tag of the dialogue sentence and the slot position tag corresponding to the dialogue sentence per se on the parameters in the second preset network, so that the analysis accuracy of the semantic analysis model can be improved, and the generation accuracy of the semantic information is improved.
Fig. 3 is a schematic structural diagram of an electronic device according to a preferred embodiment of the present invention, which implements a semantic analysis method based on human-computer interaction.
In one embodiment of the present invention, the electronic device 1 includes, but is not limited to, a memory 12, a processor 13, and computer readable instructions stored in the memory 12 and executable on the processor 13, such as a human-machine interaction based semantic parser.
It will be appreciated by a person skilled in the art that the schematic diagram is only an example of the electronic device 1 and does not constitute a limitation of the electronic device 1, and that it may comprise more or less components than shown, or some components may be combined, or different components, e.g. the electronic device 1 may further comprise an input output device, a network access device, a bus, etc.
The Processor 13 may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic device, discrete hardware component, etc. The processor 13 is an operation core and a control center of the electronic device 1, and is connected to each part of the whole electronic device 1 by various interfaces and lines, and executes an operating system of the electronic device 1 and various installed application programs, program codes, and the like.
Illustratively, the computer readable instructions may be partitioned into one or more modules/units that are stored in the memory 12 and executed by the processor 13 to implement the present invention. The one or more modules/units may be a series of computer readable instruction segments capable of performing specific functions, which are used for describing the execution process of the computer readable instructions in the electronic device 1. For example, the computer-readable instructions may be divided into an acquisition unit 110, an analysis unit 111, a recognition unit 112, a processing unit 113, a calculation unit 114, an adjustment unit 115, an input unit 116, a generation unit 117, an encryption unit 118, and a transmission unit 119.
The memory 12 may be used for storing the computer readable instructions and/or modules, and the processor 13 implements various functions of the electronic device 1 by executing or executing the computer readable instructions and/or modules stored in the memory 12 and invoking data stored in the memory 12. The memory 12 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application program required by at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data created according to use of the electronic device, and the like. The memory 12 may include non-volatile and volatile memories, such as: a hard disk, a memory, a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), at least one magnetic disk storage device, a Flash memory device, or other storage device.
The memory 12 may be an external memory and/or an internal memory of the electronic device 1. Further, the memory 12 may be a memory having a physical form, such as a memory stick, a TF Card (Trans-flash Card), or the like.
The integrated modules/units of the electronic device 1 may be stored in a computer-readable storage medium if they are implemented in the form of software functional units and sold or used as separate products. Based on such understanding, all or part of the flow of the method according to the above embodiments may be implemented by hardware that is configured to be instructed by computer readable instructions, which may be stored in a computer readable storage medium, and when the computer readable instructions are executed by a processor, the steps of the method embodiments may be implemented.
Wherein the computer readable instructions comprise computer readable instruction code which may be in source code form, object code form, an executable file or some intermediate form, and the like. The computer-readable medium may include: any entity or device capable of carrying said computer readable instruction code, recording medium, U-disk, removable hard disk, magnetic disk, optical disk, computer Memory, Read-Only Memory (ROM), Random Access Memory (RAM).
The block chain is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, a consensus mechanism, an encryption algorithm and the like. A block chain (Blockchain), which is essentially a decentralized database, is a series of data blocks associated by using a cryptographic method, and each data block contains information of a batch of network transactions, so as to verify the validity (anti-counterfeiting) of the information and generate a next block. The blockchain may include a blockchain underlying platform, a platform product service layer, an application service layer, and the like.
With reference to fig. 1, the memory 12 in the electronic device 1 stores computer-readable instructions to implement a human-computer interaction based semantic parsing method, and the processor 13 can execute the computer-readable instructions to implement:
obtaining a conversation sample, wherein the conversation sample comprises a conversation sentence and a slot position label, and obtaining a first preset network, and the first preset network comprises a first network layer, a second network layer, a third network layer and a fourth network layer;
analyzing the dialogue statement based on the first network layer to obtain an output vector, wherein the output vector comprises a semantic vector;
performing intention identification on the semantic vector based on the second network layer to obtain an intention vector;
performing self-attention analysis on each statement participle in the dialogue statement based on the output vector and the intention vector of the third network layer to obtain slot position characteristics of each statement participle;
analyzing the slot position characteristics based on the fourth network layer to obtain a first prediction label of the first preset network for the conversation statement;
compressing the first preset network to obtain a second preset network, and inputting the dialogue sentences into the second preset network to obtain a second prediction label;
calculating a first loss value of the second preset network according to the first prediction tag and the second prediction tag, and calculating a second loss value of the second preset network according to the slot position tag and the second prediction tag;
determining a target loss value of the second preset network according to the first loss value and the second loss value, and adjusting parameters in the second preset network according to the target loss value until the target loss value is not reduced any more, so as to obtain a semantic analysis model;
when a semantic analysis request is received, obtaining a statement to be analyzed according to the semantic analysis request, and inputting the statement to be analyzed into the semantic analysis model to obtain semantic information of the target statement, wherein the semantic information comprises target intention and slot position information.
Specifically, the processor 13 may refer to the description of the relevant steps in the embodiment corresponding to fig. 1 for a specific implementation method of the computer readable instructions, which is not described herein again.
In the embodiments provided in the present invention, it should be understood that the disclosed system, 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 modules is only one logical functional division, and other divisions may be realized in practice.
The computer readable storage medium has computer readable instructions stored thereon, wherein the computer readable instructions when executed by the processor 13 are configured to implement the steps of:
obtaining a conversation sample, wherein the conversation sample comprises a conversation sentence and a slot position label, and obtaining a first preset network, and the first preset network comprises a first network layer, a second network layer, a third network layer and a fourth network layer;
analyzing the dialogue statement based on the first network layer to obtain an output vector, wherein the output vector comprises a semantic vector;
performing intention identification on the semantic vector based on the second network layer to obtain an intention vector;
performing self-attention analysis on each statement participle in the dialogue statement based on the output vector and the intention vector of the third network layer to obtain slot position characteristics of each statement participle;
analyzing the slot position characteristics based on the fourth network layer to obtain a first prediction label of the first preset network for the conversation statement;
compressing the first preset network to obtain a second preset network, and inputting the dialogue sentences into the second preset network to obtain a second prediction label;
calculating a first loss value of the second preset network according to the first prediction tag and the second prediction tag, and calculating a second loss value of the second preset network according to the slot position tag and the second prediction tag;
determining a target loss value of the second preset network according to the first loss value and the second loss value, and adjusting parameters in the second preset network according to the target loss value until the target loss value is not reduced any more, so as to obtain a semantic analysis model;
when a semantic analysis request is received, obtaining a statement to be analyzed according to the semantic analysis request, and inputting the statement to be analyzed into the semantic analysis model to obtain semantic information of the target statement, wherein the semantic information comprises target intention and slot position information.
The modules described as separate parts may or may not be physically separate, and parts displayed as modules 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 modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment.
In addition, functional modules 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 module.
The present embodiments are therefore to be considered in all respects as illustrative and not restrictive, the scope of the invention being indicated by the appended claims rather than by the foregoing description, and all changes which come within the meaning and range of equivalency of the claims are therefore intended to be embraced therein. Any reference signs in the claims shall not be construed as limiting the claim concerned.
Furthermore, it is obvious that the word "comprising" does not exclude other elements or steps, and the singular does not exclude the plural. The plurality of units or devices may also be implemented by one unit or device through software or hardware. The terms first, second, etc. are used to denote names, but not any particular order.
Finally, it should be noted that the above embodiments are only for illustrating the technical solutions of the present invention and not for limiting, and although the present invention is described in detail with reference to the preferred embodiments, it should be understood by those skilled in the art that modifications or equivalent substitutions may be made on the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention.
- 上一篇:石墨接头机器人自动装卡簧、装栓机
- 下一篇:文本处理方法、装置、设备以及存储介质