Semantic recognition method, device, electronic device and storage medium
Through the multi-module semantic recognition method, combining text matching, grammar rules and natural language understanding, the highest priority result is selected as the target recognition result, which solves the problem of low semantic recognition accuracy and realizes rapid cold start and intelligent intention analysis.
Patent Information
- Application Number
- CN202011627199.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-12-31
- Publication Date
- 2025-08-19
- Estimated Expiration
- 2040-12-31
AI Technical Summary
In the prior art, the accuracy of semantic recognition is low, especially in vertical scenarios, where robots cannot quickly analyze user intentions when cold starts, and the Q&A service relies on manual intervention, with low success rate and poor scalability.
At least two semantic recognition modules are used to process the recognition text, and a semantic recognition result is selected as the target recognition result according to the module's priority, including text matching module, grammar rule recognition module, natural language understanding module and question and answer module, to improve the recognition accuracy through convolutional layer and domain feature vector fusion.
It improves the accuracy of semantic recognition results, supports rapid cold start iteration and later intelligent improvement of intention analysis, reduces manual intervention, and enhances the scalability of the system.
Smart Images

Figure CN114691841B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of semantic recognition technology, and in particular to a semantic recognition method, device, electronic device and storage medium. Background Art
[0002] With the development of internet technology, more and more smart devices are using voice for human-computer interaction. Users can interact with smart devices through voice, enabling functions such as booking flights, searching for information, and chatting, freeing their hands and bringing many conveniences to their lives. As a result, users' requirements for voice human-computer interaction technology are becoming increasingly higher, and how smart devices understand human voice input is becoming a growing concern.
[0003] Taking robots as an example, in vertical scenarios, robots often face the cold start problem. Without sufficient data, they need to be able to parse user query intent. After a period of operation and data reflow, they hope to have technology with autonomous iteration capabilities to parse user query intent. In vertical scenarios, most query parsing relies on question-and-answer services. However, question-and-answer services require operators to pre-configure question and answer pairs, which require frequent manual intervention, have a high success rate, low scalability, and a high false recall rate, making them unable to truly parse user intent. Therefore, there is an urgent need for semantic parsing solutions that can support rapid cold start iterations in the early stages of intent parsing and then enhance intent parsing capabilities through intelligent technology. Summary of the Invention
[0004] The embodiments of the present application provide a semantic recognition method, device, electronic device and storage medium, which solve the problem of low semantic recognition accuracy in the prior art.
[0005] In a first aspect, a semantic recognition method is provided, which may include:
[0006] Get the text to be recognized;
[0007] Using at least two semantic recognition modules to perform semantic recognition processing on the text to be recognized respectively;
[0008] From the output semantic recognition results, one semantic recognition result is selected as the target recognition result.
[0009] In a possible implementation, selecting a semantic recognition result from the output semantic recognition results and determining it as a target recognition result includes:
[0010] According to the priorities corresponding to the semantic recognition modules, the semantic recognition result output by the semantic recognition module with the highest priority is selected from the output semantic recognition results, and is determined as the target recognition result of the text to be recognized.
[0011] In one possible implementation, the at least two semantic recognition modules include: at least two of: a text matching module, a grammar rule recognition module, a natural language understanding (NLU) module, and a question-answering module; wherein:
[0012] The priority of the text matching module is higher than that of the grammar rule recognition module, the priority of the grammar rule recognition module is higher than that of the NLU module, and the priority of the NLU module is higher than that of the question-answering module.
[0013] In one possible implementation, the question-and-answer module includes a first question-and-answer module and a second question-and-answer module, wherein the first question-and-answer module performs text similarity matching based on pre-configured texts, and the second question-and-answer module performs text keyword matching based on pre-configured keywords;
[0014] Among them, the priority of the first question and answer module is higher than the priority of the second question and answer module.
[0015] In a possible implementation, selecting a semantic recognition result from the output semantic recognition results and determining it as a target recognition result includes:
[0016] If the second question-answering module recognizes that the text to be recognized contains the specified keyword, the semantic recognition result output by the second question-answering module is determined as the target recognition result;
[0017] or
[0018] If the second question-answering module recognizes that the text to be recognized does not contain the specified keyword, a semantic recognition result is selected from the output semantic recognition results and determined as the target recognition result.
[0019] In a possible implementation, selecting a semantic recognition result from the output semantic recognition results and determining it as a target recognition result includes:
[0020] If neither the text matching module nor the grammar rule module has an output, and the NLU module identifies that the domain corresponding to the text to be recognized is the target domain, the semantic recognition result output by the question-answering module is determined as the target recognition result;
[0021] or
[0022] If both the text matching module and the grammar rule module have no output, and the NLU module recognizes that the domain corresponding to the text to be recognized is the target domain, and the intent corresponding to the text to be recognized is the target intent, then the target domain and the target intent are determined as the target recognition result.
[0023] In one possible implementation, the method further includes:
[0024] If both the text matching module and the grammar rule module have no output, and the NLU module recognizes that the domain corresponding to the text to be recognized is not the target domain, it is determined that the semantics of the text to be recognized cannot be recognized.
[0025] In one possible implementation, determining the semantic recognition result output by the second question-answering module as the target recognition result includes:
[0026] If both the first question-and-answer module and the second question-and-answer module in the question-and-answer module output corresponding semantic recognition results, the semantic recognition result output by the first question-and-answer module is determined as the target recognition result.
[0027] In one possible implementation, the step of the NLU module identifying the domain corresponding to the text to be recognized includes:
[0028] Using four convolution layers with different convolution kernels, convolution is performed on the sentence vector corresponding to the text to be recognized and the dictionary feature vector corresponding to the pre-configured domain, thereby obtaining four domain feature sub-vectors representing the association relationship between the sentence vector and the dictionary feature vector;
[0029] Fusing the four domain feature sub-vectors to obtain a domain feature vector;
[0030] The domain corresponding to the text to be recognized is determined according to the domain feature vector.
[0031] In one possible implementation, the first convolutional layer uses a convolution kernel of size 1×1;
[0032] The size of the convolution kernel used in the second convolution layer is 3×3;
[0033] The convolution kernel sizes used in the third convolution layer are 1×1 and 3×3 respectively;
[0034] The fourth convolutional layer uses convolution kernels of sizes 3×3 and 5×5 respectively.
[0035] In a second aspect, a semantic recognition device is provided, which may include: an acquisition unit, a semantic recognition unit, and a selection unit; wherein:
[0036] The acquiring unit is used to acquire the text to be recognized;
[0037] The semantic recognition unit is used to use at least two semantic recognition modules to perform semantic recognition processing on the text to be recognized respectively;
[0038] The selection unit is used to select a semantic recognition result from the output semantic recognition results and determine it as a target recognition result.
[0039] In a possible implementation, the selection unit is specifically configured to select the semantic recognition result output by the semantic recognition module with the highest priority from the output semantic recognition results according to the priorities corresponding to the semantic recognition modules, and determine it as the target recognition result of the text to be recognized.
[0040] In one possible implementation, the at least two semantic recognition modules include: at least two of: a text matching module, a grammar rule recognition module, a natural language understanding (NLU) module, and a question-answering module; wherein:
[0041] The priority of the text matching module is higher than that of the grammar rule recognition module, the priority of the grammar rule recognition module is higher than that of the NLU module, and the priority of the NLU module is higher than that of the question-answering module.
[0042] In one possible implementation, the question-and-answer module includes a first question-and-answer module and a second question-and-answer module, wherein the first question-and-answer module performs text similarity matching based on pre-configured texts, and the second question-and-answer module performs text keyword matching based on pre-configured keywords;
[0043] Among them, the priority of the first question and answer module is higher than the priority of the second question and answer module.
[0044] In a possible implementation, the selection unit is further specifically configured to determine the semantic recognition result output by the second question-answering module as the target recognition result if the second question-answering module recognizes that the text to be recognized contains a specified keyword;
[0045] or
[0046] If the second question-answering module recognizes that the text to be recognized does not contain the specified keyword, a semantic recognition result is selected from the output semantic recognition results and determined as the target recognition result.
[0047] In one possible implementation, the selection unit is further specifically configured to, if both the text matching module and the grammar rule module have no output, and the NLU module identifies that the domain corresponding to the text to be recognized is the target domain, determine the semantic recognition result output by the question-answering module as the target recognition result;
[0048] or
[0049] If both the text matching module and the grammar rule module have no output, and the NLU module recognizes that the domain corresponding to the text to be recognized is the target domain, and the intent corresponding to the text to be recognized is the target intent, then the target domain and the target intent are determined as the target recognition result.
[0050] In one possible implementation, the apparatus further includes a determining unit;
[0051] The determination unit is configured to determine that the semantics of the text to be recognized cannot be recognized if both the text matching module and the grammar rule module have no output and the NLU module recognizes that the domain corresponding to the text to be recognized is not the target domain.
[0052] In one possible implementation, the determination unit is also used to determine the semantic recognition result output by the first question and answer module as the target recognition result if both the first question and answer module and the second question and answer module in the question and answer module output corresponding semantic recognition results.
[0053] In one possible implementation, the step of the NLU module identifying the domain corresponding to the text to be recognized includes:
[0054] The semantic recognition unit is specifically configured to use four convolution layers with different convolution kernels to convolve the sentence vector corresponding to the text to be recognized with the dictionary feature vector corresponding to the pre-configured domain, thereby obtaining four domain feature sub-vectors representing the association relationship between the sentence vector and the dictionary feature vector;
[0055] Furthermore, the four domain feature sub-vectors are fused to obtain a domain feature vector, and the domain corresponding to the to-be-recognized text is determined based on the domain feature vector.
[0056] In one possible implementation, the first convolutional layer uses a convolution kernel of size 1×1;
[0057] The size of the convolution kernel used in the second convolution layer is 3×3;
[0058] The convolution kernel sizes used in the third convolution layer are 1×1 and 3×3 respectively;
[0059] The fourth convolutional layer uses convolution kernels of sizes 3×3 and 5×5 respectively.
[0060] In a third aspect, an electronic device is provided, the electronic device including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other via the communication bus;
[0061] Memory for storing computer programs;
[0062] The processor is configured to implement any of the method steps described in the first aspect when executing a program stored in the memory.
[0063] In a fourth aspect, a computer-readable storage medium is provided, wherein a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, any of the method steps described in the first aspect is implemented.
[0064] After acquiring a text to be recognized, the semantic recognition method provided by an embodiment of the present invention employs at least two semantic recognition modules to perform semantic recognition processing on the text to be recognized. From the output semantic recognition results, one semantic recognition result is selected as the target recognition result. Compared to existing technologies, this method can perform multiple semantic recognitions on the same text using at least two semantic recognition modules, thereby improving the accuracy of semantic recognition results. BRIEF DESCRIPTION OF THE DRAWINGS
[0065] Figure 1 A schematic diagram of an application scenario of a semantic recognition method provided by an embodiment of the present invention;
[0066] Figure 2 A flowchart of a semantic recognition method provided by an embodiment of the present invention;
[0067] Figure 3 A schematic diagram of a process of performing domain identification on a text to be identified by a natural language understanding model provided in an embodiment of the present invention;
[0068] Figure 4 A schematic diagram of a process for identifying the intent of a text to be identified and slot information provided by an embodiment of the present invention;
[0069] Figure 5 A process diagram of a semantic recognition method provided by an embodiment of the present invention;
[0070] Figure 6 A schematic structural diagram of a semantic recognition device provided by an embodiment of the present invention;
[0071] Figure 7 A schematic structural diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0072] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments of this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0073] For ease of understanding, the terms involved in the embodiments of the present invention are explained below:
[0074] A domain refers to the same type of data or resources, as well as the services provided around these data or resources, such as the weather domain, music domain, train ticket domain, airline ticket domain, etc.
[0075] An intent is the user's intended purpose, identified through interactive input. Typically, an intent refers to an operation on domain data and is typically named using a verb-object phrase. For example, in the airline ticket domain, there are intents such as "buy tickets" and "refund tickets."
[0076] Slots are the information needed to translate initial user intent into a clear user command. A slot corresponds to a specific piece of information required for an intent. In other words, a slot is the parameter information of an intent, and an intent can be expressed through slots. For example, the text "What's the weather like in Beijing today?" has the intent of "checking the weather," which requires necessary elements such as location and time. These necessary elements are slots, with "Beijing" being the location slot and "today" being the time slot.
[0077] Grammar rules (or "syntax rules") are formal rules used to describe the structure of a language's grammatical components. They include the relationship between each field covered by the text and multiple intents, and the relationship between each intent and multiple grammars. Grammar formally defines and describes the structure of the text. Each grammar is composed of entries (or "strings") in the machine dictionary corresponding to different language structure nodes.
[0078] The NLU module includes a pre-trained domain classification model and intent-slot model for semantic analysis of text, such as sentences, paragraphs, or utterances. The NLU module uses domain, intent, and slots to represent semantic results for text semantic recognition.
[0079] Figure 1 Schematic diagram of the application scenario of the semantic recognition method provided in the embodiment of the present invention. During the interaction between the user 10 and the smart device 11, the smart device 11 sends the dialogue information input by the user 10 to the server 12. The server 12 performs semantic recognition processing on the dialogue information uploaded by the smart device 11, clarifies the user's intention, and controls the smart device 11 to respond accordingly to the dialogue information and give feedback to the user. The dialogue information input by the user can be voice information or text information, which is not limited in the embodiment of the present invention. If the dialogue information input by the user is voice information, then before performing semantic recognition processing, voice recognition is first performed on the voice information to obtain the text information corresponding to the voice information.
[0080] In this application scenario, smart device 11 and server 12 communicate via a network, which can be a local area network (LAN), a wide area network (WAN), or the like. Smart device 11 can be a portable device (e.g., a mobile phone, tablet, laptop), a personal computer (PC), or an intelligent control device such as a smart speaker or robot. Server 12 can be any server, a server cluster consisting of multiple servers, or a cloud computing center capable of providing semantic recognition services.
[0081] The following combination Figure 1 The application scenario shown is used to illustrate the technical solution provided by the embodiment of the present invention.
[0082] Figure 2 A flowchart of a semantic recognition method provided in an embodiment of the present application may include:
[0083] Step S210: Obtain the text to be recognized.
[0084] In the embodiment of the present invention, the text to be recognized is user input information, such as query text, which can be voice information or text information. When the user input information is voice information, the existing voice recognition method is used to obtain the text to be recognized corresponding to the voice information.
[0085] Step S220: Use at least two semantic recognition modules to perform semantic recognition processing on the text to be recognized.
[0086] In an embodiment of the present invention, the at least two semantic recognition modules may include at least two of: a text matching module, a grammar rule recognition module, a natural language understanding (NLU) module, and a question-answering module.
[0087] At least two semantic recognition modules among a text matching module, a grammar rule recognition module, an NLU module and a question-answering module are used to perform semantic recognition processing on the text to be recognized.
[0088] The text matching module has a higher priority than the grammar rule recognition module, which in turn has a higher priority than the NLU module, which in turn has a higher priority than the question-answering module. The following describes each semantic recognition module.
[0089] 1. The text matching module performs a complete text match based on pre-configured text. The input to the text matching module is the query text, and the output semantic recognition result is the pre-configured text that matches the query text. Because the semantics of the pre-configured text are known, the response information for the query text can be determined based on the matched pre-configured text.
[0090] The complete text match means that all characters and the order of the characters in the query text completely match all characters and the order of the characters in any pre-configured text.
[0091] For example, if the query text is "How is the weather today?", if the characters and the order of the characters in the target text in the pre-configured text match the characters and the order of the characters in the text "How is the weather today?", then it is determined that the pre-configured target text completely matches the query text.
[0092] In addition, if the query text does not match any pre-configured text, the confirmation text matching module has no output.
[0093] Specifically, if at least one character in the query text does not match a character in the preconfigured text, or the order of the characters in the query text does not match the order of the characters in the preconfigured text, it is determined that the query text does not match the preconfigured text.
[0094] 2. The grammar rule recognition module performs grammar rule matching based on pre-configured grammar rules. The grammar rule recognition module takes the query text as input and determines the query text's intent, slot, and domain based on the matched grammar rules. Based on the query text's intent, slot, and domain, the module determines the response information for the query text.
[0095] Among them, grammar rule matching refers to matching the terms of different language structures in the query text with the terms corresponding to the corresponding language structure nodes in the preset grammar rules.
[0096] 3. The NLU module performs semantic recognition based on a pre-trained domain classification model and intent-slot model. The NLU module takes query text as input and outputs semantic recognition results representing the query text's intent, slot, and domain. Based on the query text's intent, slot, and domain, the module determines the response information for the query text.
[0097] 4. The question-answer module pre-configures question-answer pairs (QA pairs) and performs matching based on them. Specifically, it determines the question that matches the query text and determines the answer corresponding to the matched question as the response information for the query text.
[0098] Furthermore, the question-and-answer module may include a first question-and-answer module and a second question-and-answer module.
[0099] The first question-and-answer module performs text similarity matching based on pre-configured text. Its input is the query text, and its output semantic recognition result is the query information corresponding to the query text. This query information is similar text to the query text. The answer corresponding to this similar text is determined as the reply information to the query text. The similar text can be the pre-configured text corresponding to the maximum similarity among candidate similar texts whose text similarity between the query text and the pre-configured text exceeds a preset similarity threshold.
[0100] The second Q&A module performs text keyword retrieval based on pre-configured keywords. Its input is the query text, and its output is the semantic recognition result of the pre-configured keywords contained in the query text. The answer corresponding to the keyword is determined as the response information to the query text. The priority of the first Q&A module is higher than that of the second Q&A module.
[0101] It is understandable that the grammar rule recognition module can not only be used for semantic recognition of text, but also reversely mine the grammatical structure of the text based on grammar rules, and can also generate query sentences for supplementing the query information in the question-answering module.
[0102] Step S230: Select one semantic recognition result from the output semantic recognition results and determine it as a target recognition result.
[0103] In a specific implementation, if only one semantic recognition module outputs a semantic recognition result, the semantic recognition result is determined as the target recognition result;
[0104] If at least two semantic recognition modules both output semantic recognition results, then the semantic recognition result output by the semantic recognition module with the highest priority can be selected from among the semantic recognition results output by the at least two semantic recognition modules according to their corresponding priorities, and determined as the target recognition result for the text to be recognized. In other words, the semantic recognition result output by the semantic recognition module with the highest priority is selected from among the output semantic recognition results.
[0105] Specifically, the semantic recognition modules, in descending order of priority, include a text matching module, a grammar rule recognition module, an NLU module, a first question-and-answer module, and a second question-and-answer module. After the above semantic recognition modules are used to perform semantic recognition processing on the text to be recognized, selecting a semantic recognition result as the target recognition result may include the following situations:
[0106] In case 1, if the text matching module has output, since the text matching module has the highest priority, at this time, regardless of whether the other semantic recognition modules have output, the semantic recognition result output by the text matching module will be determined as the target recognition result of the text to be recognized.
[0107] In the second case, if the text matching module has no output and the grammar rule recognition module has output, then regardless of whether the NLU module or the question-answering module has output, the semantic recognition result output by the grammar rule recognition module will be determined as the target recognition result of the text to be recognized.
[0108] Case 3: If both the text matching module and the grammar rule recognition module have no output, and the NLU module identifies the domain, intent, and slot corresponding to the text to be recognized, then regardless of whether the question-answering module has output, the semantic recognition result output by the NLU module will be determined as the target recognition result for the text to be recognized.
[0109] Case 4: If the text matching module, grammar rule recognition module and NLU module have no output, and the question-answering module has output, the query information output by the question-answering module is determined as the target recognition result of the text to be recognized.
[0110] In one possible implementation, when the semantic recognition result output by the question-and-answer module is determined as the target recognition result, if only the first question-and-answer module in the question-and-answer module outputs the semantic recognition result, or only the second question-and-answer module outputs the semantic recognition result, then the output semantic recognition result is determined as the target recognition result of the text to be recognized;
[0111] Alternatively, if the first question-and-answer module and the second question-and-answer module in the question-and-answer module both output corresponding semantic recognition results, since the priority of the first question-and-answer module is higher than that of the second question-and-answer module, the semantic recognition result output by the first question-and-answer module is determined as the target recognition result of the text to be recognized.
[0112] Furthermore, since the number of pre-configured question-answer pairs in the question-answer module is limited, the response information corresponding to the text to be recognized determined by the question-answer module may not be what the user intended. In other words, the accuracy of the semantic recognition results output by the question-answer module is low, which can easily lead to false recalls. Therefore, in order to avoid false recalls and improve the accuracy of semantic recognition, a possible implementation method is as follows when the semantic recognition modules with higher priority than the question-answer module have no output and the question-answer module has output:
[0113] If the NLU module identifies the domain of the text to be recognized as the target domain and the question-answering module has an output, the semantic recognition result output by the question-answering module is determined as the target recognition result. The target domain refers to at least one pre-configured domain, which can be configured based on the actual application scenario, such as the shopping domain, navigation domain, music domain, etc.
[0114] In addition, if the NLU module does not recognize that the domain corresponding to the text to be recognized is the target domain, or the NLU module does not recognize the domain corresponding to the text to be recognized, it is determined that the semantics of the text to be recognized cannot be recognized. At this time, whether the question-answering module outputs it is not considered.
[0115] In one possible implementation, the question-and-answer module includes a first question-and-answer module and a second question-and-answer module. Since the first question-and-answer module determines the semantic recognition result based on text similarity and has a high accuracy rate, but the second question-and-answer module only recognizes the user's intention based on keywords, has a low accuracy rate and a high false recall rate, therefore, when only the second question-and-answer module has an output, it is necessary to combine the field corresponding to the text to be recognized to determine whether to adopt the semantic recognition result of the second question-and-answer module.
[0116] In the above embodiment, if the NLU module identifies that the field corresponding to the text to be recognized is the target field, and only the second question-answering module in the question-answering module has an output, the semantic recognition result output by the second question-answering module is determined as the target recognition result.
[0117] Furthermore, if the NLU module identifies the domain corresponding to the text to be recognized as the target domain and the second question-answering module in the question-answering module has no output, then it is determined that the semantics of the text to be recognized cannot be recognized. Alternatively, if the NLU module identifies the domain corresponding to the text to be recognized as a non-target domain, then regardless of whether the second question-answering module has an output, it is determined that the semantics of the text to be recognized cannot be recognized.
[0118] In another possible implementation of the embodiment of the present invention, a specified keyword is pre-configured. If the specified keyword exists in the text to be recognized, the response information determined by the second question-and-answer module will have a high degree of match with the text to be recognized. Therefore, the output result of the second question-and-answer module can be directly determined as the target recognition result. The specific solution is as follows:
[0119] It can detect whether the second question-answering module recognizes that the text to be recognized contains the specified keyword;
[0120] If the second question-answering module recognizes that the text to be recognized contains a specified keyword, the keyword matched with the text to be recognized determined by the second question-answering module is determined as a target recognition result.
[0121] At this time, even if there are semantic recognition results output by other semantic modules, they do not need to be considered. The designated keyword is at least one pre-marked keyword, which can be a keyword that is strongly related to the target field or a keyword that is unrelated to the target field, such as a user-defined keyword.
[0122] Specifically, when the specified keyword is a keyword that is strongly related to the target field, since there are keywords that are strongly related to the target field in the text to be identified, the reply information determined by the second question and answer module will have a high degree of matching with the text to be identified. Therefore, the output result of the second question and answer module can be directly determined as the target recognition result, and the reply information of the text to be identified can be further determined based on the target recognition result.
[0123] When configuring designated keywords, you can configure them based on actual business needs so that there is a high degree of match between the text to be identified containing the designated keywords and the reply information corresponding to the designated keywords identified by the second question-and-answer module. For example, in order to promote sales, the mall may launch some promotional activities. During the promotion period, it may encounter more questions related to the promotional activities. The keywords in the questions related to the promotional activities can be set as designated keywords. In this way, as long as the text to be identified contains the designated keywords, the user is likely to be asking questions related to the promotional activities. At this time, the reply information can meet the user's needs.
[0124] As can be seen, in the above embodiment, if the second question-and-answer module has output, the output of the second question-and-answer module is directly used as the target recognition result to determine the response information for the query text, regardless of whether other semantic recognition modules have output. This allows for a faster and more accurate response to the query text, improving the user experience.
[0125] Furthermore, if the second question-and-answer module recognizes that the text to be recognized does not contain the specified keywords, then according to the priority corresponding to the semantic recognition module, the semantic recognition result output by the semantic recognition module with the highest priority is selected from the semantic recognition results output by the above-mentioned at least two semantic recognition modules, and is determined as the target recognition result of the text to be recognized.
[0126] Based on any of the above embodiments, the steps of using a pre-trained domain model in the NLU module of the embodiment of the present invention, such as a text classification model (text Convolutional Neural Networks, textCNN) model, to identify the domain corresponding to the text to be identified may include:
[0127] Four convolutional layers with different convolution kernels are used to convolve the sentence vector corresponding to the text to be recognized with the dictionary feature vector corresponding to the pre-configured domain, and four domain feature sub-vectors are obtained to represent the association between the sentence vector and the dictionary feature vector; the four domain feature sub-vectors are fused, such as by performing feature fusion in a concatenation manner, to obtain a domain feature vector; based on the domain feature vector, the domain corresponding to the text to be recognized is determined.
[0128] Specifically, the pre-configured domain-corresponding dictionary feature vector is obtained by obtaining the pre-configured domain-corresponding dictionary based on the pre-configured domain-related keywords, and then annotating the domain-related keywords in the text according to the domain-corresponding dictionary.
[0129] The concatenation method is to fuse the calculation results corresponding to each convolution layer, specifically, to concatenate the calculation results corresponding to each convolution layer. For example, assuming that the calculation result corresponding to the input vector in the first convolution layer is: [1, 2, 3], the calculation result corresponding to the input vector in the second convolution layer is: [4, 5, 6], the calculation result corresponding to the input vector in the third convolution layer is: [7, 8, 9], and the calculation result corresponding to the input vector in the fourth convolution layer is: [10, 11, 12]. Then, the calculation results corresponding to these four convolution layers are fused, and the feature vector corresponding to the input vector is: {[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12]}.
[0130] Among them, the size of the convolution kernel used in the first convolution layer is 1×1; the size of the convolution kernel used in the second convolution layer is 3×3; the sizes of the convolution kernels used in the third convolution layer are 1×1 and 3×3 respectively; the sizes of the convolution kernels used in the fourth convolution layer are 3×3 and 5×5 respectively.
[0131] like Figure 3 The domain model in the NLU model shown is a schematic diagram of the process of performing domain identification on the text to be identified.
[0132] There are 4 convolutional layers: the first convolutional layer includes a convolution kernel of size 1×1, the second convolutional layer includes a convolution kernel of size 3×3, the third convolutional layer includes two convolution kernels of size 1×1 and 3×3, and the fourth convolutional layer includes two convolution kernels of size 3×3 and 5×5.
[0133] First, the text to be recognized is segmented, and a preset word vector algorithm, such as the One-Hot encoding algorithm or the word2vec algorithm, is used to obtain the word vector corresponding to each word in the text to be recognized. A preset sentence vector algorithm, such as the bag-of-words model algorithm, is then used to operate on the word vector corresponding to the text to be recognized to obtain the sentence vector corresponding to the text to be recognized.
[0134] Then, a dictionary feature vector corresponding to a pre-configured domain is searched, and the dictionary feature vector has the same length as the sentence vector corresponding to the text to be recognized.
[0135] For example, the text to be recognized is "I want to eat KFC chicken wings", and the dictionary feature vector corresponding to the corresponding field is [0, 0, 0, 1, 1, 1, 0, 0, 0], which includes two types of numbers. Among them, "KFC" is the keyword corresponding to the pre-configured field, so the characters corresponding to "KFC" in the text to be recognized are marked as 1, and the other characters in the text to be recognized except "KFC" are marked as 0.
[0136] Next, the dictionary feature vector corresponding to the domain is concatenated with the sentence vector corresponding to the text to be recognized to obtain the concatenated vector;
[0137] Finally, four convolutional layers with different convolution kernels are used to convolve the spliced vectors respectively to obtain four domain feature sub-vectors that represent the relationship between the sentence vector and the dictionary feature vector. The four domain feature sub-vectors are then fused in a concatenation manner to obtain a domain feature vector. Based on the domain feature vector, the domain corresponding to the text to be identified is determined.
[0138] In the embodiment of the present application, the dictionary feature vector corresponding to the domain makes full use of the domain-related information. The target convolution layer can obtain feature information of different scales in the text to be recognized through the convolution operation of multiple convolution kernels, thereby effectively identifying the domain-related text and improving the accuracy of semantic recognition.
[0139] Based on any of the above embodiments, Figure 4 As shown, the pre-trained Intent-slot model in the NLU module of the embodiment of the present invention includes a Long Short-Term Memory (LSTM) model, a normalization model such as a softmax model, and a Conditional Random Field (CRF) model. The steps of using the pre-trained Intent-slot model to identify the intent and word slot corresponding to the text to be recognized may include:
[0140] First, the LSTM model in the pre-trained Intent-slot model is used to extract features from the sentence vector corresponding to the text to be recognized and the dictionary feature vector corresponding to the pre-configured intent to obtain the intent feature vector.
[0141] The dictionary feature vector corresponding to the pre-configured intent is obtained by obtaining at least one dictionary corresponding to the pre-configured intent based on the entity words related to the pre-configured intent, and then marking the entity words related to the intent in the text according to the at least one dictionary corresponding to the intent.
[0142] Secondly, the softmax model in the Intent-slot model is used to normalize the intent feature vector, output the processed intent feature vector, and determine the intent corresponding to the text to be recognized based on the processed intent feature vector.
[0143] Finally, the CRF model in the Intent-slot model is used to perform slot analysis on the processed intent feature vector, output the slot vector, and determine the slot information corresponding to the text to be recognized based on the slot vector.
[0144] For example, the text to be recognized is "I want to eat KFC chicken wings", and the dictionary feature vector corresponding to the corresponding pre-configured intent is [0, 0, 0, 3, 3, 3, 0, 5, 5]. Among them, the "KFC" entity word can be extracted from the store-related dictionary corresponding to the intent, and the "chicken wings" entity word can be extracted from the food-related dictionary corresponding to the intent. Different numbers are used to mark the text to be recognized, among which "KFC" is the location slot information.
[0145] It should be noted that when there are multiple competing features in the dictionary feature vector corresponding to the domain or the dictionary feature vector corresponding to the intent, the feature vector with the largest non-zero ratio is selected as the corresponding dictionary feature vector. Competition refers to the situation where the features of two feature vectors are different but some features are the same.
[0146] For example, consider the text "I want to eat ice cream." The dictionary feature vector corresponding to the intent domain contains the terms "I want to eat ice" and "I want to eat ice cream." The first feature vector corresponding to the term "I want to eat ice" is [0, 0, 2, 2], and the second feature vector corresponding to the term "I want to eat ice cream" is [0, 0, 2, 2, 2]. The features in the first and second feature vectors are different, but some features are the same. In this case, the second feature vector with the largest non-zero percentage is selected as the dictionary feature vector corresponding to the intent of the text.
[0147] Based on any of the above embodiments, the training process of the intent-slot model in the NLU module is as follows:
[0148] Obtain text samples, where each text sample corresponds to intent annotation information and slot annotation information;
[0149] Input the sentence vector corresponding to the text sample and the dictionary feature vector corresponding to the pre-configured intent into the initial intent-slot model, and output the intent and slot information of the text sample;
[0150] Furthermore, based on the intent loss value between the output intent and the intent annotation information of the corresponding text sample, as well as the slot loss value between the output slot information and the slot annotation information of the corresponding text sample, the initial intent-slot model is iteratively trained to obtain a trained intent and slot model.
[0151] It can be seen that during the training process, the loss values generated by the intent and slot information can be shared to complete the training of the initial intent-slot model. For example, the initial intent-slot model can be iteratively trained based on the maximum likelihood values of the intent loss value and the slot loss value to obtain a trained intent-slot model. For another example, the initial intent-slot model can be iteratively trained based on the weighted values of the intent loss value and the slot loss value with the corresponding preset weights, such as the intention loss value having a weight of 0.8 and the slot loss value having a weight of 0.2, to obtain a trained intent-slot model.
[0152] In one example, if Figure 5 Schematic diagram of the process of semantic recognition method shown.
[0153] For example, let's consider the shopping mall as a target domain. After obtaining the text to be recognized, such as "I want to eat KFC chicken wings," the semantic recognition modules of the text matching module, grammar rule recognition module, NLU module, and question-answering module are used to perform semantic recognition processing on the text to be recognized. The question-answering module includes a question-answer similarity module and a question-answer keyword module. The priority of these semantic recognition modules, from highest to lowest, is as follows: text matching module, grammar rule recognition module, NLU module priority, question-answer similarity module, and question-answer keyword module.
[0154] Detect whether the question-answering keyword module recognizes that the text to be recognized contains the specified keyword "KFC";
[0155] If so, the keywords output by the question-answer keyword module are determined as the target recognition results;
[0156] If not, one semantic recognition result is selected from the output semantic recognition results according to the priority corresponding to the semantic recognition module and determined as the target recognition result.
[0157] Specific options may include the following:
[0158] (1) If at least one of the semantic recognition modules with a higher priority than the question-answer keyword module has an output, the semantic recognition result output by the semantic recognition module with the highest priority among the output semantic recognition results is determined as the target recognition result of the text to be recognized.
[0159] (2) If the semantic recognition modules with a higher priority than the question-answer keyword module have no output, and the question-answer keyword module has output, then when the NLU module identifies that the field corresponding to the text to be recognized is the shopping mall field, the keyword output by the question-answer keyword module is determined as the target recognition result.
[0160] Alternatively, if the semantic recognition modules with a higher priority than the question-answer keyword module have no output, and the question-answer keyword module has output, when the NLU module does not recognize that the field corresponding to the text to be recognized is the shopping mall field, it is determined that the semantics of the text to be recognized cannot be recognized.
[0161] The semantic recognition method provided by the embodiments of the present invention, after acquiring a text to be recognized, uses at least two semantic recognition modules to perform semantic recognition processing on the text to be recognized. From the output semantic recognition results, one semantic recognition result is selected as the target recognition result. Compared with existing technologies, this method can perform semantic recognition on the same text multiple times using at least two semantic recognition modules, thereby improving the accuracy of semantic recognition results.
[0162] Corresponding to the above method, the embodiment of the present invention also provides a semantic recognition device, such as Figure 6 As shown, the semantic recognition device includes: an acquisition unit 610, a semantic recognition unit 620 and a selection unit 630; wherein:
[0163] An acquisition unit 610 is used to acquire text to be recognized;
[0164] A semantic recognition unit 620 is configured to use at least two semantic recognition modules to perform semantic recognition processing on the text to be recognized;
[0165] The selection unit 630 is configured to select one semantic recognition result from the output semantic recognition results and determine it as a target recognition result.
[0166] In one possible implementation, the selection unit 630 is specifically configured to select the semantic recognition result output by the semantic recognition module with the highest priority from the output semantic recognition results according to the priorities corresponding to the semantic recognition modules, and determine it as the target recognition result of the text to be recognized.
[0167] In one possible implementation, the at least two semantic recognition modules include: at least two of: a text matching module, a grammar rule recognition module, a natural language understanding (NLU) module, and a question-answering module; wherein:
[0168] The priority of the text matching module is higher than that of the grammar rule recognition module, the priority of the grammar rule recognition module is higher than that of the NLU module, and the priority of the NLU module is higher than that of the question-answering module.
[0169] In one possible implementation, the question-and-answer module includes a first question-and-answer module and a second question-and-answer module, wherein the first question-and-answer module performs text similarity matching based on pre-configured texts, and the second question-and-answer module performs text keyword matching based on pre-configured keywords;
[0170] Among them, the priority of the first question and answer module is higher than the priority of the second question and answer module.
[0171] In one possible implementation, the selection unit 630 is further specifically configured to determine the semantic recognition result output by the second question-answering module as the target recognition result if the second question-answering module recognizes that the text to be recognized contains a specified keyword;
[0172] Alternatively, if the second question-answering module recognizes that the text to be recognized does not contain the specified keyword, one semantic recognition result is selected from the output semantic recognition results and determined as the target recognition result.
[0173] In one possible implementation, the selection unit 630 is further specifically configured to, if neither the text matching module nor the grammar rule module has an output, and the NLU module identifies that the domain corresponding to the to-be-recognized text is a target domain, determine the semantic recognition result output by the question-answering module as the target recognition result;
[0174] Alternatively, if the text matching module and the grammar rule module have no output, and the NLU module recognizes that the domain corresponding to the text to be recognized is the target domain, and the intent corresponding to the text to be recognized is the target intent, then the target domain and the target intent are determined as the target recognition result.
[0175] In one possible implementation, the apparatus further includes a determining unit 640;
[0176] The determination unit 640 is configured to determine that the semantics of the text to be recognized cannot be recognized if both the text matching module and the grammar rule module have no output and the NLU module recognizes that the domain corresponding to the text to be recognized is not the target domain.
[0177] In one possible implementation, the determination unit 640 is further used to determine the semantic recognition result output by the first question and answer module as the target recognition result if both the first question and answer module and the second question and answer module in the question and answer module output semantic recognition results.
[0178] In one possible implementation, the step of the NLU module identifying the domain corresponding to the text to be recognized includes:
[0179] The semantic recognition unit 620 is specifically configured to use four convolution layers with different convolution kernels to convolve the sentence vector corresponding to the text to be recognized with the dictionary feature vector corresponding to the pre-configured domain, thereby obtaining four domain feature sub-vectors representing the association between the sentence vector and the dictionary feature vector;
[0180] Furthermore, the four domain feature sub-vectors are fused to obtain a domain feature vector, and the domain corresponding to the to-be-recognized text is determined based on the domain feature vector.
[0181] In one possible implementation, the first convolutional layer uses a convolution kernel of size 1×1;
[0182] The size of the convolution kernel used in the second convolution layer is 3×3;
[0183] The convolution kernel sizes used in the third convolution layer are 1×1 and 3×3 respectively;
[0184] The fourth convolutional layer uses convolution kernels of sizes 3×3 and 5×5 respectively.
[0185] The functions of the various functional units of the semantic recognition device provided in the above embodiments of the present invention can be realized through the above method steps. Therefore, the specific working process and beneficial effects of each unit in the semantic recognition device provided in the embodiment of the present invention will not be repeated here.
[0186] The embodiment of the present invention further provides an electronic device, such as Figure 7 As shown, it includes a processor 710 , a communication interface 720 , a memory 730 and a communication bus 740 , wherein the processor 710 , the communication interface 720 , and the memory 730 communicate with each other via the communication bus 740 .
[0187] Memory 730, for storing computer programs;
[0188] The processor 710 is configured to execute the program stored in the memory 730 by performing the following steps:
[0189] Get the text to be recognized;
[0190] Using at least two semantic recognition modules to perform semantic recognition processing on the text to be recognized respectively;
[0191] From the output semantic recognition results, one semantic recognition result is selected as the target recognition result.
[0192] In a possible implementation, selecting a semantic recognition result from the output semantic recognition results and determining it as a target recognition result includes:
[0193] According to the priorities corresponding to the semantic recognition modules, the semantic recognition result output by the semantic recognition module with the highest priority is selected from the output semantic recognition results, and is determined as the target recognition result of the text to be recognized.
[0194] In one possible implementation, the at least two semantic recognition modules include: at least two of: a text matching module, a grammar rule recognition module, a natural language understanding (NLU) module, and a question-answering module; wherein:
[0195] The priority of the text matching module is higher than that of the grammar rule recognition module, the priority of the grammar rule recognition module is higher than that of the NLU module, and the priority of the NLU module is higher than that of the question-answering module.
[0196] In one possible implementation, the question-and-answer module includes a first question-and-answer module and a second question-and-answer module, wherein the first question-and-answer module performs text similarity matching based on pre-configured texts, and the second question-and-answer module performs text keyword matching based on pre-configured keywords;
[0197] Among them, the priority of the first question and answer module is higher than the priority of the second question and answer module.
[0198] In a possible implementation, selecting a semantic recognition result from the output semantic recognition results and determining it as a target recognition result includes:
[0199] If the second question-answering module recognizes that the text to be recognized contains the specified keyword, the semantic recognition result output by the second question-answering module is determined as the target recognition result;
[0200] or
[0201] If the second question-answering module recognizes that the text to be recognized does not contain the specified keyword, a semantic recognition result is selected from the output semantic recognition results and determined as the target recognition result.
[0202] In a possible implementation, selecting a semantic recognition result from the output semantic recognition results and determining it as a target recognition result includes:
[0203] If neither the text matching module nor the grammar rule module has an output, and the NLU module identifies that the domain corresponding to the text to be recognized is the target domain, the semantic recognition result output by the question-answering module is determined as the target recognition result;
[0204] or
[0205] If both the text matching module and the grammar rule module have no output, and the NLU module recognizes that the domain corresponding to the text to be recognized is the target domain, and the intent corresponding to the text to be recognized is the target intent, then the target domain and the target intent are determined as the target recognition result.
[0206] In one possible implementation, the method further includes:
[0207] If both the text matching module and the grammar rule module have no output, and the NLU module recognizes that the domain corresponding to the text to be recognized is not the target domain, it is determined that the semantics of the text to be recognized cannot be recognized.
[0208] In one possible implementation, determining the semantic recognition result output by the second question-answering module as the target recognition result includes:
[0209] If both the first question-and-answer module and the second question-and-answer module in the question-and-answer module output corresponding semantic recognition results, the semantic recognition result output by the first question-and-answer module is determined as the target recognition result.
[0210] In one possible implementation, the step of the NLU module identifying the domain corresponding to the text to be recognized includes:
[0211] Using four convolution layers with different convolution kernels, convolution is performed on the sentence vector corresponding to the text to be recognized and the dictionary feature vector corresponding to the pre-configured domain, thereby obtaining four domain feature sub-vectors representing the association relationship between the sentence vector and the dictionary feature vector;
[0212] Fusing the four domain feature sub-vectors to obtain a domain feature vector;
[0213] The domain corresponding to the text to be recognized is determined according to the domain feature vector.
[0214] In one possible implementation, the first convolutional layer uses a convolution kernel of size 1×1;
[0215] The size of the convolution kernel used in the second convolution layer is 3×3;
[0216] The convolution kernel sizes used in the third convolution layer are 1×1 and 3×3 respectively;
[0217] The fourth convolutional layer uses convolution kernels of sizes 3×3 and 5×5 respectively.
[0218] The communication bus mentioned above can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. This communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is used in the figure, but this does not mean that there is only one bus or only one type of bus.
[0219] The communication interface is used for communication between the above electronic device and other devices.
[0220] The memory may include random access memory (RAM) or non-volatile memory (NVM), such as at least one disk storage. Alternatively, the memory may be at least one storage device located away from the processor.
[0221] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, and discrete hardware components.
[0222] The implementation methods and beneficial effects of the various components of the electronic device in the above embodiments to solve the problems can be found in Figure 2 The various steps in the embodiments shown are implemented, therefore, the specific working process and beneficial effects of the electronic device provided by the embodiments of the present invention are not repeated here.
[0223] In another embodiment of the present invention, a computer-readable storage medium is provided. The computer-readable storage medium stores instructions that, when executed on a computer, enable the computer to execute any of the semantic recognition methods described in the above embodiments.
[0224] In another embodiment of the present invention, a computer program product including instructions is provided. When the computer program product is run on a computer, the computer executes the semantic recognition method described in any one of the above embodiments.
[0225] Those skilled in the art will appreciate that the embodiments of the present application can be provided as methods, systems, or computer program products. Therefore, the embodiments of the present application can be implemented in the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Furthermore, the embodiments of the present application can be implemented in the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0226] The embodiments of the present application are described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the steps in the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0227] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.
[0228] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0229] Although preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they become aware of the basic creative concepts. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present invention.
[0230] Obviously, those skilled in the art can make various changes and modifications to the embodiments of the present application without departing from the spirit and scope of the embodiments of the present application. Thus, if these modifications and variations of the embodiments of the present application fall within the scope of the claims and their equivalents, the embodiments of the present application are also intended to include these modifications and variations.
Claims
1. A semantic recognition method, characterized in that: The method comprises: Get the text to be recognized; Using at least two semantic recognition modules to perform semantic recognition processing on the text to be recognized, the at least two semantic recognition modules include: at least two of a text matching module, a grammar rule recognition module, a natural language understanding (NLU) module, and a question-answering module; Selecting one semantic recognition result from the output semantic recognition results as a target recognition result, including: if both the text matching module and the grammar rule module have no output, and the NLU module identifies that the field corresponding to the text to be recognized is the target field, then determining the semantic recognition result output by the question-answering module as the target recognition result; The step of the NLU module identifying the field corresponding to the text to be recognized includes: using four convolution layers with different convolution kernels to convolve the sentence vector corresponding to the text to be recognized with the dictionary feature vector corresponding to the pre-configured field, to obtain four field feature sub-vectors representing the association relationship between the sentence vector and the dictionary feature vector; fusing the four field feature sub-vectors to obtain a field feature vector; and determining the field corresponding to the text to be recognized based on the field feature vector.
2. The method according to claim 1, wherein From the output semantic recognition results, select one semantic recognition result as the target recognition result, including: According to the priorities corresponding to the semantic recognition modules, the semantic recognition result output by the semantic recognition module with the highest priority is selected from the output semantic recognition results, and is determined as the target recognition result of the text to be recognized.
3. The method according to claim 1, wherein The priority of the text matching module is higher than that of the grammar rule recognition module, the priority of the grammar rule recognition module is higher than that of the NLU module, and the priority of the NLU module is higher than that of the question-answering module.
4. The method according to claim 3, wherein The question-and-answer module includes a first question-and-answer module and a second question-and-answer module, wherein the first question-and-answer module performs text similarity matching based on pre-configured texts, and the second question-and-answer module performs text keyword matching based on pre-configured keywords; Among them, the priority of the first question and answer module is higher than the priority of the second question and answer module.
5. The method according to claim 4, wherein From the output semantic recognition results, select one semantic recognition result as the target recognition result, which also includes: If the second question-answering module recognizes that the text to be recognized contains the specified keyword, the semantic recognition result output by the second question-answering module is determined as the target recognition result; or If the second question-answering module recognizes that the text to be recognized does not contain the specified keyword, a semantic recognition result is selected from the output semantic recognition results and determined as the target recognition result.
6. The method according to claim 5, wherein From the output semantic recognition results, select one semantic recognition result as the target recognition result, which also includes: If both the text matching module and the grammar rule module have no output, and the NLU module recognizes that the domain corresponding to the text to be recognized is the target domain, and the intent corresponding to the text to be recognized is the target intent, then the target domain and the target intent are determined as the target recognition result.
7. The method according to claim 6, wherein The method further comprises: If both the text matching module and the grammar rule module have no output, and the NLU module recognizes that the domain corresponding to the text to be recognized is not the target domain, it is determined that the semantics of the text to be recognized cannot be recognized.
8. The method according to claim 5, wherein Determining the semantic recognition result output by the second question-answering module as the target recognition result includes: If both the first question-and-answer module and the second question-and-answer module in the question-and-answer module output corresponding semantic recognition results, the semantic recognition result output by the first question-and-answer module is determined as the target recognition result.
9. The method according to claim 1, wherein The convolution kernel size used in the first convolution layer is 1×1; The size of the convolution kernel used in the second convolution layer is 3×3; The convolution kernel sizes used in the third convolution layer are 1×1 and 3×3 respectively; The fourth convolutional layer uses convolution kernels of sizes 3×3 and 5×5 respectively.
10. A semantic recognition device, characterized in that: The device comprises: an acquisition unit, a semantic recognition unit and a selection unit; wherein: The acquiring unit is used to acquire the text to be recognized; The semantic recognition unit is configured to use at least two semantic recognition modules to perform semantic recognition processing on the text to be recognized, wherein the at least two semantic recognition modules include at least two of a text matching module, a grammar rule recognition module, a natural language understanding (NLU) module, and a question-answering module; The selection unit is used to select a semantic recognition result from the output semantic recognition results and determine it as a target recognition result; The selection unit is specifically configured to determine the semantic recognition result output by the question-answering module as the target recognition result if both the text matching module and the grammar rule module have no output and the NLU module recognizes that the field corresponding to the text to be recognized is the target field; The step of the NLU module identifying the field corresponding to the text to be recognized includes: The semantic recognition unit is specifically used to use four convolution layers with different convolution kernels to convolve the sentence vector corresponding to the text to be recognized with the dictionary feature vector corresponding to the pre-configured domain to obtain four domain feature sub-vectors that characterize the association relationship between the sentence vector and the dictionary feature vector; and to fuse the four domain feature sub-vectors to obtain a domain feature vector, and determine the domain corresponding to the text to be recognized based on the domain feature vector.
11. An electronic device, characterized in that: The electronic device includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus; Memory for storing computer programs; A processor, configured to implement the method steps described in any one of claims 1 to 9 when executing a program stored in a memory.
12. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method steps of any one of claims 1 to 9 are implemented.
Citation Information
Patent Citations
Intention recognition method, device and system
CN110334201A