Semantic recognition method, semantic recognition device, storage medium and electronic device

Through word segmentation processing and calculating word evaluation index values, the problem of sentence order and template matching in semantic recognition is solved, the recognition rate and flexibility are improved, and more efficient semantic recognition is achieved.

CN114091465BActive Publication Date: 2024-12-24BEIJING WODONG TIANJUN INFORMATION TECH CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202011592712.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-12-29
Publication Date
2024-12-24
Estimated Expiration
2040-12-29

AI Technical Summary

Technical Problem

In the semantic recognition process, in the prior art, the statements entered by the user may contain catchphrases or modalities, and the order of the sentences does not match the semantic template, resulting in a low recognition rate and the statements entered by the user cannot be effectively recognized.

Method used

By obtaining the sentences to be identified, performing word segmentation processing, calculating the evaluation index value and length similarity of the words, and outputting the recognition statement based on these indicators, expanding the recognition range of the statements, avoiding the limitations of sequence and template matching, and improving the recognition rate.

Benefits of technology

It improves the flexibility and accuracy of semantic recognition, expands the recognition scope, avoids the limitation that semantic templates must contain all words, and enhances the recognition rate of statements.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114091465B_ABST
    Figure CN114091465B_ABST
Patent Text Reader

Abstract

The present disclosure provides a semantic recognition method, a semantic recognition device, a computer-readable storage medium and an electronic device, and relates to the technical field of natural language processing. The semantic recognition method comprises: obtaining a sentence to be recognized, performing word segmentation processing on the sentence to be recognized according to a semantic template, obtaining a set of words to be recognized and a first template word set corresponding to the set of words to be recognized; determining the evaluation index value corresponding to each word based on each word in the set of words to be recognized and the word type of each word, and calculating the first similarity between the sentence to be recognized and the semantic template using the evaluation index value corresponding to each word; calculating the second similarity between the sentence to be recognized and the semantic template based on the sum of the lengths of each word in the set of words to be recognized and the sum of the lengths of each word in the first template word set; and outputting the first recognition sentence corresponding to the sentence to be recognized based on the first similarity and the second similarity. The present disclosure can improve the recognition rate of semantics and expand the recognition range of semantics.
Need to check novelty before this filing date? Find Prior Art

Description

Background Art

[0002] Currently, programmers often use rule-based semantic parsing engines to process user input sentences or texts, such as Stanford University's CoreNLP project. The technical solution adopted by the CoreNLP project is: first, configure the specified semantic recognition template, and then, if the user input sentence is exactly the same as the content of the semantic recognition template, match and output the sentence recognition result, otherwise, do not output the result. However, in the actual processing process, the sentence input by the user may include one or more catchphrases or modal particles, and the user may input sentences that are different from the order of the semantic template, which will cause the computer to fail to recognize the sentence input by the user.

[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 the present disclosure, and therefore may include information that does not constitute the prior art known to ordinary technicians in the field. Summary of the invention

[0004] The purpose of the present disclosure is to provide a semantic recognition method, a semantic recognition device, a computer-readable storage medium and an electronic device, thereby overcoming the problem of low semantic recognition rate due to the limitations and defects of related technologies at least to a certain extent.

[0005] According to a first aspect of the present disclosure, a semantic recognition method is provided, comprising: obtaining a sentence to be recognized, performing word segmentation processing on the sentence to be recognized according to a semantic template, and obtaining a word set to be recognized and a first template word set corresponding to the word set to be recognized; determining an evaluation index value corresponding to each word based on each word in the word set to be recognized and the word type of each word, and calculating a first similarity between the sentence to be recognized and the semantic template using the evaluation index value corresponding to each word; calculating a second similarity between the sentence to be recognized and the semantic template based on the sum of the lengths of each word in the word set to be recognized and the sum of the lengths of each word in the first template word set; and outputting a first recognized sentence corresponding to the sentence to be recognized based on the first similarity and the second similarity.

[0006] According to a second aspect of the present disclosure, a semantic recognition device is provided, comprising: a word set determination module, used to obtain a sentence to be recognized, perform word segmentation processing on the sentence to be recognized according to a semantic template, and obtain a word set to be recognized and a first template word set corresponding to the word set to be recognized; a first similarity calculation module, used to determine an evaluation index value corresponding to each word based on each word in the word set to be recognized and the word type of each word, and calculate a first similarity between the sentence to be recognized and the semantic template using the evaluation index value corresponding to each word; a second similarity calculation module, used to calculate a second similarity between the sentence to be recognized and the semantic template based on the sum of the lengths of each word in the word set to be recognized and the sum of the lengths of each word in the first template word set; and a sentence output module, used to output a first recognized sentence corresponding to the sentence to be recognized based on the first similarity and the second similarity.

[0007] Optionally, the first similarity calculation module can be configured to perform: when the word type of each word includes a first keyword type, determining the evaluation index value of the word corresponding to the first keyword type as a first preset index value; determining each word except the word corresponding to the first keyword type as an intermediate word set, and determining the evaluation index value corresponding to each word in the intermediate word set.

[0008] Optionally, the first similarity calculation module can be configured to perform: determining the weight coefficient corresponding to the word type of each word in the intermediate word set; deriving the evaluation score corresponding to each word in the intermediate word set based on the intermediate word set and the word evaluation index library; calculating the evaluation index value of each word in the intermediate word set based on the evaluation score corresponding to each word in the intermediate word set and the weight coefficient corresponding to the word type of each word in the intermediate word set.

[0009] Optionally, the semantic recognition device also includes: an indicator value determination module, which can be configured to execute: when the word type of each word includes a first keyword type, and the evaluation index value of the word corresponding to the second keyword type is less than the indicator threshold, then determine that the evaluation index of the word corresponding to the second keyword type in the word set to be identified is a second preset indicator value.

[0010] Optionally, the semantic recognition device also includes: a word set generation module, used to determine a second template word set corresponding to the first recognition sentence according to the semantic template; a sentence determination module, used to output a second recognition sentence corresponding to the sentence to be recognized based on the first template word set and the second template word set.

[0011] Optionally, the sentence determination module can be configured to execute: when the word type of each word in the first template word set includes the first keyword type and the second keyword type, determine the evaluation index value corresponding to each word in the first template word set, and use the evaluation index value corresponding to each word in the first template word set to calculate the third similarity between the first recognition sentence and the semantic template; calculate the fourth similarity between the first recognition sentence and the semantic template based on the sum of the lengths of each word in the first template word set and the sum of the lengths of each word in the second template word set; and output the second recognition sentence corresponding to the sentence to be recognized based on the third similarity and the fourth similarity.

[0012] Optionally, the word set generation module may be configured to execute: determining words in the first template word set that are identical to words corresponding to the semantic template as the second template word set corresponding to the first recognition sentence.

[0013] Optionally, the sentence output module may be configured to execute: obtaining a target similarity based on the first similarity and the second similarity, comparing the target similarity with a similarity threshold, and outputting a first recognition sentence corresponding to the sentence to be recognized if the target similarity is greater than the similarity threshold.

[0014] Optionally, the sentence output module can be configured to execute: determining the position order of each word in the to-be-recognized word set in the sentence to be recognized; sorting each word in the first template word set according to the position order, and outputting the sorted first recognition sentence corresponding to the sentence to be recognized.

[0015] Optionally, the word set determination module may be configured to perform: filtering stop words in the sentence to be recognized after word segmentation to obtain a word set to be recognized.

[0016] According to a third aspect of the present disclosure, a computer-readable storage medium is provided, on which a computer program is stored, and when the program is executed by a processor, the semantic recognition method as described above is implemented.

[0017] According to a fourth aspect of the present disclosure, an electronic device is provided, comprising: one or more processors; a storage device for storing one or more programs, which, when the one or more programs are executed by the one or more processors, enables the one or more processors to implement the semantic recognition method as described above.

[0018] The exemplary embodiments of the present disclosure have the following beneficial effects:

[0019] In the technical solutions provided by some embodiments of the present disclosure, first, a sentence to be recognized is obtained, and the sentence to be recognized is segmented according to the semantic template to obtain a set of words to be recognized and a first template word set corresponding to the set of words to be recognized; then, based on each word in the set of words to be recognized and the word type of each word, the evaluation index value corresponding to each word is determined, and the first similarity between the sentence to be recognized and the semantic template is calculated using the evaluation index value corresponding to each word; then, according to the sum of the lengths of each word in the set of words to be recognized and the sum of the lengths of each word in the first template word set, the second similarity between the sentence to be recognized and the semantic template is calculated; then, based on the first similarity and the second similarity, the first recognized sentence corresponding to the sentence to be recognized is output. On the one hand, the present disclosure determines the evaluation index value of each word in the set of words to be recognized based on the set of words to be recognized and the first template word set, and further obtains the similarity value between the sentence to be recognized and the semantic template, avoiding limiting the order of words in the sentence to be recognized to be the same as the semantic template, and avoiding limiting the semantic template to contain all words in the sentence to be recognized. The present disclosure expands the recognition range of the sentence, improves the recognition rate of the sentence, and improves the flexibility of the semantic recognition step. On the other hand, the present disclosure uses the evaluation index value corresponding to each word to calculate the first similarity between the sentence to be recognized and the semantic template, thereby avoiding the failure to recognize sentences with similar semantics to the semantic template and expanding the recognition range of sentences.

[0020] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] The drawings herein are incorporated into the specification and constitute a part of the specification, showing embodiments consistent with the present disclosure, and together with the specification, are used to explain the principles of the present disclosure. Obviously, the drawings described below are only some embodiments of the present disclosure, and for ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. In the drawings:

[0022] Figure 1 A flowchart schematically shows a semantic recognition method of a rule semantic parsing engine according to an exemplary embodiment of the present disclosure;

[0023] Figure 2 A flowchart of a semantic recognition method according to an exemplary embodiment of the present disclosure is schematically shown;

[0024] Figure 3 A schematic diagram schematically shows each loading data module in a template loader according to an exemplary embodiment of the present disclosure;

[0025] Figure 4Schematically shows a block diagram of a semantic recognition device according to an exemplary embodiment of the present disclosure;

[0026] Figure 5 Schematically shows a block diagram of a semantic recognition device according to another exemplary embodiment of the present disclosure;

[0027] Figure 6 Schematically shows a block diagram of a semantic recognition system according to an exemplary embodiment of the present disclosure;

[0028] Figure 7 A block diagram of an electronic device according to an exemplary embodiment of the present disclosure is schematically shown. DETAILED DESCRIPTION

[0029] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as being limited to the examples set forth herein; on the contrary, these embodiments are provided so that the present disclosure will be more comprehensive and complete, and the concepts of the example embodiments are fully conveyed to those skilled in the art. The described features, structures, or characteristics may be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present disclosure. However, those skilled in the art will appreciate that the technical solutions of the present disclosure may be practiced while omitting one or more of the specific details, or other methods, components, devices, steps, etc. may be adopted. In other cases, known technical solutions are not shown or described in detail to avoid obscuring various aspects of the present disclosure.

[0030] In addition, the accompanying drawings are only schematic illustrations of the present disclosure and are not necessarily drawn to scale. The same reference numerals in the figures represent the same or similar parts, and their repeated description will be omitted. Some of the block diagrams shown in the accompanying drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software form, or implemented in one or more hardware modules or integrated circuits, or implemented in different networks and / or processor devices and / or microcontroller devices.

[0031] It should be noted that, in the present disclosure, the terms "include" and "comprising" are used to express an open-ended meaning of inclusion, and mean that in addition to the listed elements / components / etc., there may be other elements / components / etc. In addition, the terms "first" and "second" used in the present disclosure are only for the purpose of distinction and should not be used as limitations of the present disclosure.

[0032] The flowcharts shown in the accompanying drawings are only exemplary and do not necessarily include all the steps. For example, some steps may be decomposed, while some steps may be combined or partially combined, so the actual execution order may change according to the actual situation.

[0033] At present, the words or texts input by users using terminal devices are generally processed by rule semantic parsing engines. For specific semantic recognition methods, please refer to Figure 1 In step S102, the speech input by the user is obtained; in step S104, the speech input by the user is preprocessed to determine the semantic domain corresponding to the speech; in step S106, an index between the semantic domain and the semantic template is established based on the semantic domain corresponding to the speech, and the index between the semantic domain and the semantic template is determined; in step S108, a candidate semantic template corresponding to the speech is determined from the semantic template set based on the index between the semantic domain and the semantic template; in step S110, regular semantic recognition processing is performed on the speech based on the candidate semantic template to obtain a semantic recognition result; in step S112, if the semantic recognition result is that the semantic template and the speech are exactly the same, the semantic recognition result corresponding to the speech is output.

[0034] However, when the speech includes one or more modal particles, or the sentence order of the speech is different from the semantic template, the semantic recognition result cannot be output through the semantic template.

[0035] To address this problem, the present disclosure proposes a semantic recognition method.

[0036] It should be noted that, in the exemplary embodiments of the present disclosure, the semantic recognition method described below can generally be implemented by a server, that is, each step of the semantic recognition method can be executed by the server. In this case, the semantic recognition device can be configured in the server.

[0037] In addition, the semantic recognition method can be implemented by a terminal device (such as a mobile phone, a tablet, a personal computer, etc.), that is, each step of the semantic recognition method can be executed by the terminal device. In this case, the semantic recognition device can be configured in the terminal device.

[0038] The following will describe in more detail the various steps of the semantic recognition method in this example implementation with reference to the accompanying drawings and embodiments.

[0039] Figure 2 The flowchart of the semantic recognition method of the exemplary embodiment of the present disclosure is schematically shown. In the following example description, the server is used as the execution subject for example description. Figure 2 , the semantic recognition method may specifically include the following steps:

[0040] S201. Obtain a sentence to be recognized, perform word segmentation processing on the sentence to be recognized according to a semantic template, and obtain a word set to be recognized and a first template word set corresponding to the word set to be recognized.

[0041] In an exemplary embodiment of the present disclosure, the sentence to be recognized may be a sentence of the user acquired by the terminal device through a voice acquisition module, or may be a sentence input by the user through the terminal device. The sentence to be recognized may be a sentence in a semantic field.

[0042] The semantic template may be a semantic template related to the semantic domain corresponding to the sentence to be recognized, may include multiple words related to the sentence to be recognized, and may include multiple words related to the semantic domain. A server may include multiple semantic templates for a semantic domain. The present disclosure may configure the semantic template before obtaining the sentence to be recognized, and may specify the matching relationship between each semantic template in the semantic template set and the corresponding semantic domain. The semantic domain may be the content theme of the sentence to be recognized.

[0043] Before obtaining the sentence to be recognized, the server executes the data loading process in the template loader to obtain a set of semantic templates. Figure 3 The server loads and configures semantic template 1 350 , semantic template 2 360 . . . semantic template m 370 in the template loader 340 based on semantic domain 1 310 , semantic domain 2 320 . . . semantic domain n 330 .

[0044] Each semantic template includes a word naming module, a semantic pattern module and a semantic result module. For example, semantic template 2 360 includes a word naming module 3601, a semantic pattern module 3603 and a semantic result module 3605. The word naming module can define the word type and the variable of the word, the semantic pattern module can configure the word segmentation step and the weight coefficient corresponding to the word type, and the semantic result module can combine the recognized words to determine the semantic result corresponding to the sentence to be recognized.

[0045] In the case where the semantic domain is weather, the preset configuration program expression form of the semantic template may be, for example:

[0046] <synsets>

[0047] <synset name="Query" core_term="" expr="! Check | Query" / >

[0048] <synset name="of" core_term="" expr="! Obtain | of" / >

[0049] <synset name="weather" core_term="" expr="! Weather" / >

[0050] <synset name="How about" core_term="" expr="! How about" / >

[0051] <synset name="city" core_term="" expr="!?, @location # %LOCATION%" / >< / synsets>

[0052] The set of words to be recognized may be a plurality of words constituting a sentence to be recognized, or may include some of the words to be recognized.

[0053] According to an exemplary embodiment of the present disclosure, the server can filter out stop words in the to-be-recognized statement after word segmentation to obtain a set of to-be-recognized words. Among them, stop words can refer to empty words and non-retrievable words in computer retrieval. Stop words can include, for example, modal particles, adverbs, prepositions, conjunctions, etc., such as "de", "zai", "he", "jiezhao", "ya", "a", etc. The stop words in the present disclosure can use a stop word database in the network.

[0054] The first template word set can refer to the word set corresponding to the semantic template determined after comparing the words included in the semantic template with the set of to-be-recognized words.

[0055] The present disclosure performs semantic recognition based on the first template word set and the set of to-be-recognized words, avoiding incorrect recognition results caused by restricting the word order of the recognized statement. The present disclosure improves the semantic recognition rate. In addition, the present disclosure filters out stop words in the to-be-recognized statement after word segmentation, expands the semantic recognition range, and improves the recognition rate of the statement.

[0056] For example, the to-be-recognized statement is "Help me check the weather in Beijing today". Among them, the stop words are "de" and "help me". The semantic template is: "[Query]?, [City], [Time], [de]?, [Weather], [How about]?".

[0057] The server can obtain that the set of to-be-recognized words is {check, Beijing, today, weather, how}, and the first template word set is {Beijing, today, weather, how}.

[0058] First, the server can obtain the to-be-recognized statement. Then, perform statement preprocessing on the to-be-recognized statement to determine the semantic domain of the to-be-recognized statement. Next, establish an index between the semantic domain and the semantic template based on the semantic domain of the to-be-recognized statement. Subsequently, determine the semantic template corresponding to the to-be-recognized statement from the set of semantic templates according to the index. The server can also obtain the to-be-recognized statement in a semantic domain, then determine the index between the semantic domain and the semantic template, and subsequently determine the semantic template corresponding to the to-be-recognized statement.

[0059] Among them, the semantic domain of the to-be-recognized statement can be the content theme of the to-be-recognized statement. For example, if the to-be-recognized statement is: "What's the weather like in Beijing today", then after statement preprocessing, it can be determined that the domain of the to-be-recognized statement is weather.

[0060] S203. Based on each word and the word type of each word in the set of to-be-recognized words, determine the evaluation index value corresponding to each word, and use the evaluation index value corresponding to each word to calculate the first similarity between the to-be-recognized statement and the semantic template.

[0061] The server can pre-configure the classification of words in the semantic template, and the word types can include entity word types, optional word types, and mandatory word types.

[0062] Among them, the words of the entity word type can include words such as place names, times, or dates. In the semantic template, the entity type words can also be “%LOCATION%” or “

city

[0063] The words of the optional word type can be modal particles, adverbs, auxiliary words, etc. For example, it can be “的” (de), “怎么样” (zen me yang).

[0064] The words of the mandatory word type can be words related to the semantic field of the sentence to be recognized and can be words related to the content theme of the sentence to be recognized.

[0065] The word type of each word can be determined by using the word classification method of the semantic template.

[0066] The evaluation index value corresponding to each word can be the value corresponding to multiple evaluation parameters used to evaluate each word.

[0067] The server can use the entity word type as the first keyword word type and the mandatory word type as the second keyword word type.

[0068] According to an exemplary embodiment of the present disclosure, when the word type of each word includes the first keyword word type, the server determines that the evaluation index value of the word corresponding to the first keyword word type is the first preset index value; determines each word other than the word corresponding to the first keyword word type as an intermediate word set, and determines the evaluation index value corresponding to each word in the intermediate word set.

[0069] Among them, the first preset index value can be set to a specified value. For example, the evaluation index value of the word corresponding to the entity word type can be 1.

[0070] The intermediate word set can include the words of the mandatory word type and the words of the optional word type in the word set to be recognized.

[0071] The evaluation index value can include an evaluation score and a weight coefficient. Among them, the scoring score can be determined from the word evaluation index library in the network based on the word. The weight coefficient corresponding to the word type of the word can be a preset value.

[0072] It should be noted that, when the word type of each word does not include the first key word type, the similarity of the sentence to be recognized is not calculated, and the semantic template can also be replaced to re-perform semantic recognition. The present disclosure uses the evaluation index value corresponding to each word to calculate the first similarity between the sentence to be recognized and the semantic template, avoids the inability to recognize sentences with similar semantics to the semantic template, and expands the recognition range of sentences.

[0073] The server may also determine the evaluation score of the word corresponding to the first keyword type as a specified value, and then determine the evaluation index value of the word corresponding to the first keyword type based on the evaluation score of the word corresponding to the first keyword type and the weight coefficient corresponding to the first keyword type.

[0074] According to an exemplary embodiment of the present disclosure, the server may first determine the weight coefficient corresponding to the word type of each word in the intermediate word set; then, based on the intermediate word set and the word evaluation index library, derive the evaluation score corresponding to each word in the intermediate word set; subsequently, based on the evaluation score corresponding to each word in the intermediate word set and the weight coefficient corresponding to the word type of each word in the intermediate word set, calculate the evaluation index value of each word in the intermediate word set.

[0075] For example, the sentence to be recognized is "What is the weather like in Beijing today?" The semantic template is: "[query]?, [city], [time], [of]?, [weather], [how is it]?". The semantic template configuration includes: the first keyword type is an entity word type, and the evaluation score of the entity word type is 1, the weight coefficient corresponding to the entity word type is 1, the weight coefficient corresponding to the required word type is 1, and the weight coefficient corresponding to the optional word type is 0.2. The word evaluation index library can adopt the synonym word forest extension library.

[0076] The server first determines that the set of words to be recognized is {Beijing, today, climate, how} according to the semantic template, and the first template word set is {Beijing, today, weather, how}.

[0077] Among them, words of entity word type: "Beijing", "Today", words of required word type: "climate", and words of optional word type: "how".

[0078] Then, based on the words in the to-be-recognized word set and the word type of each word, the server determines that the evaluation index values ​​of the two words "Beijing" and "Today" are 1=1*1;

[0079] According to the word evaluation index database and the word "climate", it is determined that the evaluation score of "climate" and "weather" is 0.9, and the weight coefficient corresponding to the word type of the word "climate" is 1, so the evaluation index value of the word "climate" is 0.9 = 0.9*1;

[0080] Based on the word evaluation index library and the word "how", it is determined that the evaluation scores of "how" and "what about" are 0.9, and the weight coefficient corresponding to the word type of the word "how" is 0.2. Then, the evaluation index value of the word "how" is 0.18 = 0.9 * 0.2;

[0081] For the two words "of" and "query" in the semantic template, no evaluation scores are determined according to the word evaluation index library, so they do not participate in the calculation.

[0082] Subsequently, the server calculates the first similarity between the sentence to be recognized and the semantic template as 0.9625 = (1 + 1 + 0.9 + 0.18) / (1 + 1 + 1 + 0.2) based on the evaluation index values of each word in the set of words to be recognized.

[0083] According to the exemplary embodiments of the present disclosure, when the word types of each word include the first keyword word type, and the evaluation index value of the word corresponding to the second keyword word type is less than the index threshold, it is determined that the evaluation index value of the word corresponding to the second keyword word type in the set of words to be recognized is the second preset index value.

[0084] Among them, the index threshold can refer to the index condition value that the server can preset during the calculation of the word evaluation index value.

[0085] The second preset index value can be the weight coefficient value corresponding to the second keyword word type taking a negative number, and can be preset as a specified value, for example, it can be -1.

[0086] It should be noted that when the evaluation index value of a word is greater than or equal to the index threshold, the server uses the calculated evaluation index value.

[0087] For example, the sentence to be recognized is "What's the temperature in Beijing today?". The semantic template is: "

query

city

time

of

weather

what about

[0088] The server first determines the set of words to be recognized as {Beijing, today, temperature, how} according to the semantic template, and the first template word set is {Beijing, today, weather, how}.

[0089] Among them, the words of the entity word type: "Beijing", "today", the words of the mandatory word type: "temperature", and the words of the optional word type: "how".

[0090] Then, based on each word in the set of words to be recognized and the word type of each word, the server determines that the evaluation index values of the two words "Beijing" and "today" are 1 = 1 * 1;

[0091] According to the word evaluation index library and the word "temperature", it is determined that the evaluation score of "temperature" and "weather" is 0.0225, and the weight coefficient corresponding to the word type of the word "temperature" is 1. Then, the evaluation index value of the word "temperature" is 0.0225 = 0.0225 * 1 < the index threshold of 0.5, so the evaluation index value of the word "temperature" is determined to be -1.

[0092] According to the word evaluation index library and the word "how", it is determined that the evaluation score of "how" and "what about" is 0.9, and the weight coefficient corresponding to the word type of the word "how" is 0.2. Then, the evaluation index value of the word "how" is 0.18 = 0.9 * 0.2;

[0093] Subsequently, based on the evaluation index values of each word in the set of words to be recognized, the server calculates the first similarity between the sentence to be recognized and the semantic template as 0.3687 = (1 + 1 - 1 + 0.18) / (1 + 1 + 1 + 0.2).

[0094] S205. Calculate the second similarity between the sentence to be recognized and the semantic template according to the sum of the lengths of each word in the set of words to be recognized and the sum of the lengths of each word in the first template word set.

[0095] The length of a word can be the number of characters included in the word. For example, the length of the word "weather" is 2.

[0096] After obtaining the set of words to be recognized and the first template word set, the server can calculate the sum of the lengths of each word respectively.

[0097] For example, the sentence to be recognized is "Help me check the weather in Beijing today. How is it?". Among them, the stop words are "the" and "Help me". The semantic template is: "[Query]?, [City], [Time], [the]?, [Weather], [What about]?".

[0098] The server first filters out the stop words in the segmented sentence to be recognized to obtain the set of words to be recognized {check, Beijing, today, weather, how}, and the first template word set is {Beijing, today, weather, how};

[0099] Then, the server calculates that the sum of the lengths of each word in the set of words to be recognized is 10, and the sum of the lengths of each word in the first template word set is 8;

[0100] Subsequently, the server calculates that the second similarity between the statement to be recognized and the semantic template is 0.8 = 8 / 10.

[0101] S207. Based on the first similarity and the second similarity, output the first recognition statement corresponding to the statement to be recognized.

[0102] In an exemplary embodiment of the present disclosure, the first recognition statement may be a statement generated after recognizing the statement to be recognized according to the speech template, and may include each word in the first template word set.

[0103] According to an exemplary embodiment of the present disclosure, after the server calculates the first similarity and the second similarity, it may first obtain the target similarity based on the first similarity and the second similarity, and then compare the target similarity with the similarity threshold. If the target similarity is greater than the similarity threshold, output the first recognition statement corresponding to the statement to be recognized.

[0104] Among them, the target similarity may be the average value of the first similarity and the second similarity. The first similarity threshold may be a preset specified value.

[0105] It should be noted that when the target similarity is less than the similarity threshold, the recognition statement is not output, and the semantic template is replaced and recognition is performed again.

[0106] The present disclosure first determines the evaluation index values of each word in the statement to be recognized based on the statement to be recognized word set and the first template word set, then calculates the first similarity and the second similarity between the statement to be recognized and the semantic template, and subsequently outputs the first recognition statement of the statement to be recognized based on the first similarity and the second similarity. The present disclosure avoids requiring that the order of words in the entire statement and the semantic template must be the same as the statement to be recognized, nor is it restricted to including every word in the statement to be recognized, avoiding missing the recognition result of the statement. The present disclosure expands the recognition range of the statement, improves the recognition rate of the statement, and improves the flexibility of the semantic recognition step.

[0107] Specifically, in the case where the semantic domain is weather, the program manifestation related to semantic recognition in the semantic template may be, for example:

[0108] <?xml version="1.0" encoding="UTF-8"?>

[0109] <templates domainID="id.triage.weather" domainContext="weather">

[0110] <synsets>

[0111] <synset name="query" core_term="" expr="! Check|Query" / >

[0112] <synset name="of" core_term="" expr="! Get|Of" / >

[0113] <synset name="weather" core_term="" expr="! Weather" / >

[0114] <synset name="how about" core_term="" expr="! How about" / >

[0115] <synset name="city" core_term="" expr="!?@location#%LOCATION%" / >< / synsets>

[0116] <template id="QUERY_WEATHER_1">

[0117] <description> have ner result: Beijing / LOCATION weather today / DATE TIME< / description>

[0118] <pattern type="EXACT">^

Query

city

of

weather

how

[0119] <semantics type="JSON">

[0120] <![CDATA[{"domain":"weather","intent":"query","city":"@location","time":"%time%"}]]>

[0121]

[0122]

[0123]

[0124] For example, the sentence to be recognized is "Help me check the climate in Beijing today". Among them, the stop words are "of" and "Help me". The semantic template is: "

Query

city

time

of

weather

how

[0125] Among them, the semantic template configuration includes: the first keyword type is the entity word type, and the evaluation score of the words of the entity word type is 1, the weight coefficient corresponding to the entity word type is 1, the weight coefficient corresponding to the required word type is 1, and the weight coefficient corresponding to the optional word type is 0.2. The word evaluation index library can adopt the Extended Synonym Thesaurus. The similarity threshold is set to 0.8.

[0126] The server first performs word segmentation on the sentence to be recognized according to the semantic template, and filters out the stop words in the segmented sentence to be recognized, and determines that the set of words to be recognized is {check, Beijing, today, climate, how}, and the first set of template words is {Beijing, today, weather, how}.

[0127] Among them, the words of the entity word type: "Beijing" and "today", the words of the required word type: "climate", and the words of the optional word type: "how".

[0128] Then, the server determines, based on each word in the set of words to be recognized and the word type of each word, that the evaluation index values of the two words "Beijing" and "today" are 1 = 1 * 1;

[0129] According to the word evaluation index library and the word "climate", the evaluation scores of "climate" and "weather" are determined to be 0.9, and the weight coefficient corresponding to the word type of the word "climate" is 1. Then, the evaluation index value of the word "climate" is 0.9 = 0.9 * 1;

[0130] According to the word evaluation index library and the word "how", the evaluation scores of "how" and "what about" are determined to be 0.9, and the weight coefficient corresponding to the word type of the word "how" is 0.2. Then, the evaluation index value of the word "how" is 0.18 = 0.9 * 0.2;

[0131] For the two words "de" (的) and "query" in the semantic template, no evaluation scores are determined according to the word evaluation index library, so they do not participate in the calculation.

[0132] Secondly, based on the evaluation index values of each word in the set of words to be recognized, the server calculates the first similarity between the sentence to be recognized and the semantic template as 0.9625 = (1 + 1 + 0.9 + 0.18) / (1 + 1 + 1 + 0.2).

[0133] Thirdly, the server calculates that the sum of the lengths of each word in the set of words to be recognized is 10, and the sum of the lengths of each word in the first template word set is 8. Furthermore, the server calculates the second similarity between the sentence to be recognized and the semantic template as 0.8 = 8 / 10.

[0134] Subsequently, based on the first similarity of 0.9625 and the second similarity of 0.8, the target similarity is determined to be 0.88125 > the similarity threshold of 0.8. Then, the first recognized sentence corresponding to the sentence to be recognized, "How is the weather in Beijing today", is output.

[0135] According to the exemplary embodiments of the present disclosure, the server may first determine the position order of each word in the set of words to be recognized in the sentence to be recognized; then, sort each word in the first template word set according to the position order, and output the sorted first recognized sentence corresponding to the sentence to be recognized.

[0136] For example, the sentence to be recognized is "Help me check the climate in Beijing today". Among them, the stop words are "de" (的) and "help me". The semantic template is: "

query

city

time

de

weather

what about

[0137] The server first performs word segmentation on the sentence to be recognized according to the semantic template, and filters out the stop words in the segmented sentence to be recognized, and determines that the set of words to be recognized is {check, Beijing, climate, how, today}, and the first template word set is {Beijing, today, weather, how}.

[0138] Then, the position order of each word in the to-be-recognized word set in the to-be-recognized sentence is determined as follows: 1) see 2) Beijing, 3) climate, 4) how, 5) today;

[0139] Subsequently, the words in the first template word set are sorted according to the position order, and the sorted first recognition sentence "How is the weather in Beijing today" corresponding to the sentence to be recognized is output.

[0140] According to an exemplary embodiment of the present disclosure, after outputting the first recognition sentence, the server may first determine a second template word set corresponding to the first recognition sentence according to the semantic template; then, based on the first template word set and the second template word set, output a second recognition sentence corresponding to the sentence to be recognized.

[0141] The server may determine the words in the first template word set that are identical to the words corresponding to the semantic template as the second template word set corresponding to the first recognition sentence.

[0142] According to an exemplary embodiment of the present disclosure, after the server determines the first template word set and the second template word set, first, when the word type of each word in the first template word set includes the first keyword type and the second keyword type, the evaluation index value corresponding to each word in the first template word set is determined, and the third similarity between the first recognition sentence and the semantic template is calculated using the evaluation index value corresponding to each word in the first template word set; then, the fourth similarity between the first recognition sentence and the semantic template is calculated based on the sum of the lengths of each word in the first template word set and the sum of the lengths of each word in the second template word set; subsequently, based on the third similarity and the fourth similarity, the second recognition sentence corresponding to the sentence to be recognized is output.

[0143] Specifically, the server may first determine an average value of the third similarity and the fourth similarity, and then compare the average value of the third similarity and the fourth similarity with a similarity threshold; if the average value of the third similarity and the fourth similarity is greater than the similarity threshold, the server outputs a second recognition sentence corresponding to the sentence to be recognized.

[0144] It should be noted that, when the word type of each word in the first template word set does not include the first keyword type or the second keyword type, the similarity between the first recognition sentence and the semantic template is not calculated.

[0145] For example, the first recognition sentence is "How will the weather in Beijing be tomorrow?". The semantic template is: "[query]?, [city], [time], [of]?, [weather], [how is it]?". The semantic template configuration includes: the first keyword type is an entity word type, and the second keyword type is a required word type. The similarity threshold is set to 0.8.

[0146] The server first performs word segmentation processing on the sentence to be recognized according to the semantic template, determines that the second template word set is {Beijing, tomorrow, weather}, and obtains the first template word set as {Beijing, weather, how, tomorrow};

[0147] Then, the server determines that the first template word set has: words of entity word type: "Beijing", "tomorrow", and words of required word type: "weather", and determines that the evaluation index values ​​of the three words "Beijing", "tomorrow", and "weather" are all 1; in addition, since the optional word in the semantic template is "how", and the optional word in the first template word set is "how", the two words are different, and the evaluation index value of the optional word "how" is not calculated; then the third similarity between the first recognition sentence and the semantic template is 1;

[0148] Next, the sum of the lengths of the words in the first template word set is calculated to be 8, and the sum of the lengths of the words in the second template word set is calculated to be 6, and the fourth similarity between the first recognition sentence and the semantic template is calculated to be 0.75=6 / 8;

[0149] Subsequently, the server calculates the average value of the third similarity and the fourth similarity as 0.875=(1+0.75) / 2, where 0.875>0.8, and outputs the second recognition sentence "Beijing's weather tomorrow" corresponding to the sentence to be recognized.

[0150] It should be noted that although the steps of the method in the present disclosure 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 the steps shown 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, etc.

[0151] Furthermore, in an exemplary embodiment of the present disclosure, a semantic recognition device is also provided.

[0152] Figure 4 Schematically shows a block diagram of a semantic recognition device according to an exemplary embodiment of the present disclosure. Figure 4 According to an exemplary embodiment of the present disclosure, the semantic recognition device 400 may include: a word set determination module 401 , a first similarity calculation module 403 , a second similarity calculation module 405 , and a sentence output module 407 .

[0153] Among them, the word set determination module 401 is used to obtain the sentence to be recognized, perform word segmentation processing on the sentence to be recognized according to the semantic template, and obtain the word set to be recognized and the first template word set corresponding to the word set to be recognized; the first similarity calculation module 403 is used to determine the evaluation index value corresponding to each word based on each word in the word set to be recognized and the word type of each word, and use the evaluation index value corresponding to each word to calculate the first similarity between the sentence to be recognized and the semantic template; the second similarity calculation module 405 is used to calculate the second similarity between the sentence to be recognized and the semantic template according to the sum of the lengths of each word in the word set to be recognized and the sum of the lengths of each word in the first template word set; the sentence output module 407 is used to output the first recognized sentence corresponding to the sentence to be recognized based on the first similarity and the second similarity.

[0154] According to another embodiment of the present disclosure, the first similarity calculation module 403 can be configured to perform: when the word type of each word includes the first keyword type, determining the evaluation index value of the word corresponding to the first keyword type as a first preset index value; determining each word except the word corresponding to the first keyword type as an intermediate word set, and determining the evaluation index value corresponding to each word in the intermediate word set.

[0155] According to another embodiment of the present disclosure, the first similarity calculation module 403 can be configured to perform: determining the weight coefficient corresponding to the word type of each word in the intermediate word set; deriving the evaluation score corresponding to each word in the intermediate word set based on the intermediate word set and the word evaluation index library; calculating the evaluation index value of each word in the intermediate word set based on the evaluation score corresponding to each word in the intermediate word set and the weight coefficient corresponding to the word type of each word in the intermediate word set.

[0156] According to another embodiment of the present disclosure, the semantic recognition device 400 may also include: an index value determination module, which can be configured to execute: when the word type of each word includes a first keyword type, and the evaluation index value of the word corresponding to the second keyword type is less than the index threshold, then determine that the evaluation index value of the word corresponding to the second keyword type in the word set to be identified is a second preset index value.

[0157] According to another embodiment of the present disclosure, Figure 5 Compared with the semantic recognition device 400 , the semantic recognition device 500 may further include: a word set generation module 502 and a sentence determination module 504 .

[0158] The word set generation module 502 is used to determine a second template word set corresponding to the first recognition sentence according to the semantic template; the sentence determination module 504 is used to output a second recognition sentence corresponding to the sentence to be recognized based on the first template word set and the second template word set.

[0159] According to another embodiment of the present disclosure, the sentence determination module 504 can be configured to perform: when the word type of each word in the first template word set includes the first keyword type and the second keyword type, determine the evaluation index value corresponding to each word in the first template word set, and use the evaluation index value corresponding to each word in the first template word set to calculate the third similarity between the first recognition sentence and the semantic template; calculate the fourth similarity between the first recognition sentence and the semantic template based on the sum of the lengths of each word in the first template word set and the sum of the lengths of each word in the second template word set; and output the second recognition sentence corresponding to the sentence to be recognized based on the third similarity and the fourth similarity.

[0160] According to another embodiment of the present disclosure, the word set generation module 502 may be configured to execute: determining the words in the first template word set that are identical to the words corresponding to the semantic template as the second template word set corresponding to the first recognition sentence.

[0161] According to another embodiment of the present disclosure, the sentence output module 407 can be configured to execute: obtaining a target similarity based on the first similarity and the second similarity, comparing the target similarity with a first similarity threshold, and if the target similarity is greater than the first similarity threshold, outputting a first recognition sentence corresponding to the sentence to be recognized.

[0162] According to another embodiment of the present disclosure, the sentence output module 407 can be configured to execute: determining the position order of each word in the to-be-recognized word set in the to-be-recognized sentence; sorting each word in the first template word set according to the position order, and outputting the sorted first recognition sentence corresponding to the to-be-recognized sentence.

[0163] According to another embodiment of the present disclosure, the word set determination module 401 may be configured to perform: filtering stop words in the sentence to be recognized after word segmentation to obtain a word set to be recognized.

[0164] The specific details of each module / unit in the above device have been described in detail in the embodiment of the method part, so they will not be repeated here.

[0165] In the exemplary embodiment of the present disclosure, referring to Figure 6, schematically shows a block diagram of a semantic recognition system according to an exemplary embodiment of the present disclosure. The semantic recognition device 600 according to an exemplary embodiment of the present disclosure may include: a sentence acquisition device 601 to be recognized, a domain selection device 603, an index determination device 605, a semantic template selection device 607 and a sentence recognition device 500.

[0166] Among them, the sentence acquisition device 601 to be recognized is used to obtain the sentence to be recognized input by the user; the field selection device 603 is used to determine the semantic field of the sentence to be recognized; the index determination device 605 is used to obtain the index between the semantic field of the sentence to be recognized and the semantic template based on the semantic field of the sentence to be recognized and the position of the semantic field in the semantic template; the semantic template selection device 607 is used to select the semantic template corresponding to the sentence to be recognized based on the index between the semantic field of the sentence to be recognized and the semantic template; the sentence recognition device 500 is used to perform semantic recognition on the sentence to be recognized and output the first recognition sentence of the sentence to be recognized.

[0167] According to an exemplary embodiment of the present disclosure, before executing the sentence recognition device 500, the server may first use an accurate semantic recognition template for recognition, or may use a wildcard recognition template or a slot recognition template. The recognition method of the wildcard recognition template or the slot recognition template may be obtained by referring to the sentence recognition method of the present disclosure, and will not be described in detail here.

[0168] In an exemplary embodiment of the present disclosure, a computer-readable storage medium is also provided, on which a program product capable of implementing the above method of the present specification is stored. In some possible implementations, various aspects of the present invention may also be implemented in the form of a program product, which includes a program code, and when the program product is run on a terminal device, the program code is used to enable the terminal device to execute the steps according to various exemplary embodiments of the present invention described in the above "Exemplary Method" section of the present specification.

[0169] In an exemplary embodiment of the present disclosure, an electronic device capable of implementing the above method is also provided.

[0170] It will be appreciated by those skilled in the art that various aspects of the present invention may be implemented as a system, method or program product. Therefore, various aspects of the present invention may be specifically implemented in the following forms, namely: a complete hardware implementation, a complete software implementation (including firmware, microcode, etc.), or a combination of hardware and software, which may be collectively referred to herein as a "circuit", "module" or "system".

[0171] Refer to the following Figure 7 An electronic device 700 according to this embodiment of the present invention will be described. Figure 7The electronic device 700 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.

[0172] like Figure 7 As shown, the electronic device 700 is in the form of a general computing device. The components of the electronic device 700 may include, but are not limited to: the at least one processing unit 710, the at least one storage unit 720, a bus 730 connecting different system components (including the storage unit 720 and the processing unit 710), and a display unit 740.

[0173] The storage unit stores program codes, which can be executed by the processing unit 710, so that the processing unit 710 performs the steps according to various exemplary embodiments of the present invention described in the above “Exemplary Method” section of this specification. For example, the processing unit 710 can perform the following steps: Figure 2 Steps S201 to S207 are shown.

[0174] The storage unit 720 may include a readable medium in the form of a volatile storage unit, such as a random access storage unit (RAM) 7201 and / or a cache storage unit 7202 , and may further include a read-only storage unit (ROM) 7203 .

[0175] The storage unit 720 may also include a program / utility 7204 having a set (at least one) of program modules 7205, such program modules 7205 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.

[0176] Bus 730 may represent one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.

[0177] The electronic device 700 may also communicate with one or more external devices 800 (e.g., keyboards, pointing devices, Bluetooth devices, etc.), may also communicate with one or more devices that enable a user to communicate with the electronic device 700, and / or may communicate with any device that enables the electronic device 700 to communicate with one or more other computing devices (e.g., routers, modems, etc.). Such communication may be performed via an input / output (I / O) interface 750. Furthermore, the electronic device 700 may also communicate with one or more networks (e.g., local area networks (LANs), wide area networks (WANs), and / or public networks, such as the Internet) via a network adapter 760. As shown, the network adapter 760 communicates with other modules of the electronic device 700 via a bus 730. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 700, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, etc.

[0178] Through the description of the above implementation, it is easy for those skilled in the art to understand that the example implementation described here can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to the implementation of the present disclosure 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, including several instructions to enable a computing device (which can be a personal computer, a server, a terminal device, or a network device, etc.) to execute the method according to the implementation of the present disclosure.

[0179] In addition, the above-mentioned figures are only schematic illustrations of the processes included in the method according to an exemplary embodiment of the present invention, and are not intended to be limiting. It is easy to understand that the processes shown in the above-mentioned figures do not indicate or limit the time sequence of these processes. In addition, it is also easy to understand that these processes can be performed synchronously or asynchronously, for example, in multiple modules.

[0180] 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 embodiments of the present disclosure, the features and functions of two or more modules or units described above can be embodied 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 embodied.

[0181] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary technical means in the art that are not disclosed in the present disclosure. The specification and examples are to be considered as exemplary only, and the true scope and spirit of the present disclosure are indicated by the claims.

[0182] It should be understood that the present disclosure is not limited to the exact structures that have been 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 disclosure is limited only by the appended claims.

Claims

1. A semantic recognition method, characterized in that: include: Acquire a sentence to be recognized, perform word segmentation processing on the sentence to be recognized according to a semantic template, and obtain a word set to be recognized and a first template word set corresponding to the word set to be recognized; Based on each word in the to-be-recognized word set and the word type of each word, determining an evaluation index value corresponding to each word, and calculating a first similarity between the to-be-recognized sentence and the semantic template using the evaluation index value corresponding to each word; Calculating a second similarity between the sentence to be recognized and the semantic template according to the sum of the lengths of the words in the to-be-recognized word set and the sum of the lengths of the words in the first template word set; Based on the first similarity and the second similarity, outputting a first recognition sentence corresponding to the sentence to be recognized; Outputting a first recognition sentence corresponding to the sentence to be recognized includes: Determine the position order of each word in the to-be-recognized word set in the to-be-recognized sentence; The words in the first template word set are sorted according to the position order, and a first recognition sentence corresponding to the sentence to be recognized after sorting is output.

2. The semantic recognition method according to claim 1, wherein the semantic template comprises a first keyword type, characterized in that: Based on each word in the to-be-recognized word set and the word type of each word, determining the evaluation index value corresponding to each word includes: In the case where the word type of each of the words includes the first keyword type, determining the evaluation index value of the word corresponding to the first keyword type to be a first preset index value; The words except the words corresponding to the first keyword type are determined as an intermediate word set, and the evaluation index value corresponding to each word in the intermediate word set is determined.

3. According to the semantic recognition method of claim 2, the evaluation index value includes an evaluation score and a weight coefficient, characterized in that: Determining the evaluation index value corresponding to each word in the intermediate word set includes: Determining a weight coefficient corresponding to a word type of each word in the intermediate word set; Based on the intermediate word set and the word evaluation index library, an evaluation score corresponding to each word in the intermediate word set is obtained; Based on the evaluation score corresponding to each word in the intermediate word set and the weight coefficient corresponding to the word type of each word in the intermediate word set, the evaluation index value of each word in the intermediate word set is calculated.

4. The semantic recognition method according to claim 2 or 3, wherein the semantic template includes a second keyword type, characterized in that: Before calculating the first similarity between the sentence to be recognized and the semantic template, the semantic recognition method further includes: When the word type of each of the words includes the first keyword type, and the evaluation index value of the word corresponding to the second keyword type is less than the index threshold, the evaluation index value of the word corresponding to the second keyword type in the set of words to be identified is determined to be a second preset index value.

5. The semantic recognition method according to claim 4, characterized in that: The semantic recognition method further comprises: Determine a second template word set corresponding to the first recognition sentence according to the semantic template; Based on the first template word set and the second template word set, a second recognition sentence corresponding to the sentence to be recognized is output.

6. The semantic recognition method according to claim 5, characterized in that: Based on the first template word set and the second template word set, outputting a second recognition sentence corresponding to the sentence to be recognized includes: In a case where the word type of each word in the first template word set includes the first keyword type and the second keyword type, determining an evaluation index value corresponding to each word in the first template word set, and calculating a third similarity between the first recognition sentence and the semantic template using the evaluation index value corresponding to each word in the first template word set; Calculating a fourth similarity between the first recognition sentence and the semantic template according to the sum of the lengths of the words in the first template word set and the sum of the lengths of the words in the second template word set; Based on the third similarity and the fourth similarity, a second recognized sentence corresponding to the sentence to be recognized is output.

7. The semantic recognition method according to claim 5, characterized in that: Determining a second template word set corresponding to the intermediate sentence according to the semantic template includes: Words in the first template word set that are identical to words corresponding to the semantic template are determined as a second template word set corresponding to the first recognition sentence.

8. The semantic recognition method according to any one of claims 1 to 3, characterized in that: Based on the first similarity and the second similarity, outputting a first recognized sentence corresponding to the sentence to be recognized includes: A target similarity is obtained based on the first similarity and the second similarity, and the target similarity is compared with a similarity threshold. If the target similarity is greater than the similarity threshold, a first recognition sentence corresponding to the sentence to be recognized is output.

9. The semantic recognition method according to any one of claims 1 to 3, characterized in that: After the sentence to be recognized is segmented according to the semantic template, the word set to be recognized includes: The stop words in the sentence to be recognized after word segmentation are filtered to obtain a set of words to be recognized.

10. A semantic recognition device, characterized in that: include: A word set determination module, used to obtain a sentence to be recognized, perform word segmentation processing on the sentence to be recognized according to a semantic template, and obtain a word set to be recognized and a first template word set corresponding to the word set to be recognized; A first similarity calculation module, configured to determine the evaluation index value corresponding to each word in the to-be-recognized word set and the word type of each word, and calculate the first similarity between the to-be-recognized sentence and the semantic template using the evaluation index value corresponding to each word; A second similarity calculation module, configured to calculate a second similarity between the sentence to be recognized and the semantic template according to the sum of the lengths of the words in the set of words to be recognized and the sum of the lengths of the words in the first template word set; A sentence output module, configured to output a first recognition sentence corresponding to the sentence to be recognized based on the first similarity and the second similarity; The sentence output module is used to determine the position order of each word in the set of words to be recognized in the sentence to be recognized; The words in the first template word set are sorted according to the position order, and a first recognition sentence corresponding to the sentence to be recognized after sorting is output.

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

12. An electronic device, characterized in that: include: processor; as well as A memory, configured to store executable instructions of the processor; The processor is configured to execute the semantic recognition method according to any one of claims 1 to 9 by executing the executable instructions.