Data processing method, device, equipment and storage medium

文档序号:1953427 发布日期:2021-12-10 浏览:26次 中文

阅读说明:本技术 数据处理方法、装置、设备和存储介质 (Data processing method, device, equipment and storage medium ) 是由 章波 张月 王睿 于 2020-06-10 设计创作,主要内容包括:本发明实施例提供一种数据处理方法、装置、设备和存储介质,该方法包括:获取训练语句,并将其输入需要训练的句法分析模型。再将句法分析模型输出的句法信息和训练语句一并输入标注模型,以实现对标注模型的训练。根据标注模型输出的标注结果同时调两个模型的整模型参数。可见,标注模型是依靠训练语句以及句法信息才输出标注结果的,因此,根据标注结果反向调整模型参数的过程也会同时影响到前述的两个模型,从而实现两个模型的同时训练,保证了两个模型的训练效果。同时,在标注模型训练过程中还引入了句法信息,这相当于对训练语句进行了句法增强,因此,根据经过句法增强训练语句训练标注模型,进一步保证了模型的训练效果。(The embodiment of the invention provides a data processing method, a device, equipment and a storage medium, wherein the method comprises the following steps: and acquiring a training sentence and inputting the training sentence into a syntactic analysis model needing training. And inputting the syntactic information output by the syntactic analysis model and the training sentences into the labeling model together so as to realize the training of the labeling model. And adjusting the whole model parameters of the two models simultaneously according to the labeling result output by the labeling model. Therefore, the process of reversely adjusting the model parameters according to the labeling result can simultaneously influence the two models, so that the simultaneous training of the two models is realized, and the training effect of the two models is ensured. Meanwhile, syntax information is introduced in the process of training the labeling model, which is equivalent to syntax enhancement on the training sentences, so that the labeling model is trained according to the syntax enhancement training sentences, and the training effect of the model is further ensured.)

1. A data processing method, comprising:

acquiring a training sentence;

inputting the training sentence into a syntactic analysis model to obtain syntactic information corresponding to the training sentence;

training a labeling model according to the syntactic information and the training sentences;

and adjusting the respective model parameters of the syntactic analysis model and the labeling model according to the labeling result output by the labeling model.

2. The method of claim 1, wherein the inputting the training sentence into a syntactic analysis model to obtain syntactic information corresponding to the training sentence comprises:

and inputting the training sentence into the syntactic analysis model, and coding the training sentence through a coding layer of the syntactic analysis model to obtain first syntactic information corresponding to the training sentence.

3. The method of claim 2, wherein training a labeling model based on the syntactic information and the training sentence comprises:

inputting the first syntax information and the training sentence into a coding layer of the labeling model, and coding the first syntax information and the training sentence through the coding layer of the labeling model to obtain semantic information;

and inputting the semantic information into a decoding layer of the labeling model so as to output a labeling result of the training sentence through the decoding layer.

4. The method of claim 2, further comprising:

inputting the first syntax information into a decoding layer of the syntax analysis model so as to output second syntax information corresponding to the training sentence through the decoding layer;

and adjusting the model parameters of the syntactic analysis model according to the second syntactic information.

5. The method of claim 1, wherein the inputting the training sentence into a syntactic analysis model to obtain syntactic information corresponding to the training sentence comprises:

inputting the training sentence into the syntactic analysis model, and coding the training sentence through a coding layer of the syntactic analysis model to obtain first syntactic information corresponding to the training sentence;

inputting the first syntax information into a decoding layer of the parsing model to output corresponding second syntax information of the training sentence through the decoding layer.

6. The method of claim 5, wherein training a labeling model based on the syntactic information and the training sentence, comprises:

inputting the training sentences into the labeling model, and coding the training sentences through a coding layer of the labeling model to obtain semantic information;

inputting the second syntax information and the semantic information into a fusion model to fuse the second syntax information and the semantic information through the fusion model;

and inputting the fusion result into a decoding layer of the labeling model, and outputting the labeling result of the training sentence through the decoding layer.

7. The method of claim 5, wherein training a labeling model based on the syntactic information and the training sentence, comprises:

inputting the first syntax information and the training sentence into the labeling model, and coding the first syntax information and the training sentence through a coding layer of the labeling model to obtain semantic information;

inputting the semantic information and the second syntactic information into a fusion model to fuse the second syntactic information and the semantic information through the fusion model;

and inputting the fusion result into a decoding layer of the labeling model, and outputting the labeling result of the training sentence through the decoding layer.

8. The method according to claim 6 or 7, wherein the labeling result output by the labeling model adjusts model parameters of the syntactic analysis model and the labeling model, respectively, and comprises:

and adjusting model parameters of the labeling model, the syntactic analysis model and the fusion model according to the labeling result.

9. The method of claim 1, further comprising:

acquiring a sentence to be annotated input by a user;

inputting and training the sentence to be marked to a convergent syntactic analysis model to obtain syntactic information corresponding to the sentence to be marked;

inputting and training the syntactic information and the sentence to be labeled to a convergent labeling model to obtain a labeling result of the sentence to be labeled, wherein the labeling result comprises the emotion type of the sentence to be labeled;

and outputting a response sentence, wherein the emotion type of the response sentence is matched with the emotion type of the sentence to be labeled.

10. A data processing apparatus, comprising:

the acquisition module is used for acquiring training sentences;

the input module is used for inputting the training sentences into a syntactic analysis model so as to obtain syntactic information corresponding to the training sentences;

the training module is used for training a labeling model according to the syntactic information and the training sentences;

and the adjusting module is used for adjusting the respective model parameters of the syntactic analysis model and the labeling model according to the labeling result output by the labeling model.

11. An electronic device, comprising: a memory, a processor; wherein the memory has stored thereon executable code which, when executed by the processor, causes the processor to carry out the data processing method of any one of claims 1 to 9.

12. A non-transitory machine-readable storage medium having stored thereon executable code, which when executed by a processor of an electronic device, causes the processor to perform the data processing method of any one of claims 1 to 9.

Technical Field

The present invention relates to the field of computer technologies, and in particular, to a data processing method, apparatus, device, and storage medium.

Background

Natural language processing is an important research direction in the field of artificial intelligence. After a computer has the ability to understand the natural language text generated by a user, its comprehension can play a great role in different scenarios.

For example, the user can leave evaluation information about the commodity on the e-commerce platform, and the computer can understand the use feedback of the commodity of the user by performing semantic understanding and emotion recognition on the evaluation of the user. For another example, the user may perform a fact comment on a portal site, and at this time, the computer may also perform semantic understanding on the message of the user, thereby implementing public opinion analysis. Therefore, how to ensure the accuracy of semantic understanding of the sentences becomes a problem to be solved urgently.

Disclosure of Invention

In view of this, embodiments of the present invention provide a data processing method, apparatus, device and storage medium, so as to ensure a training effect of a model.

In a first aspect, an embodiment of the present invention provides a data processing method, including:

acquiring a training sentence;

inputting the training sentence into a syntactic analysis model to obtain syntactic information corresponding to the training sentence;

training a labeling model according to the syntactic information and the training sentences;

and adjusting the respective model parameters of the syntactic analysis model and the labeling model according to the labeling result output by the labeling model.

In a second aspect, an embodiment of the present invention provides a data processing apparatus, including:

the acquisition module is used for acquiring training sentences;

the input module is used for inputting the training sentences into a syntactic analysis model so as to obtain syntactic information corresponding to the training sentences;

the training module is used for training a labeling model according to the syntactic information and the training sentences;

and the adjusting module is used for adjusting the respective model parameters of the syntactic analysis model and the labeling model according to the labeling result output by the labeling model.

In a third aspect, an embodiment of the present invention provides an electronic device, including a processor and a memory, where the memory is used to store one or more computer instructions, and when the one or more computer instructions are executed by the processor, the data processing method in the first aspect is implemented. The electronic device may also include a communication interface for communicating with other devices or a communication network.

In a fourth aspect, an embodiment of the present invention provides a non-transitory machine-readable storage medium having stored thereon executable code, which when executed by a processor of an electronic device, causes the processor to implement at least the data processing method according to the first aspect.

The data processing method provided by the embodiment of the invention obtains the training sentence, inputs the training sentence into the syntactic analysis model needing to be trained, and outputs the syntactic information corresponding to the training sentence through the syntactic analysis model. And inputting the syntactic information and the training sentences into the labeling model together to realize the training of the labeling model. Finally, adjusting the whole model parameters of the two models simultaneously according to the labeling result output by the labeling model.

According to the above description, on one hand, the labeling model outputs the labeling result only by means of two parts of contents, that is, the labeling result is output only by means of the training sentence and the syntactic information output by the syntactic analysis model. Therefore, the process of reversely adjusting the model parameters according to the labeling result can simultaneously influence the two models, so that the training tasks of the two models are mutually influenced, the simultaneous training of the two models is realized, and the training effect of the two models is ensured. On the other hand, the training sentences and the syntactic information output by the syntactic analysis model are used in the process of training the annotation model, and the introduction of the syntactic information is equivalent to syntactic enhancement of the training sentences, so that the annotation model is trained according to the syntactic enhancement training sentences, and the training effect of the annotation model is further ensured.

Drawings

In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and those skilled in the art can also obtain other drawings according to the drawings without creative efforts.

Fig. 1 is a flowchart of a data processing method according to an embodiment of the present invention;

FIG. 2 is a flow chart of a syntactic analysis model training approach provided by an embodiment of the present invention;

FIG. 3 is a flow chart of another data processing method according to an embodiment of the present invention;

FIG. 4 is a schematic diagram of a model structure corresponding to the data processing method provided in the embodiment shown in FIG. 3;

FIG. 5 is a flow chart of another data processing method according to an embodiment of the present invention;

FIG. 6 is a schematic diagram of a model structure corresponding to the data processing method provided in the embodiment shown in FIG. 5;

FIG. 7 is a flowchart of another data processing method according to an embodiment of the present invention;

FIG. 8 is a schematic diagram of a model structure corresponding to the data processing method provided in the embodiment shown in FIG. 7;

FIG. 9 is a flowchart of another data processing method according to an embodiment of the present invention;

FIG. 10 is a block diagram of a data processing apparatus according to an embodiment of the present invention;

fig. 11 is a schematic structural diagram of an electronic device corresponding to the data processing apparatus provided in the embodiment shown in fig. 10;

fig. 12 is a schematic diagram of a data processing method provided in an embodiment of the present invention in a home human-computer interaction scenario.

Detailed Description

In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.

The terminology used in the embodiments of the invention is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. As used in the examples of the present invention and the appended claims, the singular forms "a", "an", and "the" are intended to include the plural forms as well, and "a" and "an" generally include at least two, but do not exclude at least one, unless the context clearly dictates otherwise.

It should be understood that the term "and/or" as used herein is merely one type of association that describes 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 character "/" herein generally indicates that the former and latter related objects are in an "or" relationship.

The words "if," "if," as used herein may be interpreted as "at … …" or "at … …" or "in response to a determination" or "in response to a recognition," depending on the context. Similarly, the phrases "if determined" or "if identified (a stated condition or event)" may be interpreted as "when determined" or "in response to a determination" or "when identified (a stated condition or event)" or "in response to an identification (a stated condition or event)", depending on the context.

It is also noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a good or system that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such good or system. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a commodity or system that includes the element.

Before explaining the data processing method provided by the embodiment of the present invention, the semantic understanding, particularly the realistic meaning of emotion recognition, may be exemplarily explained:

as mentioned in the background, a scenario may be where a user enters ratings information on purchased goods at an e-commerce website. The server can perform semantic understanding on the obtained large amount of evaluation information, wherein the semantic understanding specifically comprises emotion recognition so as to obtain use feedback information of the commodity for a large amount of users. Such as the user's liking or not liking the merchandise, what kind of shortcoming is in the use of the merchandise, etc. Furthermore, the commodities can be improved according to the use feedback information, and the use experience of the user is improved.

In another scenario, the user may also enter comment information for a certain event hotspot on the web portal. The server carries out semantic understanding on a large amount of comment information, so that public opinion analysis of the current hotspot is realized.

In another scenario, the user may input a control command to the intelligent robot. And the intelligent robot outputs response sentences for the user through semantic understanding of the control instructions. In order to guarantee the use experience of the user, the answer sentence has the emotion type matched with the emotion type of the control instruction input by the user. For example, the control command input by the user corresponds to a sad emotion type, and the answer sentence output by the intelligent robot can correspond to a happy emotion type, so that comfort to the user is realized.

There is a need for semantic understanding, particularly emotion recognition, for the above scenarios, but not limited to the above scenarios, and in practical applications, the semantic understanding is usually realized by means of a network model. At this time, the method provided by the invention can be used for realizing the training of the network model so as to ensure the accuracy of semantic understanding.

Based on the above description, some embodiments of the present invention will be described in detail below with reference to the accompanying drawings. The features of the embodiments and examples described below may be combined with each other without conflict between the embodiments. In addition, the sequence of steps in each method embodiment described below is only an example and is not strictly limited.

Fig. 1 is a flowchart of a data processing method according to an embodiment of the present invention. The data processing method provided by the embodiment of the invention can be executed by processing equipment. It will be appreciated that the processing device may be implemented as software, or a combination of software and hardware. The processing device in this embodiment and each of the embodiments described below may specifically be a server. The data processing method provided by the embodiment is actually a model training method. As shown in fig. 1, the method comprises the steps of:

s101, obtaining a training sentence.

Before the training of the annotation model and the syntactic analysis model, a first corpus can be established for the annotation model in advance, and a second corpus can be established for the syntactic analysis model. Wherein, the sentences contained in the two corpora can be obtained through the internet. In this case, the acquired training sentence may be any sentence in the first corpus.

For the first corpus, each sentence contained in the corpus is labeled correspondingly according to different labeling requirements of the labeling model.

For example, if the annotation model is used to perform semantic recognition on a sentence and emphasize the emotional type of the sentence, the sentence "i love eating apple" in the first corpus is annotated as follows: i [ holder ] love [ expression ] eat apple [ target ]. Wherein, holder represents an emotion issuer, expression represents an emotion type, and target represents an emotion expression object.

The labeling model is used for performing semantic recognition on the sentences, and the emotion types of the sentences are not emphasized, so that the sentences 'I love eating apples' can be labeled as follows: i [ Agent ] love [ Predicate ] eat apple [ parent ]. Wherein, Agent represents an action initiator, Predicate represents a Predicate verb, and parent represents an action subject.

Similarly, for the second corpus, each statement contained therein may exist in the form of its corresponding dependency syntax tree. And the statements contained in the second corpus may be the same as the first corpus, or the first corpus may be a subset of the second corpus.

For example, the sentence "i love eating apples" is labeled as:the dependency syntax tree above shows that: love has dependency relationship with me and eat respectively, and eat has dependency relationship with apple.

S102, inputting the training sentence into the syntactic analysis model to obtain syntactic information corresponding to the training sentence.

And inputting any sentence in the second corpus, namely the training sentence, into the syntactic segment model, and performing feature extraction on the sentence through syntactic analysis to obtain syntactic information corresponding to the training sentence. The syntax information may be represented in different forms, such as a word vector matrix, a probability matrix, or a dependency syntax tree. It should be noted that the training sentences input into the syntactic analysis model also need to be included in the first corpus.

For the probability matrix, it can be understood that: if the training sentence contains N words, the syntactic analysis model can respectively obtain the probability value of whether the dependency relationship exists between the N words, and the N x N probability values form a probability matrix. Further, the syntax analysis may generate a dependency syntax tree corresponding to the training sentence according to the elements in the probability matrix.

In connection with the above example of "i love apple", the word "i" included in the training sentence is denoted as a, "love" is denoted as B, "eat" is denoted as C, "apple" is denoted as D, that is, when N is 4, the probability matrix may be expressed as:

optionally, the probability matrix may be normalized. And then, extracting the part with the probability value larger than a preset threshold value from the normalized probability matrix, and generating a dependency relationship tree of the training sentence according to the extracted content.

And S103, training a labeling model according to the syntactic information and the training sentences.

Then, the extracted syntax information and a training sentence expressed as a word vector matrix are input into the annotation model together to realize the training of the annotation model.

Specifically, when the syntactic information output by the syntactic analysis model is represented as a word vector, the two vectors can be directly spliced to input the splicing result into the labeling model. For example, assuming that the training sentence contains N words, each word represented by D1 dimensional data, the training sentence may be represented as a word vector matrix of N x D1; and the syntax information may be represented as a word vector matrix of N x D2, when the input label concatenation result is actually a word vector matrix of N x (D1+ D2). The magnitude relationship between D1 and D2 is not limited.

When the syntactic information is represented as a probability matrix or a relational sequential tree, the word vector representation of the training sentence and the syntactic information may be fused, and a specific fusion process may refer to the following description in the embodiments shown in fig. 5 to fig. 8.

Alternatively, the annotation model may be composed of a Bi-directional Long Short-Term Memory (BiLSTM) network and a Conditional Random Field (CRF) network.

And S104, adjusting respective model parameters of the syntactic analysis model and the labeling model according to the labeling result output by the labeling model.

The labeling model can output the labeling result corresponding to the training sentence. According to different application scenes of the labeling model, labeling results can be used for labeling emotion senders, emotion types and emotion expression objects in the training sentences, and can also be used for labeling action senders and action bearing objects in the training sentences.

Furthermore, a loss value can be calculated according to the labeling result and a preset loss function, and then the model parameters are adjusted in a back propagation mode according to the loss value. Because the syntactic analysis model also participates in the training process of the labeling model, the model parameters of the syntactic analysis model and the labeling model can be adjusted simultaneously in the process of back propagation, namely the simultaneous training of the two models is realized.

After multiple parameter adjustments, the syntactic analysis mode and the labeling model can be converged simultaneously, and therefore model training is completed.

In this embodiment, on one hand, the annotation model depends on two parts of content, that is, the annotation result is output only by the training sentence and the syntactic information output by the syntactic analysis model. Therefore, the process of reversely adjusting the model parameters according to the labeling result can simultaneously influence the two models, so that the training tasks of the two models are mutually influenced, the simultaneous training of the two models is realized, and the training effect of the two models is ensured. On the other hand, the training sentences and the syntactic information output by the syntactic analysis model are used in the process of training the annotation model, and the introduction of the syntactic information is equivalent to syntactic enhancement of the training sentences, so that the annotation model is trained according to the syntactic enhancement training sentences, and the training effect of the annotation model is further ensured.

The above embodiments disclose processes for simultaneously training a syntactic analysis model and a labeling model. In the process of the labeled model training, the syntactic information output by the syntactic analysis model is used, so that the accuracy of the syntactic information can directly influence the training effect of the labeled model, and the training effect of the syntactic analysis model is especially ensured.

Based on this, for the syntactic analysis model, while training together with the annotation model, it can also be trained independently, as shown in fig. 2, the independent training process may include the following steps:

s201, inputting the training sentence into the syntactic analysis model, and coding the training sentence through a coding layer of the syntactic analysis model to obtain first syntactic information corresponding to the training sentence.

And S202, inputting the first syntax information into a decoding layer of the syntax analysis model, and outputting second syntax information corresponding to the training sentence through the decoding layer.

And S203, adjusting the model parameters of the syntactic analysis model according to the second syntactic information.

When training alone, the training sentences input to the syntactic analysis model may be any of the sentences in the second corpus, and are not limited to the same sentences as in the first corpus.

And the model structure of the syntactic analysis model may be an input layer-an encoding layer-a decoding layer. Based on this structure, after the training sentence is input to the coding layer through the input layer of the syntactic analysis model, the coding layer may code it. The encoding process here may be regarded as a syntactic analysis model that performs feature extraction on training to output first syntax information corresponding to a training sentence by an encoding layer. Wherein the first syntax information may be represented as a word vector matrix. If the word vector matrix is directly output, the user sees some data and cannot intuitively understand the meaning of the data, so that the first syntactic information is actually implicit information.

Then, the first syntax information output by the coding layer of the syntax analysis model is further input to the decoding layer, and the decoding layer outputs second syntax information corresponding to the training sentence, wherein the second syntax information is embodied in the form of a probability matrix or a syntax dependency tree. The second syntax information is explicit information that the user can intuitively understand, as opposed to the first syntax feature.

Finally, the syntactic analysis model can also adjust the model parameters in a back propagation manner according to the analysis result output by the coding layer. It can be seen that, in the whole training process, the annotation model is not involved, that is, the separate training of the syntactic analysis model is realized.

It should be noted that the above-mentioned step of separate training actually provided by the present embodiment may be performed before step 101 or after step 104.

In combination with the above embodiments, the syntactic analysis model may be trained simultaneously with the annotation model in one aspect, in the manner shown in FIG. 1. Meanwhile, the syntactic analysis model can also be trained separately in the way of the embodiment shown in fig. 2. Compare in only carrying out alone to the syntax model, combine together two kinds of training modes, can promote the training effect of syntax analysis model greatly for the syntax information of its output is more accurate, and this has just also further guaranteed the effect of mark model training.

In the embodiment shown in fig. 1, it is disclosed that the syntactic information extracted by the syntactic model may participate in the training process of the annotation model, and in practical applications, the annotation model may generally include an input layer, an encoding layer, and a decoding layer. Based on this network structure, syntax information can optionally be introduced at the coding layer of the annotation model.

Fig. 3 is a flowchart of another data processing method according to an embodiment of the present invention. The training process described in this embodiment can be understood in conjunction with the description of fig. 4. As shown in fig. 3, the method may include the steps of:

s301, obtaining a training sentence.

The obtained training sentence may be any sentence in the first corpus, and the execution process of step 301 is similar to the corresponding steps in the foregoing embodiment, and reference may be made to the related description in the embodiment shown in fig. 1, which is not repeated herein.

S302, inputting the training sentence into the syntactic analysis model, and coding the training sentence through a coding layer of the syntactic analysis model to obtain first syntactic information corresponding to the training sentence.

As with the annotation model, the structure of the syntactic analysis model may also be input layer-coding layer-decoding layer. Based on the structure, after the training sentence is input to the coding layer through the input layer of the syntax analysis model, the coding layer can code the training sentence, so that the coding layer outputs the first syntax information corresponding to the training sentence. The first syntax information may be considered as a sentence feature extracted from the training sentence by the coding layer, and the first syntax information may be specifically expressed as a word vector matrix.

And S303, inputting the first syntax information and the training sentence into a coding layer of the labeling model, and coding the first syntax information and the training sentence through the coding layer of the labeling model to obtain semantic information.

S304, inputting the semantic information into a decoding layer of the annotation model, and outputting the annotation result of the training sentence through the decoding layer.

And then, inputting the first syntax information and the training sentence into a coding layer of the labeling model together so as to further output a labeling result of the training sentence through a decoding layer. The specific content included in the labeling result can refer to the related description in the embodiment shown in fig. 1, and is not described herein again.

Optionally, "inputting the first syntax information and the training together" may be regarded as splicing the first syntax information and the training sentence together in the form of a vector matrix, and a specific splicing process may refer to a related description in the embodiment shown in fig. 1. And inputting the splicing result into a coding layer of the labeling model, and coding the splicing result through the coding layer to obtain semantic information of the training sentence, wherein the semantic information can also be expressed in a vector matrix form. The encoding process here may also be considered as feature extraction on the splicing result.

The above-mentioned splicing processing can realize the syntactic enhancement of the training sentence, and the splicing result can be regarded as the syntactic enhancement result. The fusion result contains the syntactic information of the training sentence, so the syntactic information of the training sentence also participates in the extraction process of the semantic information, and the accuracy of the semantic information is ensured. And inputting the semantic information into a decoding layer of the annotation model, and outputting an annotation result through the decoding layer.

Alternatively, the encoding layer in the annotation model may be a Bi-directional Long Short-Term Memory (bilst) network, and the decoding layer may be a Conditional Random Field (CRF) network.

S305, adjusting the model parameters of the syntactic analysis model and the annotation model according to the annotation result output by the annotation model.

The execution process of step 305 is similar to the corresponding steps in the foregoing embodiment, and reference may be made to the related description in the embodiment shown in fig. 1, which is not repeated herein.

In this embodiment, the syntax information output by the syntax analysis model is introduced in the coding layer of the annotation model. By introducing the syntax information, the syntax enhancement of the training sentences can be realized, so that the syntax of the sentences can be considered in the process of labeling the labeling model, and the training effect of the labeling model is ensured.

Optionally, syntax information can also be introduced at the decoding layer of the annotation model. Fig. 5 is a flowchart of another data processing method according to an embodiment of the present invention. The training process provided by the present embodiment can be understood by referring to the contents shown in fig. 6. As shown in fig. 5, the method may include the steps of:

s401, obtaining a training sentence.

S402, inputting the training sentence into the syntactic analysis model, and coding the training sentence through a coding layer of the syntactic analysis model to obtain first syntactic information corresponding to the training sentence.

The execution process of the above steps 401 to 402 is similar to the corresponding steps of the foregoing embodiment, and reference may be made to the related description in the embodiment shown in fig. 3, which is not repeated herein.

S403, inputting the first syntax information into a decoding layer of the syntax analysis model to output corresponding second syntax information of the training sentence through the decoding layer.

The first syntax information output by the coding layer of the syntax analysis model is further input to the decoding layer, so that the second syntax information corresponding to the training sentence is output by the decoding layer.

S404, inputting the training sentences into the labeling model, and coding the training sentences through a coding layer of the labeling model to obtain semantic information.

Meanwhile, the training sentences can also be input into the labeling model so as to encode the training sentences through the encoding layer of the labeling model and output the semantic information of the training sentences through the encoding layer. This encoding process may be considered as feature extraction on the training sentences.

In this case, it should be noted that, on the one hand, the syntax information of the training sentence can be obtained through the above steps 402 to 403 with respect to the obtained training sentence. On the other hand, semantic information of the training sentence can also be obtained by executing step 404. While the above is only an exemplary information acquisition order, the present invention does not limit the acquisition order of the semantic information and the second syntax information.

S405, inputting the second syntax information and the semantic information into the fusion model to fuse the second syntax information and the semantic information by the fusion model.

S406, inputting the fusion result into a decoding layer of the labeling model, so as to output the labeling result of the training sentence through the decoding layer.

Because the second syntactic information and the semantic information are matrixes with different contents, the second syntactic information and the semantic information cannot be directly spliced, and therefore, the second syntactic information and the semantic information need to be fused by means of a fusion model. Optionally, the fusion model may specifically be a Graph Convolutional neural Network (GCN), a Tree Long Short-Term Memory (Tree Long Short-Term Memory, trelstm) Network, or the like.

The syntactic enhancement of the training sentence can be realized through the fusion processing. Because the fusion result contains the syntactic information of the training sentence, the syntactic information also participates in the extraction process of the semantic information, thereby ensuring the accuracy of the semantic information. And inputting the fusion result into a decoding layer of the labeling model so as to output a labeling result corresponding to the training sentence through the decoding layer.

And S407, adjusting respective model parameters of the syntactic analysis model and the labeling model according to the labeling result output by the labeling model.

Finally, according to the labeling result output by the labeling model, the respective model parameters of the syntactic analysis model and the labeling model can be adjusted at the same time. In addition, in the training process of the labeling model, besides the syntactic analysis model and the labeling model, the fusion model also participates in the training process, so that when the model parameters are adjusted in a back propagation mode, the model parameters of the fusion model can be actually adjusted, and the simultaneous training of the three models is realized.

In this embodiment, the syntax information output by the syntax analysis model is introduced at the decoding layer of the annotation model. By introducing syntax information, the syntax enhancement of the training sentences can be realized, so that the syntax of the sentences is considered in the training process of the labeling model, and the training effect of the labeling model is ensured.

Optionally, syntax information can also be introduced at both the coding and decoding layers of the annotation model. Fig. 7 is a flowchart of another data processing method according to an embodiment of the present invention. The training process provided by the present embodiment can be understood in conjunction with the content shown in fig. 8. As shown in fig. 7, after step 403 in the embodiment shown in fig. 5, the method may further include the following steps:

s501, inputting the first syntax information and the training sentence into a labeling model, and coding the first syntax information and the training sentence through a coding layer of the labeling model to obtain semantic information.

After the step 402 is executed, the first syntax information can be obtained, and at this time, the first syntax information and the training sentence are input into the annotation model together, and the first syntax information and the training sentence are spliced and encoded by the encoding layer of the annotation model, so that the semantic information of the training sentence is obtained. The above-mentioned splicing processing can realize the syntactic enhancement of the training sentence, and the splicing result can be regarded as the syntactic enhancement result. For details, reference is made to the description relating to the embodiment shown in fig. 3.

And S502, inputting the semantic information and the second syntactic information into the fusion model so as to fuse the second syntactic information and the semantic information through the fusion model.

The semantic information and the second syntax information obtained in step 403 are then input into the fusion model, so that the fusion model fuses the semantic information and the second syntax information, and the details of this embodiment can be referred to in the description of fig. 5.

S503, inputting the fusion result into a decoding layer of the annotation model, and outputting the annotation result of the training sentence through the decoding layer.

S504, according to the labeling result output by the labeling model, adjusting respective model parameters of the syntactic analysis model and the labeling model.

The execution process of steps 503 to 504 is similar to the corresponding steps in the foregoing embodiment, and reference may be made to the relevant description in the embodiment shown in fig. 5, which is not repeated herein.

In this embodiment, the syntax information output by the syntax analysis model is introduced into the coding layer and the decoding layer of the annotation model at the same time. Syntax information is introduced into the two layers of the model, so that the training sentence has a higher syntax enhancement effect, richer syntax information is considered in the training process of the labeling model, and the training effect of the labeling model is ensured.

It should be noted that while the syntactic analysis model and the labeled model are trained together by the training method shown in fig. 3 to 8, the syntactic analysis model may also be trained separately by the method in the embodiment shown in fig. 2.

The embodiments shown in fig. 1 to 8 are actually model training methods. After the annotation model and the syntactic analysis model are trained to converge according to the above, semantic understanding, emotion analysis and the like of the sentence can be realized through the two models. Fig. 9 is a flowchart of another data processing method according to an embodiment of the present invention. As shown in fig. 7, the method is actually a man-machine interaction method based on semantic recognition, and the method may further include the following steps:

s601, obtaining the sentence to be annotated input by the user.

The user can send a control instruction to the intelligent robot. The intelligent robot can be suitable for a home scene and also can be suitable for a public service scene, such as a bank, a hospital and the like. The control instruction is also a sentence to be annotated, which may be specifically a voice instruction sent by the user or text content input by the user on an operation interface provided by the intelligent robot.

S602, inputting and training the sentence to be marked to a convergent syntactic analysis model so as to obtain syntactic information corresponding to the sentence to be marked.

After obtaining the sentence to be labeled, the intelligent robot can input the sentence to the self-configured syntactic analysis model trained to be convergent, so that the syntactic information corresponding to the sentence to be labeled is output by the syntactic analysis model. The syntactic information may be represented as a word vector matrix, a probability matrix, or a syntactic dependency tree, among others. The syntactic information expressed in the form of word vector matrix may be output by the coding layer of the syntactic analysis model, that is, the first syntactic information in the above embodiments; the syntax information expressed in the form of the probability matrix or the syntax dependency tree may be output by the decoding layer of the syntax analysis model, that is, the second syntax information in the above embodiments.

S603, the syntax information and the to-be-labeled sentence are input and trained to a convergent labeling model, so that a labeling result of the to-be-labeled sentence is obtained, and the labeling result comprises the emotion type of the to-be-labeled sentence.

At this time, the obtained syntax information and the sentence to be labeled input by the user are input into the labeling model configured by the intelligent robot and trained to be convergent, so that the labeling result is output by the labeling model. The marking result can reflect not only the semantics of the statement to be marked, but also the emotional type of the statement to be marked, such as joy, sadness, anger, and the like.

Optionally, as described in the embodiments shown in fig. 3 to fig. 8, the annotation model may splice the input syntax information and the sentence to be annotated to obtain a splicing result; or the intelligent robot is configured with a fusion model trained to be convergent to fuse the sentence law information and the sentence to be marked so as to obtain a fusion result. At this time, the annotation model can output the annotation result of the sentence to be annotated according to the splicing result or the fusion result.

S604, outputting the answer sentence, wherein the emotion type of the answer sentence is matched with the emotion type of the sentence to be labeled.

The intelligent robot further generates a response sentence according to the labeling result, and outputs the response sentence corresponding to the sentence to be labeled to the user so as to realize human-computer interaction. And the emotion type of the answer sentence is matched with the emotion type of the sentence to be labeled. Such matching may be, for example: both the answer sentence and the sentence to be labeled have positive emotion, for example, both have joyful emotion types. The matching of the emotion types may also be: the sentence to be marked has sad emotion type, and the answer sentence has happy emotion type.

It should be noted that this embodiment is a model prediction process, and the specific prediction process is similar to the methods provided in the foregoing embodiments, and parts not described in detail may refer to the related descriptions in the foregoing embodiments, and are not described again here.

In this embodiment, after the syntactic analysis model and the tagging model trained to be convergent are obtained by using the data processing method shown in fig. 1 to 8, for the intelligent robot configured with the model, semantic understanding and emotion analysis of a sentence input by a user can be realized, so that a corresponding response sentence is output, and man-machine interaction is realized.

It should be noted that, in addition to the human-computer interaction scenario provided in the present embodiment, the annotation model and the syntactic analysis model trained to converge may also be applied to the above-mentioned scenarios of understanding the commodity evaluation information and analyzing the public opinion.

The data processing apparatus of one or more embodiments of the present invention will be described in detail below. Those skilled in the art will appreciate that these data processing devices can each be constructed using commercially available hardware components configured through the steps taught in this scheme.

Fig. 10 is a schematic structural diagram of a data processing apparatus according to an embodiment of the present invention, and as shown in fig. 10, the apparatus includes:

and the obtaining module 11 is configured to obtain a training sentence.

And the input module 12 is configured to input the training sentence into a syntactic analysis model to obtain syntactic information corresponding to the training sentence.

And the training module 13 is configured to train a labeling model according to the syntax information and the training sentence.

And the adjusting module 14 is configured to adjust model parameters of the syntactic analysis model and the labeling model according to a labeling result output by the labeling model.

Optionally, the input module 12 is specifically configured to: and inputting the training sentence into the syntactic analysis model, and coding the training sentence through a coding layer of the syntactic analysis model to obtain first syntactic information corresponding to the training sentence.

Optionally, the training module 13 is specifically configured to: inputting the first syntax information and the training sentence into a coding layer of the labeling model, and coding the first syntax information and the training sentence through the coding layer of the labeling model to obtain semantic information; and inputting the semantic information into a decoding layer of the labeling model so as to output a labeling result of the training sentence through the decoding layer.

Optionally, the input module 12 is further configured to: and inputting the first syntax information into a decoding layer of the syntax analysis model, and outputting second syntax information corresponding to the training sentence through the decoding layer.

The adjusting module 14 is further configured to adjust a model parameter of the syntactic analysis model according to the second syntactic information.

Optionally, the input module 12 is specifically configured to: inputting the training sentence into the syntactic analysis model, and coding the training sentence through a coding layer of the syntactic analysis model to obtain first syntactic information corresponding to the training sentence; and inputting the first syntax information into a decoding layer of the syntax analysis model to output corresponding second syntax information of the training sentence through the decoding layer.

Optionally, the training module 13 is specifically configured to: inputting the training sentences into the labeling model, and coding the training sentences through a coding layer of the labeling model to obtain semantic information;

inputting the second syntax information and the semantic information into a fusion model to fuse the second syntax information and the semantic information through the fusion model; and inputting the fusion result into a decoding layer of the labeling model so as to output the labeling result of the training sentence through the decoding layer.

Optionally, the training module 13 is further specifically configured to: inputting the first syntax information and the training sentence into the labeling model, and coding the first syntax information and the training sentence through a coding layer of the labeling model to obtain semantic information;

inputting the semantic information and the second syntactic information into a fusion model to fuse the second syntactic information and the semantic information through the fusion model; and inputting the fusion result into a decoding layer of the labeling model so as to output the labeling result of the training sentence through the decoding layer.

Optionally, the adjusting module 14 is specifically configured to: and adjusting model parameters of the labeling model, the syntactic analysis model and the fusion model according to the labeling result.

Optionally, the apparatus further comprises: and an output module 21.

The obtaining module 11 is configured to obtain a sentence to be annotated, which is input by a user.

The input module 12 is used for inputting and training the sentence to be labeled to a convergent syntactic analysis model by a user so as to obtain syntactic information corresponding to the sentence to be labeled; and inputting and training the syntactic information and the sentence to be labeled to a convergent labeling model so as to obtain a labeling result of the sentence to be labeled, wherein the labeling result comprises the emotion type of the sentence to be labeled.

The output module 21 is configured to output a response sentence, where an emotion type of the response sentence matches an emotion type of the sentence to be labeled.

The apparatus shown in fig. 10 can perform the method of the embodiment shown in fig. 1 to 9, and reference may be made to the related description of the embodiment shown in fig. 1 to 9 for a part not described in detail in this embodiment. The implementation process and technical effect of the technical solution refer to the descriptions in the embodiments shown in fig. 1 to fig. 9, and are not described herein again.

Having described the internal functions and structure of the data processing apparatus, in one possible design, the structure of the data processing apparatus may be implemented as an electronic device, as shown in fig. 11, which may include: a processor 31 and a memory 32. Wherein the memory 32 is used for storing a program for supporting the electronic device to execute the data processing method provided in the embodiments shown in fig. 1 to 9, and the processor 31 is configured to execute the program stored in the memory 32.

The program comprises one or more computer instructions which, when executed by the processor 31, are capable of performing the steps of:

acquiring a training sentence;

inputting the training sentence into a syntactic analysis model to obtain syntactic information corresponding to the training sentence;

training a labeling model according to the syntactic information and the training sentences;

and adjusting the respective model parameters of the syntactic analysis model and the labeling model according to the labeling result output by the labeling model.

Optionally, the processor 31 is further configured to perform all or part of the steps in the embodiments shown in fig. 1 to 9.

The electronic device may further include a communication interface 33 for communicating with other devices or a communication network.

In addition, an embodiment of the present invention provides a computer storage medium for storing computer software instructions for the electronic device, which includes a program for executing the data processing method in the method embodiments shown in fig. 1 to 9.

For ease of understanding, the specific implementation process of the data processing method provided above is exemplarily illustrated in conjunction with the following human-computer interaction scenario.

In a human-computer interaction scene, a user can input question sentences to the intelligent robot, and the intelligent robot can recognize and understand the semantics and emotion types of the question sentences according to a labeling model and a syntactic analysis model configured by the intelligent robot.

Specifically, taking a home human-computer interaction scene as an example, a user can input question sentences to an intelligent robot at home: "search for a favorite movie". The parsing model configured by the intelligent robot obtains and processes the input question to obtain the syntax information of the question sentence. The syntax information may include first syntax information expressed as a word vector matrix output by an encoding layer of the parsing model and second syntax information expressed as a probability matrix or a dependent syntax tree output by a decoding layer of the parsing model.

And then, inputting the syntactic information output by the syntactic model and the question and sentence input by the user into a labeling model configured by the intelligent robot, wherein the labeling model can perform semantic analysis and emotion type recognition on the question and sentence by combining the syntactic information, and the output labeling result can be as follows: search for movies target that i [ holder ] likes [ expression ].

According to the labeling result, the intelligent robot can know that the question sentence is to search the movie and can know that the user is in a happy state, but the labeling result cannot be output to the user. Further, the intelligent robot can also output question sentence response sentences for the user according to the labeling result: "recommend movie" XX "for you, hope you see the movie happy".

The relevant contents of the above-described human-computer interaction scenario at home can be understood in conjunction with fig. 12.

In a human-computer interaction scenario of a public service occasion, the question statements input by the user may be: "there are several customers waiting in line and the bank's transaction efficiency is too low". The intelligent robot obtains the labeling result of the question sentence as follows: the bank's transaction efficiency [ target ] is too low for several waiting customers [ express ]. Because the emotion type of the question sentence is dysphoria, at the moment, in order to relieve the dysphoria emotion, the intelligent robot can output a response sentence with mild attitude, namely that '5 customers waiting in line currently, please wait for patience, and get inconvenience to you due to apology'

In a public opinion analysis scenario, a user may input a comment sentence: "I think that the processing method of this thing is really too good, the server can get the annotation result according to the syntactic analysis model and the annotation model that self dispose: "I [ holder ] feels small and the handling method of the event [ target ] is really Tai excellent [ expression ]. The server analyzes a large number of comment sentences to realize public opinion analysis.

In a merchandise evaluation scenario, a user may enter an evaluation statement: "I love the product too much", the server can obtain the labeling result according to the self-configured syntactic analysis model and the labeling model: "I [ holder ] likes [ expression ] this product [ target ]. The server analyzes a large number of evaluation sentences so as to analyze the using effect of the product.

It should be noted that, in the processes of performing semantic analysis and emotion recognition, the intelligent robot or the server needs to use the syntactic analysis model and the annotation model in combination, the specific use process of the syntactic analysis model and the annotation model may refer to the modes shown in fig. 4, fig. 6, and fig. 8, and the specific training modes of the two models may also refer to the relevant descriptions in the embodiments shown in fig. 1 to fig. 8, which are not described herein again.

Finally, it should be noted that: the above examples are only intended to illustrate the technical solution of the present invention, but not to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.

22页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:一种用于隐式篇章关系分析的显式数据筛选方法及系统

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!