Statement recognition method and device, electronic equipment, storage medium and program product
By inserting multiple marker bits into the statement and utilizing cross-attention enhancement processing, the problem of incomplete intent understanding in traditional statement recognition methods is solved, achieving more accurate and comprehensive intent recognition and improving user experience.
Patent Information
- Application Number
- CN202511041224.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-28
- Publication Date
- 2025-11-11
AI Technical Summary
Traditional sentence recognition methods identify user intent through keyword matching and preset rules, which leads to incomplete understanding of intent and inaccurate intent recognition, thus affecting user experience.
By inserting multiple marker bits into the sentence, including intent classification marker bits, sentence end marker bits, and other attribute marker bits, multiple recognition results are generated using cross-attention enhancement processing. The results are then combined with the mutual enhancement between different marker bits to achieve comprehensive recognition.
It improves the accuracy and comprehensiveness of intent recognition, thus enhancing the user experience.
Smart Images

Figure CN120930656A_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of natural language processing technology, and in particular to a sentence recognition method, apparatus, electronic device, storage medium, and program product. Background Technology
[0002] Sentence recognition is an important task in Natural Language Processing (NLP), aiming to understand, classify, or parse complete input sentences to accurately identify their semantics, intent, sentiment, and other information. Sentence recognition is widely used in voice assistants, intelligent customer service, machine translation, information retrieval, and other fields.
[0003] Taking film and television material retrieval as an example, typically, the user inputs a search query, then performs natural language processing on the query to determine the user's search intent, and then retrieves film and television materials that match the search intent from the database based on the search intent.
[0004] However, traditional sentence recognition methods often rely on keyword matching and preset rules to identify user intent, which may lead to incomplete understanding of intent, inaccurate intent recognition, failure to identify the user's true intent, and negatively impact user experience. Summary of the Invention
[0005] To solve the above-mentioned technical problems, or at least partially solve them, this disclosure provides a statement recognition method, apparatus, electronic device, storage medium, and program product.
[0006] A first aspect of this disclosure provides a sentence recognition method, the method comprising: acquiring a sentence to be recognized; performing word segmentation on the sentence to be recognized to obtain multiple words included in the sentence to be recognized; inserting multiple marker bits into the multiple words to obtain target sentence features, the multiple marker bits including an intent classification marker bit, a sentence end marker bit, and at least one target marker bit for indicating other attributes of the sentence to be recognized; encoding the target sentence features to obtain multiple first vectors, the multiple first vectors being used to indicate context representations learned from the multiple words that respectively match the multiple marker bits; performing cross-attention enhancement processing on the multiple first vectors to obtain multiple second vectors, one second vector being enhanced by other first vectors based on a corresponding first vector; and decoding the multiple second vectors to generate multiple recognition results matching the sentence to be recognized, the multiple recognition results including an intent classification result matching the intent classification marker bit, and at least one recognition result respectively matching the at least one target marker bit.
[0007] In some embodiments of this disclosure, the cross-attention enhancement processing of the plurality of first vectors to obtain a plurality of second vectors includes: performing the following operations for each first vector to obtain a plurality of second vectors; weighting the at least one third vector based on the enhancement weights corresponding to at least one third vector to obtain a target enhancement vector corresponding to the target first vector, wherein the at least one third vector is a first vector other than the target first vector among the plurality of first vectors, and the target first vector is any one of the plurality of first vectors, and the enhancement weight is used to indicate the enhancement effect of a third vector on the target first vector; and determining the weighted sum of the target first vector and the target enhancement vector as the second vector corresponding to the target first vector, wherein the weight of the target first vector is 1.
[0008] In some embodiments of this disclosure, the process of weighting the at least one third vector based on the enhancement weights corresponding to the at least one third vector to obtain the target enhancement vector corresponding to the target first vector includes: weighting at least one fourth vector corresponding to the at least one third vector based on the enhancement weights corresponding to the at least one third vector to obtain the target enhancement vector, wherein a fourth vector is the product of a learnable transformation matrix corresponding to a third vector and the third vector.
[0009] In some embodiments of this disclosure, the weighted weight of the target enhancement vector is used to indicate the degree of influence of the at least one third vector on the target first vector, and the weighted weight of the target enhancement vector is different for different first vectors.
[0010] In some embodiments of this disclosure, the enhanced weight includes any one of the following: a preset weight corresponding to the third vector; an attention weight based on an attention mechanism; or the product of the preset weight corresponding to the third vector and the attention weight based on an attention mechanism.
[0011] In some embodiments of this disclosure, when the at least one target marker includes a first target marker for identifying keywords and sentence structures representing intent in the statement to be identified, the intent classification result is a first-dimensional classification result, and the identification result corresponding to the first target marker is a second-dimensional classification result, the first-dimensional classification result including the second-dimensional classification result; when the at least one target marker includes a second target marker for identifying keywords representing entities and entity description information in the statement to be identified, the identification result corresponding to the second target marker is an entity type prediction result and an entity boundary prediction result; when the at least one target marker includes a third target marker for identifying keywords representing emotions and the mode of emotion expression in the statement to be identified, the identification result corresponding to the third target marker is an emotion polarity classification result and an emotion intensity prediction result, the emotion polarity classification result being used to indicate the positive emotion of the statement to be identified. The degree of the emotional intensity prediction result is used to indicate the emotional intensity level of the statement to be identified; when at least one target label bit includes a fourth target label bit for identifying keywords representing time and the urgency information of time in the statement to be identified, the identification result corresponding to the fourth target label bit is the urgency classification result; when at least one target label bit includes a fifth target label bit for identifying the structural complexity and professional terminology information of the statement to be identified, the identification result corresponding to the fifth target label bit is the complexity classification result and the professional assessment result, the complexity classification result is used to indicate the structural complexity level of the statement to be identified, and the professional assessment result is used to indicate the professional terminology level of the statement to be identified; after decoding the multiple second vectors to generate multiple identification results matching the statement to be identified, the method further includes: generating a target classification result based on the first dimension classification result and the second dimension classification result.
[0012] In some embodiments of this disclosure, after decoding the plurality of second vectors to generate a plurality of recognition results matching the statement to be recognized, the method further includes: integrating the plurality of recognition results to generate a target recognition result and a confidence level of the target recognition result, wherein the confidence level is used to indicate the recognition accuracy of the target recognition result.
[0013] A second aspect of this disclosure provides a sentence recognition apparatus, comprising: an acquisition module for acquiring a sentence to be recognized; a processing module for performing word segmentation on the sentence to be recognized to obtain multiple words included in the sentence to be recognized; inserting multiple marker bits into the multiple words to obtain target sentence features, the multiple marker bits including an intent classification marker bit, a sentence end marker bit, and at least one target marker bit for indicating other attributes of the sentence to be recognized; encoding the target sentence features to obtain multiple first vectors, the multiple first vectors being used to indicate context representations learned from the multiple words that respectively match the multiple marker bits; performing cross-attention enhancement processing on the multiple first vectors to obtain multiple second vectors, one second vector being enhanced by other first vectors based on a corresponding first vector; and a generation module for performing decoding processing on the multiple second vectors to generate multiple recognition results matching the sentence to be recognized, the multiple recognition results including an intent classification result matching the intent classification marker bit, and at least one recognition result respectively matching the at least one target marker bit.
[0014] In some embodiments of this disclosure, the processing module is specifically configured to perform the following operations for each first vector to obtain a plurality of second vectors; based on the enhancement weights corresponding to at least one third vector, weight the at least one third vector to obtain a target enhancement vector corresponding to the target first vector, wherein the at least one third vector is a first vector other than the target first vector among the plurality of first vectors, and the target first vector is any one of the plurality of first vectors, and the enhancement weight is used to indicate the enhancement effect of a third vector on the target first vector; and determine the weighted sum of the target first vector and the target enhancement vector as the second vector corresponding to the target first vector, wherein the weight of the target first vector is 1.
[0015] In some embodiments of this disclosure, the processing module is specifically used to weight at least one fourth vector corresponding to each of the at least one third vector based on the enhancement weights corresponding to the at least one third vector, to obtain the target enhancement vector, wherein a fourth vector is the product of a learnable transformation matrix corresponding to a third vector and the third vector.
[0016] In some embodiments of this disclosure, the weighted weight of the target enhancement vector is used to indicate the degree of influence of the at least one third vector on the target first vector, and the weighted weight of the target enhancement vector is different for different first vectors.
[0017] In some embodiments of this disclosure, the enhanced weight includes any one of the following: a preset weight corresponding to the third vector; an attention weight based on an attention mechanism; or the product of the preset weight corresponding to the third vector and the attention weight based on an attention mechanism.
[0018] In some embodiments of this disclosure, when the at least one target marker includes a first target marker for identifying keywords and sentence patterns representing intent in the statement to be identified, the intent classification result is a first-dimensional classification result, and the identification result corresponding to the first target marker is a second-dimensional classification result, the first-dimensional classification result including the second-dimensional classification result; when the at least one target marker includes a second target marker for identifying keywords representing entities and entity description information in the statement to be identified, the identification result corresponding to the second target marker is an entity type prediction result and an entity boundary prediction result; when the at least one target marker includes a third target marker for identifying keywords representing emotions and the mode of emotion expression in the statement to be identified, the identification result corresponding to the third target marker is an emotion polarity classification result and an emotion intensity prediction result, the emotion polarity classification result being used to indicate the degree of emotional positivity of the statement to be identified. The emotional intensity prediction result is used to indicate the emotional intensity level of the statement to be identified. When at least one target marker includes a fourth target marker for identifying keywords representing time and the urgency of time in the statement to be identified, the identification result corresponding to the fourth target marker is an urgency classification result. When at least one target marker includes a fifth target marker for identifying the structural complexity and technical terminology information of the statement to be identified, the identification result corresponding to the fifth target marker is a complexity classification result and a technicality assessment result. The complexity classification result indicates the structural complexity level of the statement to be identified, and the technicality assessment result indicates the technical terminology level of the statement to be identified. The generation module is further configured to, after decoding the multiple second vectors to generate multiple identification results matching the statement to be identified, generate a target classification result based on the first dimension classification result and the second dimension classification result.
[0019] In some embodiments of this disclosure, the generation module is further configured to, after decoding the plurality of second vectors and generating a plurality of recognition results that match the statement to be recognized, integrate the plurality of recognition results to generate a target recognition result and a confidence level of the target recognition result, wherein the confidence level is used to indicate the recognition accuracy of the target recognition result.
[0020] A third aspect of this disclosure provides an electronic device including a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the statement recognition method as described in the first aspect.
[0021] A fourth aspect of this disclosure provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the statement recognition method as described in the first aspect.
[0022] A fifth aspect of this disclosure provides a computer program product, wherein the computer program product includes a computer program that, when the computer program product is run on a processor, causes the processor to execute the computer program to implement the statement recognition method as described in the first aspect.
[0023] A sixth aspect of this disclosure provides a chip including a processor and a communication interface coupled to the processor, the processor being used to execute program instructions to implement the statement recognition method as described in the first aspect.
[0024] The technical solution provided in this disclosure has the following advantages compared with the prior art: It obtains a sentence to be identified; performs word segmentation on the sentence to be identified to obtain multiple words included in the sentence to be identified; inserts multiple marker bits into the multiple words to obtain target sentence features, the multiple marker bits including an intent classification marker bit, a sentence end marker bit, and at least one target marker bit used to indicate other attributes of the sentence to be identified; encodes the target sentence features to obtain multiple first vectors, the multiple first vectors being used to indicate context representations learned from the multiple words that respectively match the multiple marker bits; performs cross-attention enhancement processing on the multiple first vectors to obtain multiple second vectors, one second vector being enhanced by other first vectors based on a corresponding first vector; and decodes the multiple second vectors to generate multiple recognition results matching the sentence to be identified, the multiple recognition results including an intent classification result matching the intent classification marker bit, and at least one recognition result matching the at least one target marker bit respectively. Thus, in this embodiment of the disclosure, by adding target markers other than intent classification markers and sentence end markers, recognizing the sentence to be recognized based on multiple markers, and by enhancing each other between different markers, not only can the information of the corresponding marker itself be recognized from the sentence to be recognized, but also the auxiliary information of other markers for that marker can be recognized. Therefore, by understanding and recognizing the sentence to be recognized from different aspects and the interaction between different aspects, the recognition result can be more comprehensive and accurate, the accuracy of intent recognition can be improved, and the user experience can be improved. Attached Figure Description
[0025] The accompanying drawings, which are incorporated in and form a part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure.
[0026] To more clearly illustrate the technical solutions in the embodiments of this disclosure or the prior art, the accompanying drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0027] Figure 1 A flowchart illustrating a sentence recognition method provided in an embodiment of this disclosure;
[0028] Figure 2 A structural block diagram of a sentence recognition device provided in an embodiment of this disclosure;
[0029] Figure 3 This is a structural block diagram of an electronic device provided in an embodiment of the present disclosure. Detailed Implementation
[0030] To better understand the above-mentioned objectives, features, and advantages of this disclosure, the solutions disclosed herein will be further described below. It should be noted that, unless otherwise specified, the embodiments and features described herein can be combined with each other.
[0031] Numerous specific details are set forth in the following description in order to provide a full understanding of this disclosure, but this disclosure may also be implemented in other ways different from those described herein; obviously, the embodiments in the specification are only some, and not all, of the embodiments of this disclosure.
[0032] The terms "first," "second," etc., used in this disclosure and in the claims are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such use of data can be interchanged where appropriate so that embodiments of this disclosure can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first," "second," etc., are generally of the same class and the number of objects is not limited; for example, a first object can be one or more. Furthermore, in the specification and claims, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.
[0033] The following section will first explain some of the terms or terms used in the claims and description of the embodiments disclosed herein.
[0034] Word segmentation: The sentence to be recognized is divided into a sequence of sub-words using a word segmenter.
[0035] This disclosure relates to the fields of artificial intelligence and natural language processing, and can be particularly applied to voice assistants, intelligent customer service, machine translation, and information retrieval. Taking the field of film and television film retrieval as an example, the method provided in this disclosure is applied to the intent understanding stage of the search statement (the statement to be identified) in the field of film and television film retrieval. The background, current status, and existing fields of statement recognition are introduced below.
[0036] In the film and television production process, screenwriters, directors, and creative personnel often need to search through a large amount of film and television materials, historical works, and creative knowledge to gain inspiration or reference. Regarding the user intent understanding stage in film and television material retrieval question-and-answer systems, traditional systems often struggle to accurately understand the user's true intent, leading to inaccurate search results and impacting creative efficiency.
[0037] Currently, film and television film retrieval question-answering systems mainly employ the following technologies: rule-based intent classification, which identifies user intent through keyword matching and preset rules; single-task deep learning models, such as BERT and RoBERTa pre-trained models, for intent classification; and pipelined multi-stage processing, which first performs intent classification, then entity recognition, and finally retrieval or question answering, with each stage being independent of the others.
[0038] The existing problems and causes of the aforementioned film and television material retrieval question-answering system are as follows: Incomplete intent understanding, focusing only on a single dimension of intent classification while ignoring auxiliary information such as user sentiment and question complexity, leading to a one-sided understanding; Information silos between tasks, with intent classification, entity recognition, and sentiment analysis performed independently, failing to effectively share and complement information; Lack of hierarchical understanding, unable to simultaneously handle coarse-grained and fine-grained intent classification, resulting in insufficient classification accuracy; Low resource utilization efficiency, with independent models trained for different tasks, resulting in wasted computational resources and high maintenance costs.
[0039] The electronic devices in this disclosure can be mobile electronic devices or non-mobile electronic devices. Mobile electronic devices can be mobile phones, tablets, laptops, PDAs, in-vehicle electronic devices, wearable devices, ultra-mobile personal computers (UMPCs), netbooks, or personal digital assistants (PDAs), etc.; non-mobile electronic devices can be personal computers (PCs), televisions (TVs), ATMs, or self-service machines, etc.; this disclosure does not impose specific limitations.
[0040] The execution subject of the statement recognition method provided in this disclosure can be the aforementioned electronic device (including mobile electronic devices and non-mobile electronic devices), or it can be a functional module and / or functional entity in the electronic device that can implement the statement recognition method. The specific implementation subject can be determined according to actual usage requirements, and this disclosure does not limit it.
[0041] The sentence recognition method provided in this disclosure will be described in detail below with reference to the accompanying drawings, through specific embodiments and application scenarios.
[0042] like Figure 1 As shown in the figure, this disclosure provides a statement recognition method, which may include the following steps 100 to 105.
[0043] 100. Obtain the statement to be recognized.
[0044] The statement to be recognized can be in the form of speech or text; there is no limitation here.
[0045] The statement to be identified can be an information retrieval statement, a question-and-answer statement, or other human-computer interaction statement.
[0046] 101. Perform word segmentation on the statement to be identified to obtain multiple words included in the statement.
[0047] 102. Insert multiple marker bits into the multiple word segments to obtain the target sentence features.
[0048] The plurality of markers includes an intent classification marker, a sentence end marker, and at least one target marker for indicating other attributes of the statement to be identified.
[0049] The intent classification marker is [CLS], and the sentence end marker is [SEP]. The target marker may include any of the following: keywords and sentence structures representing intent in the sentence to be identified (corresponding marker [INTENT]); keywords representing entities and entity descriptions in the sentence to be identified (corresponding marker [ENTITY]); keywords representing emotions and the way emotions are expressed in the sentence to be identified (corresponding marker [EMOTION]); keywords representing time and the urgency of time in the sentence to be identified (corresponding marker [URGENCY]); and structural complexity and technical terminology information in the sentence to be identified (corresponding marker [COMPLEXITY]).
[0050] The target flag bit may include one or more of [INTENT], [ENTITY], [EMOTION], [URGENCY], and [COMPLEXITY], and may also include other target flag bits, which are not limited here.
[0051] For example, the structure of the target statement features is as follows: [CLS] multiple segments of the statement to be identified [SEP][INTENT][ENTITY][EMOTION][URGENCY][COMPLEXITY].
[0052] The preprocessing process can be implemented through the input processing module, which can perform word segmentation on the query statement to obtain multiple words, insert special marker bits into the multiple words, and obtain the target statement features.
[0053] Before obtaining the characteristics of the target statement, other preprocessing can be performed, which is not limited here.
[0054] 103. Encode the features of the target statement to obtain multiple first vectors.
[0055] The plurality of first vectors are used to indicate the context representations that are respectively matched with the plurality of tag bits and learned from the plurality of word segments.
[0056] Step 103 can be understood as performing feature extraction on the statement to be identified based on multiple marker bits to obtain multiple first vectors.
[0057] The encoding process can be implemented through an encoding module, which is an encoder structure based on a pre-trained language model (such as BERT). The encoding module includes an initial representation generation submodule and a multi-layer self-attention encoding submodule.
[0058] The initial representation generation submodule includes: converting target sentence features into token IDs, that is, converting the token bits and word segments in the target sentence features into corresponding unique numeric identifiers; generating positional encodings for the token bits and word segments in the target sentence features, that is, generating positional encodings for each element (token bit or word segment) in the target sentence features, while preserving the order information of each element in the target sentence features; generating token type IDs for each element in the target sentence features, that is, generating type encodings for different types of token bits (ordinary text tokens, special task tokens), helping the model distinguish the functions of different token bits; and fusing the token IDs, positional encodings, and token type encodings to generate the initial representation.
[0059] Example 1, the sentence to be recognized is "Search for action movies directed by Zhang San", and the multiple word segments are "search / find / Zhang San / director / of / action / theme / movie". After inserting special markers, the target sentence feature is "[CLS]Search for action movies directed by Zhang San[SEP][INTENT][ENTITY][EMOTION][URGENCY][COMPLEXITY]", and the marker ID is "101([CLS])1398(search)2356(find)8964(Zhang San)3421(director)4638(of)5792(action)7845(theme)2134(movie)102([SEP])30522([INTENT])30523([ENTITY])30524([EMOTION])30525([URGENCY])30526([COMPLEXITY])", and the position encoding is "0 1 2 3 45 6 7 8 9 10 11 12 1314", and the marker type encoding is "1 0 0 0 0 0 0 0 0 2 3 4 5 6 7".
[0060] The multi-layer self-attention encoding sub-module processes the initial representation through the L-layer Transformer encoder to obtain multiple first vectors. Among them, each layer of the Transformer encoder includes: 1), a multi-head self-attention sub-layer, which is used to calculate the attention weights between all token positions and update the token representations; 2), a feed-forward neural network sub-layer, which is used to further transform the token representations; 3), residual connections and layer normalization, which are used to ensure the smooth transmission of information and the stability of training.
[0061] Among them, the output of the encoding module is the context representation of all tokens, especially the representations of each special token position, which respectively capture different aspects of information in the input text.
[0062] 104. Perform cross-attention enhancement processing on the multiple first vectors to obtain multiple second vectors.
[0063] Among them, one second vector is enhanced by other first vectors based on the corresponding first vector.
[0064] Among them, the cross-attention enhancement processing is implemented by the cross-task enhancement module. The learning of the sentence to be recognized based on one token position can be a learning task. The cross-task enhancement module is responsible for implementing the information interaction and complementary enhancement between different tasks corresponding to different token positions, and overcoming the task interference problem in traditional multi-task learning. The output of the cross-task enhancement module is the token position representations (i.e., multiple second vectors) that have been interacted and enhanced. These token position representations contain the information shared among multiple tasks, which helps to improve the performance of each task.
[0065] The cross-task enhancement module can include multiple cross-attention enhancement networks, each corresponding one-to-one with a set of first vectors. The multiple first vectors are input into the multiple cross-attention networks, and the outputs are multiple second vectors. For example, inputting the multiple first vectors into the cross-attention network corresponding to any one of the target first vectors will output the second vector corresponding to the target first vector.
[0066] The specific network structure of the cross-attention enhancement network is not limited in this embodiment.
[0067] 105. Decode the multiple second vectors to generate multiple recognition results that match the statement to be recognized.
[0068] The plurality of recognition results include an intent classification result that matches the intent classification tag bit, and at least one recognition result that matches the at least one target tag bit.
[0069] It is understandable that the most comprehensive and accurate recognition results for the sentence to be recognized can be obtained based on multiple recognition results.
[0070] In this embodiment of the disclosure, by adding target markers other than intent classification markers and sentence end markers, and recognizing the sentence to be recognized based on multiple markers, and by enhancing each other between different markers, not only the information of the corresponding marker itself can be recognized from the sentence to be recognized, but also the auxiliary information of other markers for that marker can be recognized. Thus, by understanding and recognizing the sentence to be recognized from different aspects and the interaction between different aspects, the recognition results can be more comprehensive and accurate, the accuracy of intent recognition can be improved, and the user experience can be improved.
[0071] In some embodiments of this disclosure, step 104 can be specifically implemented by step 104a.
[0072] 104a. Perform the following operations S1 and S2 on each first vector to obtain multiple second vectors.
[0073] S1. Based on the enhancement weights corresponding to at least one third vector, weight the at least one third vector to obtain the target enhancement vector corresponding to the target first vector.
[0074] Wherein, the at least one third vector is a first vector other than the target first vector among the plurality of first vectors, the target first vector is any one of the plurality of first vectors, and the enhancement weight is used to indicate the enhancement effect of a third vector on the target first vector.
[0075] The target enhancement vectors corresponding to different first vectors can be the same or different, and can be determined according to the actual situation. No restrictions are imposed here.
[0076] S2. The weighted sum of the first vector of the target and the enhanced vector of the target is determined as the second vector corresponding to the first vector of the target.
[0077] The weight of the first vector of the target is 1.
[0078] In this embodiment of the disclosure, the interaction and enhancement results between learning tasks corresponding to multiple marker bits can be obtained through the above step 104a.
[0079] In some embodiments of this disclosure, step S1 can be specifically implemented by the following S1a.
[0080] S1a. Based on the enhancement weights corresponding to the at least one third vector, weight the at least one fourth vector corresponding to the at least one third vector to obtain the target enhancement vector.
[0081] Here, a fourth vector is the product of the learnable transformation matrix corresponding to a third vector and that third vector.
[0082] In this embodiment of the disclosure, adding a learnable transformation matrix during the interactive task enhancement process can make the obtained multiple second vectors more accurate, thereby making the recognition result more accurate based on the multiple second vectors.
[0083] In some embodiments of this disclosure, the weighted weight of the target enhancement vector is used to indicate the degree of influence of the at least one third vector on the target first vector, and the weighted weight of the target enhancement vector is different for different first vectors.
[0084] Specifically, for different first vectors, the weighting of the target augmentation vector can be a preset value or a value that changes as the cross-task augmentation module is trained. For example, a progressive interaction strategy can be adopted to avoid the negative impact of unstable representations in the early stages. Specifically, in the early stages of training, the interaction strength between marker bits is reduced; as training progresses, the interaction strength is gradually increased so that each task can fully benefit from the information of other tasks.
[0085] In this embodiment of the disclosure, by adjusting the effect of other first vectors on the target first vector through the weighting of the target enhancement vector, a more accurate second vector corresponding to the target first vector can be obtained.
[0086] In some embodiments of this disclosure, the enhanced weight includes any one of the following: a preset weight corresponding to the third vector; an attention weight based on an attention mechanism; or the product of the preset weight corresponding to the third vector and the attention weight based on an attention mechanism.
[0087] Specifically, if the enhancement weight includes a preset weight corresponding to the third vector, the enhancement weight is said to be a preset fixed value used to indicate the fixed correlation (intrinsic connection and relevance) between different learning tasks; if the enhancement weight includes attention weight based on the attention mechanism, the enhancement weight is the correlation between different label positions obtained by learning multiple label positions based on the attention mechanism; if the enhancement weight includes the product of the preset weight corresponding to the third vector and the attention weight based on the attention mechanism, the enhancement weight is the product of the fixed correlation between different learning tasks and the correlation between different label positions obtained by learning multiple label positions based on the attention mechanism, thus obtaining a more accurate correlation between different label positions.
[0088] Among these, a special attention layer can be designed based on the tag-bit interaction mechanism, enabling different tags to directly exchange information, and the attention weight matrix A between the tags can be calculated, where A... ij Let represent the attention weight of tag j to tag i, where i = 1, 2, ..., n, j = 1, 2, ..., n, and n is the number of tags.
[0089] Users can pre-design a task relevance matrix R based on the inherent connections between learning tasks to guide the interaction process of the labeled bits. ij This represents the preset weight of tag j relative to tag i. For example, intent classification is highly correlated with entity recognition, therefore the interaction weight between [CLS] and [ENTITY] is high, and the interaction weight between [INTENT] and [ENTITY] is also high.
[0090] Therefore, the enhancement weight is A. ij , or R ij , or A -ij =A ij R ij .
[0091] This disclosure provides various scenarios for enhancing weights, allowing for the determination of accurate enhancement weights based on actual usage requirements. By designing enhancement weights, the markers for different tasks can influence and enhance each other, overcoming the task interference problem in traditional multi-task learning.
[0092] Example 2, the second vector corresponding to the first target vector is finally represented as: Among them, W j It is a learnable transformation matrix, hi h is the encoded tag bit representation (i.e., the target first vector). i 'A represents the enhanced flag bit representation (i.e., the second vector corresponding to the first target vector),' -ij To enhance weight, The target enhancement vector, where ω is the weighting weight of the target enhancement vector.
[0093] It should be noted that, in this embodiment of the disclosure, the target augmentation vector may include the product of the target first vector itself and the augmentation weights corresponding to the target first vector (which may be 0, 1, or other values). For example, the target augmentation vector in Example 2 is... The target augmentation vector may also exclude the product of the target first vector itself and the augmentation weights corresponding to the target first vector. For example, the target augmentation vector in Example 2 should be replaced with... The specifics can be determined based on the actual situation; no restrictions are imposed here.
[0094] In this embodiment, a special attention mechanism and gating information fusion mechanism are designed to achieve information interaction and complementary enhancement between different tasks. This overcomes the task interference problem in traditional multi-task learning, enabling each task to benefit from the others.
[0095] In some embodiments of this disclosure, when the at least one target marker bit includes a first target marker bit for identifying keywords and sentence patterns that characterize intent in the statement to be identified, the intent classification result is a first-dimensional classification result, the identification result corresponding to the first target marker bit is a second-dimensional classification result, and the first-dimensional classification result includes the second-dimensional classification result.
[0096] The first dimension classification result can be understood as a coarse-grained classification result, and the second dimension classification result can be understood as a fine-grained classification result.
[0097] In this embodiment of the disclosure, the first-dimensional classification result and the second-dimensional classification result of the statement to be identified are obtained through the intent classification marker bit ([CLS]) and the first target marker bit ([INTENT]), which can improve the classification accuracy and make the intent classification more accurate and comprehensive.
[0098] In some embodiments of this disclosure, after step 104 described above, the statement recognition method provided by the embodiments of this disclosure may further include step 106 as described below.
[0099] 106. Based on the first dimension classification result and the second dimension classification result, generate the target classification result.
[0100] In this embodiment of the disclosure, a final classification result is generated based on the first-dimensional classification result and the second-dimensional classification result, thereby realizing hierarchical intent classification. By utilizing the synergistic effect of different marker bits, hierarchical intent understanding from the first dimension to the second dimension is achieved, improving classification accuracy and flexibility.
[0101] In this embodiment, by utilizing the two marker bits [CLS] and [INTENT] to work together, they are responsible for the first and second dimensions of intent classification, respectively. A special fusion mechanism is used to integrate the two-level classification results, which improves the accuracy and flexibility of intent classification, and significantly enhances the ability to recognize complex intents.
[0102] In some embodiments of this disclosure, when the at least one target marker bit includes a second target marker bit for identifying keywords representing entities and entity description information in the statement to be identified, the identification result corresponding to the second target marker bit is an entity type prediction result and an entity boundary prediction result.
[0103] In this embodiment, the first-dimensional classification result, entity type prediction result, and entity boundary prediction result of the statement to be identified are obtained through the intent classification marker ([CLS]) and the second target marker ([ENTITY]). By combining intent classification with entity recognition, the accuracy of statement recognition is improved based on the interaction between intent classification and entity recognition. The key entities in the query are identified through the [ENTITY] marker, and the entity information is used to enhance the intent classification process in reverse through the cross-task enhancement module. This solves the problem of interdependence between intent and entity, and improves the context sensitivity of intent classification, especially for entity-intensive queries.
[0104] In some embodiments of this disclosure, when the at least one target marker includes a third target marker for identifying keywords representing emotions and the mode of emotion expression in the statement to be identified, the identification result corresponding to the third target marker is an emotion polarity classification result and an emotion intensity prediction result. The emotion polarity classification result is used to indicate the positiveness of the emotion of the statement to be identified, and the emotion intensity prediction result is used to indicate the emotion intensity level of the statement to be identified.
[0105] In this embodiment of the disclosure, the first dimension classification result, the sentiment polarity classification result, and the sentiment intensity prediction result of the sentence to be identified are obtained by using the intent classification marker bit ([CLS]) and the third target marker bit ([EMOTION]). By combining intent classification and sentiment recognition, the accuracy of sentence recognition is improved based on the interaction between intent classification and sentiment recognition.
[0106] In some embodiments of this disclosure, when the at least one target marker bit includes a fourth target marker bit for identifying keywords representing time and information on the urgency of time in the statement to be identified, the identification result corresponding to the fourth target marker bit is the urgency classification result.
[0107] In this embodiment of the disclosure, the first dimension classification result and urgency classification result of the statement to be identified are obtained by using the intent classification marker bit ([CLS]) and the fourth target marker bit ([URGENCY]). By combining intent classification and urgency classification, the accuracy of statement recognition is improved based on the interaction between intent classification and urgency classification.
[0108] In this embodiment of the disclosure, by introducing [EMOTION] and [URGENCY] flags, the system analyzes the user's emotional state and the urgency of the query as auxiliary decision-making information, enabling the system to adjust its response strategy based on the user's emotions and the urgency of the need.
[0109] In some embodiments of this disclosure, when the at least one target marker includes a fifth target marker for identifying the structural complexity and terminology information of the statement to be identified, the identification result corresponding to the fifth target marker is a complexity classification result and a professionalism assessment result. The complexity classification result is used to indicate the structural complexity level of the statement to be identified, and the professionalism assessment result is used to indicate the level of professionalism of the statement to be identified.
[0110] In this embodiment, the first-dimensional classification result, complexity classification result, and professionalism evaluation result of the statement to be identified are obtained through the intent classification marker ([CLS]) and the fifth target marker ([COMPLEXITY]). By combining intent classification with complexity and professionalism classification, and based on the interaction between intent classification and complexity and professionalism classification, the accuracy of statement recognition is improved. The query complexity is evaluated through the [COMPLEXITY] marker, which guides the system to select processing paths, achieving efficient utilization of computing resources, fast response for simple queries, and more accurate results for complex queries.
[0111] In some embodiments of this disclosure, different task-specific header modules can be set to decode different second vectors and obtain corresponding recognition results.
[0112] The task-specific header module equips each special label with a dedicated classification or prediction header, converting the label representation into the output specific to the task. The implementation is as follows:
[0113] (1) Intent classification header: Process the [CLS] and [INTENT] flag bits to implement hierarchical intent classification.
[0114] 1) First-dimensional classification results: Based on the [CLS] representation, predict the main intent category (such as general question answering, retrieval question answering, material recommendation, etc.).
[0115] 2) Second dimension classification results: Based on the [INTENT] representation, predict the specific intent subcategory.
[0116] 3) Post-processing hierarchical fusion: Combine the first-dimensional classification results and the second-dimensional classification results to generate the final intent prediction.
[0117] (2) Entity identification head: Processes the [ENTITY] flag to identify key entities in the query.
[0118] 1) Entity type prediction results: Predict the entity types that may be included in the query (such as movie name, director name, character name, etc.).
[0119] 2) Entity boundary prediction results: Predict the start and end positions of entities in the text.
[0120] (3) Sentiment Analysis Header: Processes the [EMOTION] flag to analyze the user's emotional state.
[0121] 1) Emotional polarity classification results: predicts whether the emotion is positive, negative, or neutral.
[0122] 2) Emotion intensity prediction results: Predict the intensity level of emotion.
[0123] (4) Urgency assessment header: The [URGENCY] flag indicates the urgency of the query.
[0124] Urgency classification results: Queries are classified into three levels of urgency: high, medium, and low.
[0125] (5) Complexity evaluation header: Process the [COMPLEXITY] flag to evaluate the complexity of the query.
[0126] 1) Complexity classification results: Queries are classified into three levels: simple, medium, and complex.
[0127] 2) Professionalism assessment results: assess the level of professional knowledge involved in the query.
[0128] Each task header typically consists of one or more fully connected layers, and depending on the nature of the task, it may also include activation functions (such as Softmax, Sigmoid, etc.) and normalization layers.
[0129] In this embodiment, by expanding the way the pre-trained model uses its marker bits, multiple dedicated marker bits ([CLS], [INTENT], [ENTITY], [EMOTION], [URGENCY], [COMPLEXITY]) are introduced, each responsible for a specific task. This achieves effective capture and representation of multi-task information, overcomes the bottleneck problem of traditional single [CLS] marker bit information, and improves the model's ability to understand multiple features of the query.
[0130] In some embodiments of this disclosure, after step 104 described above, the statement recognition method provided by the embodiments of this disclosure may further include step 107 as described below.
[0131] 107. Integrate the multiple recognition results to generate the target recognition result and the confidence level of the target recognition result.
[0132] The confidence level is used to indicate the accuracy of the target identification result.
[0133] The integration process can be implemented by the output integration module, which is responsible for integrating the prediction results of each task into a unified output, providing comprehensive information for downstream tasks based on the recognition results (such as downstream retrieval tasks in the field of film and television film retrieval based on the recognition results).
[0134] The steps for calculating the confidence level of the target recognition result may include:
[0135] Step 1: Obtain the confidence level for each individual task.
[0136] The confidence level for each task is derived from the output of the classification layer in the "task-specific header".
[0137] For example, after using the Softmax activation function, the model outputs a probability value for each possible class, which is the confidence level of the prediction. This can be understood as the output of a task-specific head when predicting the corresponding class being a probability distribution after passing through the Softmax function.
[0138] For example: the intent classification head is defined as the intent task, the entity classification head as the entity task, and the sentiment analysis head, urgency assessment head, and complexity assessment head as auxiliary tasks. For the intent task, for the [CLS] marker, the model outputs probabilities of three types: ordinary question answering, retrieval question answering, and material recommendation, respectively, with probabilities of 0.1, 0.8, and 0.1. Therefore, the first dimension classification result is "retrieval question answering," with a confidence score of 0.8. Similarly, the probability value of the second dimension classification result corresponding to the [INTENT] marker is the confidence score (assumed to be 0.92). The average of the confidence scores corresponding to the [CLS] marker and the [INTENT] marker is recorded as the confidence score corresponding to the intent task. For the entity task, for the [ENTITY] marker, for each identified entity, its confidence score is a combined result (e.g., a weighted result) of the entity type prediction result and the entity boundary prediction result. To simplify implementation, the probability of the entity type prediction result can be directly used as the confidence score. If multiple entities are identified, the average confidence score of all entities is calculated to obtain the average entity confidence score, which is the confidence score corresponding to the entity identification head. Similarly, for the auxiliary task, the confidence scores of the predicted categories are obtained from the sentiment analysis head, urgency assessment head, and complexity assessment head, and their average scores are calculated to obtain the average auxiliary task confidence score, which is the confidence score corresponding to the auxiliary task.
[0139] Step 2: Set the task importance weights.
[0140] Considering the varying importance of different tasks for query understanding, the system pre-defines a set of weight parameters for weighted summation. Typically, core tasks (such as intent and entity tasks) have greater weight than auxiliary tasks. These weights are hyperparameters pre-set based on experience and do not require training.
[0141] For example, the weight of the intent task is 0.5, the weight of the entity task is 0.3, and the weight of the auxiliary task is 0.2 (the sum of the weights should be 1).
[0142] Step 3: Calculate the overall confidence level (i.e., the confidence level of the target recognition result) using a weighted average.
[0143] The overall confidence level is calculated by weighted averaging of the confidence levels of each task.
[0144] For example, the output integration module is only used during inference and does not require training. The specific implementation steps are as follows:
[0145] (1) Intent decision integration: Combine the first dimension classification results and the second dimension classification results to generate the final intent decision.
[0146] (2) Entity information integration: Integrate the identified entities to form a structured query understanding.
[0147] (3) Integration of auxiliary information: The results of the emotion, urgency and complexity assessments are used as auxiliary information to guide subsequent processing.
[0148] (4) Confidence assessment: Calculate the overall confidence level for the integrated output to help the system decide whether further clarification or confirmation is needed.
[0149] Example 3, combined with Example 1, is the following output after integration:
[0150] {
[0151] "intent":{"main":"Search Q&A","sub":"Director's Works Search","confidence":0.92},
[0152] "entities":[{"text":"Zhang San","type":"Director","confidence":0.95},
[0153]
[0154] When the confidence level is low, the statement to be identified can be re-identified or further identified to correct the identification result until a higher confidence level is output.
[0155] In this embodiment of the disclosure, the most accurate, comprehensive and concise target recognition result can be output to the user through integrated processing, and the confidence level of the target recognition result can be output, and the recognition accuracy can be determined based on the confidence level.
[0156] In some embodiments of this disclosure, downstream tasks such as information retrieval or command control can be performed based on multiple identification results or target identification results obtained from the identification, which is not limited here.
[0157] In this embodiment, the statement to be identified can be recognized using a statement recognition model. This model may include an input processing module, an encoding module, a cross-task enhancement module, a task-specific header module, and an output integration module. These modules work collaboratively to achieve a comprehensive understanding and accurate response to user queries.
[0158] This disclosure aims to address issues in sentence recognition such as incomplete intent understanding, information silos between tasks, lack of hierarchical understanding, and low resource utilization efficiency. The method innovatively expands the way pre-trained models like BERT use their marker bits, with each marker bit responsible for a specific task, and information exchange is achieved through sharing the underlying representation. Furthermore, it proposes a cross-task attention enhancement mechanism, which, through the design of a special attention layer and gating mechanism, enables marker bits from different tasks to directly exchange information, overcoming the problem of task interference.
[0159] The innovation of this embodiment lies in the organic integration of multiple NLP tasks (intent classification, entity recognition, sentiment analysis, etc.) through a multi-label mechanism, forming an end-to-end joint learning framework. This overcomes the problems of task fragmentation and information silos in traditional methods, significantly improving intent understanding capabilities in the field of sentence recognition. By expanding the way pre-trained language models use labels, a multi-task joint learning framework is constructed to achieve comprehensive intent understanding in the field of sentence recognition. Traditional pre-trained models such as BERT typically only use the [CLS] label for classification tasks. This embodiment innovatively introduces multiple dedicated labels, each responsible for a specific task, and achieves information interaction and enhancement between tasks through shared underlying representations and attention mechanisms.
[0160] In this embodiment of the disclosure, in the field of film and television creation, it can help screenwriters, directors and other creators quickly and accurately retrieve the required film and television materials on the film and television knowledge base, thereby improving creative efficiency; by accurately understanding the complex intentions of creators, it can recommend relevant reference works, creative techniques and inspirational materials to promote the production of high-quality content; and by optimizing the professional terminology and knowledge in the film and television field, it can enable the system to understand industry-specific expressions and improve the professional user experience.
[0161] Figure 2 This is a structural block diagram of a sentence recognition device according to an embodiment of the present disclosure, such as... Figure 2 As shown, it includes:
[0162] The acquisition module 201 is used to acquire the statement to be recognized; the processing module 202 is used to perform word segmentation processing on the statement to be recognized to obtain multiple words included in the statement to be recognized; insert multiple marker bits into the multiple words to obtain target statement features, the multiple marker bits including intent classification marker bits, sentence end marker bits and at least one target marker bit used to indicate other attributes of the statement to be recognized; encode the target statement features to obtain multiple first vectors, the multiple first vectors are used to indicate the context representations learned from the multiple words that match the multiple marker bits respectively; perform cross-attention enhancement processing on the multiple first vectors to obtain multiple second vectors, one second vector is obtained by enhancing other first vectors based on the corresponding first vector; the generation module 203 is used to decode the multiple second vectors to generate multiple recognition results that match the statement to be recognized, the multiple recognition results including intent classification results that match the intent classification marker bits and at least one recognition result that matches the at least one target marker bit respectively.
[0163] In some embodiments of this disclosure, the processing module 202 is specifically configured to perform the following operations for each first vector to obtain a plurality of second vectors; based on the enhancement weights corresponding to at least one third vector, weight the at least one third vector to obtain a target enhancement vector corresponding to the target first vector, wherein the at least one third vector is a first vector other than the target first vector among the plurality of first vectors, and the target first vector is any one of the plurality of first vectors, and the enhancement weight is used to indicate the enhancement effect of a third vector on the target first vector; and the weighted sum of the target first vector and the target enhancement vector is determined as the second vector corresponding to the target first vector, wherein the weight of the target first vector is 1.
[0164] In some embodiments of this disclosure, the processing module 202 is specifically used to weight at least one fourth vector corresponding to the at least one third vector based on the enhancement weights corresponding to the at least one third vector, to obtain the target enhancement vector, wherein a fourth vector is the product of a learnable transformation matrix corresponding to a third vector and the third vector.
[0165] In some embodiments of this disclosure, the weighted weight of the target enhancement vector is used to indicate the degree of influence of the at least one third vector on the target first vector, and the weighted weight of the target enhancement vector is different for different first vectors.
[0166] In some embodiments of this disclosure, the enhanced weight includes any one of the following: a preset weight corresponding to the third vector; an attention weight based on an attention mechanism; or the product of the preset weight corresponding to the third vector and the attention weight based on an attention mechanism.
[0167] In some embodiments of this disclosure, when the at least one target marker includes a first target marker for identifying keywords and sentence structures representing intent in the statement to be identified, the intent classification result is a first-dimensional classification result, and the identification result corresponding to the first target marker is a second-dimensional classification result, the first-dimensional classification result including the second-dimensional classification result; when the at least one target marker includes a second target marker for identifying keywords representing entities and entity description information in the statement to be identified, the identification result corresponding to the second target marker is an entity type prediction result and an entity boundary prediction result; when the at least one target marker includes a third target marker for identifying keywords representing emotions and the mode of emotion expression in the statement to be identified, the identification result corresponding to the third target marker is an emotion polarity classification result and an emotion intensity prediction result, the emotion polarity classification result being used to indicate the emotional positivity of the statement to be identified. The sentiment intensity prediction result is used to indicate the sentiment intensity level of the statement to be identified; when at least one target marker includes a fourth target marker for identifying keywords representing time and urgency information in the statement to be identified, the identification result corresponding to the fourth target marker is an urgency classification result; when at least one target marker includes a fifth target marker for identifying structural complexity and technical terminology information in the statement to be identified, the identification result corresponding to the fifth target marker is a complexity classification result and a professionalism assessment result, the complexity classification result is used to indicate the structural complexity level of the statement to be identified, and the professionalism assessment result is used to indicate the technical terminology level of the statement to be identified; the generation module 203 is further used to generate a target classification result based on the first dimension classification result and the second dimension classification result after decoding the multiple second vectors to generate multiple identification results matching the statement to be identified.
[0168] In some embodiments of this disclosure, the generation module 203 is further configured to, after decoding the plurality of second vectors and generating a plurality of recognition results that match the statement to be recognized, integrate the plurality of recognition results to generate a target recognition result and a confidence level of the target recognition result, wherein the confidence level is used to indicate the recognition accuracy of the target recognition result.
[0169] In this embodiment, each module can implement the statement recognition method provided in the above method embodiments and achieve the same technical effect. To avoid repetition, it will not be described again here.
[0170] Figure 3 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure. It is used to exemplarily illustrate an electronic device that implements any statement recognition method in the embodiments of the present disclosure and should not be construed as a specific limitation on the embodiments of the present disclosure.
[0171] like Figure 3 As shown, the electronic device 300 may include a processor (e.g., a central processing unit, a graphics processing unit, etc.) 301, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 302 or a program loaded from a storage device 308 into a random access memory (RAM) 303. The RAM 303 also stores various programs and data required for the operation of the electronic device 300. The processor 301, ROM 302, and RAM 303 are interconnected via a bus 304. An input / output (I / O) interface 305 is also connected to the bus 304.
[0172] Typically, the following devices can be connected to I / O interface 305: input devices 306 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 307 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 308 including, for example, magnetic tapes, hard disks, etc.; and communication devices 309. Communication device 309 allows electronic device 300 to communicate wirelessly or wiredly with other devices to exchange data. Although an electronic device 300 with various devices is shown, it should be understood that it is not required to implement or possess all of the devices shown. More or fewer devices may be implemented or possessed alternatively.
[0173] In particular, according to embodiments of this disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this disclosure include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication device 309, or installed from storage device 308, or installed from ROM 302. When the computer program is executed by processor 301, it can perform the functions defined in any statement recognition method provided in embodiments of this disclosure.
[0174] It should be noted that the computer-readable medium described in this disclosure can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this disclosure, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this disclosure, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium can be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wires, optical fibers, RF (radio frequency), etc., or any suitable combination thereof.
[0175] In some implementations, the client and server can communicate using any currently known or future-developed network protocol such as HTTP (Hypertext Transfer Protocol), and can interconnect with digital data communication (e.g., communication networks) of any form or medium. Examples of communication networks include local area networks (“LANs”), wide area networks (“WANs”), the Internet (e.g., the Internet of Things), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future-developed networks.
[0176] The aforementioned computer-readable medium may be included in the aforementioned electronic device; or it may exist independently and not assembled into the electronic device.
[0177] The aforementioned computer-readable medium carries one or more programs, which, when executed by the electronic device, cause the electronic device to: acquire a statement to be recognized; perform word segmentation on the statement to be recognized to obtain multiple words included in the statement to be recognized; insert multiple marker bits into the multiple words to obtain target statement features, the multiple marker bits including an intent classification marker bit, a sentence end marker bit, and at least one target marker bit used to indicate other attributes of the statement to be recognized; encode the target statement features to obtain multiple first vectors, the multiple first vectors being used to indicate context representations learned from the multiple words that respectively match the multiple marker bits; perform cross-attention enhancement processing on the multiple first vectors to obtain multiple second vectors, one second vector being enhanced by other first vectors based on a corresponding first vector; and decode the multiple second vectors to generate multiple recognition results matching the statement to be recognized, the multiple recognition results including an intent classification result matching the intent classification marker bit, and at least one recognition result matching the at least one target marker bit respectively.
[0178] In embodiments of this disclosure, computer program code for performing the operations of this disclosure can be written in one or more programming languages or a combination thereof. These programming languages include, but are not limited to, object-oriented programming languages such as Java, Smalltalk, and C++, as well as conventional procedural programming languages such as the "C" language or similar programming languages. The program code can be executed entirely on a computer, partially on a computer, as a standalone software package, partially on a computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0179] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0180] The units described in the embodiments of this disclosure can be implemented in software or in hardware. The names of the units are not, in some cases, intended to limit the specific unit.
[0181] The functions described above in this document can be performed, at least in part, by one or more hardware logic components. For example, exemplary types of hardware logic components that can be used, without limitation, include: Field Programmable Gate Arrays (FPGAs), Application-Specific Integrated Circuits (ASICs), Application Standard Products (ASSPs), System-on-Chip (SoCs), Complex Programmable Logic Devices (CPLDs), and so on.
[0182] In the context of this disclosure, a computer-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. A computer-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of computer-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0183] The above description is merely a preferred embodiment of this disclosure and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of this disclosure is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the above-described concept. For example, technical solutions formed by substituting the above features with (but not limited to) technical features disclosed in this disclosure that have similar functions.
[0184] Furthermore, while the operations are described in a specific order, this should not be construed as requiring these operations to be performed in the specific order shown or in a sequential order. In certain environments, multitasking and parallel processing may be advantageous. Similarly, while several specific implementation details are included in the above discussion, these should not be construed as limiting the scope of this disclosure. Certain features described in the context of individual embodiments may also be implemented in combination in a single embodiment. Conversely, various features described in the context of a single embodiment may also be implemented individually or in any suitable sub-combination in multiple embodiments.
[0185] Although the subject matter has been described using language specific to structural features and / or methodological logic, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. Rather, the specific features and actions described above are merely illustrative examples of implementing the claims.
Claims
1. A sentence recognition method, characterized in that, The method includes: Obtain the statement to be recognized; The sentence to be identified is segmented into multiple words to obtain the sentence to be identified. Multiple marker bits are inserted into the multiple word segments to obtain target sentence features. The multiple marker bits include an intent classification marker bit, a sentence end marker bit, and at least one target marker bit used to indicate other attributes of the sentence to be identified. The target sentence features are encoded to obtain multiple first vectors, which are used to indicate the context representations learned from the multiple word segments that match the multiple tag bits respectively; The multiple first vectors are subjected to cross-attention enhancement processing to obtain multiple second vectors. A second vector is obtained by enhancing other first vectors based on its corresponding first vector. The plurality of second vectors are decoded to generate a plurality of recognition results that match the statement to be recognized. The plurality of recognition results include an intent classification result that matches the intent classification marker bit and at least one recognition result that matches the at least one target marker bit.
2. The method according to claim 1, characterized in that, The cross-attention enhancement process applied to the plurality of first vectors yields a plurality of second vectors, including: Perform the following operations on each first vector to obtain the plurality of second vectors; Based on the enhancement weights corresponding to at least one third vector, the at least one third vector is weighted to obtain a target enhancement vector corresponding to the target first vector. The at least one third vector is a first vector other than the target first vector among the plurality of first vectors. The target first vector is any one of the plurality of first vectors. The enhancement weights are used to indicate the enhancement effect of a third vector on the target first vector. The weighted sum of the target first vector and the target enhancement vector is determined as the second vector corresponding to the target first vector, and the weight of the target first vector is 1.
3. The method according to claim 2, characterized in that, The step of weighting the at least one third vector based on the enhancement weights corresponding to each of the at least one third vectors to obtain the target enhancement vector corresponding to the target first vector includes: Based on the enhancement weights corresponding to the at least one third vector, the at least one fourth vector corresponding to the at least one third vector is weighted to obtain the target enhancement vector, wherein a fourth vector is the product of the learnable transformation matrix corresponding to a third vector and the third vector.
4. The method according to claim 2, characterized in that, The weighted weight of the target enhancement vector is used to indicate the degree of influence of the at least one third vector on the target first vector, and the weighted weight of the target enhancement vector is different for different first vectors.
5. The method according to any one of claims 2 to 4, characterized in that, The enhanced weights include any of the following: The preset weights corresponding to the aforementioned third vector; Attention weights based on attention mechanisms; The product of the preset weight corresponding to the third vector and the attention weight based on the attention mechanism.
6. The method according to claim 1, characterized in that, When the at least one target marker includes a first target marker for identifying keywords and sentence structures that represent intent in the statement to be identified, the intent classification result is a first-dimensional classification result, the identification result corresponding to the first target marker is a second-dimensional classification result, and the first-dimensional classification result includes the second-dimensional classification result; When the at least one target marker bit includes a second target marker bit for identifying keywords representing entities and entity description information in the statement to be identified, the identification result corresponding to the second target marker bit is the entity type prediction result and the entity boundary prediction result; When the at least one target marker includes a third target marker for identifying keywords representing emotions and the expression of emotions in the statement to be identified, the identification result corresponding to the third target marker is an emotion polarity classification result and an emotion intensity prediction result. The emotion polarity classification result is used to indicate the positiveness of the emotion in the statement to be identified, and the emotion intensity prediction result is used to indicate the emotion intensity level of the statement to be identified. When the at least one target marker bit includes a fourth target marker bit for identifying keywords representing time and urgency information in the statement to be identified, the identification result corresponding to the fourth target marker bit is the urgency classification result; When at least one target marker includes a fifth target marker for identifying the structural complexity and terminology information of the statement to be identified, the identification result corresponding to the fifth target marker is a complexity classification result and a professionalism evaluation result. The complexity classification result is used to indicate the structural complexity level of the statement to be identified, and the professionalism evaluation result is used to indicate the level of professionalism of the statement to be identified. After decoding the plurality of second vectors to generate multiple recognition results matching the statement to be recognized, the method further includes: Based on the classification results of the first dimension and the classification results of the second dimension, the target classification result is generated.
7. The method according to claim 6, characterized in that, After decoding the plurality of second vectors to generate multiple recognition results matching the statement to be recognized, the method further includes: The multiple recognition results are integrated to generate a target recognition result and a confidence level of the target recognition result, wherein the confidence level is used to indicate the recognition accuracy of the target recognition result.
8. A sentence recognition device, characterized in that, include: The acquisition module is used to acquire the statement to be recognized; The processing module is used to perform word segmentation on the sentence to be identified to obtain multiple words included in the sentence to be identified; Multiple marker bits are inserted into the multiple word segments to obtain target sentence features. The multiple marker bits include an intent classification marker bit, a sentence end marker bit, and at least one target marker bit used to indicate other attributes of the sentence to be identified. The target sentence features are encoded to obtain multiple first vectors, which are used to indicate the context representations learned from the multiple word segments that match the multiple tag bits respectively; The plurality of first vectors are subjected to cross-attention enhancement processing to obtain a plurality of second vectors, wherein a second vector is obtained by enhancing other first vectors based on a corresponding first vector. The generation module is used to decode the plurality of second vectors to generate a plurality of recognition results that match the statement to be recognized. The plurality of recognition results include an intent classification result that matches the intent classification marker bit, and at least one recognition result that matches the at least one target marker bit.
9. An electronic device, characterized in that, include: A memory and a processor, wherein the memory is used to store a computer program; and the processor is used to execute the statement recognition method of any one of claims 1 to 7 when the computer program is invoked.
10. A computer-readable storage medium, characterized in that, It stores a computer program, which, when executed by a processor, implements the statement recognition method according to any one of claims 1 to 7.
11. A computer program product, characterized in that, The computer program product includes a computer program that, when executed by a processor, implements the statement recognition method according to any one of claims 1 to 7.