Semantic type recognition method and apparatus, computer-readable medium, and electronic device

By matching and extracting the template features and text features of semantic requests in a preset template library and performing two semantic type recognitions in combination with a neural network model, the problem of insufficient generalization ability of semantic recognition in existing technologies is solved, achieving higher recognition accuracy and efficiency.

CN115203418BActive Publication Date: 2025-10-21TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210867697.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-07-22
Publication Date
2025-10-21
Estimated Expiration
2042-07-22

AI Technical Summary

Technical Problem

Semantic recognition methods in existing technologies rely on manually defined rule features and have weak generalization capabilities.

Method used

By matching the target semantic request template in the preset template library, extracting template features and text features, and combining the neural network model for semantic type recognition, the semantic type recognition is performed twice and the results are fused to improve accuracy.

Benefits of technology

The accuracy and generalization ability of semantic recognition have been improved, and it can more accurately identify complex or simple semantic requests, thereby improving processing efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115203418B_ABST
    Figure CN115203418B_ABST
Patent Text Reader

Abstract

The application discloses a semantic type identification method and device, a computer readable medium and an electronic device. The method comprises: matching a to-be-identified semantic request in a preset template library to obtain a target semantic request template, and obtaining template features of the target semantic request template; performing text feature extraction on the to-be-identified semantic request to obtain text features corresponding to the to-be-identified semantic request; performing first semantic type identification according to the template features and the text features, and fusing a specified semantic type corresponding to the target semantic request template to obtain a target semantic type identification result. The technical scheme can perform semantic type identification on a voice request. On one hand, prior knowledge provided by a semantic request template is considered, and on the other hand, text features of the to-be-identified semantic request itself are considered. That is, multi-angle features are considered in the semantic type identification process, and the accuracy and generalization ability of semantic identification are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of natural language processing technology, and specifically relates to a semantic type recognition method, device, computer-readable medium, and electronic device. Background Art

[0002] Natural Language Processing (NLP) is a key area in computer science and artificial intelligence, and semantic recognition is a crucial component of NLP. Semantic recognition generally involves identifying the intent contained in semantics so that appropriate actions or responses can be taken based on the identified intent. Currently, the most common semantic recognition method uses manually defined rule templates to identify the intent contained in semantic requests. This method relies heavily on manually defined rule features and has limited generalization capabilities.

[0003] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of this application, and therefore may include information that does not constitute prior art known to ordinary technicians in this field. Summary of the Invention

[0004] The purpose of this application is to provide a semantic type recognition method, device, computer-readable medium and electronic device to optimize the problem of weak semantic recognition generalization ability in related technologies.

[0005] Other features and advantages of the present application will become apparent from the following detailed description, or may be learned in part by practice of the present application.

[0006] According to one aspect of an embodiment of the present application, a semantic type recognition method is provided, comprising:

[0007] According to the semantic request to be identified, a target semantic request template is matched in a preset template library, and template features of the target semantic request template are obtained; the preset template library includes multiple semantic request templates of specified semantic types;

[0008] Performing text feature extraction on the semantic request to be identified to obtain text features corresponding to the semantic request to be identified;

[0009] Performing a first semantic type recognition based on the template features of the target semantic request template and the text features to obtain a first semantic type recognition result;

[0010] The first semantic type recognition result and the specified semantic type corresponding to the target semantic request template are fused to obtain a target semantic type recognition result. The target semantic type recognition result indicates that the type of the semantic request to be identified is a compound semantic request or a simple semantic request. The compound semantic request includes a semantic request with multiple intentions, and the simple semantic request includes a semantic request with a single intention.

[0011] According to one aspect of an embodiment of the present application, a semantic type recognition device is provided, including:

[0012] A template matching module is used to match the semantic request to be identified in a preset template library to obtain a target semantic request template and acquire template features of the target semantic request template; the preset template library includes multiple semantic request templates of specified semantic types;

[0013] A text feature extraction module is used to extract text features from the semantic request to be identified, and obtain text features corresponding to the semantic request to be identified;

[0014] A first semantic type recognition module is configured to perform first semantic type recognition based on the template features of the target semantic request template and the text features to obtain a first semantic type recognition result;

[0015] A target semantic type identification module is used to fuse the first semantic type identification result and the specified semantic type corresponding to the target semantic request template to obtain a target semantic type identification result. The target semantic type identification result indicates that the type of the semantic request to be identified is a compound semantic request or a simple semantic request. The compound semantic request includes a semantic request with multiple intentions, and the simple semantic request includes a semantic request with a single intention.

[0016] In one embodiment of the present application, the template matching module includes:

[0017] A template screening unit is used to match the semantic request to be identified in a preset template library to obtain multiple candidate semantic request templates; calculate the confidence score of each candidate semantic request template, and the confidence score is negatively correlated with the proportion of wildcards in the semantic request to be identified; and screen the multiple candidate semantic request templates according to the confidence score to obtain a target semantic request template.

[0018] In one embodiment of the present application, the template feature includes a template vector; and the template matching module includes:

[0019] A template feature extraction unit is used to perform word segmentation processing on the target semantic request template to obtain multiple template words; perform vector mapping on the multiple template words to obtain multiple word vectors, and form the multiple word vectors into a template vector matrix; and perform pooling processing on the template vector matrix to obtain a template vector of the target semantic request template.

[0020] In one embodiment of the present application, the target semantic type recognition module includes:

[0021] A weight acquisition unit, configured to acquire a template weight, wherein the template weight reflects the importance of the specified semantic type of the target semantic request template in the target semantic type recognition result;

[0022] A second semantic recognition result obtaining unit, configured to adjust the specified semantic type of the target semantic request template according to the template weight to obtain a second semantic type recognition result;

[0023] The target result acquisition unit is used to fuse the first semantic type recognition result and the second semantic type recognition result to obtain the target semantic type recognition result.

[0024] In one embodiment of the present application, the weight acquisition unit is specifically configured to:

[0025] Check whether the template weight parameter has the set value;

[0026] If the template weight parameter has a set value, the set value is used as the template weight;

[0027] If the template weight parameter does not have a set value, the template weight is calculated based on the template features of the target semantic request template and the text features.

[0028] In one embodiment of the present application, the template features of the target semantic request template include a template vector of the target semantic request template and a confidence score of the target semantic request template; and the weight acquisition unit is further configured to:

[0029] Multiplying the template vector of the target semantic request template and the confidence score of the target semantic request template to obtain an initial weight;

[0030] Feature extraction and mapping processing are performed according to the initial weight and the text feature to obtain the template weight.

[0031] In one embodiment of the present application, the text feature extraction module is specifically used to:

[0032] Performing word segmentation processing on the semantic request to be recognized to obtain a plurality of words to be recognized;

[0033] Performing vector mapping on the plurality of to-be-recognized words to obtain a plurality of vocabulary vectors, and forming a to-be-recognized vector matrix from the plurality of vocabulary vectors;

[0034] Performing convolution processing on the vector matrix to be identified using convolution kernels of various sizes to obtain multiple convolution vectors;

[0035] Performing pooling processing on the multiple convolution vectors to obtain multiple pooled data;

[0036] The multiple pooled data are spliced ​​together to obtain text features corresponding to the semantic request to be identified.

[0037] According to one aspect of an embodiment of the present application, a computer-readable medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the semantic type recognition method in the above technical solution is implemented.

[0038] According to one aspect of an embodiment of the present application, an electronic device is provided, comprising: a processor; and a memory for storing executable instructions of the processor; wherein the processor executes the executable instructions so that the electronic device executes the semantic type recognition method as in the above technical solution.

[0039] According to one aspect of an embodiment of the present application, a computer program product or computer program is provided, comprising computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the semantic type recognition method described in the above technical solution.

[0040] In the technical solution provided in the embodiment of the present application, the semantic request to be identified is matched in a preset template library to obtain a target semantic request template, and then the template features of the target semantic request template are obtained; at the same time, text features are extracted for the semantic request to be identified to obtain text features; then a first semantic type recognition result is obtained based on the template features and the text features; finally, a target semantic type recognition result is obtained based on the fusion of the first semantic type recognition result and the specified semantic type corresponding to the target semantic request template. The semantic type recognition of the technical solution of the present application takes into account the prior knowledge provided by the semantic request template on the one hand, and the text features of the semantic request to be identified itself on the other hand, that is, multi-angle features are taken into account in the semantic type recognition process, which improves the accuracy and generalization ability of semantic recognition; at the same time, the technical solution of the present application performs two semantic type recognitions on the semantic request to be identified, and finally fuses the two semantic type recognition results to obtain the target semantic type recognition result, which further improves the accuracy of semantic type recognition.

[0041] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] The accompanying drawings are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present application, and together with the specification, are used to explain the principles of the present application. Obviously, the drawings described below are only some embodiments of the present application, and those skilled in the art can derive other drawings based on these drawings without inventive effort.

[0043] Figure 1 The following schematically shows an exemplary system architecture block diagram applying the technical solution of the present application.

[0044] Figure 2 The flowchart of the semantic type recognition method provided by one embodiment of the present application is schematically shown.

[0045] Figure 3 The flowchart of the semantic type recognition method provided by one embodiment of the present application is schematically shown.

[0046] Figure 4 The flowchart of the semantic request processing process provided by one embodiment of the present application is schematically shown.

[0047] Figure 5 The flowchart of the semantic type recognition method provided by one embodiment of the present application is schematically shown.

[0048] Figure 6 The flowchart of the template parsing process provided by one embodiment of the present application is schematically shown.

[0049] Figure 7 The flowchart of the text parsing process provided by one embodiment of the present application is schematically shown.

[0050] Figure 8 The structure diagram of the neural network discrimination model provided by one embodiment of the present application is schematically shown.

[0051] Figure 9 The structural block diagram of a semantic type recognition device provided by an embodiment of the present application is schematically shown.

[0052] Figure 10 The following schematically shows a block diagram of a computer system structure of an electronic device suitable for implementing an embodiment of the present application. DETAILED DESCRIPTION

[0053] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in many forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this application will be thorough and complete and will fully convey the concepts of the example embodiments to those skilled in the art.

[0054] In addition, described feature, structure or characteristic can be combined in one or more embodiments in any suitable manner.In the following description, many specific details are provided so as to provide a full understanding of the embodiments of the present application. However, it will be appreciated by those skilled in the art that the technical scheme of the present application can be put into practice without one or more of the specific details, or other methods, components, devices, steps etc. can be adopted. In other cases, known methods, devices, implementations or operations are not shown or described in detail to avoid blurring the various aspects of the application.

[0055] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically separate entities. That is, these functional entities may be implemented in software, in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.

[0056] The flowcharts shown in the accompanying drawings are for illustrative purposes only and do not necessarily include all contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps may be decomposed, while others may be combined or partially combined. Therefore, the actual execution order may vary depending on the actual situation.

[0057] Figure 1 The following schematically shows an exemplary system architecture block diagram applying the technical solution of the present application.

[0058] like Figure 1 As shown, system architecture 100 may include terminal device 110, network 120, and server 130. Terminal device 110 may include a smartphone, tablet computer, laptop computer, intelligent voice interaction device, smart home appliance, vehicle-mounted terminal, aircraft, etc. Server 130 may be a standalone physical server, a server cluster or distributed system consisting of multiple physical servers, or a cloud server providing cloud computing services. Network 120 may be a communication medium of various connection types capable of providing a communication link between terminal device 110 and server 130, such as a wired communication link or a wireless communication link.

[0059] Depending on implementation needs, the system architecture in the embodiments of the present application can have any number of terminal devices, networks, and servers. For example, server 130 can be a server group consisting of multiple server devices. In addition, the technical solutions provided in the embodiments of the present application can be applied to terminal device 110, server 130, or can be implemented by both terminal device 110 and server 130, and this application does not impose any special restrictions on this.

[0060] In one embodiment of the present application, the semantic type identification method provided in the embodiment of the present application is implemented by the server 130. The server 130 matches the preset template library according to the semantic request to be identified, obtains the target semantic request template, and obtains the template features of the target semantic request template; the preset template library includes multiple semantic request templates of specified semantic types. Then, the server 130 performs text feature extraction on the semantic request to be identified, and obtains the text features corresponding to the semantic request to be identified. Next, the server 130 performs a first semantic type identification based on the template features and text features of the target semantic request template, and obtains a first semantic type identification result. Finally, the server 130 fuses the first semantic type identification result with the specified semantic type corresponding to the target semantic request template, and obtains the target semantic type corresponding to the semantic request to be identified. The target semantic type indicates whether the type of the semantic request to be identified is a compound semantic request or a simple semantic request. The compound semantic request includes a semantic request with multiple intentions, and the simple semantic request includes a semantic request with a single intention.

[0061] In one embodiment of the present application, the semantic type recognition method provided in the embodiment of the present application is implemented by a terminal device 110, which is a vehicle-mounted terminal.

[0062] The vehicle-mounted terminal includes a voice acquisition module, which collects the semantic request to be recognized in voice form. The vehicle-mounted terminal converts the semantic request to be recognized in voice form into the semantic request to be recognized in text form, and matches the semantic request to be recognized in the preset template library according to the text form to obtain the target semantic request template, and then obtains the template features of the target semantic request template.

[0063] Assume that the template library includes multiple semantic request templates of specified semantic types, that is, the semantic types corresponding to the voice request templates in the template library are predetermined. In an embodiment of the present application, the semantic types include compound semantic requests and simple semantic requests. Compound semantic requests include semantic requests with multiple intents, and simple semantic requests include semantic requests with a single intent. For example, a semantic request is "close the car windows and turn on the air conditioner". Obviously, it includes the two intents of "close the car windows" and "turn on the air conditioner", so the semantic request is a compound semantic request. For another example, a voice request is "increase the air conditioning temperature", which only includes one intent, so the semantic request is a simple semantic request.

[0064] At the same time, the vehicle terminal performs text feature extraction on the semantic request to be recognized in text form to obtain corresponding text features. For example, the semantic request to be recognized is converted into a text vector, and then feature extraction is performed on the text vector to obtain corresponding text features.

[0065] Finally, the on-board terminal performs a first semantic type recognition based on the template features and text features of the target semantic request template to obtain a first semantic type recognition result, and fuses the first semantic type recognition result with the specified semantic type corresponding to the target semantic request template to obtain the target semantic type corresponding to the semantic request to be recognized, that is, to identify whether the semantic request to be recognized is a compound semantic request or a simple semantic request. The first semantic type recognition result is also used to indicate whether the semantic request to be recognized is a compound semantic request or a simple semantic request. The specified semantic type corresponding to the target semantic request template is equivalent to the first semantic type recognition of the semantic request to be recognized, and the first semantic type recognition result is equivalent to the second-level semantic type recognition of the semantic request to be recognized. Finally, the two are fused to obtain the target semantic recognition result, which effectively increases the accuracy and precision of semantic type recognition.

[0066] When it is identified that the semantic request to be identified is a complex semantic request, the processing method corresponding to the complex semantic request is used to respond to the semantic request to be identified. For example, the complex semantic request is decomposed to obtain each intent contained in the complex semantic request, and then a response is given to each intent. When it is identified that the semantic request to be identified is a simple semantic request, the processing method corresponding to the simple semantic request is used to respond to the semantic request to be identified. Since the simple semantic request contains a single intent, the processing method of the simple semantic request can be set to be relatively simple to improve the processing efficiency of the simple semantic request. For example, the semantic request to be identified is "close the car windows and turn on the air conditioner", which is a complex semantic request. It can be split into two simple semantic requests, "close the car windows" and "turn on the air conditioner", and then the two simple semantic requests are executed at the same time, that is, the vehicle terminal executes the two operations of "close the car windows" and "turn on the air conditioner" at the same time.

[0067] The semantic type recognition method provided by this application is described in detail below in conjunction with specific implementation methods.

[0068] Figure 2 The flowchart of the semantic type recognition method provided by an embodiment of the present application is schematically shown. The method can be Figure 1 The terminal device 110 or server 130 shown is implemented. Figure 2 As shown, the semantic type recognition method provided in the embodiment of the present application includes steps 210 to 240, which are specifically as follows:

[0069] Step 210: Match the semantic request to be identified in a preset template library to obtain a target semantic request template and acquire template features of the target semantic request template; the preset template library includes multiple semantic request templates of specified semantic types.

[0070] Specifically, the semantic request to be recognized can be in the form of voice data or text data. For example, a voice acquisition device can directly capture the voice information of a subject to obtain the semantic request to be recognized in voice form. Another example is a text input device that captures text information input by a subject to obtain the semantic request to be recognized in text form.

[0071] The preset template library includes multiple semantic request templates of specified semantic types, that is, the preset template library includes multiple semantic request templates, and the semantic types corresponding to the semantic request templates have been pre-specified. In an embodiment of the present application, the semantic types include compound semantic requests and simple semantic requests. Compound semantic requests refer to semantic requests with multiple intents, and simple semantic requests refer to semantic requests with a single intent. The specified semantic type of the semantic request template can be represented by a type label c, c∈{0,1}, that is, when c=0, it indicates that the specified semantic type of the semantic request template is a simple semantic request; when c=1, it indicates that the specified semantic type of the semantic request template is a compound semantic request.

[0072] Matching the semantic request to be identified in the preset template library means matching the semantic request to be identified with the semantic request template in the preset template library. When a semantic request template that is the same as the semantic request to be identified in the preset template library is matched, the semantic request template is the target semantic request template, and then the template features of the target semantic request template are obtained.

[0073] In one embodiment of the present application, when matching a semantic request to be recognized in a preset template library, the semantic request to be recognized in text form is matched with a semantic request template in the preset template library. If the semantic request to be recognized is in speech form, it is necessary to first convert the speech form of the semantic request to be recognized into a text form of the semantic request to be recognized, for example, by converting the speech form of the semantic request to be recognized into a text form of the semantic request to be recognized using a trained speech recognition model.

[0074] In one embodiment of the present application, the matching of the semantic request to be identified and the semantic request template is to match the character string to be identified corresponding to the semantic request to be identified with the template character string corresponding to the semantic request template. When the character string to be identified is completely consistent with the template character string, the semantic request to be identified is considered to be the same as the corresponding semantic request template. Optionally, whether the character string to be identified and the template character string are consistent can also be judged by the number of character matches. Specifically, when the number of characters that match the character string to be identified and the template character string reaches a set threshold, the character string to be identified is considered to be consistent with the template character string. For example, when 80% of the characters of the character string to be identified and the template character string are the same, the character string to be identified is considered to be consistent with the template character string.

[0075] When converting a semantic request to be recognized into a character string to be recognized, the semantic request to be recognized is first segmented to obtain multiple words to be recognized, and then the multiple words to be recognized are entity converted to obtain the corresponding character string to be recognized. Entity conversion is to convert characters into another form of representation, usually by matching characters in an entity library to obtain the converted entity of the character. For example, the semantic request to be recognized is "play music", and after segmentation, two words "play" and "music" are obtained. After entity conversion, "play" is obtained as "play" (or "play"), and "music" is obtained as "song", and then the character string to be recognized is "play song" (or "playsong").

[0076] Step 220: extract text features from the semantic request to be identified to obtain text features corresponding to the semantic request to be identified.

[0077] Specifically, text feature extraction is to convert the semantic request to be identified from text data into vector data. Therefore, the text feature corresponding to the semantic request to be identified is the text vector representation corresponding to the semantic request to be identified.

[0078] In one embodiment of the present application, a semantic request to be recognized can be first segmented to obtain multiple words to be recognized. Then, based on the number of occurrences of each word in the vocabulary, a text vector representation corresponding to the semantic request to be recognized is generated. For example, if the semantic request to be recognized is "close the car window, turn off the music", the word segmentation results in "close", "car window", "close", and "music". If the vocabulary is [close, car window, music, open], the text vector representation is [2, 1, 1, 0].

[0079] In one embodiment of the present application, the semantic request to be recognized can be first segmented to obtain multiple words to be recognized, and the multiple words to be recognized can be converted into text vector representations based on TF-IDF (Term Frequency / Inverse Document Frequency).

[0080] In one embodiment of the present application, text feature extraction can also be achieved through a neural network model, for example, text feature extraction can be performed through models such as LSTM (Long short-term memory), Transformer, and CNN (Convolutional Neural Network).

[0081] Step 230: Perform first semantic type recognition based on the template features and text features of the target semantic request template to obtain a first semantic type recognition result.

[0082] Specifically, the first semantic type identification involves extracting and mapping the template features obtained by extracting features from the target semantic request template with the text features extracted from the semantic request to be identified. The first semantic type identification result indicates whether the semantic request to be identified is a complex semantic request or a simple semantic request. The first semantic type identification is equivalent to performing a semantic type identification on the semantic request to be identified based on the template features and text features.

[0083] In one embodiment of the present application, the template feature is a template vector obtained by extracting features from the text sequence of the target semantic request template. The first semantic type recognition process is to extract and map the text features and template vector using a neural network model to output a first semantic type recognition result.

[0084] Step 240: Fusing the first semantic type recognition result and the designated semantic type corresponding to the target semantic request template to obtain a target semantic type recognition result, where the target semantic type recognition result indicates whether the type of the semantic request to be recognized is a complex semantic request or a simple semantic request.

[0085] In one embodiment of the present application, the designated semantic type corresponding to the target semantic request template is the semantic type recognition result obtained by the semantic request to be identified based on template matching, and template matching is a semantic type recognition performed on the semantic request to be identified. Fusion of the first semantic recognition result and the designated semantic type corresponding to the target semantic request template is to fuse the two semantic type recognition results to obtain the target semantic type recognition result. For example, the first semantic recognition result and the designated semantic type corresponding to the target semantic request template both represent the probability that the semantic request to be identified is a compound semantic request; the first semantic recognition result and the designated semantic type corresponding to the target semantic request template are weightedly summed to obtain the target semantic type recognition result. If the target semantic type recognition result is greater than or equal to the preset threshold, the target semantic type corresponding to the semantic request to be identified is considered to be a compound semantic request; if the target semantic type recognition result is less than the preset threshold, the target semantic type corresponding to the semantic request to be identified is considered to be a simple semantic request.

[0086] In the technical solution provided in the embodiment of the present application, the semantic request to be identified is matched in a preset template library to obtain a target semantic request template, and then the template features of the target semantic request template are obtained; at the same time, text features are extracted for the semantic request to be identified to obtain text features; then a first semantic type recognition result is obtained based on the template features and the text features; finally, a target semantic type recognition result is obtained based on the fusion of the first semantic type recognition result and the specified semantic type corresponding to the target semantic request template. The semantic type recognition of the technical solution of the present application takes into account the prior knowledge provided by the semantic request template on the one hand, and the text features of the semantic request to be identified itself on the other hand, that is, multi-angle features are taken into account in the semantic type recognition process, which improves the accuracy and generalization ability of semantic recognition; at the same time, the technical solution of the present application performs two semantic type recognitions on the semantic request to be identified, and finally fuses the two semantic type recognition results to obtain the target semantic type recognition result, which further improves the accuracy of semantic type recognition.

[0087] Figure 3 The flowchart of the semantic type recognition method provided by one embodiment of the present application is schematically shown. This embodiment is a further refinement of the above embodiment. Figure 3 As shown, the semantic type recognition method provided in the embodiment of the present application includes steps 300 to 315, which are specifically as follows:

[0088] Step 300: Obtain a semantic request to be identified.

[0089] Step 301: Match the semantic request to be identified in a preset template library to obtain multiple candidate semantic request templates.

[0090] Specifically, the process of matching the semantic request to be recognized in the preset template library is: first, the semantic request to be recognized is segmented to obtain multiple words to be recognized; then the multiple words to be recognized are entity converted to obtain corresponding multiple character strings to be recognized; finally, the multiple character strings to be recognized are matched with the template strings corresponding to the semantic request template in the preset template library to obtain multiple candidate semantic request templates.

[0091] When performing entity conversion on multiple words to be recognized, since a word may have multiple meanings, the entity library may have different entities corresponding to different meanings of the word. Therefore, the same word may be converted into multiple different character strings, resulting in multiple character strings to be recognized after entity conversion of the semantic request to be recognized. For example, if the semantic request to be recognized is "play voice", the word segmentation result can be [play, voice] or [play, language, sound]. In both cases, the entity library may find entities corresponding to each word to be recognized, and after conversion, at least two character strings to be recognized can be obtained. For example, if the entity library contains a song titled "Voice", the word to be recognized "Voice" corresponds to "song", and after conversion, the character string to be recognized is "play song"; if the entity library contains a movie titled "Voice", the word to be recognized "Voice" corresponds to "video", and after conversion, the character string to be recognized is "play video"; if the entity library contains a song titled "Language", the word to be recognized "Language" corresponds to "song", and after conversion, the character string to be recognized is "play song sound". Then, by matching the above multiple strings to be recognized in the preset template library, a template string identical to each string to be recognized can be obtained. At this time, the semantic request template corresponding to each matched template string is recorded as a candidate semantic request template.

[0092] Step 302: Calculate the confidence score of each candidate semantic request template. The confidence score is negatively correlated with the proportion of wildcards in the semantic request to be identified.

[0093] Specifically, the confidence score of the candidate semantic request template reflects the degree of matching between the candidate semantic request template and the semantic request to be identified. The higher the confidence score, the more similar the candidate semantic request template is to the semantic request to be identified, that is, the higher the matching accuracy; the lower the confidence score, the greater the difference between the candidate semantic request template and the semantic request to be identified, that is, the lower the matching accuracy.

[0094] A wildcard is a special character that can match any character, such as "*", "?", and other symbols. When a semantic request to be identified contains wildcards, it is easy to cause fuzzy matching between the semantic request to be identified and the semantic request template, reducing the matching accuracy. For example, if the semantic request to be identified is converted into a string to be identified, and the string to be identified is "play *song", then the semantic request template formed by adding any characters between "play" and "song" can be used as a candidate semantic request template that matches the semantic request with identification. For example, the candidate semantic request templates are "play 1song", "play xsong", etc.

[0095] It can be seen that the proportion of wildcards in the semantic request to be identified actually reflects the confidence score of the candidate semantic request template from the opposite side, that is, the confidence score is negatively correlated with the proportion of wildcards in the semantic request to be identified. When the proportion of wildcards in the semantic request to be identified is higher, the confidence score is lower, which indicates that the corresponding candidate semantic request template has a lower degree of match with the semantic request to be identified; when the proportion of wildcards in the semantic request to be identified is lower, the confidence score is higher, which indicates that the corresponding candidate semantic request template has a higher degree of match with the semantic request to be identified. Generally speaking, the confidence score = 1 - the proportion of wildcards in the semantic request to be identified, and the proportion of wildcards in the semantic request to be identified = the number of wildcards / the total number of characters in the tone request to be identified.

[0096] Step 303: Filter multiple candidate semantic request templates according to the confidence scores to obtain a target semantic request template.

[0097] Specifically, multiple candidate semantic request templates are screened based on their confidence scores to select the candidate semantic request template that best matches the semantic request to be identified. The candidate semantic request template with the highest confidence score is then selected from the multiple candidate semantic request templates. This candidate semantic request template is the target semantic request template. The confidence score corresponding to the target semantic request template is denoted as s.

[0098] Step 304: Perform word segmentation processing on the target semantic request template to obtain multiple template words.

[0099] Specifically, word segmentation processing can be performed using a dictionary-based word segmentation method, a character-based word segmentation method, or other word segmentation methods.

[0100] Step 305: Perform vector mapping on the multiple template words to obtain multiple word vectors, and compose the multiple word vectors into a template vector matrix.

[0101] Specifically, template vocabulary is vectorized by converting the vocabulary into digital vectors according to a specific rule. For example, template vocabulary can be mapped into vocabulary vectors using methods such as one-hot, word2Vec, or gloVe. After obtaining the vocabulary vectors, the individual vocabulary vectors are arranged in the order of their corresponding template vocabulary in the target semantic request template to obtain a template vector matrix.

[0102] For example, after the template semantic request template is segmented, multiple template words are obtained as [tok1,…,tok n ], where n represents the total number of template words and tok1 represents the i-th template word. After vector mapping, multiple vocabulary vectors are obtained as [v1,…,v n ],v i represents the i-th vocabulary vector, v i ∈R d , R represents a real number, d represents the vocabulary vector dimension. In general, v i It is a 1*d size vector. A vocabulary vector is a row in the template vector matrix, so the template vector matrix is ​​a matrix of n*d size.

[0103] Step 306: Perform pooling processing on the template vector matrix to obtain a template vector of the target semantic request template.

[0104] Specifically, pooling the template vector matrix actually involves sampling the template vector matrix to obtain a template vector of the template target semantic request template, which is denoted as v. Pooling can be maximum pooling or average pooling. Maximum pooling refers to selecting the maximum value within the pooled data range as the pooled value, and average pooling refers to calculating the average value within the pooled data range as the pooled value. Exemplarily, the pooled data range is a column in the template vector matrix. For a template vector matrix of size n*d, after average pooling, the size of the template vector of the target semantic request template is 1*d.

[0105] According to the above steps 301 to 306, the template matching process of the semantic request to be identified is completed, and the template features of the target semantic request template and the semantic type corresponding to the target semantic request template are obtained. The template features of the target semantic request template include a template vector and a confidence score. For ease of description, the template vector v of the target semantic request template, the confidence score s of the target semantic request template, and the specified semantic type c corresponding to the target semantic request template are collectively referred to as the template features of the target semantic request template. Then, the template features f of the target semantic request template are p=(c,s,v). It should be noted that whether the template features of the target semantic request template include the specified semantic type corresponding to the target semantic request template only changes the classification attributes of the specified semantic type corresponding to the target semantic request template, and does not change the actual execution process of the technical solution of this application.

[0106] Step 307: perform word segmentation processing on the semantic request to be recognized to obtain multiple words to be recognized.

[0107] Specifically, the word segmentation processing method of the semantic request to be identified can refer to the word segmentation processing method of the target semantic request template, which will not be described in detail here.

[0108] Step 308: Perform vector mapping on the multiple words to be recognized to obtain multiple word vectors, and combine the multiple word vectors into a vector matrix to be recognized.

[0109] Specifically, the manner of performing vector mapping on the vocabulary to be recognized and forming the vector matrix to be recognized can refer to the relevant description in step 305, which will not be repeated here.

[0110] Step 309: Perform convolution processing on the vector matrix to be identified using convolution kernels of various sizes to obtain multiple convolution vectors.

[0111] Specifically, convolution kernels of different sizes are actually convolution matrices of different sizes. Convolution processing is to perform matrix multiplication on the area matrix selected by the convolution kernel in the vector matrix to be identified and the convolution matrix represented by the convolution kernel to obtain the corresponding convolution value. As the convolution kernel moves in the vector matrix to be identified, multiple convolution processes can be performed to obtain multiple convolution values, which can form a convolution vector. Then, a convolution kernel of one size corresponds to a convolution vector, and convolution kernels of multiple sizes can obtain multiple convolution vectors.

[0112] Generally, when setting the size of the convolution kernel, the width of the convolution kernel is set to be the same as the matrix of the vector to be identified. Then, by changing the height of the convolution kernel, you can set the convolution kernel of various sizes. For example, if the size of the matrix of the vector to be identified is n*d, the convolution kernel size can be: k1*d, k2*d, k3*d, etc., where k1, k2, and k3 are not equal.

[0113] Step 310: Perform pooling processing on the multiple convolution vectors to obtain multiple pooled data.

[0114] Specifically, the pooling process for the convolution vector may be a maximum pooling process or an average size process. Performing pooling on one convolution vector yields one pooled data, and performing pooling on multiple convolution vectors yields multiple pooled data.

[0115] Step 311: Concatenate multiple pooled data to obtain text features corresponding to the semantic request to be identified.

[0116] Specifically, multiple pooled data are spliced ​​together to obtain a new vector, which is the text vector representation of the semantic request to be identified, that is, the text feature corresponding to the semantic request to be identified, denoted as f t Assuming there are j pooled data, the text feature is a vector of size 1*j.

[0117] Step 312: Perform first semantic type recognition based on the template vector and text features of the target semantic request template to obtain a first semantic type recognition result.

[0118] Specifically, the template vector v and text feature f of the target semantic request template are t As an input feature, the input feature is subjected to feature extraction and mapping processing to obtain a first semantic type recognition result r′. The feature extraction and mapping processing here can be implemented through a neural network model.

[0119] Step 313: Acquire a template weight, where the template weight reflects the importance of the specified semantic type of the target semantic request template in the target semantic type recognition result.

[0120] Specifically, the template weight reflects the importance of the specified semantic type of the target semantic request template in the target semantic type recognition result, that is, the degree of dependence of the target semantic type recognition result on the semantic type recognition result obtained by template matching. The larger the template weight, the more important the specified semantic type of the target semantic request template is when calculating the target semantic type recognition result, that is, the more dependent the target semantic type recognition result is on the semantic type recognition result obtained by template matching. Conversely, the smaller the template weight, the less important the specified semantic type of the target semantic request template is when calculating the target semantic type recognition result, that is, the lower the dependence of the target semantic type recognition result on the semantic type recognition result obtained by template matching. Then, when the template weight is 0, it indicates that the semantic type recognition result obtained by template matching is not used when calculating the target semantic type recognition result, that is, the specified semantic type of the target semantic request template does not participate in the calculation of the target semantic type recognition result. When the template weight is infinite, it indicates that the target semantic type recognition result is completely dependent on the semantic type recognition result obtained by template matching when calculating the target semantic type recognition result, which is equivalent to the specified semantic type of the target semantic request template being the target semantic type recognition result.

[0121] In one embodiment of the present application, the template weight can be calculated through the template features of the target semantic request template, or it can be a pre-set fixed value. In this way, external factors can have a certain intervention ability on the target semantic type recognition results, facilitating the regulation of the semantic type recognition process.

[0122] In one embodiment of the present application, the process of obtaining the template weight includes: detecting whether the template weight parameter has a set value; if the template weight parameter has a set value, then using the set value as the template weight; if the template weight parameter does not have a set value, then calculating the template weight based on the template vector of the target semantic request template, the reliability score of the target semantic request template and the text features.

[0123] Specifically, the template weight parameter is used to pre-set the template weight. When the template weight parameter has a set value, it indicates that the template weight has been pre-set by external factors. In this case, there is no need to calculate the template weight during the semantic recognition process; the set value can be directly used as the template weight. When the template weight parameter does not have a set value, it indicates that there is no external interference in the semantic recognition process. In this case, the template weight can be calculated based on the template vector of the target semantic request template, the target semantic request template's confidence score, and the text features.

[0124] In one embodiment of the present application, the template weight calculation process includes: multiplying the template vector of the target semantic request template and the confidence score of the target semantic request template to obtain an initial weight; performing feature extraction and mapping processing based on the initial weight and text features to obtain the template weight.

[0125] Specifically, first multiply the template vector v of the target semantic request template and the confidence score s of the target semantic request template to obtain the initial weight G = v*s. Then, the initial weight G and the text feature f t Perform feature extraction and mapping, for example, the initial weight G and text feature f t Input the neural network model together to obtain the template weight g.

[0126] Step 314: Obtain a second semantic type recognition result according to the fusion result of the template weight and the specified semantic type of the target semantic request template.

[0127] Specifically, the second semantic type recognition result r″ is the product of the template weight g and the specified semantic type c of the target semantic request template, that is, r″=g·c.

[0128] Step 315: Fuse the first semantic type recognition result and the second semantic type recognition result to obtain a target semantic type recognition result.

[0129] In one embodiment of the present application, the weighted average of the first semantic type recognition result r′ and the second semantic type recognition result r″ can be used as the target semantic type recognition result r, for example, r = α*r′+β*r″, α+β = 1, and α and β are pre-set weighting coefficients. The target semantic type recognition result r∈[0,1]. If the target semantic type recognition result r is greater than or equal to a preset threshold (for example, the preset threshold is 0.5), the target semantic type corresponding to the semantic request to be recognized is considered to be a compound semantic request; if the target semantic type recognition result r is less than the preset threshold, the target semantic type corresponding to the semantic request to be recognized is considered to be a simple semantic request.

[0130] In one embodiment of the present application, the target semantic type recognition result r can be calculated as follows:

[0131]

[0132] Where ρ is a preset threshold, ρ∈(0,1), and is generally set to 0.5. When r=0, it indicates that the target semantic type corresponding to the semantic request to be identified is a simple semantic request; when r=1, it indicates that the target semantic type corresponding to the semantic request to be identified is a complex semantic request.

[0133] Substituting the second semantic type recognition result r″=g·c into the above formula, we can obtain:

[0134]

[0135] Among them, g is the template weight; c is the specified semantic type of the target semantic request template, that is, the semantic type recognition result obtained by template matching of the semantic request to be identified, referred to as the template matching result. It can be seen that when the template weight g = 0, the target semantic type recognition result r depends on the value of the first semantic type recognition result r′, that is, the calculation of the template semantic type recognition result does not refer to the template matching result. When the template weight g = ∞, the value of the first semantic type recognition result r′ can be ignored, that is, the calculation of the template semantic type recognition result completely refers to the template matching result. It can be seen that by changing the value of g, the degree of dependence of the target semantic type recognition result on the template matching result can be adjusted, thereby regulating the target semantic type recognition result of a specific semantic request to be identified. Generally, if you want to make the target semantic type recognition result completely dependent on the semantic type recognition result obtained by template matching, set the template weight parameter to a larger value, such as 1000, 9999, etc.

[0136] In one embodiment of the present application, it is possible to identify whether the semantic request to be identified is a specific semantic request, and then determine the template weight based on the identification result. For example, a specific semantic library is pre-set, and the specific semantic library includes multiple specific semantic requests. The semantic request to be identified is matched in the specific semantic library to determine whether the semantic request to be identified is a specific semantic request. When a specific semantic request identical to the semantic request to be identified can be matched in the specific semantic library, the semantic request to be identified is considered to be a specific semantic request, otherwise, the semantic request to be identified is not a specific semantic request. When it is determined that the semantic request to be identified is a specific semantic request, the template weight g corresponding to the specific semantic request to which the semantic request to be identified belongs is obtained to calculate the target semantic type recognition result r. When the semantic request to be identified is not a specific semantic request, the template weight g is calculated based on the template vector, the confidence threshold and the text feature. In this way, a technical solution is implemented for a specific semantic request, in which the template weight can be optionally set to select whether to rely on the template matching result.

[0137] For example, Figure 4 The flowchart of the semantic request processing process provided by one embodiment of the present application is schematically shown. Figure 4 As shown, the semantic request processing process includes:

[0138] S1. Input the semantic request to be recognized. The semantic request to be recognized can be directly input in text form, or can be input in voice form first and then converted into text form.

[0139] S2. Determine whether the semantic request to be identified is a composite semantic request. The determination of composite semantic requests can be implemented by the semantic type identification method provided in any embodiment of the present application. For example, Figure 5 The illustrated embodiment provides a semantic type identification method for determining whether a semantic request to be identified is composite semantic information.

[0140] S3. If the semantic request to be identified is a compound semantic request, process the compound semantic request.

[0141] S4. If the semantic request to be identified is a simple semantic request, process the simple semantic request.

[0142] For example, Figure 5 The flowchart of the semantic type recognition method provided by one embodiment of the present application is schematically shown. Figure 5 As shown, the semantic type recognition method includes:

[0143] S21, perform template parsing P on the semantic request q to be recognized, and obtain the template feature representation f p .

[0144] Specifically, template parsing refers to matching the target semantic request template in the preset template library according to the semantic request to be identified, and obtaining the template features of the target semantic request template. The template features of the target semantic request template are the template feature representation f p . Let template parsing be denoted as P, then the template feature representation f p =P(q).

[0145] For example, Figure 6 The flow chart of the template parsing process provided by one embodiment of the present application is schematically shown as follows: Figure 6 As shown, the template parsing process includes:

[0146] S211, the semantic request q to be identified is matched by the template matching module P based on the rule template. M , and obtain the template matching result.

[0147] Specifically, the template matching module P M A preset template library is used to match the semantic request q to be identified, where the preset template library includes multiple semantic request templates of specified semantic types.

[0148] Template matching result V p =[p1,…,p m ], p i Indicates the i-th candidate semantic request template that is matched, and m is the total number of candidate semantic request templates that are matched. Each candidate semantic request template includes three parameters, denoted as p i =(c i ,s i ,t pi ), where: c i ∈{0,1}, represents the candidate semantic request template p i The corresponding specified semantic type; when c i =0, indicating candidate semantic request template p i The semantic type is a simple semantic request; when c i =1, indicating candidate semantic request template p i The semantic type is a composite semantic request. i ∈[0,1], represents the candidate semantic request template p i The corresponding confidence score, where 1 is the highest and 0 is the lowest. Represents the candidate semantic request template p i The corresponding template text sequence, where t pij Indicates the jth word in the template text sequence, o i Indicates the total number of words in the template text sequence.

[0149] S212: Input the template matching result into the result selection module P. s, to filter the template matching results according to the confidence score and obtain the target semantic request template p.

[0150] Specifically, multiple candidate semantic request templates are screened according to the confidence scores, and the candidate semantic request template with the highest confidence score is selected as the target semantic request template p = (c, s, t p ), c is the specified semantic type corresponding to the target semantic request template p, s is the confidence score corresponding to the target semantic request template p, t p Request the template text sequence corresponding to the target semantic template p.

[0151] S213: Input the target semantic request template p into the feature representation module P. r , to extract features from the target semantic request template p and generate the template feature representation f of the target semantic request template p p .

[0152] Specifically, the feature representation module P t First, the template text sequence y of the target semantic request template p p Perform word segmentation processing to obtain word segmentation results Among them i Represents the i-th template word after word segmentation, n p Indicates the total number of template vocabularies.

[0153] Then, the template text sequence t is transformed into p Converted into vector representation. That is, multiple template words are vector-mapped to obtain multiple word vectors, and multiple word vectors are combined into a template vector matrix. The template vector matrix is ​​the template text sequence t p The vector representation of .

[0154] Next, the template vector matrix is ​​average pooled to obtain the template vector v∈R d , where d represents the dimension of the feature representation vector and R represents a real number.

[0155] Finally, the final template feature representation f is output p =(c,s,v).

[0156] Continue to refer Figure 5 , S22, perform text analysis T on the semantic request q to obtain the text feature representation f t .

[0157] Specifically, the text parsing T is to extract text features from the semantic request to be identified q, and obtain the text features corresponding to the semantic request to be identified q. The text features are the text feature representation ft t .

[0158] For example, Figure 7 The flowchart of the text parsing process provided by one embodiment of the present application is schematically shown as follows: Figure 7 As shown, the text parsing process includes:

[0159] S221 , performing word segmentation processing on the semantic request to be recognized to obtain a plurality of words to be recognized.

[0160] S222: Map the vocabulary to be recognized into vocabulary vectors, and form a vector matrix to be recognized.

[0161] Specifically, if Figure 7 As shown, each word to be recognized is mapped into a word vector of size 1*d. There are w words to be recognized in total, forming a vector matrix to be recognized of size w*d.

[0162] S223. Perform convolution processing on the vector matrix to be identified to obtain multiple convolution vectors.

[0163] Specifically, if Figure 7 As shown in the figure, the matrix of the vector to be identified is convolved with convolution kernels of three sizes: 4*d, 3*d, and 2*d, resulting in three convolution vectors. When convolving the vector to be identified, the convolution kernel only needs to slide from top to bottom, not from left to right.

[0164] In one embodiment of the present application, for each size of convolution kernel, multiple convolution kernels with different weights can be set, that is, for one convolution kernel size, multiple convolution kernels can be set.

[0165] S224. Perform maximum pooling processing on the multiple convolution vectors to obtain multiple pooled data.

[0166] Specifically, the maximum value in each convolution vector is selected as the pooled data corresponding to the convolution vector, so three convolution vectors can obtain three pooled data.

[0167] S225: Combine multiple pooled data to obtain the text feature representation ft corresponding to the semantic request p to be identified. t .

[0168] Specifically, if Figure 7 As shown, the three pooled data are spliced ​​to form a new vector, which is the text feature representation f corresponding to the semantic request p to be identified. t .

[0169] Continue to refer Figure 5 , S23, the template feature is represented by f p And text feature representation f t Input the neural network discriminant model M and obtain the template semantic type recognition result r.

[0170] For example, Figure 8 The structure diagram of the neural network discrimination model M provided by one embodiment of the present application is schematically shown. Figure 8 As shown, the template feature represents f p It includes three parameters: the specified semantic type c corresponding to the target semantic request template p, the confidence score s corresponding to the target semantic request template p, and the template vector v1 of the target semantic request template p.

[0171] On the one hand, the template vector v of the target semantic request template p and the text feature representation f t They are input together into the first fully connected network M1 to obtain the first semantic type recognition result r′.

[0172] On the other hand, the product of the confidence score s corresponding to the target semantic request template p and the template vector v of the target semantic request template p is added to the text feature representation f t They are input together into the second fully connected network M2 to obtain the template weight g, g∈R. Then the second semantic recognition result r″ is obtained according to the product of the template weight g and the specified semantic type c corresponding to the target semantic request template p.

[0173] Finally, the template semantic recognition result r is obtained according to the first semantic recognition result r′, the second semantic type recognition result r″ and the template weight g. The calculation method is as follows:

[0174]

[0175] When r=0, it indicates that the target semantic type corresponding to the semantic request to be identified is a simple semantic request; when r=1, it indicates that the target semantic type corresponding to the semantic request to be identified is a compound semantic request.

[0176] The technical solution provided in the embodiment of the present application takes into account the prior knowledge provided by the semantic request template on the one hand, and the text features of the semantic request to be identified on the other hand, that is, multi-angle features are taken into account in the semantic type recognition process, thereby improving the accuracy and generalization ability of semantic recognition.

[0177] For example, Table 1 below shows a comparison of the effects of the technical solution of the present application and the traditional semantic type recognition method.

[0178] Table 1

[0179] method Prec Recall F1 Rule-based templates 0.9874 0.5064 0.6695 Based on neural network 0.9191 0.9220 0.9206 Technical solution of this application 0.9741 0.9327 0.9530

[0180] Prec represents the recognition accuracy, which indicates the proportion of samples with accurate semantic type recognition to the total number of samples. Recall represents the recall rate, which indicates the proportion of positive samples with accurate semantic type recognition to the total number of positive samples. F1 is the harmonic mean of the recognition accuracy and recall rates.

[0181] As can be seen from Table 1, the recognition accuracy and recall rate of the technical solution of the present application are both high, and the F1 index value obtained is also significantly higher than that of the other two traditional technical solutions. The technical solution of the present application can effectively improve the accuracy and generalization ability of semantic recognition in practical applications.

[0182] It should be noted that although the steps of the method of the present application are described in a specific order in the drawings, this does not require or imply that the steps must be performed in this specific order, or that all steps must be performed to achieve the desired results. Additionally or alternatively, some steps may be omitted, multiple steps may be combined into one step, and / or one step may be decomposed into multiple steps.

[0183] The following introduces an apparatus embodiment of the present application, which can be used to execute the semantic type recognition method in the above-mentioned embodiment of the present application. Figure 9 The following schematically shows a block diagram of a semantic type recognition device provided by an embodiment of the present application. Figure 9 As shown, the semantic type recognition device provided in the embodiment of the present application includes:

[0184] The template matching module 910 is used to match the semantic request to be identified in a preset template library to obtain a target semantic request template and acquire template features of the target semantic request template; the preset template library includes multiple semantic request templates of specified semantic types;

[0185] A text feature extraction module 920 is configured to extract text features from the semantic request to be identified, and obtain text features corresponding to the semantic request to be identified;

[0186] A first semantic type recognition module 930 is configured to perform first semantic type recognition on the template features of the target semantic request template and the text features to obtain a first semantic type recognition result;

[0187] The target semantic type identification module 940 is used to fuse the first semantic type identification result and the specified semantic type corresponding to the target semantic request template to obtain a target semantic type identification result. The target semantic type identification result indicates that the type of the semantic request to be identified is a compound semantic request or a simple semantic request. The compound semantic request includes a semantic request with multiple intentions, and the simple semantic request includes a semantic request with a single intention.

[0188] In one embodiment of the present application, the template matching module 910 includes:

[0189] A template screening unit is used to match the semantic request to be identified in a preset template library to obtain multiple candidate semantic request templates; calculate the confidence score of each candidate semantic request template, and the confidence score is negatively correlated with the proportion of wildcards in the semantic request to be identified; and screen the multiple candidate semantic request templates according to the confidence score to obtain a target semantic request template.

[0190] In one embodiment of the present application, the template feature includes a template vector; the template matching module 910 includes:

[0191] A template feature extraction unit is used to perform word segmentation processing on the target semantic request template to obtain multiple template words; perform vector mapping on the multiple template words to obtain multiple word vectors, and form the multiple word vectors into a template vector matrix; and perform pooling processing on the template vector matrix to obtain a template vector of the target semantic request template.

[0192] In one embodiment of the present application, the target semantic type identification module 940 includes:

[0193] A weight acquisition unit, configured to acquire a template weight, wherein the template weight reflects the importance of the specified semantic type of the target semantic request template in the target semantic type recognition result;

[0194] A second semantic recognition result obtaining unit, configured to adjust the specified semantic type of the target semantic request template according to the template weight to obtain a second semantic type recognition result;

[0195] The target result acquisition unit is used to fuse the first semantic type recognition result and the second semantic type recognition result to obtain the target semantic type recognition result.

[0196] In one embodiment of the present application, the weight acquisition unit is specifically configured to:

[0197] Check whether the template weight parameter has the set value;

[0198] If the template weight parameter has a set value, the set value is used as the template weight;

[0199] If the template weight parameter does not have a set value, the template weight is calculated based on the template features of the target semantic request template and the text features.

[0200] In one embodiment of the present application, the template features of the target semantic request template include a template vector of the target semantic request template and a confidence score of the target semantic request template; and the weight acquisition unit is further configured to:

[0201] Multiplying the template vector of the target semantic request template and the confidence score of the target semantic request template to obtain an initial weight;

[0202] Feature extraction and mapping processing are performed according to the initial weight and the text feature to obtain the template weight.

[0203] In one embodiment of the present application, the text feature extraction module 920 is specifically used to:

[0204] Performing word segmentation processing on the semantic request to be recognized to obtain a plurality of words to be recognized;

[0205] Performing vector mapping on the plurality of to-be-recognized words to obtain a plurality of vocabulary vectors, and forming a to-be-recognized vector matrix from the plurality of vocabulary vectors;

[0206] Performing convolution processing on the vector matrix to be identified using convolution kernels of various sizes to obtain multiple convolution vectors;

[0207] Performing pooling processing on the multiple convolution vectors to obtain multiple pooled data;

[0208] The multiple pooled data are spliced ​​together to obtain text features corresponding to the semantic request to be identified.

[0209] The specific details of the semantic recognition device provided in each embodiment of the present application have been described in detail in the corresponding method embodiments and will not be repeated here.

[0210] Figure 10 The block diagram schematically shows a computer system structure of an electronic device used to implement an embodiment of the present application.

[0211] It should be noted that Figure 10 The computer system 1000 of the electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0212] like Figure 10As shown, the computer system 1000 includes a central processing unit (CPU) 1001, which can perform various appropriate actions and processes according to the program stored in the read-only memory 1002 (ROM) or the program loaded from the storage part 1008 into the random access memory 1003 (RAM). Various programs and data required for system operation are also stored in the random access memory 1003. The CPU 1001, the read-only memory 1002, and the random access memory 1003 are connected to each other via a bus 1004. An input / output interface 1005 (i.e., an I / O interface) is also connected to the bus 1004.

[0213] The following components are connected to the input / output interface 1005: an input section 1006 including a keyboard, a mouse, and the like; an output section 1007 including devices such as a cathode ray tube (CRT), a liquid crystal display (LCD), and a speaker; a storage section 1008 including a hard disk; and a communication section 1009 including a network interface card such as a local area network card or a modem. The communication section 1009 performs communication processing via a network such as the Internet. A drive 1010 is also connected to the input / output interface 1005 as needed. Removable media 1011, such as a magnetic disk, an optical disk, a magneto-optical disk, or a semiconductor memory, is installed in the drive 1010 as needed, so that computer programs read therefrom can be installed into the storage section 1008 as needed.

[0214] In particular, according to an embodiment of the present application, the processes described in the various method flow charts can be implemented as computer software programs. For example, an embodiment of the present application includes a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for executing the methods shown in the flow charts. In such an embodiment, the computer program can be downloaded and installed from a network via the communication portion 1009 and / or installed from a removable medium 1011. When the computer program is executed by the central processing unit 1001, the various functions defined in the system of the present application are performed.

[0215] It should be noted that the computer-readable medium shown in the embodiments of the present application may be a computer-readable signal medium or a computer-readable storage medium or any combination of the two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or component, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present application, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, which carries a computer-readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer-readable medium may be transmitted using any suitable medium, including but not limited to wireless, wired, or any suitable combination thereof.

[0216] The flowcharts and block diagrams in the accompanying drawings illustrate the possible implementation architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present application. In this regard, each box in the flowchart or block diagram can represent a module, program segment, or a part of code, and the above-mentioned module, program segment, or a part of code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in an order different from that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of the boxes in the block diagram or flowchart, can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0217] It should be noted that, although several modules or units of the device for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiment of the application, the features and functions of two or more modules or units described above can be concretized in one module or unit. On the contrary, the features and functions of one module or unit described above can be further divided into multiple modules or units to be concretized.

[0218] Through the description of the above embodiments, it is easy for those skilled in the art to understand that the example embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solution according to the embodiments of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which can be a personal computer, a server, a touch terminal, or a network device, etc.) to execute the method according to the embodiments of the present application.

[0219] Those skilled in the art will readily appreciate other embodiments of the present invention after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present invention that follow the general principles of this application and include common knowledge or customary techniques in the art that are not disclosed herein.

[0220] It should be understood that the present application is not limited to the exact structures described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.

Claims

1. A semantic type recognition method, characterized in that: include: Matching the semantic request to be identified in a preset template library to obtain a target semantic request template, and obtaining template features of the target semantic request template; The preset template library includes a plurality of semantic request templates of specified semantic types; Performing text feature extraction on the semantic request to be identified to obtain text features corresponding to the semantic request to be identified; Performing a first semantic type recognition based on the template features of the target semantic request template and the text features to obtain a first semantic type recognition result; The first semantic type recognition result and the specified semantic type corresponding to the target semantic request template are fused to obtain a target semantic type recognition result. The target semantic type recognition result indicates that the type of the semantic request to be identified is a compound semantic request or a simple semantic request. The compound semantic request includes a semantic request with multiple intentions, and the simple semantic request includes a semantic request with a single intention.

2. The semantic type recognition method according to claim 1, characterized in that: The target semantic request template is obtained by matching the semantic request to be identified in the preset template library, including: According to the semantic request to be identified, a plurality of candidate semantic request templates are obtained by matching in a preset template library; Calculating a confidence score for each candidate semantic request template, wherein the confidence score is negatively correlated with the proportion of wildcards in the semantic request to be identified; The multiple candidate semantic request templates are screened according to the confidence scores to obtain a target semantic request template.

3. The semantic type recognition method according to claim 1, characterized in that: The template feature includes a template vector; Acquiring template features of the target semantic request template includes: Performing word segmentation processing on the target semantic request template to obtain multiple template words; Performing vector mapping on the multiple template words to obtain multiple word vectors, and forming a template vector matrix from the multiple word vectors; Pooling is performed on the template vector matrix to obtain a template vector of the target semantic request template.

4. The semantic type recognition method according to claim 1, characterized in that: The first semantic type recognition result and the specified semantic type corresponding to the target semantic request template are merged to obtain a target semantic type recognition result, including: Acquire a template weight, where the template weight reflects the importance of the specified semantic type of the target semantic request template in the target semantic type recognition result; Adjusting the specified semantic type of the target semantic request template according to the template weight to obtain a second semantic type recognition result; The first semantic type recognition result and the second semantic type recognition result are fused to obtain the target semantic type recognition result.

5. The semantic type recognition method according to claim 4, characterized in that: Get the template weight, including: Check whether the template weight parameter has the set value; If the template weight parameter has a set value, the set value is used as the template weight; If the template weight parameter does not have a set value, the template weight is calculated based on the template features of the target semantic request template and the text features.

6. The semantic type recognition method according to claim 5, characterized in that: The template features of the target semantic request template include a template vector of the target semantic request template and a confidence score of the target semantic request template; The template weight is calculated according to the template features of the target semantic request template and the text features, including: Multiplying the template vector of the target semantic request template and the confidence score of the target semantic request template to obtain an initial weight; Feature extraction and mapping processing are performed according to the initial weight and the text feature to obtain the template weight.

7. The semantic type recognition method according to any one of claims 1 to 6, characterized in that: Performing text feature extraction on the semantic request to be identified to obtain text features corresponding to the semantic request to be identified includes: Performing word segmentation processing on the semantic request to be recognized to obtain a plurality of words to be recognized; Performing vector mapping on the plurality of to-be-recognized words to obtain a plurality of vocabulary vectors, and forming a to-be-recognized vector matrix from the plurality of vocabulary vectors; Performing convolution processing on the vector matrix to be identified using convolution kernels of various sizes to obtain multiple convolution vectors; Performing pooling processing on the multiple convolution vectors to obtain multiple pooled data; The multiple pooled data are spliced ​​together to obtain text features corresponding to the semantic request to be identified.

8. A semantic type recognition device, characterized in that: include: A template matching module is used to match the semantic request to be identified in a preset template library to obtain a target semantic request template and acquire template features of the target semantic request template; The preset template library includes a plurality of semantic request templates of specified semantic types; A text feature extraction module is used to extract text features from the semantic request to be identified, and obtain text features corresponding to the semantic request to be identified; A first semantic type recognition module is configured to perform first semantic type recognition based on the template features of the target semantic request template and the text features to obtain a first semantic type recognition result; A target semantic type identification module is used to fuse the first semantic type identification result and the specified semantic type corresponding to the target semantic request template to obtain a target semantic type identification result. The target semantic type identification result indicates that the type of the semantic request to be identified is a compound semantic request or a simple semantic request. The compound semantic request includes a semantic request with multiple intentions, and the simple semantic request includes a semantic request with a single intention.

9. A computer-readable medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method for semantic type recognition according to any one of claims 1 to 7 is implemented.

10. An electronic device, characterized in that: include: processor; as well as a memory for storing executable instructions of the processor; The processor executes the executable instructions so that the electronic device executes the semantic type recognition method described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Semantic recognition method and device, storage medium and processor

    CN111739537A

  • Text intention recognition method and device and related equipment

    CN112417855A