A natural language understanding method, device, equipment and readable storage medium
By using a dual-network structure natural language understanding model and employing asynchronous training, the shortcomings of independent and joint modeling are addressed, achieving efficient parsing and decoding of natural language understanding tasks and improving the sharing of modeling parameters and task relevance.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-02
- Publication Date
- 2026-03-27
AI Technical Summary
In existing natural language understanding technologies, independent modeling ignores task relevance, while joint modeling suffers from negative cross-influence of information, failing to fully utilize shared resources between modules.
A dual-network natural language understanding model is adopted, which includes a semantic encoder and a decoder for two natural language understanding tasks, respectively parsing and decoding the input text. Asynchronous training is used to avoid the crossover of negative information and achieve the sharing of modeling parameters.
It solves the problems of independent modeling parameters not being shared and negative information overlap in joint models, thus improving the efficiency and accuracy of natural language understanding.
Smart Images

Figure CN115952257B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of natural language understanding, and in particular, to a natural language understanding method, device, equipment and readable storage medium. BACKGROUND
[0002] In recent years, with the rapid development of artificial intelligence, natural language understanding (NLU) technology provides basic technical support for intelligent question and answer systems, multi-round dialogue systems and other human-computer dialogue applications, and therefore has attracted widespread attention from the academic and industrial circles.
[0003] Among existing natural language understanding technical solutions, there are two common ways, namely, independent modeling and joint modeling. The independent modeling way is to separately perform an intent recognition task and a semantic slot filling task, which ignores the relevance between the two tasks.
[0004] The joint modeling way jointly recognizes the intent recognition task and the semantic slot filling task, which solves the problem of unshared parameters in independent modeling, but jointly trains the two tasks in training, which causes negative information of the tasks to also cross-influence. (Elimination of the cross-influence of negative information, whether it is achieved by training two models under different tasks and then performing feature interaction, is a key point for determining the scope of protection of claim 1) Furthermore, the joint model passes text through the same encoder and then through different decoders to complete the two tasks, which does not fully utilize shared resources among modules. SUMMARY
[0005] The present application aims to provide a natural language understanding method, device, equipment and readable storage medium to improve the above problems. In order to achieve the above purpose, the technical solution adopted by the present application is as follows:
[0006] In a first aspect, the present application provides a natural language understanding method, comprising:
[0007] establishing and training a double-network-structure natural language understanding model to obtain a trained double-network-structure natural language understanding model, the double-network-structure natural language understanding model comprising a semantic encoder of two natural language understanding tasks and a semantic decoder of the two natural language understanding tasks, the semantic encoder of the two natural language understanding tasks being configured to obtain a first analysis result and a second analysis result by analyzing an input vector, and the semantic decoder of the two natural language understanding tasks being configured to obtain a first decoding result and a second decoding result by interacting and decoding the first analysis result and the second analysis result;
[0008] obtaining an input text;
[0009] converting the input text into an input vector;
[0010] The input vector is taken as input information of the trained double-network-structure natural language understanding model, the double-network-structure natural language understanding model is solved, and semantic information corresponding to the input text is obtained.
[0011] In a second aspect, the present application further provides a natural language understanding device, comprising:
[0012] An acquisition module is configured to acquire an input text.
[0013] A conversion module is configured to convert the input text into an input vector.
[0014] A model establishing and training module is configured to establish and train a double-network-structure natural language understanding model, obtain the trained double-network-structure natural language understanding model, and configure the double-network-structure natural language understanding model to comprise semantic encoders of two natural language understanding tasks and semantic decoders of the two natural language understanding tasks, wherein the semantic encoders of the two natural language understanding tasks are configured to obtain first and second analysis results after analyzing the input vector, and the semantic decoders of the two natural language understanding tasks are configured to obtain first and second decoding results after interacting and decoding the first and second analysis results.
[0015] A solving module is configured to take the input vector as input information of the trained double-network-structure natural language understanding model, solve the double-network-structure natural language understanding model, and obtain semantic information corresponding to the input text.
[0016] In a third aspect, the present application further provides a natural language understanding device, comprising:
[0017] A memory is configured to store a computer program.
[0018] A processor is configured to execute the computer program to realize the steps of the natural language understanding method.
[0019] In a fourth aspect, the present application further provides a readable storage medium, wherein the readable storage medium stores a computer program, and the computer program is executed by a processor to realize the steps of the natural language understanding method.
[0020] The present application has the advantages that the double-network-structure and the asynchronous training mode are adopted to complete the natural language understanding task, and the problem that the independent modeling parameters cannot be shared or the negative information of the joint model cannot be crossed in the prior art is solved to a certain extent.
[0021] The application trains the double-network structure natural language understanding model through input text, the double-network structure natural language understanding model includes semantic encoders of two natural language understanding tasks, semantic decoders of two natural language understanding tasks, the semantic encoders of two natural language understanding tasks are used for obtaining first analysis results and second analysis results after analyzing input vectors respectively, and the semantic decoders of two natural language understanding tasks are used for obtaining first decoding results and second decoding results after interacting and decoding the first analysis results and the second analysis results respectively. Therefore, the double-network structure natural language understanding model with a double-network structure is established and trained under corresponding natural language understanding tasks, the model has semantic encoders of two natural language understanding tasks and semantic decoders of two natural language understanding tasks, so that negative information cannot cross under multiple task training, and then the analysis results of each natural language understanding model are interacted and decoded, so that modeling parameters are shared.
[0022] Other features and advantages of the present application will be set forth in the following description, and in part will become apparent to those skilled in the art from the description, or can be learned by practice of the present application. The objects and other advantages of the present application can be realized and attained by means of the instrumentalities particularly pointed out in the written description and claims hereof, as well as the appended drawings. BRIEF DESCRIPTION OF DRAWINGS
[0023] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings needed to be used in the embodiments will be briefly introduced below, and it should be understood that the following drawings only show some of the embodiments of the present application, and therefore should not be regarded as a limitation on the scope, and for those skilled in the art, other related drawings can also be obtained without creative labor on the basis of these drawings.
[0024] Figure 1 The natural language understanding method flowchart described in the embodiments of the present application.
[0025] Figure 2 The natural language understanding device structure diagram described in the embodiments of the present application.
[0026] Figure 3 The natural language understanding device structure diagram described in the embodiments of the present application.
[0027] Figure 4 The first feature interaction module diagram described in the embodiments of the present application.
[0028] Figure 5 The second feature interaction module diagram described in the embodiments of the present application.
[0029] Marked in the figure: 500, acquisition module; 600, conversion module; 700, model establishment and training module; 701, first establishment module; 702, second establishment module; 703, third establishment module; 704, fourth establishment module; 705, first full connection layer; 706, second full connection layer 706; 707, first softmax classification module; 708, second softmax classification module; 709, first understanding module; 710, second understanding module; 800, solving module; 900, natural language understanding device; 901, processor; 902, memory; 903, multimedia component; 904, I / O interface; 905, communication component. DETAILED DESCRIPTION
[0030] To make the objects, technical solutions and advantages of the embodiments of the present application clearer, the following will be combined with the drawings in the embodiments of the present application to make a clear and complete description of the technical solutions in the embodiments of the present application. Obviously, the described embodiments are some of the embodiments of the present application but not all the embodiments. The components of the embodiments of the present application described and shown in the drawings can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the claimed present application but only represents selected embodiments of the present application. All other embodiments obtained by those of ordinary skill in the art without creative work based on the embodiments in the present application belong to the scope of protection of the present application.
[0031] It should be noted that: similar labels and letters represent similar items in the following drawings, therefore, once an item is defined in one drawing, it does not need to be further defined and explained in the subsequent drawings. Meanwhile, in the description of the present application, the terms "first", "second" and the like are only used to distinguish the description and cannot be understood as indicating or implying relative importance.
[0032] Embodiment 1
[0033] The embodiment provides a natural language understanding method.
[0034] Referring to Figure 1 , the method includes steps S100, S200, S300 and S400.
[0035] Step S100 is to acquire an input text.
[0036] Step S200 is to convert the input text into an input vector.
[0037] Step S200 specifically includes:
[0038] Converting the input text into a word vector;
[0039] The word vectors are transformed into contextual vectors based on the attention mechanism.
[0040] The word vectors and the context perception vectors are concatenated to form the input vector.
[0041] In this step, converting the input text into word vectors specifically includes: a text S of length N = {s1, s2, ..., s...} N} is transformed into a multidimensional vector E through the embedding layer. S ={e1,e2,...,e N}∈R N×d , where R is the set of real numbers, d represents the word embedding dimension, and the embedding layer adopts the embedding layer in the prior art.
[0042] In this step, to further extract semantic features, word vectors are transformed into context-aware vectors based on an attention mechanism. In this embodiment, an attention mechanism is used to obtain the context-aware vector of the corresponding input text. The formula for obtaining the context-aware vector is as follows:
[0043] C E =SlefAtt(E S (1)
[0044] The attention mechanism described uses existing attention mechanisms, which will not be elaborated upon here.
[0045] Concatenating word vectors with context-aware vectors to form the input vector specifically includes:
[0046] The multidimensional vector E s With context-aware vector C E ={c1,c2,...,c N The concatenation operations are performed to obtain the concatenated vector X = {x1, x2, ..., x}. N The specific formula is as follows:
[0047] x i =[e i ,c i (2)
[0048] Where, x i Let e represent the i-th concatenated vector. i Let c represent the i-th word vector and c respectively. i This represents the i-th context-aware vector;
[0049] Step S300 is to establish and train a dual-network structure natural language understanding model to obtain a trained dual-network structure natural language understanding model, the dual-network structure natural language understanding model comprising semantic encoders of two natural language understanding tasks and semantic decoders of the two natural language understanding tasks, the semantic encoders of the two natural language understanding tasks being configured to obtain first and second analysis results respectively after analyzing an input vector, and the semantic decoders of the two natural language understanding tasks being configured to obtain first and second decoding results respectively after interacting and decoding the first and second analysis results;
[0050] In this step, the dual-network structure natural language understanding model is established and trained, comprising:
[0051] A first Bi-GRU network is established, the input of the first Bi-GRU network being the input vector and the output being the first analysis result;
[0052] A second Bi-GRU network is established, the input of the second Bi-GRU network being the input vector and the output being the second analysis result.
[0053] In this step, the dual-network structure natural language understanding model is established and trained, comprising:
[0054] A first GRU network is established, the input of the first GRU network at a current time being the analysis results of the first and second Bi-GRU networks at the current time and the hidden layer and output of the first GRU network at a previous time, and the output being the first decoding result, the first decoding result comprising the outputs of all times of the first GRU network;
[0055] A second GRU network is established, the input of the second GRU network at the current time being the analysis results of the first and second Bi-GRU networks at the current time and the hidden layer of the second GRU network at the previous time, and the output being the second decoding result, the second decoding result being the output of the last time of the second GRU network.
[0056] The first and second GRU networks do not have hidden layers and outputs of previous times at the first time.
[0057] In this step, the first and second Bi-GRU networks correspond to the semantic encoders of the two natural language understanding tasks of the dual-network structure natural language understanding model.
[0058] In this step, the first and second GRU networks correspond to the semantic decoders of the two natural language understanding tasks of the dual-network structure natural language understanding model.
[0059] In this step, a dual-network structure natural language understanding model is established and trained, including:
[0060] A first full connection layer is established, with the first decoding result as the input and the first decoding vector as the output;
[0061] A second full connection layer is established, with the second decoding result as the input and the second decoding vector as the output;
[0062] A first softmax classification module is established, with the first decoding vector as the input and the first category distribution as the output;
[0063] A second softmax classification module is established, with the second decoding vector as the input and the second category distribution as the output;
[0064] A first understanding module is established, with the first category distribution as the input and the first semantic information of the input text as the output;
[0065] A second understanding module is established, with the second category distribution as the input and the second semantic information of the input text as the output.
[0066] In this step, the first Bi-GRU network, the second Bi-GRU network, the first GRU network and the second GRU network of the dual-network structure natural language understanding model correspond to the semantic encoder and the semantic decoder of the semantic slot filling task model and the intent recognition task model, respectively.
[0067] In this step, the specific operation process of the Bi-GRU network is as follows:
[0068]
[0069]
[0070]
[0071] Specifically, as shown in formulas (3)-(5), represents the forward encoding, represents the backward encoding, x t represents the input vector at time t, represents the forward hidden state at time t, represents the forward hidden state at time t-1, represents the backward hidden state at time t, h t represents the hidden state of the encoding layer at time t, represents the hidden state at time t-1, and the hidden state output by the corresponding model semantic encoder is When i = S, it represents the hidden state output by the semantic encoder of the semantic slot filling task model. Hidden states output by the semantic encoder in the semantic slot filling task model Corresponding to the first parsing result above, when i = I, it represents the hidden state output by the semantic encoder of the intent recognition task model. Hidden state output by the semantic encoder of the intent recognition task model correspond.
[0072] In this step, the specific computation process of the semantic decoder in the semantic slot filling task model is as follows:
[0073] The input to the first GRU network at time t is the hidden state output by the semantic encoder of the semantic slot filling task model and the semantic encoder of the intent recognition task model at time t. and and the hidden layer of the first GRU network at time t-1 and output The output of the semantic decoder in the semantic slot filling task model is Specifically, as shown in formula (6). Then, the fully connected layer... S Perform dimensional transformation, transforming O S Transform it into a k-dimensional vector, where k represents the number of semantic slots. The output of the first GRU network at time t. This represents the output of the first GRU network at time t-1. Let be the hidden layer of the first GRU network at time t. Let ψ be the hidden layer of the first GRU network at time t-1, and let ψ be the constituent unit of the first GRU network.
[0074]
[0075] See Figure 4 As shown, the semantic decoder of the semantic slot filling task model is shown to operate between the first, second, third, and fourth time points.
[0076] In this step, the specific computational process of the semantic decoder of the intent recognition task model is as follows:
[0077] The input to the second GRU network at time t is the hidden state output by the semantic encoder of the semantic slot filling task model and the semantic encoder of the intent recognition task model at time t. and the hidden layer of the second GRU network at time t-1 The output is the hidden state of the second GRU network at the last time step. The specific formula is shown in formula (7). Then, a fully connected layer is used to... The dimension of the semantic slot filling task model is converted into the number of intent categories L, wherein is the hidden layer of the second GRU network at time t, is the hidden layer of the second GRU network at time t-1, is a component unit of the second GRU network.
[0078]
[0079] Referring to Figure 5 , the operation process of the semantic decoder of the intent recognition task model between N-2, N-1 and N is shown.
[0080] In this step:
[0081] The first softmax classification module specifically takes the output of the semantic decoder of the semantic slot filling task model as the input of the first softmax classification module, and outputs the category distribution of semantic slot filling. The specific calculation formula is shown in formula (8).
[0082] Y S = softmax(W S O S +b S ) (8)
[0083] The second softmax classification module specifically takes the output of the semantic decoder of the intent recognition task model as the input of the second softmax classification module, and outputs the category distribution of intent recognition. The specific calculation formula is shown in formula (9).
[0084]
[0085] wherein Y S represents the category distribution of the output semantic slot filling, W S is the weight matrix of the first softmax classification module, b S is the bias vector of the first softmax classification module, Y S represents the category distribution of intent recognition, W I is the weight matrix of the second softmax classification module, represents the output at the last word position, and b I is the bias vector of the second softmax classification module.
[0086] In this step:
[0087] The first understanding module specifically takes the category distribution of semantic slot filling as the input, and outputs the slot label sequence label S . The specific calculation formula is shown in formula (10):
[0088] label S =argmax(Y S )(10)
[0089] The second understanding module specifically takes the category distribution of the intention recognition as input and outputs an intention category label I . The specific calculation formula is as formula (11) :
[0090] label I =argmax(Y I )(11)
[0091] Step S400 is to take the input vector as the input information of the trained double-network-structure natural language understanding model, solve the double-network-structure natural language understanding model, and obtain the semantic information corresponding to the input text.
[0092] The method further comprises:
[0093] The first improved cross-entropy loss function is constructed, and the first improved cross-entropy loss function includes the length of the output text, the real first semantic information, the number of categories of the first semantic information, and the predicted output of the first understanding module.
[0094] The second improved cross-entropy loss function is constructed, and the second improved cross-entropy loss function includes the real second semantic information, the number of categories of the second semantic information, and the predicted output of the second understanding module.
[0095] After training the double-network-structure natural language understanding model according to each training batch, the loss value of the double-network-structure natural language understanding model is calculated by using the improved cross-entropy loss function, and the parameters of the double-network-structure natural language understanding model are updated by using the Adam optimizer. The training batch includes at least two sample data, and each sample data is obtained by converting the first information.
[0096] If the loss value change rate is less than the second preset value within a preset number of training batches, the training is stopped and the model is saved.
[0097] The specific formulas of the constructed first improved cross-entropy loss function and the second improved cross-entropy loss function are shown in formula (12) and formula (13). Wherein, Loss slot is the loss function of the semantic slot filling task, Loss intent is the loss function of the intention recognition task, and represent the real intention and the label sequence, y I and y S represent the predicted output of the model, k is the number of category labels, l is the number of semantic label categories, and N is the length of the sentence.
[0098]
[0099]
[0100] Embodiment 2
[0101] Referring to Figure 2 As shown in the figure, the embodiment provides a natural language understanding device, which comprises:
[0102] The acquisition module 500 is configured to acquire an input text.
[0103] The conversion module 600 is configured to convert the input text into an input vector.
[0104] The model establishing and training module 700 is configured to establish and train a double-network-structure natural language understanding model to obtain a trained double-network-structure natural language understanding model, wherein the double-network-structure natural language understanding model comprises semantic encoders of two natural language understanding tasks and semantic decoders of the two natural language understanding tasks, the semantic encoders of the two natural language understanding tasks are configured to obtain first and second analysis results respectively after analyzing the input vector, and the semantic decoders of the two natural language understanding tasks are configured to obtain first and second decoding results respectively after interacting and decoding the first and second analysis results.
[0105] The solving module 800 is configured to take the input vector as input information of the trained double-network-structure natural language understanding model, solve the double-network-structure natural language understanding model, and obtain semantic information corresponding to the input text.
[0106] In this step, the model establishing and training module 700 comprises:
[0107] The first establishing module 701 is configured to establish a first Bi-GRU network, wherein the input of the first Bi-GRU network is the input vector, and the output of the first Bi-GRU network is the first analysis result.
[0108] The second establishing module 702 is configured to establish a second Bi-GRU network, wherein the input of the second Bi-GRU network is the input vector, and the output of the second Bi-GRU network is the second analysis result.
[0109] In this step, the model establishing and training module comprises:
[0110] The third establishing module 703 is configured to establish a first GRU network, an input of the first GRU network at a current time is an analysis result of the first Bi-GRU network at the current time, an analysis result of the second Bi-GRU network, and a hidden layer and an output of the first GRU network at a previous time, and an output is a first decoding result, the first decoding result including outputs of all times of the first GRU network.
[0111] The fourth establishing module 704 is configured to establish a second GRU network, an input of the second GRU network at the current time is the analysis result of the first Bi-GRU network at the current time, the analysis result of the second Bi-GRU network, and a hidden layer of the second GRU network at the previous time, and an output is a second decoding result, the second decoding result being an output of a last time of the second GRU network.
[0112] In some specific embodiments, the model establishing and training module 700 further includes:
[0113] The first full connection layer 705 is configured to establish a first full connection layer, an input of the first full connection layer is the first decoding result, and an output is a first decoding vector;
[0114] The second full connection layer 706 is configured to establish a second full connection layer, an input of the second full connection layer is the second decoding result, and an output is a second decoding vector;
[0115] The first softmax classification module 707 is configured to establish a first softmax classification module, an input of the first softmax classification module is the first decoding vector, and an output is a first category distribution;
[0116] The second softmax classification module 708 is configured to establish a second softmax classification module, an input of the second softmax classification module is the second decoding vector, and an output is a second category distribution;
[0117] The first understanding module 709 is configured to establish a first understanding module, an input of the first understanding module is the first category distribution, and an output is first semantic information of the input text;
[0118] The second understanding module 710 is configured to establish a second understanding module, an input of the second understanding module is the second category distribution, and an output is second semantic information of the input text.
[0119] It should be noted that, as to the apparatus in the above embodiments, the specific manners in which various modules perform operations have been described in detail in the embodiments of the method, and will not be described here in detail.
[0120] Embodiment 3:
[0121] Corresponding to the above method embodiments, this embodiment also provides a natural language understanding device. The natural language understanding device described below can correspond to the natural language understanding method described above.
[0122] Figure 3 is a block diagram of a natural language understanding device 900 according to an exemplary embodiment. Referring to Figure 3 As shown, the natural language understanding device 900 can include a processor 901, a memory 902. The natural language understanding device 900 can also include one or more of a multimedia component 903, an I / O interface 904, and a communication component 905.
[0123] The processor 901 is configured to control overall operations of the natural language understanding device 900 to complete all or part of the steps in the natural language understanding method described above. The memory 902 is configured to store various types of data to support the operations of the natural language understanding device 900, which can include, for example, instructions for any application or method operating on the natural language understanding device 900, and application-related data, such as contact data, sent and received messages, pictures, audio, video, and the like. The memory 902 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as a static random access memory (SRAM), an electrically erasable programmable read-only memory (EEPROM), an erasable programmable read-only memory (EPROM), a programmable read-only memory (PROM), a read-only memory (ROM), a magnetic memory, a flash memory, a magnetic disk, or an optical disk. The multimedia component 903 can include a screen and an audio component. The screen can be, for example, a touch screen, and the audio component is configured to output and / or input audio signals. For example, the audio component can include a microphone configured to receive external audio signals. The received audio signals can be further stored in the memory 902 or transmitted through the communication component 905. The audio component also includes at least one speaker configured to output audio signals. The I / O interface 904 provides an interface between the processor 901 and other interface modules, which can be a keyboard, a mouse, a button, and the like. The buttons can be virtual buttons or physical buttons. The communication component 905 is configured to perform wired or wireless communication between the natural language understanding device 900 and other devices. The wireless communication, such as Wi-Fi, Bluetooth, near field communication (NFC), 2G, 3G, or 4G, or a combination of one or more of them, so the corresponding communication component 905 can include a Wi-Fi module, a Bluetooth module, an NFC module.
[0124] In an example embodiment, the natural language understanding device 900 can be implemented by one or more Application Specific Integrated Circuits (ASICs), Digital Signal Processors (DSPs), Digital Signal Processing Devices (DSPDs), Programmable Logic Devices (PLDs), Field Programmable Gate Arrays (FPGAs), controllers, micro-controllers, microprocessors or other electronic elements for executing the natural language understanding method described above.
[0125] In another example embodiment, a computer readable storage medium including program instructions is also provided, which when executed by a processor, implement the steps of the natural language understanding method described above. For example, the computer readable storage medium can be the memory 902 described above including program instructions executable by the processor 901 of the natural language understanding device 900 to complete the natural language understanding method described above.
[0126] Embodiment 4
[0127] Corresponding to the method embodiments above, in this embodiment, a readable storage medium is also provided, which can be referred to each other below described with the natural language understanding method described above.
[0128] A readable storage medium, on which a computer program is stored, when executed by a processor, implements the steps of the natural language understanding method of the method embodiments described above.
[0129] The readable storage medium can be specifically a U disk, a mobile hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and various readable storage media that can store program codes.
[0130] The above only describes the preferred embodiments of the present application and is not used to limit the present application. For those skilled in the art, the present application can have various modifications and changes. Any modification, equivalent replacement, improvement, etc. within the spirit and principle of the present application shall be included in the protection scope of the present application.
[0131] The above merely illustrates the specific embodiments of the present application, but the protection scope of the present application is not limited thereto, any person skilled in the art can easily think of the changes or replacements within the technical range disclosed by the present application, which should be covered in the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.
Claims
1. A natural language understanding method, characterized by, The method comprises the following steps: acquiring an input text; transforming the input text into an input vector; establishing and training a double-network-structure natural language understanding model to obtain a trained double-network-structure natural language understanding model, wherein the double-network-structure natural language understanding model comprises semantic encoders for two natural language understanding tasks and semantic decoders for the two natural language understanding tasks, the semantic encoders are used to obtain first and second analysis results by analyzing the input vector, and the semantic decoders are used to obtain first and second decoding results by decoding and interacting the first and second analysis results; inputting the input vector into the trained double-network-structure natural language understanding model as input information, and solving the double-network-structure natural language understanding model to obtain semantic information corresponding to the input text; wherein, after inputting the input vector into the trained double-network-structure natural language understanding model as input information, and solving the double-network-structure natural language understanding model to obtain semantic information corresponding to the input text, the method further comprises the following steps: constructing a first improved cross-entropy loss function, wherein the first improved cross-entropy loss function comprises the length of the output text, the real first semantic information, the number of categories of the first semantic information, and the predicted output of the first understanding module; constructing a second improved cross-entropy loss function, wherein the second improved cross-entropy loss function comprises the real second semantic information, the number of categories of the second semantic information, and the predicted output of the second understanding module; after training the double-network-structure natural language understanding model according to each training batch, calculating the loss value of the double-network-structure natural language understanding model by using the improved cross-entropy loss function, and updating the parameters of the double-network-structure natural language understanding model by using the Adam optimizer, wherein the training batch comprises at least two sample data, and each sample data is obtained by transforming the first information; if the loss value change rate is less than a second preset value within a preset number of training batches, stopping training and saving the model.
2. The natural language understanding method of claim 1, wherein, The method for establishing and training the double-network-structure natural language understanding model comprises the following steps: establishing a first Bi-GRU network, wherein the input of the first Bi-GRU network is the input vector, and the output of the first Bi-GRU network is the first analysis result; establishing a second Bi-GRU network, wherein the input of the second Bi-GRU network is the input vector, and the output of the second Bi-GRU network is the second analysis result.
3. The natural language understanding method of claim 1, wherein, The method for establishing and training the double-network-structure natural language understanding model comprises the following steps: establishing a first GRU network, wherein the input of the first GRU network at the current time is the analysis result of the first Bi-GRU network and the analysis result of the second Bi-GRU network at the current time, the hidden layer and the output of the first GRU network at the previous time, and the output of the first GRU network at the current time comprises the outputs of the first GRU network at all times; A second GRU network is established, an input of a current time of the second GRU network is a parsing result of a current time first Bi-GRU network, a parsing result of a second Bi-GRU network and a hidden layer of a last time of the second GRU network, and an output is a second decoding result, the second decoding result is an output of a last time of the second GRU network.
4. The natural language understanding method of claim 1, wherein, The input text is converted into an input vector, including: The input text is converted into a word vector; The word vector is converted into an up-down perception vector according to an attention mechanism; The word vector and the up-down perception vector are spliced into the input vector.
5. A natural language understanding apparatus characterized by comprising: Including: An acquisition module is configured to acquire an input text; A conversion module is configured to convert the input text into an input vector; A model establishing and training module is configured to establish and train a double-network-structure natural language understanding model to obtain a trained double-network-structure natural language understanding model, the double-network-structure natural language understanding model including semantic encoders of two natural language understanding tasks, a semantic decoder, the semantic encoders of the two natural language understanding tasks being configured to respectively obtain a first parsing result and a second parsing result after parsing the input vector, and the semantic decoder being configured to respectively obtain a first decoding result and a second decoding result after interacting and decoding the first parsing result and the second parsing result; A solving module is configured to take the input vector as input information of the trained double-network-structure natural language understanding model, solve the double-network-structure natural language understanding model, and obtain semantic information corresponding to the input text; After taking the input vector as input information of the trained double-network-structure natural language understanding model, solving the double-network-structure natural language understanding model, and obtaining the semantic information corresponding to the input text, the method further includes: A first improved cross-entropy loss function is constructed, the first improved cross-entropy loss function including a length of the output text, real first semantic information, a category number of the first semantic information, and a predicted output of the first understanding module; A second improved cross-entropy loss function is constructed, the second improved cross-entropy loss function including the real second semantic information, a category number of the second semantic information, and a predicted output of the second understanding module; After training the double-network-structure natural language understanding model according to each training batch, a loss value of the double-network-structure natural language understanding model is calculated by using the improved cross-entropy loss function, and parameters of the double-network-structure natural language understanding model are updated by using an Adam optimizer, the training batch including at least two sample data, and each sample data being obtained by converting the first information; If a loss value change rate is less than a second preset value within a preset number of training batches, the training is stopped and the model is saved.
6. The natural language understanding apparatus of claim 5, wherein, The model establishing and training module includes: A first establishing module is configured to establish a first Bi-GRU network, an input of the first Bi-GRU network being the input vector, and an output being the first parsing result; A second establishing module is configured to establish a second Bi-GRU network, an input of the second Bi-GRU network being the input vector, and an output being the second parsing result.
7. The natural language understanding apparatus of claim 5, wherein, The model establishing and training module includes: The third establishing module is configured to establish a first GRU network, an input of a current time of the first GRU network being a result of analysis of the first Bi-GRU network, a result of analysis of the second Bi-GRU network and a hidden layer and an output of the first GRU network of a last time, and an output being a first decoding result, the first decoding result including outputs of all times of the first GRU network; The fourth establishing module is configured to establish a second GRU network, an input of a current time of the second GRU network being a result of analysis of the first Bi-GRU network, a result of analysis of the second Bi-GRU network and a hidden layer of the second GRU network of a last time, and an output being a second decoding result, the second decoding result being an output of a last time of the second GRU network.
8. The natural language understanding apparatus of claim 5, wherein, The converting module comprises: The first converting module is configured to convert the input text into a word vector; The second converting module is configured to convert the word vector into a context-aware vector according to an attention mechanism; The third converting module is configured to splice the word vector and the context-aware vector into an input vector.
9. A natural language understanding apparatus device, characterized by, The computer program is stored in the readable storage medium and is executed by the processor to realize the steps of the natural language understanding method according to any one of claims 1 to 4. The computer program is stored in the readable storage medium and is executed by the processor to realize the steps of the natural language understanding method according to any one of claims 1 to 4. 10. A readable storage medium characterized by:
Citation Information
Patent Citations
Joint modeling method for spoken language understanding model and language model and dialogue method
CN108962224A
Semantic understanding method
CN113128235A