CN116431811A - Hidden factor-based attention mechanism intention recognition method, device, equipment and medium - Google Patents

Hidden factor-based attention mechanism intention recognition method, device, equipment and medium Download PDF

Info

Publication number
CN116431811A
CN116431811A CN202310418264.8A CN202310418264A CN116431811A CN 116431811 A CN116431811 A CN 116431811A CN 202310418264 A CN202310418264 A CN 202310418264A CN 116431811 A CN116431811 A CN 116431811A
Authority
CN
China
Prior art keywords
vector
corpus
intention
weighted average
attention
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310418264.8A
Other languages
Chinese (zh)
Inventor
吴信朝
阮晓雯
吴振宇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Technology Shenzhen Co Ltd
Original Assignee
Ping An Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Technology Shenzhen Co Ltd filed Critical Ping An Technology Shenzhen Co Ltd
Priority to CN202310418264.8A priority Critical patent/CN116431811A/en
Publication of CN116431811A publication Critical patent/CN116431811A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/35Clustering; Classification
    • G06F16/353Clustering; Classification into predefined classes
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/33Querying
    • G06F16/3331Query processing
    • G06F16/334Query execution
    • G06F16/3346Query execution using probabilistic model
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/30Semantic analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/047Probabilistic or stochastic networks

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computational Linguistics (AREA)
  • Data Mining & Analysis (AREA)
  • Artificial Intelligence (AREA)
  • General Health & Medical Sciences (AREA)
  • Health & Medical Sciences (AREA)
  • Databases & Information Systems (AREA)
  • Probability & Statistics with Applications (AREA)
  • Biomedical Technology (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Biophysics (AREA)
  • Evolutionary Computation (AREA)
  • Molecular Biology (AREA)
  • Computing Systems (AREA)
  • Mathematical Physics (AREA)
  • Software Systems (AREA)
  • Machine Translation (AREA)

Abstract

The invention relates to artificial intelligence technology, and discloses an intention recognition method based on a hidden factor attention mechanism, which comprises the following steps: vector conversion is carried out on the corpus of the user; decomposing the corpus vector to obtain a hidden factor vector and a first corpus vector; encoding the first corpus vector to obtain a vector space, and extracting feature vectors of the vector space; inputting the hidden factor vector and the feature vector into the attention model to obtain attention weights, and carrying out weighted average on the feature vector and the attention weights to obtain weighted average vectors; and inputting the weighted average vector into an intention classifier to obtain intention recognition probability, and determining the weighted average vector with the intention recognition probability being greater than or equal to a threshold value as the intention corresponding to the user corpus. In addition, the invention also relates to a blockchain technology, and the user corpus can be stored in nodes of the blockchain. The invention also provides a hidden factor attention mechanism-based intention recognition device, equipment and medium. The invention can improve the effect of intention recognition.

Description

Hidden factor-based attention mechanism intention recognition method, device, equipment and medium
Technical Field
The invention relates to the technical field of artificial intelligence, in particular to a hidden factor attention mechanism-based intention recognition method, a hidden factor attention mechanism-based intention recognition device, electronic equipment and a computer-readable storage medium.
Background
With the development of artificial intelligence, machine learning technology is increasingly applied to the field of traditional Chinese medicine, such as telemedicine, intelligent diagnosis, robot inquiry and the like. However, in order to accurately recognize the user intention, the user intention needs to be recognized from the user corpus to respond to the user intention, so that the effect of recognizing the user intention is improved.
The existing intention recognition technology mainly utilizes a multi-classification method, namely, each intention corresponds to one classifier, so that the intention of the user is classified, and further, the intention recognition of the user is realized. For example, in the field of intelligent traditional Chinese medicine, a patient needs to understand his/her intention to speak correctly during the interaction with an intelligent system. In practical application, the relevance of different intentions and specific words in sentences is higher than that of other words, and only the fact that all words in sentences are considered to be identical in one view can lead to inaccurate recognition during the intention recognition, so that the recognition effect of carrying out the intention recognition on users is lower.
Disclosure of Invention
The invention provides a hidden factor-based attention mechanism intention recognition method, a hidden factor-based attention mechanism intention recognition device and a computer-readable storage medium, and mainly aims to solve the problem that recognition effect is low when intention recognition is carried out.
In order to achieve the above object, the present invention provides a hidden factor attention mechanism based intention recognition method, comprising:
acquiring preset user corpus, and performing vector conversion on the user corpus to obtain corpus vectors;
decomposing the corpus vector to obtain a hidden factor vector and a first corpus vector;
performing feature coding on the first corpus vector by using a preset depth network to obtain a corpus vector space, and extracting feature vectors corresponding to the first corpus vector in the corpus vector space;
inputting the hidden factor vector and the feature vector into a preset attention model to obtain attention weights, and carrying out weighted average on the feature vector and the attention weights to obtain weighted average vectors;
and inputting the weighted average vector into a preset intention classifier to obtain intention recognition probability, and determining that the weighted average vector with the intention recognition probability being more than or equal to a preset threshold value is the intention corresponding to the user corpus.
Optionally, the decomposing the corpus vector to obtain a hidden factor vector and a first corpus vector includes:
obtaining a vector matrix corresponding to the corpus vector;
performing matrix decomposition on the vector matrix to obtain a first matrix and a second matrix;
adjusting the first matrix by using a preset root mean square error to obtain a first optimal matrix, and adjusting the second matrix by using the root mean square error to obtain a second optimal matrix;
and taking the vector corresponding to the first optimal matrix as the hidden factor vector, and taking the vector corresponding to the second optimal matrix as the first corpus vector.
Optionally, the feature encoding is performed on the first corpus vector by using a preset depth network to obtain a corpus vector space, including:
the first corpus vector is selected one by one and is input into a hidden layer of the depth network to perform feature coding, so that a coding vector is obtained;
taking the coding vector output by the top layer of the depth network as an output vector corresponding to the first corpus vector;
and collecting the output vector as a corpus vector space.
Optionally, the inputting the hidden factor vector and the feature vector into a preset attention model to obtain an attention weight includes:
calculating the attention weight from the hidden factor vector and the feature vector using the attention model:
(a 1 ,a 2 ,a 3 ,…,a n )=softmax(v*h 1 ,v*h 2 ,v*h 3 ,…,v*h n )
wherein v represents a hidden factor vector, h n Representing feature vectors, a, of an nth first semantic vector output from a sentence through a top layer of a depth network n Representing the normalized attention weight corresponding to the nth first semantic vector.
Optionally, the performing weighted average on the feature vector and the attention weight to obtain a weighted average vector includes:
and carrying out weighted average on the corpus feature coding vector and the attention weight by using the following weighted average formula to obtain a weighted average vector:
V s =a 1 *h 1 +a 2 *h 2 +…+a n *h n
wherein V is s A for the weighted average vector n Represents the normalized attention weight, h, corresponding to the nth first semantic vector n Representing feature vectors of the nth first semantic vector output via the top layer of the depth network.
Optionally, the inputting the weighted average vector into a preset intention classifier to obtain an intention recognition probability includes:
inputting the weighted average vector into the intention classifier to classify, so as to obtain intention distribution;
the intent recognition probability is determined from the intent distribution.
Optionally, the determining the intent recognition probability according to the intent distribution includes:
extracting intent semantics in the intent distribution;
calculating the matching degree of the intention semantics and the intention semantics in a preset intention database;
and taking the matching degree as the intention recognition probability.
In order to solve the above-mentioned problems, the present invention also provides an apparatus for identifying an intention based on a hidden factor attention mechanism, the apparatus comprising:
the corpus vector conversion module is used for obtaining preset user corpus and carrying out vector conversion on the user corpus to obtain corpus vectors;
the corpus vector decomposition module is used for decomposing the corpus vector to obtain a hidden factor vector and a first corpus vector;
the vector coding module is used for carrying out feature coding on the first corpus vector by utilizing a preset depth network to obtain a corpus vector space, and extracting a feature vector corresponding to the first corpus vector in the corpus vector space;
the weighted average vector calculation module is used for inputting the hidden factor vector and the feature vector into a preset attention model to obtain attention weights, and carrying out weighted average on the feature vector and the attention weights to obtain a weighted average vector;
the user intention determining module is used for inputting the weighted average vector into a preset intention classifier to obtain intention recognition probability, and determining that the weighted average vector with the intention recognition probability being greater than or equal to a preset threshold value is the intention corresponding to the user corpus.
And the second recommending module is used for recommending the product to be recommended to the second target user group.
In order to solve the above-mentioned problems, the present invention also provides an electronic apparatus including:
at least one processor; the method comprises the steps of,
a memory communicatively coupled to the at least one processor; wherein, the liquid crystal display device comprises a liquid crystal display device,
the memory stores a computer program executable by the at least one processor to enable the at least one processor to perform the hidden factor based attention mechanism intent recognition method described above.
In order to solve the above-mentioned problems, the present invention also provides a computer-readable storage medium having stored therein at least one computer program that is executed by a processor in an electronic device to implement the above-mentioned hidden factor based attention mechanism intention recognition method.
According to the embodiment of the invention, the corpus vector is obtained by carrying out vector conversion on the corpus of the user, the corpus limit is decomposed to obtain the hidden factor vector and the first corpus vector, and the attention calculation is carried out by utilizing the hidden factor vector, so that the intention classifier pays attention to the high-correlation vocabulary; inputting the first corpus vector into a depth network for feature coding to obtain a corpus vector space, and realizing the conversion of the vector from low dimension to high dimension; the hidden factor vector and the feature vector are input into an attention model to obtain attention weight, and weighted average is carried out on the attention weight and the feature vector, so that higher-weight keywords in user semantics are obtained, and further, according to an intention classifier, the intention recognition probability is obtained; and determining whether the original user semantics contain the corresponding intention according to the intention recognition probability, so as to promote the multi-intention recognition task effect. Therefore, the hidden factor attention mechanism-based intention recognition method, the hidden factor attention mechanism-based intention recognition device, the electronic equipment and the computer-readable storage medium can solve the problem that the recognition effect is low when intention recognition is carried out.
Drawings
FIG. 1 is a flow chart of a hidden factor based attention mechanism intent recognition method according to an embodiment of the present invention;
FIG. 2 is a flow chart of decomposing corpus vector according to an embodiment of the present invention;
FIG. 3 is a flowchart illustrating encoding a first corpus vector according to an embodiment of the present invention;
FIG. 4 is a functional block diagram of an intention recognition device based on a hidden factor attention mechanism according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of an electronic device implementing the hidden factor based attention mechanism intention recognition method according to an embodiment of the present invention.
The achievement of the objects, functional features and advantages of the present invention will be further described with reference to the accompanying drawings, in conjunction with the embodiments.
Detailed Description
It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the invention.
The embodiment of the application provides a hidden factor-based attention mechanism intention recognition method. The execution subject of the hidden factor based attention mechanism intent recognition method includes, but is not limited to, at least one of a server, a terminal, and the like, which can be configured to execute the method provided by the embodiments of the present application. In other words, the hidden factor based attention mechanism intent recognition method may be performed by software or hardware installed at a terminal device or a server device, and the software may be a blockchain platform. The service end includes but is not limited to: a single server, a server cluster, a cloud server or a cloud server cluster, and the like. The server may be an independent server, or may be a cloud server that provides cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (ContentDelivery Network, CDN), and basic cloud computing services such as big data and artificial intelligence platforms.
Referring to fig. 1, a flow chart of a hidden factor based attention mechanism intention recognition method according to an embodiment of the invention is shown. In this embodiment, the hidden factor based attention mechanism intention recognition method includes:
s1, acquiring preset user corpus, and performing vector conversion on the user corpus to obtain corpus vectors;
in the embodiment of the present invention, the user corpus refers to the words spoken by the user or the question asked by the user, for example, in the field of intelligent traditional Chinese medicine, robot assisted inquiry is a relatively common business scenario, and the robot replaces manual specialists to collect patient information by talking with the patient, for example, the question asked by the user is "how much the medicine is eaten and how harmful to the body"? It is necessary to acquire the questions of the user, that is, the corpus of the user, and then identify the intention of the user, so that only the robot can accurately answer the questions of the user.
In detail, the stored user corpus may be crawled from a predetermined storage area including, but not limited to, databases, blockchain nodes, network caches, by computer sentences having data crawling functionality (e.g., java sentences, python sentences, etc.).
In the embodiment of the invention, the user corpus can be subjected to vector conversion through a preset vector conversion model to obtain corpus vectors, wherein the vector conversion model comprises but is not limited to a word2vec model and a Bert model.
In detail, the user corpus is subjected to vector conversion, that is, the whole sentence corresponding to the corpus and the semantic information thereof are expressed as vectors, so that a machine can understand the context, meaning and other subtle differences hidden in the text, for example, an embedding matrix is 8000 x 732, wherein the dictionary capacity is 8000, the embedding vector dimension is 732, and the sentence with the length s is expressed as an s x 732 matrix, therefore, the machine can understand the context of the sentence through the vector matrix, and the user intention is identified.
S2, decomposing the corpus vector to obtain a hidden factor vector and a first corpus vector;
in the embodiment of the invention, the corpus vector is represented by a vector matrix, the hidden factor vector refers to features hidden in the corpus vector, the hidden features are mined out in a vector matrix decomposition mode, the first corpus vector refers to the first corpus vector after matrix decomposition, and the other part of the decomposition is the first corpus vector after matrix decomposition.
In the embodiment of the present invention, referring to fig. 2, the decomposing the corpus vector to obtain a hidden factor vector and a first corpus vector includes:
s21, obtaining a vector matrix corresponding to the corpus vector;
s22, performing matrix decomposition on the vector matrix to obtain a first matrix and a second matrix;
s23, adjusting the first matrix by using a preset root mean square error to obtain a first optimal matrix, and adjusting the second matrix by using the root mean square error to obtain a second optimal matrix;
s24, taking the vector corresponding to the first optimal matrix as the hidden factor vector, and taking the vector corresponding to the second optimal matrix as the first corpus vector.
In detail, the hidden factors can be effectively captured by matrix decomposition, when the dimension of the hidden factor vector is k, the smaller the k value is, the less information the hidden factor vector contains, the weaker the expression capability is, and the higher the generalization degree of the model is; the larger the k value is, the more information the hidden factor vector contains, the stronger the expression capability is, and the lower the generalization degree of the model is.
Specifically, for probability prediction, the accuracy generally refers to a root mean square error or an average absolute error, and the parameter dimensions of the first matrix and the second matrix are adjusted by using the root mean square error, so that the parameter dimensions of the first matrix and the second matrix are optimized, and the prediction capability of the matrix based on the hidden factor vector can be optimized.
For example, when the vector matrix dimension of the corpus vector is 300×732, the vector matrix corresponding to the corpus vector may be decomposed into a first matrix of 300×500 and a second matrix of 500×732, the first matrix and the second matrix are subjected to matrix dimension adjustment by root mean square error, after adjustment, the vector matrix is decomposed into a first optimal matrix of 300×512 and a second optimal matrix of 512×732, that is, the vector corresponding to the first optimal matrix is a hidden factor vector, and the vector corresponding to the second optimal matrix is the first corpus vector.
Further, after the corpus vector is subjected to matrix decomposition, a hidden factor vector and a first corpus vector are obtained, the first corpus vector is input into a depth network, and sentence characteristic coding is carried out on the first corpus vector.
S3, performing feature coding on the first corpus vector by using a preset depth network to obtain a corpus vector space, and extracting a feature vector corresponding to the first corpus vector in the corpus vector space;
in the embodiment of the present invention, feature encoding the first corpus vector means encoding not only the first corpus vector but also the context information of the first corpus vector, so that each first corpus vector obtains a hidden state containing the context information of the first corpus vector. The corpus feature coding vector is used for carrying out vector position coding on the first corpus vector and outputting sentence vector space representation through the top layer of the depth network.
In the embodiment of the present invention, referring to fig. 3, the feature encoding of the first corpus vector by using a preset depth network to obtain a corpus vector space includes:
s31, selecting the first corpus vector one by one, and inputting the first corpus vector into a hidden layer of the depth network to perform feature coding to obtain a coding vector;
s32, taking the coded vector output by the top layer of the depth network as an output vector corresponding to the first corpus vector;
s33, collecting the output vectors into a corpus vector space.
In detail, the deep neural network is a technology in the machine learning field, wherein an input layer neuron of the deep neural network receives external input, hidden layer neurons and output layer neurons process signals, and a final result is output by the output layer neurons. And (3) encoding the context information of each first semantic vector through a depth network, namely performing feature encoding on sentences by using the depth network, namely inputting the embedded sentence vectors into the depth network, performing sentence feature extraction, and outputting sentence vector space representation at the top layer of the depth network.
In the embodiment of the invention, the feature vector corresponding to the first corpus vector in the corpus vector space is extracted, namely the feature vector corresponding to each first semantic vector is output at the output layer of the depth network in the corpus vector space, the first semantic vector is input one by one at the output layer of the depth network, feature coding is carried out through the hidden layer of the depth network, and then the feature vector corresponding to each first semantic vector is output at the output layer of the depth network. And the feature vector is an output vector corresponding to each first semantic vector output by an output layer in the depth network.
Illustratively, when the first semantic vector tableShown as v= (V 1 ,v 2 ,…,v n ) The first semantic vectors are used as input vectors of a depth network one by one, context information encoding is carried out on the first semantic vectors by using a depth neural network, and the corresponding output vector H= (H) is obtained by the first semantic vectors through an output layer of the depth network 1 ,h 2 ,…,h n ) Namely, the feature vector H= (H) corresponding to the first semantic vector is output through the top output layer of the deep neural network 1 ,h 2 ,…,h n )。
S4, inputting the hidden factor vector and the feature vector into a preset attention model to obtain attention weights, and carrying out weighted average on the feature vector and the attention weights to obtain weighted average vectors;
in the embodiment of the invention, the attention model is widely used in various different types of deep learning tasks such as natural language processing, image recognition, i.e. voice recognition, and the like, and is one of the core technologies most worthy of attention and deep understanding in the deep learning technology.
In the embodiment of the present invention, the inputting the hidden factor vector and the feature vector into a preset attention model to obtain an attention weight includes:
calculating the attention weight from the hidden factor vector and the feature vector using the attention model:
(a 1 ,a 2 ,a 3 ,…,a n )=softmax(v*h 1 ,v*h 2 ,v*h 3 ,…,v*h n )
wherein v represents a hidden factor vector, h n Representing feature vectors, a, of an nth first semantic vector output from a sentence through a top layer of a depth network n Representing the normalized attention weight corresponding to the nth first semantic vector.
In detail, the attention mechanism is utilized to dynamically generate weights of different connections, the specific calculation process of the attention mechanism is two processes, the first process is to calculate weight coefficients corresponding to the first semantic vector according to Query and key, and the second process is to carry out weighted summation on Value according to the weight coefficients. And obtaining an attention weight list corresponding to the first semantic vector through an attention model.
In the embodiment of the invention, the attention weight corresponding to the first semantic vector is obtained, and the weighted average is carried out according to the attention weight and the feature vector, so that the representation of the first corpus vector in the corpus vector space is obtained.
In an embodiment of the present invention, the performing weighted average on the feature vector and the attention weight to obtain a weighted average vector includes:
and carrying out weighted average on the corpus feature coding vector and the attention weight by using the following weighted average formula to obtain a weighted average vector:
V s =a 1 *h 1 +a 2 *h 2 +…+a n *h n
wherein V is s A for the weighted average vector n Represents the normalized attention weight, h, corresponding to the nth first semantic vector n Representing feature vectors of the nth first semantic vector output via the top layer of the depth network.
In detail, the attention weight of each first semantic vector can be determined according to the weighted average vector, the importance of the words in the corpus of the user can be determined through the attention weight, and the intention of the user can be deduced with the highest probability.
Illustratively, when attention is weighted by a 1 Attention weight a of 0.3 2 Attention weight a of 0.5 3 Is 0.6, the first semantic vector is a feature vector h output by the top layer of the depth network 1 = {3,6,5}, the first semantic vector is a feature vector h output by the top layer of the depth network 2 = {4,6,7}, the first semantic vector is a feature vector h output by the top layer of the depth network 3 And = {2, 5}, the weighted average vector corresponding to the first corpus vector can be obtained through calculation by a weighted average formula.
S5, inputting the weighted average vector into a preset intention classifier to obtain intention recognition probability, and determining that the weighted average vector with the intention recognition probability being greater than or equal to a preset threshold value is the intention corresponding to the user corpus. In the embodiment of the invention, the weighted average vector is output to an intention classifier to judge whether the weighted average vector belongs to the current intention, wherein the intention classifier classifies the intention according to the intention of speaking of the user, and then the user is given an answer by combining a historical context.
In the embodiment of the present invention, the step of inputting the weighted average vector into a preset intention classifier to obtain an intention recognition probability includes:
inputting the weighted average vector into the intention classifier to classify, so as to obtain intention distribution;
the intent recognition probability is determined from the intent distribution.
In detail, the weighted average vector is input into the intention classifier to classify, so that it is possible to obtain which intention distribution the user corpus corresponding to the weighted average vector belongs to, for example, the intention distribution includes medicine intention, inpatient intention, medicine notice in a traditional Chinese medicine scene, and the like.
Specifically, the intention recognition probability of each intention distribution is determined, the content with the largest intention recognition probability is selected as the response content, and different intention recognition probabilities correspond to different intention recognition results. For example, when the intention recognition probability is very low, the intention recognition result may be unidentifiable prompt information; when the intention recognition probability is very high, the intention recognition result may be response content corresponding to the session content; when the intention recognition probability is moderate, the intention recognition result may be a similar sentence similar to the conversation content.
In an embodiment of the present invention, the determining the intent recognition probability according to the intent distribution includes:
extracting intent semantics in the intent distribution;
calculating the matching degree of the intention semantics and the intention semantics in a preset intention database;
and taking the matching degree as the intention recognition probability.
In detail, the intention semantics corresponding to the intention distribution can be matched with the intention semantics in the intention database, the probability of each intention distribution is determined according to the matching degree, and the intention distribution with the highest probability is selected as the user intention, namely, the user is responded through the intention database.
Specifically, the matching degree of the intent semantics with the intent semantics in the preset intent database may be calculated using a matching algorithm, wherein the matching algorithm includes, but is not limited to, a cosine distance algorithm, a euclidean distance algorithm, and the like.
In the embodiment of the invention, the threshold value is set to be 0.85, when the intention recognition probability is greater than or equal to 0.85, the corresponding user intention is included in the original user corpus, and when the intention recognition probability is less than 0.85, the corresponding user intention is not included in the original user corpus.
According to the embodiment of the invention, the corpus vector is obtained by carrying out vector conversion on the corpus of the user, the corpus limit is decomposed to obtain the hidden factor vector and the first corpus vector, and the attention calculation is carried out by utilizing the hidden factor vector, so that the intention classifier pays attention to the high-correlation vocabulary; inputting the first corpus vector into a depth network for feature coding to obtain a corpus vector space, and realizing the conversion of the vector from low dimension to high dimension; the hidden factor vector and the feature vector are input into an attention model to obtain attention weight, and weighted average is carried out on the attention weight and the feature vector, so that higher-weight keywords in user semantics are obtained, and further, according to an intention classifier, the intention recognition probability is obtained; and determining whether the original user semantics contain the corresponding intention according to the intention recognition probability, so as to promote the multi-intention recognition task effect. Therefore, the hidden factor attention mechanism-based intention recognition method, the hidden factor attention mechanism-based intention recognition device, the electronic equipment and the computer-readable storage medium can solve the problem that the recognition effect is low when intention recognition is carried out.
FIG. 4 is a functional block diagram of an apparatus for identifying an intention of a device based on a hidden factor based attention mechanism according to an embodiment of the present invention.
The hidden factor based attention mechanism intent recognition device 100 of the present invention may be installed in an electronic apparatus. Depending on the implemented functionality, the hidden factor based attention mechanism intent recognition device 100 may include a corpus vector conversion module 101, a corpus vector decomposition module 102, a vector encoding module 103, a weighted average vector calculation module 104, and a user intent determination module 105. The module of the invention, which may also be referred to as a unit, refers to a series of computer program segments, which are stored in the memory of the electronic device, capable of being executed by the processor of the electronic device and of performing a fixed function.
In the present embodiment, the functions concerning the respective modules/units are as follows:
the corpus vector conversion module 101 is configured to obtain a preset user corpus, and perform vector conversion on the user corpus to obtain a corpus vector;
the corpus vector decomposing module 102 is configured to decompose the corpus vector to obtain a hidden factor vector and a first corpus vector;
the vector encoding module 103 is configured to perform feature encoding on the first corpus vector by using a preset depth network, obtain a corpus vector space, and extract a feature vector corresponding to the first corpus vector in the corpus vector space;
the weighted average vector calculation module 104 is configured to input the hidden factor vector and the feature vector into a preset attention model to obtain an attention weight, and perform weighted average on the feature vector and the attention weight to obtain a weighted average vector;
the user intention determining module 105 is configured to input the weighted average vector into a preset intention classifier to obtain an intention recognition probability, and determine that the weighted average vector with the intention recognition probability being greater than or equal to a preset threshold is an intention corresponding to the user corpus.
In detail, each module in the hidden factor based attention mechanism intention recognition device 100 in the embodiment of the present invention adopts the same technical means as the hidden factor based attention mechanism intention recognition method described in fig. 1 to 3, and can produce the same technical effects, which are not described herein.
Fig. 5 is a schematic structural diagram of an electronic device implementing a hidden factor based attention mechanism intention recognition method according to an embodiment of the present invention.
The electronic device 1 may comprise a processor 10, a memory 11, a communication bus 12 and a communication interface 13, and may further comprise a computer program stored in the memory 11 and executable on the processor 10, such as a hidden factor based attention mechanism intent recognition program.
The processor 10 may be formed by an integrated circuit in some embodiments, for example, a single packaged integrated circuit, or may be formed by a plurality of integrated circuits packaged with the same function or different functions, including one or more central processing units (Central Processing unit, CPU), a microprocessor, a digital processing chip, a graphics processor, a combination of various control chips, and so on. The processor 10 is a Control Unit (Control Unit) of the electronic device, connects various components of the entire electronic device using various interfaces and lines, executes or executes programs or modules stored in the memory 11 (for example, executes an intention recognition program based on a hidden factor attention mechanism, etc.), and invokes data stored in the memory 11 to perform various functions of the electronic device and process data.
The memory 11 includes at least one type of readable storage medium including flash memory, a removable hard disk, a multimedia card, a card type memory (e.g., SD or DX memory, etc.), a magnetic memory, a magnetic disk, an optical disk, etc. The memory 11 may in some embodiments be an internal storage unit of the electronic device, such as a mobile hard disk of the electronic device. The memory 11 may in other embodiments also be an external storage device of the electronic device, such as a plug-in mobile hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card) or the like, which are provided on the electronic device. Further, the memory 11 may also include both an internal storage unit and an external storage device of the electronic device. The memory 11 may be used not only for storing application software installed in an electronic device and various types of data, such as code for identifying a program based on a hidden factor attention mechanism intention, but also for temporarily storing data that has been output or is to be output.
The communication bus 12 may be a peripheral component interconnect standard (peripheral component interconnect, PCI) bus, or an extended industry standard architecture (extended industry standard architecture, EISA) bus, among others. The bus may be classified as an address bus, a data bus, a control bus, etc. The bus is arranged to enable a connection communication between the memory 11 and at least one processor 10 etc.
The communication interface 13 is used for communication between the electronic device and other devices, including a network interface and a user interface. Optionally, the network interface may include a wired interface and/or a wireless interface (e.g., WI-FI interface, bluetooth interface, etc.), typically used to establish a communication connection between the electronic device and other electronic devices. The user interface may be a Display (Display), an input unit such as a Keyboard (Keyboard), or alternatively a standard wired interface, a wireless interface. Alternatively, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode) touch, or the like. The display may also be referred to as a display screen or display unit, as appropriate, for displaying information processed in the electronic device and for displaying a visual user interface.
Only an electronic device having components is shown, and it will be understood by those skilled in the art that the structures shown in the figures do not limit the electronic device, and may include fewer or more components than shown, or may combine certain components, or a different arrangement of components.
For example, although not shown, the electronic device may further include a power source (such as a battery) for supplying power to the respective components, and preferably, the power source may be logically connected to the at least one processor 10 through a power management device, so that functions of charge management, discharge management, power consumption management, and the like are implemented through the power management device. The power supply may also include one or more of any of a direct current or alternating current power supply, recharging device, power failure detection circuit, power converter or inverter, power status indicator, etc. The electronic device may further include various sensors, bluetooth modules, wi-Fi modules, etc., which are not described herein.
It should be understood that the embodiments described are for illustrative purposes only and are not limited to this configuration in the scope of the patent application.
The hidden factor based attention mechanism intent recognition program stored in the memory 11 in the electronic device 1 is a combination of instructions that, when executed in the processor 10, may implement:
acquiring preset user corpus, and performing vector conversion on the user corpus to obtain corpus vectors;
decomposing the corpus vector to obtain a hidden factor vector and a first corpus vector;
performing feature coding on the first corpus vector by using a preset depth network to obtain a corpus vector space, and extracting feature vectors corresponding to the first corpus vector in the corpus vector space;
inputting the hidden factor vector and the feature vector into a preset attention model to obtain attention weights, and carrying out weighted average on the feature vector and the attention weights to obtain weighted average vectors;
and inputting the weighted average vector into a preset intention classifier to obtain intention recognition probability, and determining that the weighted average vector with the intention recognition probability being more than or equal to a preset threshold value is the intention corresponding to the user corpus.
In particular, the specific implementation method of the above instructions by the processor 10 may refer to the description of the relevant steps in the corresponding embodiment of the drawings, which is not repeated herein.
Further, the modules/units integrated in the electronic device 1 may be stored in a computer readable storage medium if implemented in the form of software functional units and sold or used as separate products. The computer readable storage medium may be volatile or nonvolatile. For example, the computer readable medium may include: any entity or device capable of carrying the computer program code, a recording medium, a U disk, a removable hard disk, a magnetic disk, an optical disk, a computer Memory, a Read-Only Memory (ROM).
The present invention also provides a computer readable storage medium storing a computer program which, when executed by a processor of an electronic device, can implement:
acquiring preset user corpus, and performing vector conversion on the user corpus to obtain corpus vectors;
decomposing the corpus vector to obtain a hidden factor vector and a first corpus vector;
performing feature coding on the first corpus vector by using a preset depth network to obtain a corpus vector space, and extracting feature vectors corresponding to the first corpus vector in the corpus vector space;
inputting the hidden factor vector and the feature vector into a preset attention model to obtain attention weights, and carrying out weighted average on the feature vector and the attention weights to obtain weighted average vectors;
and inputting the weighted average vector into a preset intention classifier to obtain intention recognition probability, and determining that the weighted average vector with the intention recognition probability being more than or equal to a preset threshold value is the intention corresponding to the user corpus.
In the several embodiments provided in the present invention, it should be understood that the disclosed apparatus, device and method may be implemented in other manners. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the modules is merely a logical function division, and there may be other manners of division when actually implemented.
The modules described as separate components may or may not be physically separate, and components shown as modules may or may not be physical units, may be located in one place, or may be distributed over multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional module in the embodiments of the present invention may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units can be realized in a form of hardware or a form of hardware and a form of software functional modules.
It will be evident to those skilled in the art that the invention is not limited to the details of the foregoing illustrative embodiments, and that the present invention may be embodied in other specific forms without departing from the spirit or essential characteristics thereof.
The present embodiments are, therefore, to be considered in all respects as illustrative and not restrictive, the scope of the invention being indicated by the appended claims rather than by the foregoing description, and all changes which come within the meaning and range of equivalency of the claims are therefore intended to be embraced therein. Any reference signs in the claims shall not be construed as limiting the claim concerned.
The blockchain is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, consensus mechanism, encryption algorithm and the like. The Blockchain (Blockchain), which is essentially a decentralised database, is a string of data blocks that are generated by cryptographic means in association, each data block containing a batch of information of network transactions for verifying the validity of the information (anti-counterfeiting) and generating the next block. The blockchain may include a blockchain underlying platform, a platform product services layer, an application services layer, and the like.
The embodiment of the application can acquire and process the related data based on the artificial intelligence technology. Among these, artificial intelligence (Artificial Intelligence, AI) is the theory, method, technique and application system that uses a digital computer or a digital computer-controlled machine to simulate, extend and extend human intelligence, sense the environment, acquire knowledge and use knowledge to obtain optimal results.
Furthermore, it is evident that the word "comprising" does not exclude other elements or steps, and that the singular does not exclude a plurality. A plurality of units or means recited in the system claims can also be implemented by means of software or hardware by means of one unit or means. The terms first, second, etc. are used to denote a name, but not any particular order.
Finally, it should be noted that the above-mentioned embodiments are merely for illustrating the technical solution of the present invention and not for limiting the same, and although the present invention has been described in detail with reference to the preferred embodiments, it should be understood by those skilled in the art that modifications and equivalents may be made to the technical solution of the present invention without departing from the spirit and scope of the technical solution of the present invention.

Claims (10)

1. A hidden factor based attention mechanism intent recognition method, the method comprising:
acquiring preset user corpus, and performing vector conversion on the user corpus to obtain corpus vectors;
decomposing the corpus vector to obtain a hidden factor vector and a first corpus vector;
performing feature coding on the first corpus vector by using a preset depth network to obtain a corpus vector space, and extracting feature vectors corresponding to the first corpus vector in the corpus vector space;
inputting the hidden factor vector and the feature vector into a preset attention model to obtain attention weights, and carrying out weighted average on the feature vector and the attention weights to obtain weighted average vectors;
and inputting the weighted average vector into a preset intention classifier to obtain intention recognition probability, and determining that the weighted average vector with the intention recognition probability being more than or equal to a preset threshold value is the intention corresponding to the user corpus.
2. The method for identifying an intention based on a hidden factor attention mechanism as recited in claim 1, wherein said decomposing the corpus vector to obtain a hidden factor vector and a first corpus vector comprises:
obtaining a vector matrix corresponding to the corpus vector;
performing matrix decomposition on the vector matrix to obtain a first matrix and a second matrix;
adjusting the first matrix by using a preset root mean square error to obtain a first optimal matrix, and adjusting the second matrix by using the root mean square error to obtain a second optimal matrix;
and taking the vector corresponding to the first optimal matrix as the hidden factor vector, and taking the vector corresponding to the second optimal matrix as the first corpus vector.
3. The hidden factor attention mechanism based intent recognition method of claim 1, wherein the feature encoding the first corpus vector using a preset depth network to obtain a corpus vector space comprises:
the first corpus vector is selected one by one and is input into a hidden layer of the depth network to perform feature coding, so that a coding vector is obtained;
taking the coding vector output by the top layer of the depth network as an output vector corresponding to the first corpus vector;
and collecting the output vector as a corpus vector space.
4. The method of claim 1, wherein inputting the hidden factor vector and the feature vector into a predetermined attention model to obtain an attention weight comprises:
calculating the attention weight from the hidden factor vector and the feature vector using the attention model:
(a 1 ,a 2 ,a 3 ,…,a n )=softmax(v*h 1 ,v*h 2 ,v*h 3 ,…,v*h n )
wherein v represents a hidden factor vector, h n Representing the nth first semantic vector in a sentence via a depth networkFeature vector, a, of top level output n Representing the normalized attention weight corresponding to the nth first semantic vector.
5. The method for identifying an intention of a hidden factor based attention mechanism as recited in claim 1, wherein said weighted averaging of said feature vector and said attention weight to obtain a weighted average vector comprises:
and carrying out weighted average on the corpus feature coding vector and the attention weight by using the following weighted average formula to obtain a weighted average vector:
V s =a 1 *h 1 +a 2 *h 2 +…+a n *h n
wherein V is s A for the weighted average vector n Represents the normalized attention weight, h, corresponding to the nth first semantic vector n Representing feature vectors of the nth first semantic vector output via the top layer of the depth network.
6. The hidden factor based attention mechanism intent recognition method of any one of claims 1 to 5, wherein the inputting the weighted average vector into a preset intent classifier results in an intent recognition probability, comprising:
inputting the weighted average vector into the intention classifier to classify, so as to obtain intention distribution;
the intent recognition probability is determined from the intent distribution.
7. The hidden factor based attention mechanism intent recognition method of claim 6, wherein the determining the intent recognition probability from the intent distribution comprises:
extracting intent semantics in the intent distribution;
calculating the matching degree of the intention semantics and the intention semantics in a preset intention database;
and taking the matching degree as the intention recognition probability.
8. An attention mechanism intent recognition device based on hidden factors, the device comprising:
the corpus vector conversion module is used for obtaining preset user corpus and carrying out vector conversion on the user corpus to obtain corpus vectors;
the corpus vector decomposition module is used for decomposing the corpus vector to obtain a hidden factor vector and a first corpus vector;
the vector coding module is used for carrying out feature coding on the first corpus vector by utilizing a preset depth network to obtain a corpus vector space, and extracting a feature vector corresponding to the first corpus vector in the corpus vector space;
the weighted average vector calculation module is used for inputting the hidden factor vector and the feature vector into a preset attention model to obtain attention weights, and carrying out weighted average on the feature vector and the attention weights to obtain a weighted average vector;
the user intention determining module is used for inputting the weighted average vector into a preset intention classifier to obtain intention recognition probability, and determining that the weighted average vector with the intention recognition probability being greater than or equal to a preset threshold value is the intention corresponding to the user corpus.
9. An electronic device, the electronic device comprising:
at least one processor; the method comprises the steps of,
a memory communicatively coupled to the at least one processor; wherein, the liquid crystal display device comprises a liquid crystal display device,
the memory stores a computer program executable by the at least one processor to enable the at least one processor to perform the hidden factor based attention mechanism intent recognition method as recited in any one of claims 1 to 7.
10. A computer readable storage medium storing a computer program, wherein the computer program when executed by a processor implements the hidden factor based attention mechanism intent recognition method as claimed in any of claims 1 to 7.
CN202310418264.8A 2023-04-12 2023-04-12 Hidden factor-based attention mechanism intention recognition method, device, equipment and medium Pending CN116431811A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310418264.8A CN116431811A (en) 2023-04-12 2023-04-12 Hidden factor-based attention mechanism intention recognition method, device, equipment and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310418264.8A CN116431811A (en) 2023-04-12 2023-04-12 Hidden factor-based attention mechanism intention recognition method, device, equipment and medium

Publications (1)

Publication Number Publication Date
CN116431811A true CN116431811A (en) 2023-07-14

Family

ID=87083904

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310418264.8A Pending CN116431811A (en) 2023-04-12 2023-04-12 Hidden factor-based attention mechanism intention recognition method, device, equipment and medium

Country Status (1)

Country Link
CN (1) CN116431811A (en)

Similar Documents

Publication Publication Date Title
CN114822812A (en) Character dialogue simulation method, device, equipment and storage medium
CN113378970B (en) Sentence similarity detection method and device, electronic equipment and storage medium
CN113704410B (en) Mood wave detection method and device, electronic equipment and storage medium
CN113807973B (en) Text error correction method, apparatus, electronic device and computer readable storage medium
CN113722483B (en) Topic classification method, device, equipment and storage medium
CN115238670B (en) Information text extraction method, device, equipment and storage medium
CN114840684A (en) Map construction method, device and equipment based on medical entity and storage medium
CN116665878A (en) Intelligent inquiry method, device, equipment and storage medium for improving accumulated errors
CN116383766A (en) Auxiliary diagnosis method, device, equipment and storage medium based on multi-mode data
CN116450829A (en) Medical text classification method, device, equipment and medium
CN116719920A (en) Dynamic sampling dialogue generation model training method, device, equipment and medium
CN116701574A (en) Text semantic similarity calculation method, device, equipment and storage medium
CN116468025A (en) Electronic medical record structuring method and device, electronic equipment and storage medium
CN116522944A (en) Picture generation method, device, equipment and medium based on multi-head attention
CN116341646A (en) Pretraining method and device of Bert model, electronic equipment and storage medium
CN114548114B (en) Text emotion recognition method, device, equipment and storage medium
WO2023173554A1 (en) Inappropriate agent language identification method and apparatus, electronic device and storage medium
CN116431811A (en) Hidden factor-based attention mechanism intention recognition method, device, equipment and medium
CN114880449B (en) Method and device for generating answers of intelligent questions and answers, electronic equipment and storage medium
CN116720513A (en) Method, device, equipment and storage medium for identifying inquiry intention
CN116431810A (en) Pruning paradigm disorder segment extraction method, device, equipment and storage medium
CN116663503A (en) Sentence error correction method, device, equipment and medium based on self-attention weight graph
CN116702761A (en) Text error correction method, device, equipment and storage medium
CN116913553A (en) Method, device, equipment and storage medium for acquiring symptoms of patients in intelligent inquiry
CN116825391A (en) Method, device, equipment and storage medium for question and answer sorting model

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination