User intention processing method, device, computer equipment and storage medium

By calculating the correlation between the intention factor vector and the sentence vector through encoding processing and attention model, combined with the semantic relationship tree, the problem of low accuracy of natural language intention understanding in the existing technology is solved, and more accurate user intention processing is achieved.

CN113157892BActive Publication Date: 2024-09-06CHINA PING AN LIFE INSURANCE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110567377.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-05-24
Publication Date
2024-09-06
Estimated Expiration
2041-05-24

AI Technical Summary

Technical Problem

Existing user intent processing technology has difficulty understanding the true intent in natural language through keyword comparison, resulting in low understanding accuracy.

Method used

Encoding processing is used to generate sentence vectors, word segmentation and attention models are used to calculate the correlation between intention factor vectors and sentence vectors, intention scores are generated to determine the true intention, and semantic relationship trees are used to perform graph queries to obtain reply information.

Benefits of technology

It improves the accuracy of user intention processing, makes intention scoring more objective, can more accurately characterize the user's true intention, and improves the accuracy of natural language understanding.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113157892B
    Figure CN113157892B
Patent Text Reader

Abstract

The present application discloses a method, apparatus, computer equipment and storage medium for processing user intentions, including: obtaining a target sentence to be identified; encoding the target sentence according to a preset encoder to generate a first sentence vector of the target sentence; segmenting the target sentence according to a preset word segmentation rule, and generating at least one to-be-confirmed intention vector representing the intention of the target sentence according to the word segmentation result and the first sentence vector; inputting the first sentence vector and each of the first intention factor vectors into a preset first attention model to generate a second sentence vector and multiple second intention factor vectors; generating an intention score of the intention vector according to the second sentence vector and the intention vector; and determining at least one true intention of the target sentence from at least one intention vector according to the intention score. The calculated intention score more objectively represents the true intention of the user.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments of the present invention relate to the field of natural language, and in particular to a method, apparatus, computer device and storage medium for processing user intention. Background Art

[0002] Natural Language Processing (NLP) is an important direction in the fields of computer science and artificial intelligence. It studies various theories and methods that can achieve effective communication between people and computers using natural language. NLP is a science that integrates linguistics, computer science, and mathematics. NLP is mainly used in machine translation, public opinion monitoring, automatic summarization, opinion extraction, text classification, question answering, text semantic comparison, speech recognition, and Chinese OCR.

[0003] The inventor of the present invention found in his research that when processing user intention in the prior art, the corresponding reply information is often determined by keyword comparison. This reply method cannot understand the true intention of the sentence in natural language, resulting in a low accuracy rate in understanding natural language. Summary of the invention

[0004] Embodiments of the present invention provide a user intention processing method, apparatus, computer equipment and storage medium capable of understanding the true intention of a user's sentence.

[0005] In order to solve the above technical problems, a technical solution adopted by an embodiment of the present invention is to provide a method for processing user intention, including:

[0006] Obtaining a target sentence to be recognized;

[0007] Encoding the target sentence according to a preset encoder to generate a first sentence vector of the target sentence;

[0008] Performing word segmentation processing on the target sentence according to a preset word segmentation rule, and generating at least one to-be-confirmed intention vector representing the intention of the target sentence according to the word segmentation result and the first sentence vector, wherein the intention vector is formed by concatenating multiple first intention factor vectors;

[0009] Input the first sentence vector and each of the first intention factor vectors into a preset first attention model to generate a second sentence vector and multiple second intention factor vectors;

[0010] Generating an intent score of the intent vector according to the second sentence vector and the intent vector;

[0011] At least one true intent of the target sentence is determined from at least one intent vector according to the intent score.

[0012] Optionally, inputting the first sentence vector and each of the first intention factor vectors into a preset first attention model to generate a second sentence vector and a plurality of second intention factor vectors includes:

[0013] Calculating a first attention distribution between each of the first intention factor vectors and the first sentence vector;

[0014] Normalizing each of the first attention distributions to generate a first parameter value;

[0015] Multiplying the first parameter value by its corresponding first intention factor vector to generate a corresponding second intention factor vector;

[0016] Concatenate multiple second intention factor vectors to generate the second sentence vector.

[0017] Optionally, generating an intent score of the intent vector according to the second sentence vector and the intent vector includes:

[0018] Calculating a second attention distribution between each of the intention vectors and the second sentence vector;

[0019] Normalizing each of the second attention distributions to generate a second parameter value;

[0020] Multiplying the second parameter value by the intention vector corresponding to the second parameter value to generate a focus vector corresponding to each intention vector;

[0021] The focus vectors are concatenated to generate a third sentence vector, and sentence scores of the intent vectors are generated using the third sentence vector.

[0022] Optionally, after concatenating the focus vectors to generate a third sentence vector, and generating sentence scores of the intent vectors through the third sentence vector, the method further includes:

[0023] Convert each of the second intention factor vectors and each intention vector into a corresponding vector matrix;

[0024] Multiplying each of the second intent factor vectors and the vector matrix of the corresponding intent vector to generate a factor vector matrix, and generating factor scores of the factor vector matrix;

[0025] The sentence score and the factor score are added together to generate the intent score.

[0026] Optionally, determining at least one true intent of the target sentence from at least one intent vector according to the intent score includes:

[0027] Using the intention score as a sorting condition, arranging the at least one true intention in descending order;

[0028] According to a preset screening rule, at least one true intent of the target sentence is determined from the at least one intent vector.

[0029] Optionally, after determining the true intent of the target sentence from at least one intent vector according to the intent score, the method further comprises:

[0030] Taking the real intention as a search condition, searching for a semantic relationship tree corresponding to the real intention in a preset sample database, wherein the semantic relationship tree is a semantic expression topology sample constructed with the user intention in the historical data as a root node;

[0031] Extracting sentence parameters in the target sentence according to the semantic relationship tree;

[0032] The sentence parameters are input into the semantic relationship tree to generate a graph query sentence of the target sentence.

[0033] Optionally, after inputting the statement parameters into the semantic relationship tree to generate the graph query statement of the target statement, the method further comprises:

[0034] According to the graph query statement, searching for reply information of the graph query statement in a preset reply database;

[0035] The reply information is sent to the user terminal that sent the target sentence.

[0036] In order to solve the above technical problems, an embodiment of the present invention further provides a user intention processing device, including:

[0037] An acquisition module, used for acquiring a target sentence to be recognized;

[0038] A processing module, used for encoding the target sentence according to a preset encoder to generate a first sentence vector of the target sentence;

[0039] A word segmentation module, configured to perform word segmentation processing on the target sentence according to a preset word segmentation rule, and generate at least one to-be-confirmed intention vector representing the intention of the target sentence according to the word segmentation result and the first sentence vector, wherein the intention vector is formed by concatenating a plurality of first intention factor vectors;

[0040] An attention module, used for inputting the first sentence vector and each of the first intention factor vectors into a preset first attention model to generate a second sentence vector and a plurality of second intention factor vectors;

[0041] A scoring module, configured to generate an intent score of the intent vector based on the second sentence vector and the intent vector;

[0042] An intent module is used to determine at least one true intent of the target sentence from at least one intent vector according to the intent score.

[0043] Optionally, the user intention processing device further includes:

[0044] A first calculation submodule, used to calculate a first attention distribution between each of the first intention factor vectors and the first sentence vector;

[0045] A first processing submodule, configured to perform normalization processing on each of the first attention distributions to generate a first parameter value;

[0046] A first generating submodule, used for multiplying the first parameter value by the first intention factor vector corresponding to the first parameter value to generate a corresponding second intention factor vector;

[0047] The first splicing submodule is used to splice multiple second intention factor vectors to generate the second sentence vector.

[0048] Optionally, the user intention processing device further includes:

[0049] A second calculation submodule, used to calculate a second attention distribution between each of the intention vectors and the second sentence vector;

[0050] A second processing submodule, configured to perform normalization processing on each of the second attention distributions to generate a second parameter value;

[0051] A second generation submodule, used for multiplying the second parameter value by the intention vector corresponding to the second parameter value to generate a focus vector corresponding to each intention vector;

[0052] The second splicing submodule is used to splice the focus vectors to generate a third sentence vector, and generate sentence scores of each intention vector through the third sentence vector.

[0053] Optionally, the user intention processing device further includes:

[0054] A first conversion submodule, used for converting each of the second intention factor vectors and each intention vector into a corresponding vector matrix;

[0055] a third calculation submodule, configured to multiply each of the second intention factor vectors and the vector matrix of the corresponding intention vector to generate a factor vector matrix, and generate a factor score of the factor vector matrix;

[0056] The first intention submodule is used to add the sentence score and the factor score to generate the intention score.

[0057] Optionally, the user intention processing device further includes:

[0058] A first sorting submodule, configured to sort the at least one true intent in descending order based on the intent score as a sorting condition;

[0059] The first screening submodule is used to determine at least one true intention of the target sentence from the at least one intention vector according to a preset screening rule.

[0060] Optionally, the user intention processing device further includes:

[0061] A first retrieval submodule is used to search for a semantic relationship tree corresponding to the real intent in a preset sample database using the real intent as a retrieval condition, wherein the semantic relationship tree is a semantic expression topology sample constructed with the user intent in the historical data as a root node;

[0062] A first extraction submodule, configured to extract sentence parameters in the target sentence according to the semantic relationship tree;

[0063] The third generation submodule is used to input the sentence parameters into the semantic relationship tree to generate a graph query sentence of the target sentence.

[0064] Optionally, the user intention processing device further includes:

[0065] A first query submodule, configured to search for reply information of the graph query statement in a preset reply database according to the graph query statement;

[0066] The first reply submodule is used to send the reply information to the user terminal that sent the target sentence.

[0067] To solve the above technical problem, an embodiment of the present invention further provides a computer device, including a memory and a processor, wherein the memory stores computer-readable instructions, and when the computer-readable instructions are executed by the processor, the processor executes the steps of the above-mentioned user intention processing method.

[0068] In order to solve the above technical problem, an embodiment of the present invention further provides a storage medium storing computer-readable instructions. When the computer-readable instructions are executed by one or more processors, the one or more processors execute the steps of the above-mentioned user intention processing method.

[0069] The beneficial effects of the embodiment of the present invention are: encoding and processing the target sentence to generate a first sentence vector, analyzing the target sentence, splitting the target sentence into at least one intention vector, each of which is composed of multiple first intention factor vectors, and calculating the correlation between each first intention factor vector and the first sentence vector through the attention model, and updating and generating the second sentence vector and the second intention factor vector according to the correlation. The intention score of each intention vector is generated by the second intention factor vector, the second sentence vector and the intention vector, and then the true intention of the target sentence is obtained. Due to the calculation of the correlation between the first intention factor vector and the first sentence vector, the correlation between each first sentence vector and the first sentence vector can be determined, and then the first sentence vector and the first intention factor vector are updated according to the correlation, which can make the updated second intention factor vector and the second sentence vector focus on the scoring and move closer to important information or intention expression. Therefore, the calculated intention score more objectively represents the user's true intention and improves the accuracy of user intention processing. BRIEF DESCRIPTION OF THE DRAWINGS

[0070] The above and / or additional aspects and advantages of the present application will become apparent and easily understood from the following description of the embodiments in conjunction with the accompanying drawings, in which:

[0071] Figure 1 A basic flow chart of a method for processing user intent according to a specific embodiment of the present application;

[0072] Figure 2 A schematic diagram of a process of updating a first intention factor vector and a first sentence vector according to a specific embodiment of the present application;

[0073] Figure 3 A schematic diagram of a flow chart of generating sentence scores according to a specific embodiment of the present application;

[0074] Figure 4 A flowchart of intent scoring for a specific embodiment of the present application;

[0075] Figure 5 A schematic diagram of a process for screening true intentions according to a specific embodiment of the present application;

[0076] Figure 6 A schematic diagram of the flow of a graph query statement of a specific embodiment of the present application;

[0077] Figure 7 This is a schematic diagram of an example of a semantic relationship tree of a specific embodiment of the present application;

[0078] Figure 8 A schematic diagram of the process of sending a reply message according to a specific embodiment of the present application;

[0079] Fig. 9 A schematic diagram of the basic structure of a user intention processing device according to an embodiment of the present application;

[0080] Fig.10 This is a basic structural block diagram of a computer device according to an embodiment of the present application. DETAILED DESCRIPTION

[0081] The embodiments of the present application are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present application, and cannot be interpreted as limiting the present application.

[0082] Those skilled in the art will appreciate that, unless otherwise stated, the singular forms "a", "an", "said" and "the" used herein may also include plural forms. It should be further understood that the term "comprising" used in the specification of the present application refers to the presence of the features, integers, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or groups thereof.

[0083] It will be understood by those skilled in the art that, unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as those generally understood by those skilled in the art to which this application belongs. It should also be understood that terms such as those defined in general dictionaries should be understood to have meanings consistent with those in the context of the prior art, and will not be interpreted with idealized or overly formal meanings unless specifically defined as here.

[0084] It will be understood by those skilled in the art that the term "terminal" as used herein includes both devices with wireless signal receivers, which are devices with only wireless signal receivers without transmission capabilities, and devices with receiving and transmitting hardware, which are devices with receiving and transmitting hardware capable of performing two-way communications over a two-way communication link. Such devices may include: cellular or other communication devices, which have a single-line display or a multi-line display or a cellular or other communication device without a multi-line display; PCS (Personal Communications Service), which may combine voice, data processing, fax and / or data communication capabilities; PDA (Personal Digital Assistant), which may include a radio frequency receiver, a pager, Internet / intranet access, a web browser, a notepad, a calendar and / or a GPS (Global Positioning System) receiver; conventional laptop and / or palmtop computers or other devices, which have and / or include a conventional laptop and / or palmtop computer or other device with and / or including a radio frequency receiver. The "terminal" used here can be portable, transportable, installed in a vehicle (air, sea and / or land), or suitable for and / or configured to run locally, and / or in a distributed form, running at any other location on the earth and / or in space. The "terminal" used here can also be a communication terminal, an Internet terminal, a music / video playing terminal, for example, a PDA, a MID (Mobile Internet Device) and / or a mobile phone with a music / video playing function, or a smart TV, a set-top box and other devices.

[0085] See also Figure 1 , Figure 1 FIG. 2 is a basic flow chart of the method for processing user intention in this embodiment. Figure 1 As shown, a method for processing user intention includes:

[0086] S110, obtaining a target sentence to be recognized;

[0087] The target sentence in this embodiment refers to: a text sentence converted from text or voice information sent by the user during human-computer interaction. For example, when the user interacts through voice, the user's voice information is converted into corresponding text information, and the text information is the target sentence. The target sentence can be composed of a user's sentence or a whole paragraph or a whole text information elaborated by the user.

[0088] In some implementations, the target sentence can also be various types of text information, where the text information is text generated in a non-human-computer interaction process and can be text of various types of written works such as literature, law, and medicine.

[0089] S120, encoding the target sentence according to a preset encoder to generate a first sentence vector of the target sentence;

[0090] The target sentence is input into a preset encoder for compilation to generate a first sentence vector that can represent the complete meaning of the target sentence.

[0091] The encoder in this embodiment is a two-layer convolutional neural network, which generates a first sentence vector after performing two convolution extractions on the target sentence. The composition of the encoder is not limited to this. In some actual modes, the encoder can be a single-layer convolutional neural network, a three-layer convolutional neural network model, a four-layer convolutional neural network model, or a multi-layer convolutional neural network model.

[0092] S130, performing word segmentation processing on the target sentence according to a preset word segmentation rule, and generating at least one to-be-confirmed intention vector representing the intention of the target sentence according to the word segmentation result and the first sentence vector, wherein the intention vector is formed by concatenating multiple first intention factor vectors;

[0093] The target sentence is segmented. The purpose of the segmentation is to differentiate the target sentence into multiple keywords or key sentences. The keywords or key sentences are composed of at least one of the following words: Domain (subject), predicate (predicate) and target (object). The subject, predicate or object that constitutes the keyword or key sentence is defined as the first intention factor of the target sentence. The first intention factor is generally a common word in natural language. Therefore, the vector of each first intention factor can be queried through the pre-established vector library. The vector of each first intention factor can be obtained by querying and comparing.

[0094] In some implementations, when performing word segmentation, the granularity of the word segmentation is further reduced, and the word segmentation result obtained is directly Domain (subject), predicate (predicate) or target (object). Then, the intention vector is generated by combining and splicing each other.

[0095] S140, inputting the first sentence vector and each of the first intention factor vectors into a preset first attention model to generate a second sentence vector and multiple second intention factor vectors;

[0096] After the first sentence vector and the first intention factor vector are generated, in order to identify the correlation between the first intention factor vector and the first sentence vector, the correlation between each first intention factor vector and other first intention factor vectors in the first sentence vector is calculated through the attention model. The correlation between the intention factor vector and the first sentence vector can be calculated through the position between each intention factor, and the correlation between different intention factor vectors can be calculated through a pre-constructed database of correlations between Chinese characters. The vector factor of each intention factor is constructed according to the calculated correlation between the intention factors, and the factor vector generated according to the first attention model is the second intention factor vector. After the second intention factor vector is generated, the second intention factors are spliced ​​in sequence according to the arrangement of the vector factors in the target sentence to generate an updated second sentence vector.

[0097] Among them, the first attention model is the query-factor attention module. The first attention model updates the first factor vector according to the correlation between each factor vector, and then updates the first sentence vector according to the second factor vector by vector matrix splicing to generate the second sentence vector. The updated second intention factor vector and the second sentence vector include the correlation between each intention factor, which can make the text vector of important information in the sentence more prominent and improve the accuracy of later intention understanding.

[0098] S150, generating an intention score of the intention vector according to the second sentence vector and the intention vector;

[0099] After the second intention factor vector and the second sentence vector are updated, the intention score of each intention vector is calculated based on multiple second intention factor vectors, second sentence vectors and intention vectors.

[0100] A second attention distribution between each intention vector and the second sentence vector is calculated, and the second attention distribution is calculated by calculating the vector distance between each intention vector and the second sentence vector.

[0101] The calculation of the second attention distribution can calculate the Euclidean distance, Manhattan distance, Chebyshev distance, Minkowski distance, standardized Euclidean distance, Mahalanobis distance, angle cosine, Hamming distance or Jaccard distance between the intention vector and the second sentence vector.

[0102] The focus vector of each intent vector is calculated based on the calculated second attention distribution. The focus vector is calculated by multiplying the second attention distribution with the intent vector. The result of the multiplication is the focus vector corresponding to each intent vector. After the focus vector is calculated, the focus vectors are concatenated in sequence according to the position information of the intent vector corresponding to the focus vector in the target sentence to generate a third sentence vector. The third sentence vector is scored through the fully connected layer to obtain the sentence score of the second sentence vector.

[0103] After calculating the sentence score, continue to calculate the factor score between each second intent factor and its corresponding intent vector. The specific calculation method is: transform each second intent factor to generate a vector matrix, and at the same time, transform the intent vector to generate a corresponding vector matrix, then multiply the second intent factor and the vector matrix corresponding to the intent vector to obtain a factor vector matrix, and then calculate the factor vector matrix through the fully connected layer to obtain the factor score.

[0104] The calculated sentence score and factor score are added together to generate the corresponding intent score of each intent vector. The calculation of the intent score is not limited to this. In some embodiments, the intent score can be calculated by weighted calculation, for example, by counting the intent weight values ​​of each intent vector in different sentence patterns through historical data, as well as the weight values ​​of each factor vector in the intent vector, and then calculating the intent score in a weighted manner.

[0105] S160. Determine at least one true intent of the target sentence from at least one intent vector according to the intent score.

[0106] After calculating each intent vector, the intent vectors are screened according to the set screening threshold, and the intent vectors with intent scores greater than or equal to the screening threshold are screened out and determined as the true intent of the target sentence. The number of true intents of the target sentence is not limited to one, and the number of true intents can be set according to actual needs depending on the specific application scenario.

[0107] In some embodiments, the screening of the real intent is accomplished by extracting a predetermined number of real intents, arranging the intent vectors in descending order according to the calculated intent scores, and then extracting the intents corresponding to the first n intent vectors in the arranged list as the real intent of the target sentence.

[0108] In some embodiments, the screening of the true intention is dynamic. In order to identify the more obscure meanings carried in the user's natural language as much as possible, before identifying the user's true intention. First, the voice information corresponding to the target sentence is subjected to emotion recognition. Emotion recognition can be recognized by a neural network model trained to a convergent state. When the user's emotion is stable and only one emotion is expressed, the user's true intention is determined to be 1. When the user's emotion is recognized to express two emotions, the user's true intention is determined to be 2. When the user's emotion is recognized to express three emotions, the user's true intention is determined to be 3. And so on. The number of emotions identified by the user is determined accordingly. The corresponding relationship between the number of user emotions and the screening of true intentions is not limited to this, and can be set arbitrarily according to the actual needs of the specific application scenario.

[0109] In the above implementation mode, the target sentence is encoded and processed to generate a first sentence vector, the target sentence is analyzed, and the target sentence is split into at least one intention vector, each of which is composed of multiple first intention factor vectors. The attention model is used to calculate the correlation between each first intention factor vector and the first sentence vector, and the second sentence vector and the second intention factor vector are updated and generated according to the correlation. The intention score of each intention vector is generated by the second intention factor vector, the second sentence vector and the intention vector, and then the true intention of the target sentence is obtained. Since the correlation between the first intention factor vector and the first sentence vector is calculated, the correlation between each first sentence vector and the first sentence vector can be determined. Then, the first sentence vector and the first intention factor vector are updated according to the correlation, so that the updated second intention factor vector and the second sentence vector can focus the scoring on important information or intention expression. Therefore, the calculated intention score more objectively represents the user's true intention and improves the accuracy of user intention processing.

[0110] In some implementations, it is necessary to update the first intent factor vector and the first sentence vector based on the similarity between the first intent factor vector and the first sentence vector. Figure 2 , Figure 2 A schematic diagram of the process of updating the first intention factor vector and the first sentence vector in this embodiment.

[0111] like Figure 2 As shown, S140 includes:

[0112] S141, calculating a first attention distribution between each of the first intention factor vectors and the first sentence vector;

[0113] The first attention distribution between the first intention factor vector and the first sentence vector is calculated. The similarity between the intention factor vector and the first sentence vector can be calculated by the position between the intention factors, or by calculating the similarity between different intention factor vectors through a pre-built database of associations between Chinese characters. Through the above method, the first attention distribution between the first intention factor vector and the first sentence vector is calculated.

[0114] S142, normalizing each of the first attention distributions to generate a first parameter value;

[0115] After the first attention distribution is calculated, since the distance lengths between the vectors are different, the numerical span of the first attention distribution is large, so the calculated first attention distribution needs to be normalized. During the normalization process, a linear function normalization method or a zero mean normalization method can be used for normalization.

[0116] S143, multiplying the first parameter value by the first intention factor vector corresponding to it to generate a corresponding second intention factor vector;

[0117] The first parameter value of each first attention distribution is multiplied by its corresponding first intention factor vector. This step uses the calculated similarity as a weight and solidifies it into the second intention factor vector through multiplication. It highlights the weight values ​​of important characters in the target sentence and reduces the weight values ​​of regular characters. This can make the feature vector level corresponding to the target sentence clearer, which is conducive to improving the accuracy of intent recognition.

[0118] The vector obtained by multiplying the first parameter value and its corresponding first intention factor vector is defined as the second intention factor vector.

[0119] S144. Concatenate multiple second intention factor vectors to generate the second sentence vector.

[0120] After the second intention factor vector is generated, the second intention factors are concatenated in sequence according to the arrangement of the vector factors in the target sentence to generate an updated second sentence vector.

[0121] In some implementations, it is necessary to update the third sentence vector based on the similarity between the intent vector and the second sentence vector, and generate a sentence score for the third sentence vector. Figure 3 , Figure 3 A schematic diagram of the process of generating sentence scores in this embodiment.

[0122] like Figure 3 As shown, the S150 includes:

[0123] S151, calculating a second attention distribution between each of the intention vectors and the second sentence vector;

[0124] A second attention distribution between each intention vector and the second sentence vector is calculated, and the second attention distribution is calculated by calculating the vector distance between each intention vector and the second sentence vector.

[0125] The calculation of the second attention distribution can calculate the Euclidean distance, Manhattan distance, Chebyshev distance, Minkowski distance, standardized Euclidean distance, Mahalanobis distance, angle cosine, Hamming distance or Jaccard distance between the intention vector and the second sentence vector.

[0126] S152, normalizing each of the second attention distributions to generate a second parameter value;

[0127] After the second attention distribution is calculated, since the distance lengths between the vectors are different, the numerical span of the second attention distribution is large, so the calculated second attention distribution needs to be normalized. During the normalization process, a linear function normalization method or a zero mean normalization method can be used for normalization.

[0128] S153, multiplying the second parameter value by the corresponding intention vector to generate a focus vector corresponding to each intention vector;

[0129] The calculated second parameter value of each second attention distribution is multiplied by its corresponding intention vector. This step uses the calculated similarity as a weight and solidifies it into the updated intention vector through multiplication operation to calculate the relative concentration of each intention vector.

[0130] A vector obtained by multiplying the second parameter value and its corresponding intention vector is defined as a focus vector.

[0131] S154. Concatenate the focus vectors to generate a third sentence vector, and generate sentence scores for the intent vectors using the third sentence vector.

[0132] After the focus vector is calculated, the focus vectors are concatenated in sequence according to the arrangement relationship between the intention vectors corresponding to the focus vectors to generate the third sentence vector.

[0133] After generating the third sentence vector, the feature distance between each intent vector and the third sentence vector is calculated. Then, the calculated feature distance is mapped to a 1*1 fully connected layer, and the feature distance is flattened. Finally, the feature distance is classified and scored through the machine learning scoring mechanism to obtain the sentence score of each intent vector.

[0134] By calculating the scores of each intent score in the third sentence vector, the importance of each intent vector to the intent representation of the entire target sentence can be calculated, and the sentence score of each intent vector is calculated from a macro level.

[0135] In some implementations, it is necessary to calculate the factor scores in the intent vector and to calculate the intent score of each intent vector based on the factor scores and the sentence scores. Figure 4 , Figure 4 A schematic diagram of the process of scoring the intention in this embodiment.

[0136] like Figure 4 As shown, S154 and later include:

[0137] S155, converting each of the second intention factor vectors and each intention vector into a corresponding vector matrix;

[0138] Convert each second intention factor vector into a corresponding vector matrix. Each second intention factor vector is composed of characters corresponding to the intention factor. By counting the vectors corresponding to each character in each second intention factor vector, the vector matrix of each second intention factor vector is formed in the target sentence.

[0139] Each intention vector is composed of one or more second intention factor vectors, and the second intention factor vectors constituting the intention vector are arranged in order to generate a corresponding vector matrix.

[0140] The conversion obtains the vector matrix of each intention vector, and each second intention factor vector in each intention vector is converted into a corresponding vector matrix.

[0141] S156. Multiply each of the second intention factor vectors and the vector matrix of the corresponding intention vector to generate a factor vector matrix, and generate factor scores of the factor vector matrix;

[0142] Multiply each second intent factor vector with the vector matrix of the corresponding intent vector to generate a factor vector matrix. Map the calculated factor vector matrix to a 1*1 fully connected layer, expand the feature distance in a plane, and finally, calculate the expanded one-dimensional features through the scoring mechanism of machine learning to obtain the factor score of each intent vector.

[0143] S157. Add the sentence score and the factor score to generate the intention score.

[0144] The calculated sentence score and factor score of each intent vector are added together to obtain the intent score of each intent vector. Then, the true intent of the target sentence is screened according to the intent score.

[0145] The calculation method of the intent score is not limited to this. Depending on the specific application scenario, in some embodiments, the intent score can be calculated in a weighted manner. For example, during the calculation, the text length of the target sentence is counted. The longer the text length of the target sentence, the greater the weight of the corresponding sentence score, and the smaller the weight of the corresponding factor score; conversely, the smaller the weight of the sentence score, the greater the weight of the corresponding factor score. In one embodiment, the text character length of the target sentence is compared with a preset length threshold. When the comparison result is greater than 1, the weight of the sentence score is greater than 0.5; when the comparison result is less than 1, the weight of the factor score is greater than 0.5. The specific conversion ratio between the weight and the character ratio can be set according to the needs of the actual scenario.

[0146] The calculation of factor scores measures the score of each intent vector from a micro perspective, and then combines the sentence score of each intent vector at the macro level and the factor score at the micro level to calculate the comprehensive score of the intent vector: the intent score. The intent score combines the micro and macro scores of the intent vector, making each intent score more objective and helping to screen out the true intent of the target sentence.

[0147] In some implementations, after obtaining the intent score of each intent vector, it is necessary to filter out the target vector that can represent the true intent of the target sentence based on the intent score. Figure 5 , Figure 5 This is a flowchart for screening the true intention in this embodiment.

[0148] like Figure 5 As shown, S160 includes:

[0149] S161, using the intention score as a sorting condition, arranging the at least one true intention in descending order;

[0150] After calculating the intent score of each intent vector, the identified intent vectors are sorted according to the intent score in descending order.

[0151] S162. Determine at least one true intent of the target sentence from the at least one intent vector according to a preset screening rule.

[0152] According to the preset filtering rules, the real intent of the target sentence is filtered out in the sorted list. Specifically, the filtering rules are: filter out the top three intent vectors in the sorted list, and determine the intent characters corresponding to the filtered intent vectors as the real intent of the target sentence. The number of real intents to be filtered out in the filtering rules can be set according to specific needs, including (but not limited to): top1, top2, top4 or more.

[0153] In some implementations, after the real intent of the target sentence is determined, a graph query sentence needs to be generated according to the real intent representation. Figure 6 , Figure 6 Schematic diagram of the flow of the graph query statement in this embodiment.

[0154] like Figure 6 As shown, S160 includes:

[0155] S171, using the real intent as a search condition, searching a semantic relationship tree corresponding to the real intent in a preset sample database, wherein the semantic relationship tree is a semantic expression topology sample constructed with the user intent in the historical data as a root node;

[0156] After the real intention of the target sentence is screened, the semantic key tree corresponding to the real intention is searched in the preset sample database using the intention characters representing the real intention as the retrieval condition.

[0157] The semantic relationship tree is a data structure pre-built in the sample database to identify various types of user intent. Specifically, the various types of user intent collected from historical data are used as root nodes, and the user intent is segmented into four types: predicate, operator, type, and attribute. The splitting of user intent is not limited to the above four categories. In practical applications, user intent can be split according to the actual needs of the application scenario, such as reducing the types or adding subjects.

[0158] In user intent splitting, the user intent is split into a tree topology diagram. Figure 7 , Figure 7 FIG. 1 is a schematic diagram of an example of a semantic relationship tree in this embodiment. Figure 7 As shown in the figure, the user intent is taken as the root node, and the predicate, operator, type and attribute are taken as the child nodes of the root node. The predicate can record the main intention of the user intent, such as: insurance, cancellation, claim or purchase information. The operator is used to identify the logical relationship between the predicates in the intent representation, such as parallel, sequence, condition, greater than, equal to, belong to or contain information. The type refers to the condition for the execution of the predicate in the user intent, such as: amount, age, years, product, occupation or disease. The attribute refers to the type of user intent, such as: subject, object, age, occupation, weight and payment period.

[0159] The semantic relationship tree is constructed through the Biaffine model. The Biaffine model segments various types of user intentions collected from historical data, and then directly uses a neural network to predict the probability of a dependency relationship between two words. Finally, different words are classified according to the probability of the dependency relationship between words in user intentions to form a semantic relationship tree.

[0160] S172, extracting sentence parameters in the target sentence according to the semantic relationship tree;

[0161] After matching the semantic relationship tree of the real intention, the corresponding sentence parameters are collected according to the words in the leaf nodes in the semantic relationship tree. For example, the target sentence is: I want to buy two years of health insurance, where "buy health insurance" is defined as the user's real intention. Health insurance will become a leaf node of the semantic relationship tree corresponding to the user's real intention. This leaf node only includes the noun health insurance, without any attached quantifiers. At this time, "two years" is extracted as the sentence parameter adapted to "health insurance" in the target sentence. When there are multiple user intentions, the sentence parameters are extracted by extracting the parameter values ​​corresponding to each leaf node separately.

[0162] S173. Input the statement parameters into the semantic relationship tree to generate a graph query statement for the target statement.

[0163] The extracted sentence parameters are input into the corresponding leaf nodes of the semantic relationship tree to generate a graph query statement of the target sentence. The graph query statement links the leaf nodes in the semantic relationship tree in a topological form to generate a cascaded graph query statement.

[0164] In some implementations, after the reply information is retrieved, it is necessary to transmit the reply information back to the user terminal. Figure 8 , Figure 8 The figure is a schematic diagram of the sending process of reply information in this embodiment.

[0165] S181, searching for reply information of the graph query statement in a preset reply database according to the graph query statement;

[0166] When searching, the answer query is performed in the order of the link of the leaf nodes, and the search scope of the matching answer is continuously narrowed until the answer obtained by the search can meet the matching requirements in all leaf nodes, and the answer is replied as the reply information. For example, when there are two leaf nodes in the semantic relationship tree, the two leaf nodes constitute a cascaded graph query statement. When the leaf node of the first level searches for the answer, 20 groups of matching answers are found. When the leaf node of the second level adapts the answer, it adapts it in these 20 groups of answers that have been recalled. This retrieval method can avoid the disadvantage that each user intent needs to be globally searched and matched in traditional multi-intent recognition. It can not only improve the accuracy of the reply information, but also improve the efficiency of the retrieval and save computing resources.

[0167] S182: Send the reply information to the user terminal that sent the target sentence.

[0168] After the reply information is retrieved, the reply information is sent to the user terminal of the target sentence. In some embodiments, after a user terminal obtains the reply information of the target sentence, the server side associates and stores the target sentence with the user terminal. When the server side receives the same target sentence again, it will perform terminal adaptation and send an inquiry message to the user terminal that previously obtained the reply information. The inquiry message will prompt the user whether to become a problem consultation officer. In some cases, paid consultation can be conducted to obtain the permission of the previous user. After obtaining the permission of the previous user terminal, a point-to-point communication channel is established between the repeated question consultation terminal and the user terminal to achieve point-to-point communication between the user terminal and the repeated question consultation terminal. Then, the user terminal sends the corresponding reply information to the repeated question consultation terminal. In this way, a communication bridge is established between existing users and consulting users, so that new users can obtain the most appropriate guidance and suggestions, and at the same time, customer service resources are saved.

[0169] Please refer to Fig. 9 , Fig. 9 Schematic diagram of the basic structure of the user intention processing device of this embodiment.

[0170] like Fig. 9 As shown, a user intention processing device includes: an acquisition module 1100, a processing module 1200, a word segmentation module 1300, an attention module 1400, a scoring module 1500 and an intention module 1600. The acquisition module is used to acquire a target sentence to be identified; the processing module is used to encode the target sentence according to a preset encoder to generate a first sentence vector of the target sentence; the word segmentation module is used to segment the target sentence according to a preset word segmentation rule, and generate at least one intention vector to be confirmed that represents the intention of the target sentence according to the word segmentation result and the first sentence vector, wherein the intention vector is composed of a plurality of first intention factor vectors; the attention module is used to input the first sentence vector and each of the first intention factor vectors into a preset first attention model to generate a second sentence vector and a plurality of second intention factor vectors; the scoring module is used to generate an intention score of the intention vector according to the second sentence vector and the intention vector; the intention module is used to determine at least one true intention of the target sentence from at least one intention vector according to the intention score.

[0171] The user intention processing device encodes the target sentence to generate a first sentence vector, analyzes the target sentence, and splits the target sentence into at least one intention vector, each of which is composed of multiple first intention factor vectors. Through the attention model, the correlation between each first intention factor vector and the first sentence vector is calculated, and the second sentence vector and the second intention factor vector are updated and generated according to the correlation. The intention score of each intention vector is generated by the second intention factor vector, the second sentence vector and the intention vector, and then the true intention of the target sentence is obtained. Due to the calculation of the correlation between the first intention factor vector and the first sentence vector, the correlation between each first sentence vector and the first sentence vector can be determined. Then, the first sentence vector and the first intention factor vector are updated according to the correlation, which can make the updated second intention factor vector and the second sentence vector focus on the scoring and move closer to important information or intention expression. Therefore, the calculated intention score more objectively represents the user's true intention and improves the accuracy of user intention processing.

[0172] Optionally, the user intention processing device further includes: a first calculation submodule, a first processing submodule, a first generation submodule and a first splicing submodule. Among them, the first calculation submodule is used to calculate the first attention distribution between each of the first intention factor vectors and the first sentence vector; the first processing submodule is used to normalize each of the first attention distributions to generate a first parameter value; the first generation submodule is used to multiply the first parameter value with the corresponding first intention factor vector to generate a corresponding second intention factor vector; the first splicing submodule is used to splice multiple second intention factor vectors to generate the second sentence vector.

[0173] Optionally, the user intention processing device further includes: a second calculation submodule, a second processing submodule, a second generation submodule and a second splicing submodule. Among them, the second calculation submodule is used to calculate the second attention distribution between each of the intention vectors and the second sentence vector; the second processing submodule is used to normalize each of the second attention distributions to generate a second parameter value; the second generation submodule is used to multiply the second parameter value with the corresponding intention vector to generate a focus vector corresponding to each intention vector; the second splicing submodule is used to splice each of the focus vectors to generate a third sentence vector, and generate a sentence score for each intention vector through the third sentence vector.

[0174] Optionally, the user intention processing device further includes: a first conversion submodule, a third calculation submodule and a first intention submodule. The first conversion submodule is used to convert each of the second intention factor vectors and each intention vector into a corresponding vector matrix; the third calculation submodule is used to multiply each of the second intention factor vectors and the vector matrix of the corresponding intention vector to generate a factor vector matrix, and generate a factor score of the factor vector matrix; the first intention submodule is used to add the sentence score and the factor score to generate the intention score.

[0175] Optionally, the user intention processing device further includes: a first sorting submodule and a first screening submodule. The first sorting submodule is used to sort the at least one true intention in descending order based on the intention score as a sorting condition; the first screening submodule is used to determine at least one true intention of the target sentence from the at least one intention vector according to a preset screening rule.

[0176] Optionally, the user intention processing device further includes: a first retrieval submodule, a first extraction submodule and a third generation submodule. The first retrieval submodule is used to use the real intention as a retrieval condition to search for a semantic relationship tree corresponding to the real intention in a preset sample database, wherein the semantic relationship tree is a semantic expression topology example constructed with the user intention in the historical data as the root node; the first extraction submodule is used to extract the sentence parameters in the target sentence according to the semantic relationship tree; the third generation submodule is used to input the sentence parameters into the semantic relationship tree to generate a graph query sentence of the target sentence.

[0177] Optionally, the user intention processing device further includes: a first query submodule and a first reply submodule. The first query submodule is used to search for reply information of the graph query statement in a preset reply database according to the graph query statement; the first reply submodule is used to send the reply information to the user terminal that sent the target statement.

[0178] To solve the above technical problems, the embodiment of the present invention also provides a computer device. Fig.10 , Fig.10 This is a basic structural block diagram of the computer device in this embodiment.

[0179] like Fig.10As shown, a schematic diagram of the internal structure of a computer device. The computer device includes a processor, a non-volatile storage medium, a memory, and a network interface connected via a system bus. Among them, the non-volatile storage medium of the computer device stores an operating system, a database, and computer-readable instructions. The database may store a control information sequence. When the computer-readable instructions are executed by the processor, the processor can implement a user intent processing method. The processor of the computer device is used to provide computing and control capabilities to support the operation of the entire computer device. The memory of the computer device may store computer-readable instructions. When the computer-readable instructions are executed by the processor, the processor can execute a user intent processing method. The network interface of the computer device is used to connect and communicate with a terminal. Those skilled in the art will understand that Fig.10 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0180] In this embodiment, the processor is used to execute Fig. 9 The specific functions of the acquisition module 1100, the processing module 1200, the word segmentation module 1300, the attention module 1400, the scoring module 1500 and the intention module 1600 are stored in the memory, and the program code and various data required to execute the above modules are stored. The network interface is used to transmit data between the user terminal or the server. The memory in this embodiment stores the program code and data required to execute all sub-modules in the face image key point detection device, and the server can call the server's program code and data to execute the functions of all sub-modules.

[0181] The computer device encodes and processes the target sentence to generate a first sentence vector, analyzes the target sentence, and splits the target sentence into at least one intention vector, each of which is composed of multiple first intention factor vectors. Through the attention model, the correlation between each first intention factor vector and the first sentence vector is calculated, and the second sentence vector and the second intention factor vector are updated and generated according to the correlation. The intention score of each intention vector is generated through the second intention factor vector, the second sentence vector and the intention vector, and then the true intention of the target sentence is obtained. Due to the calculation of the correlation between the first intention factor vector and the first sentence vector, the correlation between each first sentence vector and the first sentence vector can be determined. Then, the first sentence vector and the first intention factor vector are updated according to the correlation, which can make the updated second intention factor vector and the second sentence vector focus on the scoring of important information or intention expression. Therefore, the calculated intention score more objectively represents the user's true intention and improves the accuracy of user intention processing.

[0182] The present invention also provides a storage medium storing computer-readable instructions. When the computer-readable instructions are executed by one or more processors, the one or more processors execute the steps of the user intention processing method in any of the above-mentioned embodiments.

[0183] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the computer program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, the aforementioned storage medium can be a non-volatile storage medium such as a disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM).

[0184] It should be understood that, although the steps in the flowchart of the accompanying drawings are displayed in sequence as indicated by the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least a part of the steps in the flowchart of the accompanying drawings may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be executed in turn or alternately with other steps or at least a part of the sub-steps or stages of other steps.

Claims

1. A method for processing user intention, characterized in that: include: Obtaining a target sentence to be recognized; Encoding the target sentence according to a preset encoder to generate a first sentence vector of the target sentence; Performing word segmentation processing on the target sentence according to a preset word segmentation rule, and generating at least one to-be-confirmed intention vector representing the intention of the target sentence according to the word segmentation result and the first sentence vector, wherein the intention vector is formed by concatenating multiple first intention factor vectors; Input the first sentence vector and each of the first intention factor vectors into a preset first attention model to generate a second sentence vector and multiple second intention factor vectors; Generating an intent score of the intent vector according to the second sentence vector and the intent vector; Determining at least one true intent of the target sentence from at least one intent vector according to the intent score; inputting the first sentence vector and each of the first intent factor vectors into a preset first attention model, and generating a second sentence vector and a plurality of second intent factor vectors comprises: Calculating a first attention distribution between each of the first intention factor vectors and the first sentence vector; Normalizing each of the first attention distributions to generate a first parameter value; Multiplying the first parameter value by its corresponding first intention factor vector to generate a corresponding second intention factor vector; Concatenate multiple second intention factor vectors to generate the second sentence vector; Generating the intent score of the intent vector according to the second sentence vector and the intent vector includes: Calculating a second attention distribution between each of the intention vectors and the second sentence vector; Normalizing each of the second attention distributions to generate a second parameter value; Multiplying the second parameter value by the intention vector corresponding to the second parameter value to generate a focus vector corresponding to each intention vector; The focus vectors are concatenated to generate a third sentence vector, and the sentence scores of the intent vectors are generated by the third sentence vector. After the focus vectors are concatenated to generate a third sentence vector, and sentence scores of the intent vectors are generated by using the third sentence vector, the method further comprises: Convert each of the second intention factor vectors and each intention vector into a corresponding vector matrix; Multiplying each of the second intent factor vectors and the vector matrix of the corresponding intent vector to generate a factor vector matrix, and generating factor scores of the factor vector matrix; The sentence score and the factor score are added together to generate the intent score.

2. The method for processing user intention according to claim 1, characterized in that: Determining at least one true intent of the target sentence from at least one intent vector according to the intent score includes: Using the intention score as a sorting condition, arranging the at least one true intention in descending order; According to a preset screening rule, at least one true intent of the target sentence is determined from the at least one intent vector.

3. The method for processing user intention according to claim 1, characterized in that: After determining the true intent of the target sentence from at least one intent vector according to the intent score, the method further comprises: Taking the real intention as a search condition, searching for a semantic relationship tree corresponding to the real intention in a preset sample database, wherein the semantic relationship tree is a semantic expression topology sample constructed with the user intention in the historical data as a root node; Extracting sentence parameters in the target sentence according to the semantic relationship tree; The sentence parameters are input into the semantic relationship tree to generate a graph query sentence of the target sentence.

4. The method for processing user intention according to claim 3, characterized in that: After the sentence parameters are input into the semantic relationship tree to generate the graph query sentence of the target sentence, the method includes: According to the graph query statement, searching for reply information of the graph query statement in a preset reply database; The reply information is sent to the user terminal that sent the target sentence.

5. A user intention processing device, characterized in that: include: An acquisition module, used for acquiring a target sentence to be recognized; A processing module, used for encoding the target sentence according to a preset encoder to generate a first sentence vector of the target sentence; A word segmentation module, configured to perform word segmentation processing on the target sentence according to a preset word segmentation rule, and generate at least one to-be-confirmed intention vector representing the intention of the target sentence according to the word segmentation result and the first sentence vector, wherein the intention vector is formed by concatenating a plurality of first intention factor vectors; An attention module, used for inputting the first sentence vector and each of the first intention factor vectors into a preset first attention model to generate a second sentence vector and a plurality of second intention factor vectors; A scoring module, configured to generate an intent score of the intent vector based on the second sentence vector and the intent vector; an intent module, configured to determine at least one true intent of the target sentence from at least one intent vector according to the intent score; The user intention processing device also includes: A first calculation submodule, used to calculate a first attention distribution between each of the first intention factor vectors and the first sentence vector; A first processing submodule, configured to perform normalization processing on each of the first attention distributions to generate a first parameter value; A first generating submodule, used for multiplying the first parameter value by the first intention factor vector corresponding to the first parameter value to generate a corresponding second intention factor vector; A first concatenation submodule, configured to concatenate a plurality of the second intention factor vectors to generate the second sentence vector; The user intention processing device also includes: A second calculation submodule, used to calculate a second attention distribution between each of the intention vectors and the second sentence vector; A second processing submodule, configured to perform normalization processing on each of the second attention distributions to generate a second parameter value; A second generating submodule, used for multiplying the second parameter value by the intention vector corresponding to the second parameter value to generate a focus vector corresponding to each intention vector; A second concatenation submodule, configured to concatenate the focus vectors to generate a third sentence vector, and generate a sentence score of each intention vector through the third sentence vector; The user intention processing device also includes: A first conversion submodule, used for converting each of the second intention factor vectors and each intention vector into a corresponding vector matrix; a third calculation submodule, configured to multiply each of the second intention factor vectors and the vector matrix of the corresponding intention vector to generate a factor vector matrix, and generate a factor score of the factor vector matrix; The first intention submodule is used to add the sentence score and the factor score to generate the intention score.

6. A computer device comprising a memory and a processor, wherein the memory stores computer-readable instructions, and when the computer-readable instructions are executed by the processor, the processor executes the steps of the user intention processing method as described in any one of claims 1 to 4.

7. A storage medium storing computer-readable instructions, wherein when the computer-readable instructions are executed by one or more processors, the one or more processors execute the steps of the user intention processing method as claimed in any one of claims 1 to 4.