Text instruction intention recognition method and device based on natural language processing

By introducing constrained attention adjustment and extreme learning machine on the Bert model, combined with generative adversarial network and quantum resonance optimization, and using the manifold encoding mechanism, the complexity and context dependence problems of text instruction intent recognition in natural language processing are solved, and the problem is improved. Improve the accuracy and generalization ability of intention recognition.

CN118503798BActive Publication Date: 2024-09-17SHANDONG ENERGY DIGITAL CLOUD TECH CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202410979004.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-22
Publication Date
2024-09-17
Estimated Expiration
2044-07-22

AI Technical Summary

Technical Problem

Existing natural language processing technology has problems in processing complex language structures, insufficient capture of context dependencies, limited instruction processing capabilities in specific fields, and weak generalization capabilities due to data scarcity in text instruction intent recognition, and lacks effective models and algorithms. To mine the interactive relationship between text instructions and task instructions.

Method used

The constrained attention adjustment strategy based on the Bert model is used to dynamically adjust the attention weight, combined with the extreme learning machine and the generative adversarial network algorithm, and through the quantum resonance optimization and manifold encoding mechanism, a feature extraction model is built to capture the intended features in the text instructions. And consider the interactive relationship between text and task instructions through the interactive attention mechanism.

Benefits of technology

It improves the context understanding ability of text instructions and the accuracy of intent recognition, optimizes the training process and classification performance of the model, and enhances the processing ability of instructions in specific fields and the generalization ability in the case of data scarcity.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118503798B
    Figure CN118503798B
Patent Text Reader

Abstract

The present invention provides a method and device for identifying the intention of text instructions based on natural language processing, which relates to the field of data processing technology. The Bert model is used to identify the input text instructions, and after capturing the features related to the intention in the text instructions, the classification results corresponding to the features are output by the classifier model, and the intention of the text instructions is determined based on the classification results. Among them, the Bert model is constructed by dynamically adjusting the attention weights by adopting a constrained attention adjustment strategy. This method can improve the model's ability to understand the context of text instructions, so as to more accurately identify and understand the intentions in text instructions. The classifier model uses an extreme learning machine as a classifier algorithm, and adopts a steady-state optimization strategy to determine the output weights of the extreme learning machine. This method optimizes the stability of the model parameters during the training process and improves the classification performance.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data processing technology, and in particular to a method and device for recognizing text instruction intention based on natural language processing. Background Art

[0002] In the field of natural language processing, with the widespread application of intelligent assistants, chatbots and various intelligent systems, the demand for machines to understand human language intentions is growing. As an important branch of natural language processing, text command intention recognition aims to enable computers to accurately understand and process instructions issued by users in text form, which is crucial to improving the naturalness and efficiency of human-computer interaction. However, due to the complexity and diversity of natural language, accurately identifying the intent in text instructions remains a challenge.

[0003] Traditional intent recognition methods mostly rely on pattern matching or basic machine learning models, which work well for simple instructions, but often fail to perform well when faced with complex language structures, implicit intent, or context-related situations. With the development of deep learning technology, models based on neural networks, especially the introduction of pre-trained language models such as BERT, have greatly improved the accuracy of intent recognition. These models can capture deep semantic and syntactic relationships in text, thereby better understanding the true intent of user instructions. However, even the most advanced models have many shortcomings, such as limited ability to handle instructions in specific fields, insufficient capture of contextual dependencies, and weak generalization capabilities when data is scarce.

[0004] In addition, existing intent recognition methods often ignore the interactive relationship between text instructions and specific task instructions, as well as the complex dependencies within and outside text instructions. These relationships are crucial for accurately identifying user intent, but the lack of effective models and algorithms to deeply explore such relationships has resulted in intent recognition performance failing to reach an ideal level. At the same time, the quality and quantity of data are also crucial for training high-performance intent recognition models. However, high-quality, highly relevant training data is often difficult to obtain, especially in specific domains, which further limits the model's learning and generalization capabilities. Summary of the invention

[0005] In view of this, an object of the present invention is to provide a method and device for identifying the intention of text instructions based on natural language processing, which can more accurately identify and understand the intention in text instructions.

[0006] In a first aspect, an embodiment of the present invention provides a method for identifying the intent of a text instruction based on natural language processing, and the method is applied to a recognition system, wherein the method includes: responding to a text instruction input by a user; identifying the text instruction through a pre-constructed Bert model to capture features related to the intent in the text instruction; wherein the Bert model is constructed by dynamically adjusting the attention weight by adopting a constrained attention adjustment strategy; inputting the features into a pre-constructed classifier model, and outputting a classification result corresponding to the features; the classifier model uses an extreme learning machine as a classifier algorithm, and adopts a steady-state optimization strategy to determine the output weight of the extreme learning machine; a training sample set for training the classifier model is constructed based on a generative adversarial network algorithm, and the parameters of the generative adversarial network algorithm are optimized based on a game deterministic strategy; and determining the intent of the text instruction based on the classification result.

[0007] In combination with the first aspect, an embodiment of the present invention also provides a first implementation method of the first aspect, wherein the step of determining the intention of the text instruction based on the classification result includes: obtaining the instruction intention classification category indicated by the classification result, and determining the intention of the text instruction based on the instruction intention classification category.

[0008] In combination with the first aspect, an embodiment of the present invention further provides a second implementation of the first aspect, wherein the method further includes: obtaining a preset neural network, initializing the parameters of the neural network to a quantum state, and mapping the value of the loss function to the amplitude and phase of the parameter state through a mapping function; simulating the dynamic evolution of a quantum oscillator, and calculating the energy and frequency corresponding to the quantum state according to the loss function of the neural network and the current state of the parameters; updating the parameters of the neural network by quantum transition based on the energy and frequency; decoding the updated parameters from the quantum state, and balancing the neural network using a multi-objective optimization strategy; until the neural network meets the preset optimization conditions, a feature extraction model is constructed based on the neural network to extract features related to the intent through the feature extraction model, and output key features among the features related to the intent.

[0009] In combination with the first aspect, an embodiment of the present invention further provides a third implementation of the first aspect, wherein the method further includes: performing quantum entanglement on the quantum state, and updating the parameters of the neural network using a dynamically adjusted quantum entanglement strategy.

[0010] In combination with the first aspect, an embodiment of the present invention also provides a fourth implementation of the first aspect, wherein the method also includes: inputting features into a preset autoencoder, mapping the features to a low-dimensional latent space using a manifold coding mechanism, and mapping the features back to the original data space through a decoder of the autoencoder; the manifold coding mechanism is implemented by a local linear embedding algorithm.

[0011] In combination with the first aspect, an embodiment of the present invention also provides a fifth implementation of the first aspect, wherein the manifold coding mechanism includes a manifold regularization term, and the method also includes: during the training process of the autoencoder, calculating the gradient of the loss function of the autoencoder with respect to the autoencoder parameters through a backpropagation algorithm, and using the Adam optimization algorithm to update the parameters of the encoder and decoder of the autoencoder; and, using an adaptive adjustment mechanism to dynamically adjust the strength of the manifold coding mechanism and the weight of the manifold regularization term according to changes in data.

[0012] In combination with the first aspect, an embodiment of the present invention further provides a sixth implementation of the first aspect, wherein a method for constructing a classifier model includes: initializing the hidden layer weights and biases of an extreme learning machine, and inputting a preset training sample set into the hidden layer of the extreme learning machine; minimizing the classification error of the extreme learning machine using a steady-state optimization strategy, and determining the final output weight of the extreme learning machine based on the gradient of the classification error to the output weight of the extreme learning machine; until the extreme learning machine reaches the preset training conditions, a classifier model is constructed based on the extreme learning machine.

[0013] In combination with the first aspect, an embodiment of the present invention also provides a seventh implementation method of the first aspect, wherein a method for constructing a training sample set includes: obtaining pre-recorded text instruction samples, annotating the text instruction samples, and constructing an initial sample set; using a preset generative adversarial network algorithm to perform data expansion on the initial sample set to generate expanded samples; optimizing the generator parameters and discriminator parameters of the generative adversarial network algorithm based on a game deterministic strategy; post-processing the expanded samples, and merging the post-processed samples with the initial sample set to construct a training sample set.

[0014] In combination with the first aspect, an embodiment of the present invention also provides an eighth implementation of the first aspect, wherein a method for constructing a Bert model comprises: inputting a preset training sample set into an initial Bert model after word segmentation and word vectorization processing; pre-training the initial Bert model through an interactive attention mechanism, and enhancing the attention mechanism of the initial Bert model using a dynamic context-aware mechanism; adopting a constrained attention adjustment strategy to further optimize the attention weight of the initial Bert model; dynamically adjusting the model parameters of the initial Bert model through an adaptive adjustment mechanism; until the initial Bert model reaches the preset training conditions, a Bert model is constructed based on the initial Bert model.

[0015] In the second aspect, an embodiment of the present invention also provides a text instruction intention recognition device based on natural language processing, the device comprising: a response module, used to respond to text instructions input by a user; a data processing module, used to recognize text instructions through a pre-built Bert model, and capture features related to intent in the text instructions; wherein the Bert model is constructed by dynamically adjusting the attention weight by adopting a constrained attention adjustment strategy; an execution module, used to input the features into a pre-built classifier model, and output the classification results corresponding to the features; the classifier model uses an extreme learning machine as a classifier algorithm, and adopts a steady-state optimization strategy to determine the output weights of the extreme learning machine; the training sample set for training the classifier model is constructed based on a generative adversarial network algorithm, and the parameters of the generative adversarial network algorithm are optimized based on a game deterministic strategy; an output module, used to determine the intent of the text instruction based on the classification results.

[0016] The embodiments of the present invention bring the following beneficial effects: the present invention provides a method and device for identifying the intention of text instructions based on natural language processing, which identifies the input text instructions through the Bert model, captures the features related to the intention in the text instructions, and then the classifier model outputs the classification results corresponding to the features, and determines the intention of the text instructions based on the classification results. Among them, the Bert model is constructed by dynamically adjusting the attention weights using a constrained attention adjustment strategy. This method can improve the model's ability to understand the context of text instructions, so as to more accurately identify and understand the intentions in text instructions. The classifier model uses an extreme learning machine as a classifier algorithm, and uses a steady-state optimization strategy to determine the output weights of the extreme learning machine. This method optimizes the stability of the model parameters during training and improves the classification performance.

[0017] Other features and advantages of the present invention will be described in the following description, and partly become apparent from the description, or understood by practicing the present invention. The purpose and other advantages of the present invention are realized and obtained by the structures particularly pointed out in the description and the drawings.

[0018] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, preferred embodiments are given below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0020] Figure 1A flowchart of a method for identifying text instruction intention based on natural language processing provided by an embodiment of the present invention;

[0021] Figure 2 A flowchart of another method for identifying text instruction intention based on natural language processing provided by an embodiment of the present invention;

[0022] Figure 3 A flowchart of a method for constructing a training sample set provided by an embodiment of the present invention;

[0023] Figure 4 A schematic diagram of the structure of a text instruction intention recognition device based on natural language processing provided by an embodiment of the present invention;

[0024] Figure 5 A schematic diagram of the structure of another device for identifying text instruction intention based on natural language processing provided by an embodiment of the present invention;

[0025] Figure 6 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0026] In order to make the purpose, technical scheme and advantages of the embodiments of the present invention clearer, the following embodiments of the present disclosure are described by specific specific examples, and those skilled in the art can easily understand other advantages and effects of the present disclosure from the contents disclosed in this specification. Obviously, the described embodiments are only part of the embodiments of the present disclosure, rather than all of the embodiments. The present disclosure can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present disclosure. It should be noted that the following embodiments and features in the embodiments can be combined with each other without conflict. Based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present disclosure.

[0027] The embodiments of the present invention provide a method and device for recognizing the intention of text instructions based on natural language processing, which can more accurately recognize and understand the intention in text instructions.

[0028] To facilitate understanding of this embodiment, a method for recognizing the intention of a text instruction based on natural language processing disclosed in an embodiment of the present invention is first introduced in detail. The method is applied to a recognition system, which refers to a natural language processing system that can parse and understand human natural language instructions. In one embodiment, such systems are widely used in virtual assistants, chatbots, smart home controls, voice recognition software, and various automation tools, and understand the intention and information in the text through semantic analysis, syntactic analysis, entity recognition, and other technologies, and then perform corresponding operations or provide required information. Figure 1 A flowchart of a method for identifying text instruction intention based on natural language processing provided by an embodiment of the present invention is shown. Figure 1 As shown, the method comprises the following steps:

[0029] Step S102, responding to the text instruction input by the user.

[0030] Step S104, identifying the text instruction through the pre-built Bert model to capture the features related to the intention in the text instruction.

[0031] Step S106, input the features into a pre-built classifier model, and output the classification results corresponding to the features.

[0032] Step S108, determining the intention of the text instruction based on the classification result.

[0033] The full name of the Bert model is Bidirectional Encoder Representations from Transformers. It is a deep learning model specifically used for natural language processing tasks. Its core innovation lies in the use of a bidirectional Transformer encoder, which enables the model to consider the context of words at the same time when processing language, thereby obtaining a richer semantic representation. BERT can simultaneously consider the left and right contexts of a word in a sentence, which helps the model understand the meaning of vocabulary in a specific context. There are many variants of the BERT model, such as Bert_BASE and Bert_LARGE, which differ in the number of layers, number of hidden units, number of attention heads, and number of parameters to meet the needs of tasks of different scales. The emergence of BERT has greatly promoted the development of the field of natural language processing, and has achieved remarkable results in many natural language processing tasks, such as sentiment analysis, named entity recognition, question-answering systems, etc. In an embodiment of the present invention, the Bert model is constructed by dynamically adjusting the attention weights using a constrained attention adjustment strategy, and the BERT model usually uses a multi-head self-attention mechanism to process sequence data. In the embodiment of the present invention, by adopting a constrained attention adjustment strategy, the attention weights of different parts can be dynamically adjusted, which helps the model focus more on the text parts that are more meaningful to the classification task. This adjustment can be achieved by introducing additional loss functions or regularization terms to ensure that the attention weights meet specific constraints.

[0034] The classifier model uses the extreme learning machine as the classifier algorithm, and a steady-state optimization strategy is used to determine the output weights of the extreme learning machine. The Extreme Learning Machine (ELM) is a fast learning algorithm for single-layer feedforward neural networks, which is designed to solve large-scale machine learning problems. In traditional neural networks, the weights of all layers need to be adjusted through the back-propagation algorithm, which can be a time-consuming process. However, in ELM, only the weights of the output layer need to be adjusted, while the weights and biases of the hidden layer are kept unchanged after initialization, which greatly simplifies the training process and enables ELM to complete training in a very short time. When ELM is used as a classifier model, its core idea is to randomly initialize the weights and biases of the hidden layer, and then pass the input data to the hidden layer to produce the output of the hidden layer. Since the weights and biases of the hidden layer are fixed, the problem is transformed into a linear regression problem, that is, finding an optimal output weight matrix that can minimize the error on the training set.

[0035] Steady-State Optimization Strategy usually refers to a method in evolutionary algorithms that evaluates and updates only one individual in the population at a time instead of evaluating the entire population at once. However, in the context of ELM, steady-state optimization strategy may refer to using some online learning or incremental learning method to gradually adjust the output weights instead of using all training data for global optimization at once. In ELM, the output weights can be determined by solving a least squares problem, which can usually be achieved through the Moore-Penrose pseudo-inverse. However, this approach may become infeasible if the amount of data is very large. At this time, steady-state optimization strategies such as gradient descent or its variants (such as stochastic gradient descent SGD) can be used to gradually update the output weights to adapt to incremental data or online learning scenarios. This approach can effectively handle streaming data or large datasets because they do not need to store all training data in memory, but can update the model in batches or sample by sample. In summary, when ELM is used as a classifier model and a steady-state optimization strategy is used to determine the output weights, it combines the fast learning ability of ELM and the flexibility of online learning algorithms, making it very suitable for processing large-scale or real-time data classification tasks.

[0036] Furthermore, the training sample set for training the classifier model in the embodiment of the present invention is constructed based on the generative adversarial network algorithm, and the parameters of the generative adversarial network algorithm are optimized based on the game deterministic strategy. Generative Adversarial Networks (GANs) is a deep learning model. The core concepts of GANs include two neural networks: a generator and a discriminator. The goal of the generator is to generate data samples similar to the distribution of real data, while the task of the discriminator is to distinguish between real data and fake data generated by the generator. The two networks are trained in a competitive manner, and finally the generator can learn the distribution of real data, thereby generating high-quality synthetic data. In the training process of GANs, the parameters of the generator and the discriminator are usually optimized by minimizing the loss function between the two parties. This process can be regarded as a zero-sum game in game theory, in which the generator and the discriminator represent the two players of the game, and their goal is to maximize their own benefits (that is, minimize the benefits of the other party). In this case, "optimization based on a game-theoretic deterministic strategy" means that a strategy is adopted during the training process that takes into account the dynamic interaction between the generator and the discriminator to ensure the stability and convergence of the training process. When the training sample set is constructed based on the GANs algorithm, the use of a game-theoretic deterministic strategy for parameter optimization can ensure that the generator can learn a more complex and realistic data distribution while ensuring the stability and convergence of the entire training process.

[0037] In summary, the embodiments of the present invention can simultaneously consider the internal dependencies of the text and the interactive relationship between the text and task instructions, improve the model's ability to understand the context of text instructions, and more accurately capture features related to task instructions, so as to more accurately identify and understand the intent in text instructions.

[0038] In one embodiment, the text instructions involved in the present invention are derived from instructions input by a user to a recognition system. The text instructions are usually related to work task scheduling. In one embodiment, the text instructions may be: ax: "Schedule a meeting at 9 am tomorrow." ay: "Remind me to check the project progress every Tuesday afternoon." Among them, the text instructions are usually user sentences containing key information such as time, events, and actions. Based on this, the intent in the text is recognized and understood through the model. Correspondingly, the intent categories output by the classifier model include: "Schedule a meeting", "Set a reminder", or other types.

[0039] On the basis of the above embodiment, the embodiment of the present invention also provides another method for identifying the intention of text instructions based on natural language processing, which mainly describes the construction method of the Bert model and the construction method of the classifier model. Among them, the embodiment of the present invention also performs feature extraction and feature dimensionality reduction on the data to further improve the accuracy of the classifier. Figure 2 FIG. 4 is a flowchart of another method for identifying text instruction intention based on natural language processing provided by an embodiment of the present invention. Figure 2 As shown, the method comprises the following steps:

[0040] Step S202, responding to the text instruction input by the user.

[0041] Step S204, identifying the text instruction through the pre-built Bert model to capture the features related to the intention in the text instruction.

[0042] The present invention adopts the Bert algorithm based on interactive attention enhancement to extract the features of text data. The traditional Bert model adopts the Transformer architecture to capture the dependencies in the text through the self-attention mechanism. The present invention adopts the interactive attention mechanism, which not only considers the dependencies within the text, but also considers the interaction between the text and the task instructions, so as to more accurately capture the features related to the intention. In addition, the present invention adopts a constrained attention adjustment strategy, which enables the model to pay more attention to the part of the text that is most relevant to the task instructions by dynamically adjusting the attention weight during the training process. Specifically, the construction method of the Bert model of the embodiment of the present invention is as follows:

[0043] 1) The preset training sample set is input into the initial Bert model after word segmentation and word vectorization.

[0044] 2) The initial BERT model is pre-trained through an interactive attention mechanism, and the attention mechanism of the initial BERT model is enhanced using a dynamic context-aware mechanism.

[0045] In the specific implementation, the Bert model is pre-trained so that it can understand the basic structure of the language. During the training process, the text instructions are first segmented and converted into a format that the model can understand. In one embodiment, for the text instruction "arrange a meeting at 9 am tomorrow", after segmentation, it may become ["arrange", "tomorrow", "morning", "9", "point", "of", "meeting"], and the text after segmentation is converted into the corresponding word vector and then input into the model.

[0046] On the basis of pre-training, the model is further trained through the interactive attention mechanism so that the model learns how to adjust its attention distribution according to the task instructions. Specifically, the present invention adopts the attention adjustment factor , which is used to enhance the model's attention to the part of the text related to the task instructions. The attention adjustment factor is calculated as follows:

[0047]

[0048] in, is a trainable weight matrix, is the feature representation of text instructions, is the bias term, is the ReLU activation function, the attention adjustment factor Used to adjust the original self-attention mechanism.

[0049] Furthermore, a dynamic context-aware mechanism is used to improve the model's ability to understand the context of text instructions. The dynamic context-aware mechanism enhances the model's attention mechanism through an additional context-aware network. The context-aware network can dynamically adjust the attention weight according to the context of the text instruction, thereby more accurately capturing the features related to the task instruction. Specifically, is the output of the context-aware network, which is based on the current attention distribution and text features Dynamically generate context weights , which can be expressed as:

[0050]

[0051] Furthermore, using context weight To adjust the original attention score, get a new context-aware attention score , which can be expressed as:

[0052]

[0053] in, is a All 1 vectors of the same dimension. Therefore, when When , the model will pay more attention to key contextual information; when , the model will pay less attention to non-critical information.

[0054] Furthermore, the context weight The calculation method is as follows:

[0055]

[0056] here, is the weight matrix of the context-aware network, is the bias term, is the LeakyReLU activation function.

[0057] Furthermore, define and Initialization method, set Initialized by:

[0058]

[0059] in, is the dimension of the input features, is the dimension of the hidden layer, The Glorot initialization function is a commonly used weight initialization method that aims to keep the variance of the input and output consistent.

[0060] And, the bias term Initialized to a zero vector, it can be expressed as:

[0061]

[0062] in, is the pre-set standard deviation.

[0063] In one embodiment, the model learns the association between "tomorrow at 9 am" and "meeting", and the association between "every Tuesday afternoon" and "check project progress".

[0064] 3) A constrained attention adjustment strategy is adopted to further optimize the attention weights of the initial BERT model.

[0065] Constrained attention adjustment strategies are often used in deep learning, especially in neural network models that process sequence data (such as natural language processing tasks). The main purpose of this strategy is to guide the model to focus on more relevant or important parts of the input sequence, while limiting or reducing attention to irrelevant or minor information. This helps to improve the efficiency and accuracy of the model. When designing a constrained attention strategy, the key is to find a balance between ensuring that the model can capture the key information of the input data while avoiding overfitting or ignoring potential useful signals. This often requires careful adjustment and optimization based on the characteristics of the specific task and dataset.

[0066] Specifically, the constraint To ensure that the attention weights do not deviate from the key information related to the task instructions, the constraint is calculated as follows:

[0067]

[0068] in, and is a trainable parameter of constrained attention adjustment, and the Softmax function is used to convert Convert it into probability distribution to ensure the reasonable distribution of attention weights. Based on this constraint, the effect of feature extraction can be optimized and the ability of feature adaptive refinement can be improved.

[0069] Further, Adopt and A similar initialization method can be expressed as:

[0070]

[0071] in, is the number of output attention heads.

[0072] 4) Dynamically adjust the model parameters of the initial Bert model through the adaptive adjustment mechanism.

[0073] 5) Until the initial Bert model reaches the preset training conditions, a Bert model is constructed based on the initial Bert model.

[0074] In the specific implementation, the adaptive adjustment mechanism dynamically adjusts the model parameters according to the feedback during the training process to improve the accuracy and efficiency of feature extraction. Specifically, the adaptive adjustment mechanism dynamically adjusts the weights To optimize the effect of feature extraction, the calculation method is as follows:

[0075]

[0076] in, is the initial weight, is the learning rate, is the weight update amount and Ada() is the Adam optimizer function.

[0077] Furthermore, the model parameters are optimized by the following objective function:

[0078]

[0079] in, is the sample size, The model is The predicted output of samples is obtained by the preset Softmax classification function. is the loss function, is the regularization coefficient, is the L2 regularization term of the weights.

[0080] Further, Also using A similar initialization method can be expressed as:

[0081]

[0082] in, is the number of adaptive tuning parameters.

[0083] Furthermore, the learning rate Dynamic adjustment through preheating strategy can be expressed as:

[0084]

[0085] in, is the initial learning rate, is the cooling rate, is the total number of training steps.

[0086] Furthermore, the weight update amount It is calculated by the gradient descent method and can be expressed as:

[0087]

[0088] in, is the learning rate, is the loss function right gradient.

[0089] The above steps are iterated repeatedly until a preset condition for stopping iteration is met. In one embodiment, the preset condition for stopping iteration is reaching a preset maximum number of iterations. Preferably, the preset maximum number of iterations is set to 1000 times.

[0090] Furthermore, the embodiment of the present invention also extracts features related to intent through a pre-built feature extraction model, and outputs key features among the features related to intent.

[0091] Among them, when processing large-scale data sets, the existing technology may not be efficient enough in feature extraction and dimensionality reduction or cannot fully retain key information useful for classification tasks, which affects the accuracy and efficiency of subsequent classifiers. The present invention proposes a neural network model based on a quantum resonance optimization algorithm, according to the resonance phenomenon in quantum physics, especially the quantum oscillator model, in which the energy level and position of particles are quantized, and the conversion between energy states follows the laws of quantum mechanics. The present invention uses the quantization and transition characteristics of energy states to simulate the optimization process of neural network parameters.

[0092] Traditional neural networks usually use a gradient descent optimization algorithm, and parameter updates are continuous and based on the direction of the gradient. The quantum resonance optimization algorithm proposed in the present invention updates parameters by simulating the transition of quantum states, so that the algorithm can make discontinuous jumps in the parameter space, thereby more effectively avoiding local optimal solutions and finding global optimal solutions. Specifically, the method for constructing the feature extraction model of the embodiment of the present invention is as follows:

[0093] 1) Obtain a preset neural network, initialize the parameters of the neural network to a quantum state, and map the value of the loss function to the amplitude and phase of the parameter state through a mapping function.

[0094] definition is the weight of the neural network, is the bias of the neural network, is the encoding of weights and biases in quantum states, is the energy corresponding to the neural network parameters, is the frequency of parameter update, is the loss function of the neural network.

[0095] Furthermore, the weights and bias parameters of the neural network are initialized to quantum states, and each parameter corresponds to an energy level in the quantum state. Specifically, the initial quantum states of the weights and biases of the neural network are assumed to be In one embodiment, the parameters of the neural network are initialized by random initialization to ensure that a wide range of parameter spaces are covered. The initial quantum state can be expressed as:

[0096]

[0097] in, is the size of the parameter space; is a random phase, used to ensure the diversity of the initial quantum state; is an imaginary unit; Represents a possible state of the weights and biases.

[0098] In the process of quantum state encoding of parameters, the current network parameters are encoded into the quantum state, and the superposition property of the quantum state is used to represent different parameter possibilities. Encoding into quantum states In, it can be expressed as:

[0099]

[0100] in, and Respectively represent The amplitude and phase of each state.

[0101] Furthermore, considering the loss function For each parameter The sensitivity of , defines a mapping function, expressed as follows: L→α, .

[0102] Furthermore, the loss function is mapped to the amplitude and phase of each parameter state, and the mapping function can be expressed as:

[0103]

[0104]

[0105] in, is a positive hyperparameter that controls the degree of influence of the loss function on the magnitude; is a function that maps the loss function to The function of the interval ensures that the phase is within the range.

[0106] Further, and It can be set as a hyperparameter by artificial preset or by dynamic adjustment.

[0107] Furthermore, the embodiment of the present invention also quantum entangles the quantum state and adopts a dynamically adjusted quantum entanglement strategy to update the parameters of the neural network. Specifically, the embodiment of the present invention improves the ability of the algorithm to explore the parameter space by adopting a dynamically adjusted quantum entanglement strategy. Quantum entanglement refers to a strong correlation between two or more quantum states, that is, the measurement result of one quantum state will instantly affect the state of other quantum states entangled with it. The present invention realizes mutual information exchange and synchronous update during the parameter update process by constructing an entanglement relationship between parameters, thereby improving the efficiency of searching for the global optimal solution.

[0108] Specifically, considering the neural network parameters and The quantum state , define the operation ,operate It is possible to use entanglement between parameters under certain conditions. The entanglement operation can be expressed as:

[0109]

[0110] in, Represents the tensor product, which is used to construct the entanglement between two parameter states.

[0111] Furthermore, in order to quantify the degree of entanglement and dynamically adjust the entanglement strength according to the algorithm progress, the entanglement metric is defined , preferably, the entanglement metric is defined based on the concept of entanglement entropy, for any given quantum state , the entanglement entropy can be expressed as:

[0112]

[0113] in, By Relative to bias The weight obtained from the partial trace The reduced density matrix of Indicates trace operation.

[0114] Furthermore, based on the entanglement entropy, the entanglement metric is defined for:

[0115]

[0116] The value of is between 0 and 1, where close to 1 indicates high entanglement and close to 0 indicates almost no entanglement. The entanglement strategy is dynamically adjusted based on the value of to optimize the parameter updating process.

[0117] Furthermore, during dynamic adjustment, a higher entanglement is used in the early stages of the algorithm to increase information exchange between parameters and accelerate the process of escaping the local optimal solution; in the later stages of the algorithm, the entanglement is reduced to refine the search and accurately approach the global optimal solution. middle and The calculation method can be expressed as:

[0118]

[0119]

[0120] in, represents the number of iterations of the algorithm, It is the phase adjustment amount, which is used to adjust the speed of phase change according to the change of entanglement degree, thereby affecting the direction and amplitude of parameter update.

[0121] 2) Simulate the dynamic evolution of the quantum oscillator and calculate the energy and frequency corresponding to the quantum state based on the loss function of the neural network and the current state of the parameters.

[0122] Simulate the dynamic evolution of the quantum oscillator, calculate the corresponding energy and frequency according to the network's loss function and the current state of the parameters, and use them to guide the direction and amplitude of parameter updates. Specifically, calculate the energy corresponding to each quantum state. can be expressed as:

[0123]

[0124] in, is the Hamiltonian, which represents the total energy of the system and is used to measure the energy of the parameter state.

[0125] Furthermore, the Hamiltonian The total energy of the calculation system. Hamiltonian is an operator in quantum mechanics that describes the total energy of a physical system. It is defined in neural network parameter optimization to measure the energy of the parameter state. Specifically, Hamiltonian is expressed as:

[0126]

[0127] in, Is the parameter status The corresponding energy is obtained through the loss function and the specific energy mapping function The calculation can be expressed as:

[0128]

[0129] in, is a function that maps the loss function value to the energy level, preferably defined as:

[0130]

[0131] in, and is a hyperparameter.

[0132] 3) Based on energy and frequency, the parameters of the neural network are updated using quantum leaps.

[0133] In specific implementation, traditional parameter optimization methods (such as gradient descent and its variants) may cause the model to fall into a local optimal solution, especially in complex model structures and high-dimensional parameter spaces, which affects the maximization of model performance. According to the simulation results, the embodiment of the present invention uses quantum transitions to update the parameters of the neural network. The transitions simulate the discontinuous jumps of quantum states between different energy levels, allowing the parameters to be explored in the search space. Specifically, the transition probability is defined as Indicates that from the current parameter state Transition to a new state The probability of, the probability calculation method can be expressed as:

[0134]

[0135]

[0136] in, From the current parameter state Transition to a new state The probability of is the time evolution operator, is the time interval, is the reduced Planck constant, which represents the smallest unit of action considered in a quantum transition.

[0137] Furthermore, the time evolution operator To measure the change of the system state over time, in one embodiment, to further explain how to use the Hamiltonian get , considering is diagonalizable, that is, only when hour, Non-zero, so The calculation method can be expressed as:

[0138]

[0139] Furthermore, if we consider In the case of The diagonal nature of the transition probability indicates that the possibility of direct transition between different parameter states is extremely small. Therefore, by using the off-diagonal element interference term to In , the influence of the environment on the parameter update process can be simulated, thereby allowing transitions to occur, which can be expressed as:

[0140]

[0141] in, is the adjusted Hamiltonian, It is a small amount, indicating that from the state To status The additional energy disturbance is used to simulate the external influence or internal nonlinear effect. And, The calculation method will be Replace with Further, and It can be set as a hyperparameter through artificial preset, or it can be set through a quantum state feedback adjustment mechanism.

[0142] Preferably, the quantum state feedback adjustment mechanism dynamically adjusts the quantum entanglement strategy and parameter update strategy by monitoring the quantum state changes during the neural network training process to further improve the performance and efficiency of the algorithm. During the neural network training process, the evolution of the quantum state not only reflects the optimization trajectory of the parameters, but also contains deep information about the network performance and training dynamics. By real-time monitoring and analysis of these quantum state changes, important feedback information can be provided to the algorithm, thereby achieving more refined control and adjustment. Specifically, the metric that defines the quantum state change , which is used to quantify the change of quantum state between two consecutive iterations, can be expressed as:

[0143]

[0144] in, represents the L1 norm.

[0145] Furthermore, based on the monitoring results of quantum state changes, the quantum state feedback regulation mechanism dynamically adjusts the entanglement strength and parameter update rate. Specifically, by defining the regulation function To achieve this, the regulation function adjusts the key hyperparameters of the algorithm according to the degree of change of the quantum state, the entanglement strength and the interval between parameter updates The update method can be expressed as:

[0146]

[0147]

[0148] in, () is a preset adjustment function used to adjust the behavior of the algorithm according to the speed of quantum state change. In one embodiment, when the quantum state changes greatly, The function reduces the entanglement strength and increases the update time interval to stabilize the training process; conversely, when the quantum state changes little, the entanglement strength is increased and the update time interval is shortened to speed up the exploration.

[0149] Based on this, for a given parameter state , the result of the time evolution operator only involves the energy of the state itself , and the corresponding phase change is calculated based on this energy.

[0150] 4) Decode the updated parameters from the quantum state and balance the neural network using a multi-objective optimization strategy.

[0151] 5) Until the neural network meets the preset optimization conditions, a feature extraction model is built based on the neural network.

[0152] After the quantum jump is completed, the quantum state updated by the quantum jump is decoded back into the parameters of the neural network. The process of decoding back into the parameters of the neural network is achieved by calculating the expected value of the quantum state, which can be expressed as:

[0153]

[0154]

[0155] in, and Represent the updated weights and biases respectively.

[0156] The exploration of multi-objective optimization strategy balance algorithm ensures that multiple aspects of network performance are taken into account at the same time. In one embodiment, multiple loss functions are considered, including accuracy, generalization ability and computational efficiency, to balance the multiple requirements of neural network performance. Specifically, suppose goals, each goal corresponds to a loss function , the total loss function is expressed as a weighted sum as follows:

[0157]

[0158] in, It is The weight of a target reflects the importance of the target relative to other targets. Set equal to the inverse of each target to keep a balance between them.

[0159] Further, it is determined whether the algorithm meets the termination condition. If so, the current optimal parameters are output; if not, the algorithm returns to the above steps to continue iterating. In one embodiment, the termination condition is reaching the maximum number of iterations. Preferably, the maximum number of iterations is set to 1000.

[0160] Step S206, input the features into a preset autoencoder, map the features to a low-dimensional latent space using a manifold coding mechanism, and map the features back to the original data space through a decoder of the autoencoder.

[0161] The present invention proposes a self-encoding neural network algorithm based on manifold coding, which reduces the dimension of the data after feature extraction by first encoding and then decoding, while maintaining the key information in the data. In the specific implementation, the manifold coding mechanism is implemented by a local linear embedding algorithm. The manifold coding mechanism includes a manifold regularization term.

[0162] Among them, the input data Through the encoder is mapped into a low-dimensional latent space Furthermore, the latent space Through the decoder is mapped back to the original data space. Specifically, the input data Through the encoder Mapping to latent space can be expressed as:

[0163]

[0164]

[0165] Among them, Re() and ta() are ReLU and tanh nonlinear activation functions.

[0166] Furthermore, in order to better capture the intrinsic structure of the data, the present invention adopts a manifold coding mechanism. In this paper, we not only consider the direct mapping of input to latent space, but also adopt the manifold regularization term , manifold regularization term Calculated by manifold learning algorithm to ensure that the latent space It can better represent the manifold structure of data. Specifically, the manifold encoding mechanism is implemented through a local linear embedding algorithm to calculate the manifold regularization term can be expressed as:

[0167]

[0168] in, is the first The potential representation of a sample, is the sample size.

[0169] Furthermore, in the embodiment of the present invention, during the training process of the autoencoder, the gradient of the loss function of the autoencoder with respect to the autoencoder parameters is calculated through the back-propagation algorithm, and the parameters of the encoder and decoder of the autoencoder are updated using the Adam optimization algorithm; and an adaptive adjustment mechanism is adopted to dynamically adjust the strength of the manifold coding mechanism and the weight of the manifold regularization term according to the changes in the data.

[0170] In the specific implementation, the autoencoder is trained through the following steps:

[0171] 1. Initialize the parameters of the autoencoder, including the encoder and decoder The weights and biases of the autoencoder and decoder The parameters are initialized as follows:

[0172]

[0173]

[0174]

[0175]

[0176] in, and are the weight matrices of the encoder and decoder respectively, and is the bias vector, and is the initialization standard deviation of weights and biases.

[0177] 2. During the training process, encoding and decoding refer to the above steps. The embodiment of the present invention also defines a structured loss function for the autoencoder: , not only considering the reconstruction error (i.e. and The difference between ), and the manifold regularization term is also considered , and the regularization term To prevent overfitting. Specifically, the loss function The calculation method can be expressed as:

[0178]

[0179] in, and is a hyperparameter used to balance the contribution of different terms, It can be the L1 norm of the weights.

[0180] 3. Calculate the loss function through the back propagation algorithm Gradients of the autoencoder parameters and update the encoder using the Adam optimization algorithm and decoder Parameters of . Specifically, calculate the loss function The gradient of the autoencoder parameters and the way to update the parameters using the optimization algorithm can be expressed as:

[0181]

[0182]

[0183]

[0184]

[0185] Furthermore, the way to update parameters using the Adam optimizer can be expressed as:

[0186]

[0187]

[0188]

[0189]

[0190]

[0191]

[0192] in, and are the first-order and second-order moment estimates of the Adam optimizer, and is the momentum factor, is the learning rate, is a small constant added to prevent division by zero. , , , , , is the updated autoencoder parameter, , , , , , are the autoencoder parameters before updating.

[0193] 4. During the training process, the present invention adopts an adaptive adjustment mechanism to dynamically adjust the strength of manifold coding and the weight of the regularization term according to the change of data to ensure that the model can adapt to different data distributions. Specifically, the calculation method of the adaptive adjustment mechanism can be expressed as:

[0194]

[0195]

[0196] in, and is the initial weight, is the adjustment rate, is the number of training iterations.

[0197] 5. Repeat the above steps until a preset stop iteration condition is met. In one embodiment, the preset stop iteration condition is reaching a preset maximum number of iterations. Preferably, the preset maximum number of iterations is set to 1000 times.

[0198] Step S208, input the features into a pre-built classifier model, and output the classification results corresponding to the features.

[0199] The present invention proposes an extreme learning machine classification algorithm based on Riemann learning, which adopts a steady-state optimization strategy to improve the classification performance and the generalization ability of the model. In specific implementation, the method for constructing a classifier model of an embodiment of the present invention includes:

[0200] 1) Initialize the hidden layer weights and biases of the extreme learning machine, and input the preset training sample set into the hidden layer of the extreme learning machine.

[0201] Initialize the hidden layer weights of the extreme learning machine and bias In one embodiment, random initialization is used to implement the method, which can be expressed as:

[0202]

[0203]

[0204] in, and are the initialization standard deviations of weights and biases, respectively.

[0205] The data after feature reduction Input to the hidden layer of the extreme learning machine, the hidden layer usually consists of a set of Sigmoid activation functions, and the data after feature dimensionality reduction Through the activation function of the hidden layer For nonlinear transformation, it can be expressed as:

[0206]

[0207] Among them, Sig() is the Sigmoid activation function.

[0208] 2) A steady-state optimization strategy is used to minimize the classification error of the extreme learning machine, and the final output weight of the extreme learning machine is determined based on the gradient of the classification error with respect to the output weight of the extreme learning machine.

[0209] Different from the traditional extreme learning machine, the present invention adopts a steady-state optimization strategy to determine the output weights , training is performed iteratively, where The update depends not only on the error gradient , also relies on the historical changes of weights to ensure the stability of the model during training. Specifically, the output weights The calculation method can be expressed as:

[0210]

[0211]

[0212]

[0213] in, is the sample size, It is The true labels of samples, is the predicted label, is the learning rate, is the steady-state control parameter, is the number of iterations.

[0214] Further, yes Output weight The gradient of can be expressed as:

[0215]

[0216] in, express right The partial derivatives of are calculated using the chain rule.

[0217] Among them, the embodiment of the present invention adopts a steady-state optimization strategy to minimize the classification error , while maintaining the stability of the model parameters. Specifically, the error Represented as the output layer prediction With the true label The difference between them, the optimization strategy can be expressed as:

[0218]

[0219] in, is the learning rate, is the steady-state control parameter, Indicates The output weight of the iteration, Indicates The output weight of the iteration, Indicates The output weight of the iteration.

[0220] 3) Until the extreme learning machine reaches the preset training conditions, a classifier model is built based on the extreme learning machine.

[0221] The above steps are iterated repeatedly until a preset condition for stopping iteration is met. In one embodiment, the preset condition for stopping iteration is reaching a preset maximum number of iterations. Preferably, the preset maximum number of iterations is set to 1000 times.

[0222] Step S210, determining the intention of the text instruction based on the classification result.

[0223] In a specific implementation, the embodiment of the present invention obtains the instruction intent classification category indicated by the classification result, and determines the intent of the text instruction based on the instruction intent classification category. Specifically, the output results of the classifier model include: "arrange a meeting", "set a reminder", or other types.

[0224] Compared with the prior art, the present invention has the following advantages:

[0225] (1) Compared with the traditional self-attention mechanism, the interactive attention mechanism adopted by the present invention can simultaneously consider the internal dependencies of the text and the interactive relationship between the text and the task instructions, and can more accurately capture the features related to the task instructions.

[0226] (2) By adopting a context-aware network, the present invention can dynamically adjust the attention weight according to the context of the text instruction, thereby improving the model's ability to understand the context of the text instruction.

[0227] (3) The present invention simulates the transition of quantum states to achieve the update of neural network parameters, allowing the algorithm to make discontinuous jumps in the parameter space, effectively avoiding local optimal solutions and finding global optimal solutions.

[0228] (4) The manifold coding-based autoencoder neural network adopted in the present invention can reduce the feature dimension while retaining the key information in the data through the encoding-decoding mechanism and the manifold regularization term, thereby better capturing the intrinsic structure of the data.

[0229] (5) The extreme learning machine classification algorithm based on Riemann learning proposed in the present invention adopts a steady-state optimization strategy to determine the output weights, optimizes the stability of the model parameters during the training process, and improves the classification performance.

[0230] Based on the above innovations, the present invention has the following technical effects:

[0231] (1) Through the interactive attention mechanism and dynamic context-aware mechanism, the present invention can more accurately identify and understand the intent in text instructions.

[0232] (2) The quantum resonance optimization algorithm can make discontinuous jumps in the parameter space, helping the model avoid local optimal solutions and find a better global solution.

[0233] (3) The autoencoder neural network algorithm based on manifold coding effectively reduces the feature dimension while retaining the key information in the data, which is conducive to improving the performance of subsequent classifiers.

[0234] (4) The introduction of the extreme learning machine classification algorithm based on Riemann learning and the steady-state optimization strategy improved the classification performance and the generalization ability of the model.

[0235] Furthermore, based on the above embodiment, the embodiment of the present invention also provides another method for identifying text instruction intention based on natural language processing, which illustrates a method for constructing a training sample set. Figure 3 A flow chart of a method for constructing a training sample set provided by an embodiment of the present invention is shown. Figure 3 As shown, the method comprises the following steps:

[0236] Step S10, obtaining pre-recorded text instruction samples, annotating the text instruction samples, and constructing an initial sample set.

[0237] In specific implementation, the text instruction samples can refer to the above embodiment. The data collection method of the embodiment of the present invention is through natural language input when the user interacts with the system, and the data is labeled manually. Each text instruction is marked as a corresponding intent category, such as "schedule a meeting", "set a reminder", or other types.

[0238] Step S11, using a preset generative adversarial network algorithm to perform data expansion on the initial sample set to generate expanded samples.

[0239] It is understandable that in the task of the present invention, the collection, acquisition, annotation and preprocessing of training data are time-consuming and labor-intensive, and insufficient training samples can easily lead to poor model generalization ability and affect the accuracy of the model. Existing data expansion technologies, such as simple data enhancement or the use of the first generation of generative adversarial networks, may have challenges in generating high-quality, high-diversity and high-relevance text data, limiting the generalization ability of the model when facing novel or unseen text instructions. The present invention proposes a generative adversarial network algorithm based on a game deterministic strategy. In the specific implementation, the generator parameters and discriminator parameters of the generative adversarial network algorithm are optimized based on the game deterministic strategy. Traditional generative adversarial network training relies on stochastic gradient descent, which may lead to instability in generated data. The present invention adopts a game deterministic strategy to optimize the parameters of the generator and the discriminator through a deterministic search process, so that the generated data is more real and accurate. In addition, in order to better guide the generator to generate high-quality text data, the present invention adopts a heuristic loss function, which not only considers the similarity between the generated data and the real data, but also considers the diversity and task relevance of the data.

[0240] Specifically, the training process of the generative adversarial network algorithm based on the game deterministic strategy is as follows:

[0241] 1. Initialize the generator and the discriminator The parameters of are initialized using Xavier. At the same time, and are the weight matrices of the generator and the discriminator, respectively. and are the number of neurons in the input layer and the output layer, respectively. Represents a normal distribution.

[0242] 2. During the generator training process, for each real sample , generator Try to generate a synthetic sample similar to this , the loss function of the generator It can be expressed as:

[0243]

[0244] in, From the prior distribution The noise vector sampled in , is the regularization coefficient of the generator, is the dynamic semantic consistency loss, It is a feature consistency loss function, which is used to ensure that the generated data is consistent with the real data in the feature space.

[0245] Furthermore, the feature consistency loss function It can be defined as:

[0246]

[0247] in, is a preset feature extraction function. In one embodiment, the feature extraction function It is a BiLSTM feature extraction network. is a semantic distance metric function, and in one embodiment, is a metric based on cosine similarity. is the weight coefficient of the consistency constraint, which is used to balance the consistency loss with other loss terms of the generator.

[0248] Furthermore, the semantic distance metric function It can be defined as:

[0249] =1-cosi( ( ), (bx))

[0250] in, Calculate the cosine similarity of two text feature vectors. The closer the value is to 1, the closer the semantics of the two texts are.

[0251] Furthermore, let the parameters of the BiLSTM feature extraction network be Optimize by:

[0252]

[0253] Furthermore, dynamic semantic consistency loss The calculation method can be expressed as:

[0254]

[0255] 3. During the discriminator training process, the discriminator is trained to distinguish between real samples and generated samples. The training goal of the discriminator is to maximize the following objective function :

[0256]

[0257] in, is the regularization coefficient, is a regularization term. In one embodiment, the regularization term is the L2 norm of the weights.

[0258] 4. By alternately training the generator and the discriminator, their parameters are continuously optimized. In each iteration, the parameters of one network are fixed and the parameters of the other network are optimized. The process can be expressed as:

[0259]

[0260]

[0261] in, Indicates the number of iterations.

[0262] Step S12, post-processing the expanded samples, and merging the post-processed samples with the initial sample set to construct a training sample set.

[0263] The embodiment of the present invention also performs post-processing on the generated synthetic samples to remove data irrelevant to the task, ensuring that the final expanded data set is highly relevant to the task. In one embodiment, the post-processing includes operations such as removing outliers and filtering irrelevant data.

[0264] The embodiment of the present invention adopts a generative adversarial network algorithm based on a game deterministic strategy to expand the training data set, and optimizes the parameters of the generator and the discriminator through a deterministic search process. Compared with the traditional stochastic gradient descent method, it can generate more realistic and accurate training data, improve the generalization ability of the model, and enable it to better adapt to unseen data.

[0265] Furthermore, based on the above method embodiment, the embodiment of the present invention also provides a text instruction intention recognition device based on natural language processing, Figure 4 FIG. 1 shows a schematic diagram of a text instruction intention recognition device based on natural language processing provided by an embodiment of the present invention. Figure 4 As shown, the device includes: a response module 100, which is used to respond to text instructions input by a user; a data processing module 200, which is used to identify text instructions through a pre-constructed Bert model and capture features related to intent in the text instructions; wherein the Bert model is constructed by dynamically adjusting the attention weight by adopting a constrained attention adjustment strategy; an execution module 300, which is used to input the features into a pre-constructed classifier model and output the classification results corresponding to the features; the classifier model uses an extreme learning machine as a classifier algorithm, and a steady-state optimization strategy is used to determine the output weights of the extreme learning machine; a training sample set for training the classifier model is constructed based on a generative adversarial network algorithm, and the parameters of the generative adversarial network algorithm are optimized based on a game deterministic strategy; an output module 400, which is used to determine the intent of the text instruction based on the classification results.

[0266] A text instruction intention recognition device based on natural language processing provided in an embodiment of the present invention has the same technical features as a text instruction intention recognition method based on natural language processing provided in the above embodiment, so it can also solve the same technical problems and achieve the same technical effects.

[0267] Furthermore, based on the above embodiment, the embodiment of the present invention also provides another text instruction intention recognition device based on natural language processing, Figure 5 A schematic diagram showing the structure of another text instruction intention recognition device based on natural language processing provided by an embodiment of the present invention is shown. Figure 5 The above-mentioned output module 400 is also used to obtain the instruction intention classification category indicated by the classification result, and determine the intention of the text instruction based on the instruction intention classification category.

[0268] Furthermore, the device also includes a feature extraction module 500, which is used to extract features related to the intent through a pre-constructed feature extraction model, and output key features among the features related to the intent; wherein the above-mentioned feature extraction module 500 is also used to obtain a preset neural network, initialize the parameters of the neural network to a quantum state, and map the value of the loss function to the amplitude and phase of the parameter state through a mapping function; simulate the dynamic evolution of the quantum oscillator, and calculate the energy and frequency corresponding to the quantum state according to the loss function of the neural network and the current state of the parameters; based on the energy and frequency, update the parameters of the neural network by quantum transition; decode the updated parameters from the quantum state, and balance the neural network using a multi-objective optimization strategy; until the neural network meets the preset optimization conditions, a feature extraction model is constructed based on the neural network.

[0269] The feature extraction module 500 is also used to perform quantum entanglement on the quantum state and update the parameters of the neural network using a dynamically adjusted quantum entanglement strategy.

[0270] Furthermore, the device also includes a feature dimensionality reduction module 600, which is used to input features into a preset autoencoder, map the features to a low-dimensional latent space using a manifold coding mechanism, and map the features back to the original data space through a decoder of the autoencoder; the manifold coding mechanism is implemented by a local linear embedding algorithm.

[0271] Among them, the manifold coding mechanism includes a manifold regularization term, and the above-mentioned feature dimensionality reduction module 600 is also used to calculate the gradient of the loss function of the autoencoder with respect to the autoencoder parameters through the back propagation algorithm during the training process of the autoencoder, and use the Adam optimization algorithm to update the parameters of the encoder and decoder of the autoencoder; and, adopt an adaptive adjustment mechanism to dynamically adjust the strength of the manifold coding mechanism and the weight of the manifold regularization term according to changes in data.

[0272] The execution module 300 is also used to initialize the hidden layer weights and biases of the extreme learning machine, input a preset training sample set into the hidden layer of the extreme learning machine; minimize the classification error of the extreme learning machine using a steady-state optimization strategy, and determine the final output weight of the extreme learning machine based on the gradient of the classification error to the output weight of the extreme learning machine; until the extreme learning machine reaches the preset training conditions, a classifier model is constructed based on the extreme learning machine.

[0273] The above-mentioned execution module 300 is also used to obtain pre-recorded text instruction samples, annotate the text instruction samples, and construct an initial sample set; use a preset generative adversarial network algorithm to perform data expansion on the initial sample set to generate expanded samples; optimize the generator parameters and discriminator parameters of the generative adversarial network algorithm based on a game deterministic strategy; post-process the expanded samples, and merge the post-processed samples with the initial sample set to construct a training sample set.

[0274] The above-mentioned data processing module 200 is also used to input the preset training sample set into the initial Bert model after word segmentation and word vectorization processing; pre-train the initial Bert model through an interactive attention mechanism, and enhance the attention mechanism of the initial Bert model by adopting a dynamic context-aware mechanism; adopt a constrained attention adjustment strategy to further optimize the attention weight of the initial Bert model; dynamically adjust the model parameters of the initial Bert model through an adaptive adjustment mechanism; until the initial Bert model reaches the preset training conditions, a Bert model is constructed based on the initial Bert model.

[0275] An embodiment of the present invention further provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the above Figures 1 to 3 The embodiment of the present invention also provides a computer-readable storage medium having a computer program stored thereon, and the computer program is executed by a processor to perform the above Figures 1 to 3 Any of the steps of the method shown.

[0276] The embodiment of the present invention also provides a schematic diagram of the structure of an electronic device, such as Figure 6 FIG. 1 is a schematic diagram of the structure of the electronic device, wherein the electronic device includes a processor 61 and a memory 60, the memory 60 stores computer executable instructions that can be executed by the processor 61, and the processor 61 executes the computer executable instructions to implement the above Figures 1 to 3 Any of the methods shown.

[0277] exist Figure 6In the illustrated embodiment, the electronic device further includes a bus 62 and a communication interface 63, wherein the processor 61, the communication interface 63 and the memory 60 are connected via the bus 62. The memory 60 may include a high-speed random access memory (RAM), and may also include a non-volatile memory, such as at least one disk memory. The communication connection between the system network element and at least one other network element is realized through at least one communication interface 63 (which may be wired or wireless), and the Internet, a wide area network, a local area network, a metropolitan area network, etc. may be used. The bus 62 may be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus, or an EISA (Extended Industry Standard Architecture) bus, etc. It may also be an AMBA (Advanced Microcontroller Bus Architecture) bus, where AMBA defines three types of buses, including an APB (Advanced Peripheral Bus) bus, an AHB (Advanced High-performance Bus) bus, and an AXI (Advanced Xtensible Interface) bus. The bus 62 may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 6 Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0278] The processor 61 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit or software instructions in the processor 61. The above processor 61 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor. The steps of the method disclosed in the embodiment of the present application can be directly embodied as a hardware decoding processor to execute, or the hardware and software modules in the decoding processor can be executed. The software module can be located in a mature storage medium in the field such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory, and the processor 61 reads the information in the memory and combines its hardware to complete the above Figures 1 to 3 Any of the methods shown.

[0279] A computer program product of a method and device for identifying text instruction intentions based on natural language processing provided in an embodiment of the present invention includes a computer-readable storage medium storing program code. The instructions included in the program code can be used to execute the methods described in the previous method embodiments. The specific implementation can be found in the method embodiments, which will not be repeated here.

[0280] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods described in various embodiments of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc., which can store program codes.

[0281] Finally, it should be noted that the above embodiments are only specific implementations of the present invention, which are used to illustrate the technical solutions of the present invention, rather than to limit them. The protection scope of the present invention is not limited thereto. Although the present invention is described in detail with reference to the above embodiments, those skilled in the art should understand that any person skilled in the art can still modify the technical solutions recorded in the above embodiments within the technical scope disclosed by the present invention, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be based on the protection scope of the claims.

Claims

1. A method for identifying text instruction intention based on natural language processing, characterized in that: The method is applied to an identification system, and the method comprises: Respond to text instructions entered by the user; The text instruction is recognized by a pre-built Bert model to capture features related to the intent in the text instruction; wherein the Bert model is constructed by dynamically adjusting the attention weight by adopting a constrained attention adjustment strategy; The features are input into a pre-built classifier model, and the classification results corresponding to the features are output; the classifier model uses an extreme learning machine as a classifier algorithm, and a steady-state optimization strategy is adopted to determine the output weight of the extreme learning machine; the training sample set for training the classifier model is constructed based on a generative adversarial network algorithm, and the parameters of the generative adversarial network algorithm are optimized based on a game deterministic strategy; The intent of the text instruction is determined based on the classification result.

2. The method according to claim 1, characterized in that The step of determining the intention of the text instruction based on the classification result includes: The instruction intention classification category indicated by the classification result is obtained, and the intention of the text instruction is determined based on the instruction intention classification category.

3. The method according to claim 1, characterized in that The method further comprises: Extracting features related to the intent through a pre-built feature extraction model, and outputting key features among the features related to the intent; The method for constructing the feature extraction model includes: Obtain a preset neural network, initialize the parameters of the neural network to a quantum state, and map the value of the loss function to the amplitude and phase of the parameter state through a mapping function; Simulating the dynamic evolution of a quantum oscillator, and calculating the energy and frequency corresponding to the quantum state according to the loss function of the neural network and the current state of the parameters; Based on the energy and frequency, updating the parameters of the neural network by quantum transition; decoding updated parameters from the quantum state and balancing the neural network using a multi-objective optimization strategy; Until the neural network meets the preset optimization conditions, a feature extraction model is constructed based on the neural network.

4. The method according to claim 3, characterized in that The method further comprises: The quantum state is quantum entangled, and the parameters of the neural network are updated using a dynamically adjusted quantum entanglement strategy.

5. The method according to claim 1, characterized in that The method further comprises: The features are input into a preset autoencoder, the features are mapped to a low-dimensional latent space using a manifold coding mechanism, and the features are mapped back to the original data space through a decoder of the autoencoder; the manifold coding mechanism is implemented by a local linear embedding algorithm.

6. The method according to claim 5, characterized in that The manifold encoding mechanism includes a manifold regularization term, and the method further includes: During the training process of the autoencoder, the gradient of the loss function of the autoencoder with respect to the autoencoder parameters is calculated by a back propagation algorithm, and the parameters of the encoder and decoder of the autoencoder are updated by an Adam optimization algorithm; Furthermore, an adaptive adjustment mechanism is used to dynamically adjust the strength of the manifold encoding mechanism and the weight of the manifold regularization term according to changes in data.

7. The method according to claim 1, characterized in that The method for constructing the classifier model comprises: Initializing the hidden layer weights and biases of the extreme learning machine, and inputting a preset training sample set into the hidden layer of the extreme learning machine; Minimizing the classification error of the extreme learning machine by adopting a steady-state optimization strategy, and determining the final output weight of the extreme learning machine based on the gradient of the classification error to the output weight of the extreme learning machine; Until the extreme learning machine reaches a preset training condition, a classifier model is constructed based on the extreme learning machine.

8. The method according to claim 1, characterized in that The method for constructing the training sample set includes: Obtaining pre-recorded text instruction samples, annotating the text instruction samples, and constructing an initial sample set; Using a preset generative adversarial network algorithm to perform data expansion on the initial sample set to generate expanded samples; the generator parameters and discriminator parameters of the generative adversarial network algorithm are optimized based on a game deterministic strategy; The expanded samples are post-processed, and the post-processed samples are merged with the initial sample set to construct a training sample set.

9. The method according to claim 1, characterized in that: The method for constructing the Bert model comprises: After word segmentation and word vectorization, the preset training sample set is input into the initial Bert model; Pre-training an initial BERT model through an interactive attention mechanism, and enhancing the attention mechanism of the initial BERT model by using a dynamic context-aware mechanism; Adopting a constrained attention adjustment strategy to further optimize the attention weights of the initial Bert model; Dynamically adjusting the model parameters of the initial Bert model through an adaptive adjustment mechanism; Until the initial Bert model reaches a preset training condition, a Bert model is constructed based on the initial Bert model.

10. A text instruction intention recognition device based on natural language processing, characterized in that: The device comprises: A response module, used to respond to text instructions input by users; A data processing module, used to identify the text instruction through a pre-built Bert model, and capture the features related to the intention in the text instruction; wherein the Bert model is constructed by dynamically adjusting the attention weight by adopting a constrained attention adjustment strategy; An execution module is used to input the features into a pre-built classifier model and output the classification results corresponding to the features; the classifier model uses an extreme learning machine as a classifier algorithm, and a steady-state optimization strategy is used to determine the output weight of the extreme learning machine; a training sample set for training the classifier model is constructed based on a generative adversarial network algorithm, and the parameters of the generative adversarial network algorithm are optimized based on a game deterministic strategy; An output module is used to determine the intention of the text instruction based on the classification result.

Citation Information

Patent Citations

  • Chinese text intention recognition method based on Bert and full-connection neural network fusion

    CN113239690A

  • Natural language processing method and system based on machine learning

    CN117493491A

  • Method and platform for pre-trained language model automatic compression based on multilevel knowledge distillation

    US20220198276A1

  • Intention recognition method, apparatus, and device, and computer readable storage medium

    WO2021143018A1