Speech recognition method, device, electronic device and storage medium
By matching the recognized voice information with the command text template in the smart elevator, and determining whether to perform the operation based on the position of the command words, the problem of poor accuracy of the smart elevator recognition results is solved, significantly reducing the number of false recognition times.
Patent Information
- Application Number
- CN202111560478.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-20
- Publication Date
- 2025-02-28
- Estimated Expiration
- 2041-12-20
AI Technical Summary
When smart elevators recognize user voice information, the number of errors is high, resulting in poor accuracy of recognition results.
By obtaining the target voice information, calling the speech recognition model to convert it into text content, and matching the text content with multiple instruction text templates, performing corresponding operations only when the matching and the command word position meets the preset conditions.
It improves the accuracy of speech recognition results of smart elevators, reduces the number of false recognitions, and ensures the accurate execution of instructions.
Smart Images

Figure CN114299960B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of artificial intelligence technology, and in particular to a speech recognition method, device, electronic device and storage medium. Background Art
[0002] The traditional contact-based elevator control mode has a greater risk of virus transmission. In order to reduce the risk of contact sensing and free the user's hands, contact-free smart elevators came into being. When a user takes a smart elevator, they can interact with the smart elevator through voice messages to realize the elevator call function with just one sentence.
[0003] To realize the voice control function, the smart elevator needs to install and run a voice recognition model for recognizing voice information. When the voice recognition model recognizes that the user's voice information contains a command word, the smart elevator executes the operation corresponding to the command word.
[0004] However, the command words recognized by the smart elevator may not be command words with the intention of calling the elevator. For example, the user says "I just went to the seventh floor for a meeting", and the "seventh floor" does not have the intention of calling the elevator. However, the smart elevator executes the corresponding operation when it recognizes that the voice information includes the command words, resulting in poor accuracy of the smart elevator's recognition results and a large number of misrecognitions. Summary of the invention
[0005] The embodiments of the present disclosure provide a speech recognition method, device, electronic device and storage medium, which can improve the accuracy of intelligent elevator recognition results and reduce the number of misrecognitions of intelligent elevators. The technical solution is as follows:
[0006] In a first aspect, a speech recognition method is provided, the method comprising:
[0007] Obtain target voice information;
[0008] Calling a speech recognition model to recognize the target speech information, wherein the speech recognition model is used to convert the speech information into text content;
[0009] When a target text content including a target instruction word is obtained, the target text content is matched with a plurality of instruction text templates;
[0010] When the target text content matches any instruction text template, and the position of the target instruction word in the instruction text template meets the preset position condition, the operation corresponding to the target instruction word is executed.
[0011] In another embodiment of the present disclosure, the method further includes:
[0012] When the target text content does not match any of the multiple instruction text templates, the operation corresponding to the target instruction word is not performed; or,
[0013] When the target text content matches any instruction text template, and the position of the target instruction word in the target text content does not meet the preset position condition, the operation corresponding to the target instruction word is not performed.
[0014] In another embodiment of the present disclosure, the construction process of the speech recognition model is:
[0015] Acquire a plurality of speech training samples, wherein all single characters with the same pronunciation in the non-command words contained in the plurality of speech training samples are represented by the same representative character;
[0016] The speech recognition model is constructed based on the multiple speech training samples.
[0017] In another embodiment of the present disclosure, the plurality of speech training samples include a plurality of speech training positive samples and a plurality of speech training negative samples, each speech training positive sample includes an instruction word, and the obtaining of the plurality of speech training samples includes:
[0018] According to a preset ratio, speech training positive samples and speech training negative samples are obtained to obtain the multiple speech training samples, and the preset ratio is used to ensure that the occurrence frequency of each instruction word in the multiple speech training samples meets a preset frequency condition.
[0019] In another embodiment of the present disclosure, constructing the speech recognition model based on the multiple speech training samples includes:
[0020] Acquire each word combination included in the plurality of speech training samples;
[0021] Determine the frequency of occurrence of each word combination among word combinations with the same number of characters;
[0022] The speech recognition model is constructed according to the occurrence frequency of word combinations with different numbers of characters.
[0023] In a second aspect, a speech recognition device is provided, the device comprising:
[0024] A first acquisition module, used to acquire target voice information;
[0025] A recognition module, used to call a speech recognition model to recognize the target speech information, wherein the speech recognition model is used to convert the speech information into text content;
[0026] A matching module, for matching the target text content with a plurality of instruction text templates when a target text content containing a target instruction word is obtained;
[0027] The execution module is used to execute the operation corresponding to the target instruction word when the target text content matches any instruction text template and the position of the target instruction word in the target text content meets the preset position condition.
[0028] In another embodiment of the present disclosure, the execution module is used to not execute the operation corresponding to the target instruction word when the target text content does not match any of the multiple instruction text templates; or
[0029] The execution module is used for not executing the operation corresponding to the target instruction word when the target text content matches any instruction text template and the position of the target instruction word in the target text content does not meet a preset position condition.
[0030] In another embodiment of the present disclosure, the apparatus for constructing the speech recognition model includes:
[0031] A second acquisition module is used to acquire a plurality of speech training samples, wherein all single characters with the same pronunciation in the non-command words contained in the plurality of speech training samples are represented by the same representative character;
[0032] A construction module is used to construct the speech recognition model based on the multiple speech training samples.
[0033] In another embodiment of the present disclosure, the multiple speech training samples include multiple speech training positive samples and multiple speech training negative samples, each speech training positive sample contains an instruction word, and the second acquisition module is used to acquire the speech training positive samples and the speech training negative samples according to a preset ratio to obtain the multiple speech training samples, and the preset ratio is used to ensure that the occurrence frequency of each instruction word in the multiple speech training samples meets a preset frequency condition.
[0034] In another embodiment of the present disclosure, the construction module is used to obtain each word combination included in the multiple speech training samples; determine the frequency of occurrence of each word combination in the word combinations with the same number of characters; and construct the speech recognition model according to the frequency of occurrence of word combinations with different numbers of characters.
[0035] In a third aspect, an electronic device is provided, comprising a processor and a memory, wherein the memory stores at least one program code, and the at least one program code is loaded and executed by the processor to implement the speech recognition method as described in the first aspect.
[0036] In a fourth aspect, a computer-readable storage medium is provided, wherein at least one program code is stored in the storage medium, and the at least one program code is loaded and executed by a processor to implement the speech recognition method as described in the first aspect.
[0037] In a fifth aspect, a computer program product is provided, which includes a computer program code, wherein the computer program code is stored in a computer-readable storage medium, a processor of an electronic device reads the computer program code from the computer-readable storage medium, and the processor executes the computer program code, so that the electronic device performs the speech recognition method described in the first aspect.
[0038] The technical solution provided by the embodiments of the present disclosure has the following beneficial effects:
[0039] After calling the speech recognition model to obtain the target text content, the corresponding operation is not directly performed based on the target instruction word in the target text content. Instead, the target text content is matched with multiple instruction text templates. When the target text content matches any instruction text template, whether to execute the operation corresponding to the target instruction word is determined according to the position of the target instruction word in the target text content, thereby avoiding taking target speech information without instruction intention as instruction speech information, improving the accuracy of the recognition results, and reducing the number of misrecognitions. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] In order to more clearly illustrate the technical solutions in the embodiments of the present disclosure, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0041] Figure 1 It is an implementation environment involved in a speech recognition method provided by an embodiment of the present disclosure;
[0042] Figure 2 is a flow chart of a speech recognition method provided by an embodiment of the present disclosure;
[0043] Figure 3 is a flow chart of another speech recognition method provided by an embodiment of the present disclosure;
[0044] Figure 4 is a structural schematic diagram of a speech recognition device provided by an embodiment of the present disclosure;
[0045] Figure 5 A structural block diagram of a terminal provided by an exemplary embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0046] In order to make the objectives, technical solutions and advantages of the present disclosure more clear, the embodiments of the present disclosure will be further described in detail below with reference to the accompanying drawings.
[0047] It can be understood that the terms "each", "multiple", and "any" used in the embodiments of the present disclosure include two or more, each refers to each of the corresponding multiple, and any refers to any one of the corresponding multiple. For example, the multiple words include 10 words, and each word refers to each word of the 10 words, and any word refers to any one of the 10 words.
[0048] First, the terms involved in the embodiments of the present disclosure are explained.
[0049] WFST (Weighted Finaite-State Transducer) is used for large-scale speech recognition, and its state changes can be marked by input symbols and output symbols.
[0050] The decoding network, also called the search space, uses various knowledge sources fused by WSFT, including at least one of a language model, an acoustic model, a context-dependent model, and a pronunciation dictionary model.
[0051] Please refer to Figure 1 , which shows the implementation environment involved in the speech recognition method provided in the embodiment of the present disclosure, and the implementation environment includes: a server 101 and a terminal 102.
[0052] The server 101 may be an independent physical server, a server cluster or a distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms. The server 101 has strong computing power and can build a speech recognition model based on speech training samples, and the speech recognition model can convert speech information into text content.
[0053] Terminal 102 can be a smart device with voice recognition function such as a smart elevator, a smart phone, a smart speaker, a smart watch, a smart air conditioner, etc. The terminal 102 is installed and runs a voice recognition model constructed by the server 101. Based on the voice recognition model, after collecting the user's voice information, the collected voice information can be converted into text content. Multiple instruction text templates are stored in the terminal 102. By matching the recognized text content with the stored multiple instruction text templates, it can be determined whether the voice information is directive voice information or meaningless voice information. In order to further improve the accuracy of the voice recognition result, when the text content matches any stored instruction text template, it will also determine whether to execute the operation corresponding to the instruction word according to the position of the instruction word in the text content.
[0054] The terminal 102 and the server 101 may be directly or indirectly connected via wired or wireless communication, which is not limited in the embodiment of the present disclosure.
[0055] based on Figure 1 The implementation environment shown in the figure, the embodiment of the present disclosure provides a speech recognition method, taking an electronic device executing the embodiment of the present disclosure as an example, the electronic device includes Figure 1 The terminal or server shown in the figure, the electronic device includes Figure 1 The terminal or server shown in the figure, when performing the speech recognition process, the electronic device can be a terminal, when performing the speech recognition model training process, the electronic device can be a server. Figure 2 , the method flow provided by the embodiment of the present disclosure includes:
[0056] 201. Obtain target voice information.
[0057] 202. Call the speech recognition model to recognize the target speech information.
[0058] Among them, the speech recognition model is used to convert voice information into text content.
[0059] 203. When the target text content containing the target instruction word is obtained, the target text content is matched with multiple instruction text templates.
[0060] 204. When the target text content matches any instruction text template, and the position of the target instruction word in the instruction text template meets the preset position condition, the operation corresponding to the target instruction word is executed.
[0061] The method provided by the embodiment of the present disclosure, after calling the speech recognition model to obtain the target text content, does not directly perform the corresponding operation based on the target instruction word in the target text content, but matches the target text content with multiple instruction text templates. When the target text content matches any instruction text template, it determines whether to execute the operation corresponding to the target instruction word according to the position of the target instruction word in the target text content, thereby avoiding treating target speech information without instruction intention as instruction speech information, improving the accuracy of the recognition result, and reducing the number of misrecognitions.
[0062] In another embodiment of the present disclosure, the method further comprises:
[0063] When the target text content does not match multiple instruction text templates, the operation corresponding to the target instruction word is not executed; or,
[0064] When the target text content matches any instruction text template, the position of the target instruction word in the target text content satisfies the non-preset position condition, and the operation corresponding to the target instruction word is not executed.
[0065] In another embodiment of the present disclosure, the process of constructing the speech recognition model is as follows:
[0066] Acquire a plurality of speech training samples, wherein all single characters with the same pronunciation in the non-command words contained in the plurality of speech training samples are represented by the same representative character;
[0067] Build a speech recognition model based on multiple speech training samples.
[0068] In another embodiment of the present disclosure, the plurality of speech training samples include a plurality of speech training positive samples and a plurality of speech training negative samples, each speech training positive sample includes an instruction word, and obtaining the plurality of speech training samples includes:
[0069] According to a preset ratio, speech training positive samples and speech training negative samples are obtained to obtain multiple speech training samples. The preset ratio is used to ensure that the occurrence frequency of each instruction word in the multiple speech training samples meets a preset frequency condition.
[0070] In another embodiment of the present disclosure, a speech recognition model is constructed based on a plurality of speech training samples, including:
[0071] Obtaining each word combination contained in a plurality of speech training samples;
[0072] Determine the frequency of occurrence of each word combination among word combinations with the same number of characters;
[0073] A speech recognition model is constructed based on the frequency of occurrence of word combinations with different numbers of characters.
[0074] All the above optional technical solutions can be arbitrarily combined to form optional embodiments of the present disclosure, and will not be described in detail here.
[0075] based on Figure 1 The implementation environment shown in the figure, the embodiment of the present disclosure provides a speech recognition method, taking an electronic device executing the embodiment of the present disclosure as an example, the electronic device includes Figure 1 The terminal or server shown in FIG. 1 may be a terminal when performing a speech recognition process, and may be a server when performing a speech recognition model training process. Figure 3 , the method flow provided by the embodiment of the present disclosure includes:
[0076] 301. The terminal obtains target voice information.
[0077] In the embodiment of the present disclosure, a voice collection module is provided in the terminal, and the voice collection module has a voice collection function. Based on the voice collection module, the terminal can collect the target voice information of the target user. Among them, the target user is a user whose distance from the terminal is less than the preset distance. The number of the target users can be one or more. For example, in the operation scenario of an intelligent elevator, the intelligent elevator can collect the voice information sent by each user in the car, so as to perform corresponding operations according to the instruction words carried in the voice information of each user, so as to meet the needs of each user for taking the elevator. The preset distance can be determined according to the voice collection capability of the voice collection module. The preset distance can be 1 meter, 2 meters, etc. The embodiment of the present disclosure does not specifically limit the size of the preset distance.
[0078] 302. The terminal calls the speech recognition model to recognize the target speech information.
[0079] In the disclosed embodiment, a speech recognition model is installed and run in the terminal. When the target speech information is acquired, the terminal calls the speech recognition model to recognize the target speech information.
[0080] In another embodiment of the present disclosure, a speech recognition model is used to convert the user's speech information into text content, and the speech recognition model can be an N-Gram model (also known as an N-gram model), etc. Among them, the N-Gram model is a very important model in natural language processing, which is constructed based on statistical methods. The basic idea of the N-Gram model is to perform a sliding window operation of size N on the content in the text according to bytes to form a sequence of byte fragments with a length of N. Each byte fragment is called a gram, and the occurrence frequency of all grams is counted, and filtered according to a pre-set threshold to form a key gram list, which is also the vector feature space of the text, and each gram in the key gram list is a feature vector dimension. N-Gram is based on such an assumption that the appearance of the Nth word is only related to the previous N-1 words, but not to any other words, and the appearance frequency of the whole sentence is the product of the appearance frequencies of each word. These occurrence frequencies can be obtained by directly counting the number of times N words appear at the same time from the corpus. The currently commonly used word combinations are the binary Bi-Gram and the ternary Tri-Gram.
[0081] The above speech recognition model is built by the server. The specific construction process is as follows:
[0082] In the first step, the server obtains multiple speech training samples.
[0083] Considering the limited computing power and storage capacity of the terminal, it is impossible to use a large number of voice training samples to construct a general voice recognition model for the terminal to build voice recognition. However, if a small number of voice training samples are used to build a voice recognition model, since the voice recognition model is a model obtained based on a statistical algorithm, when the number of voice training samples is small, the model accuracy is low, and the accuracy of the recognition result of the voice information is poor. And considering that the main purpose of voice recognition is to identify whether the text content converted from the voice information includes instruction words to perform corresponding operations, that is, voice recognition mainly focuses on instruction words, and non-instruction words are not the focus of attention. Taking into account the computing power, storage capacity and model accuracy of the terminal, when obtaining multiple voice training samples, the embodiment of the present disclosure can pre-process the single words in the non-instruction words included in the text content corresponding to the multiple voice training samples. The pre-processing process can use the same representative word to represent all the single words with the same pronunciation in the non-instruction words, and the representative word is used to identify all voice information with the same pronunciation as the same word during the voice recognition process. The disclosed embodiment uses the same representative character to represent all single words with the same pronunciation in non-instruction words. Thus, when computing power and storage capacity are limited, the same order of speech training samples as those in the general speech recognition model training process can be used for model training, thereby reducing the storage space occupied by the model without reducing the model recognition accuracy.
[0084] Before the server represents all the single characters with the same pronunciation in the non-instruction words using the same representative character, it needs to determine a representative character for each pronunciation. When the server determines the representative character for each pronunciation, it can randomly assign a representative character to each pronunciation, or it can use the single character with the highest occurrence frequency among the single characters in each pronunciation as the representative character for each pronunciation. Of course, other methods can also be used to determine the representative character for each pronunciation, which will not be elaborated one by one here. For example, for the single characters "金", "今", "斤", "津", etc. with the pronunciation of "jin", "金" can be randomly assigned as the representative character, or "今" with the highest occurrence frequency can be used as the representative character according to the occurrence frequencies of these single characters.
[0085] In an embodiment of the present disclosure, multiple speech training samples include multiple speech training positive samples and multiple speech training negative samples, and each speech training positive sample contains an instruction word. When the server obtains multiple speech training samples, it can randomly generate multiple speech training positive samples based on the instruction words, or randomly generate multiple speech training negative samples based on the non-instruction words, and then combine the multiple speech positive samples and multiple speech negative samples to form multiple speech training samples. Since the speech recognition model is a model constructed based on statistical methods, the higher the occurrence frequency of the instruction word, the higher the accuracy of the recognition result of the instruction word by the trained speech recognition model. On the contrary, the lower the occurrence frequency of the instruction word, the lower the accuracy of the recognition result of the instruction word by the trained speech recognition model. However, the number of speech positive samples in the multiple speech training samples generated by this method is random, and the proportion of the speech positive samples in the speech training samples is also random. Therefore, it is impossible to ensure that the occurrence frequencies of each instruction word in the multiple speech training samples meet the preset frequency condition. Among them, the preset frequency condition is the occurrence frequency of each instruction word in the multiple speech training samples when the recognition result of the speech recognition model meets the required model accuracy.
[0086] To achieve the purpose of enhancing the instruction word, in the embodiment of the present disclosure, the server can obtain the speech training positive samples and speech training negative samples according to a preset ratio to obtain multiple speech training samples. The preset ratio is used to make the occurrence frequencies of each instruction word in the multiple speech training samples meet the preset frequency condition. Using this method greatly increases the number of speech training positive samples. Since there is an instruction word in the speech positive samples, when constructing a speech recognition model based on multiple speech training samples, the occurrence frequency of the instruction word can be increased, thereby improving the accuracy of the recognition result of the instruction word by the speech recognition model. For example, in the scenario of using an intelligent elevator, when the server constructs a speech recognition model for the intelligent elevator, it can increase the number of speech training positive samples containing call elevator text instructions according to the usage scenario of each floor, so as to reduce the number of misidentifications when using on each floor.
[0087] Step 2. The server builds a speech recognition model based on multiple speech training samples.
[0088] The server builds a speech recognition model based on multiple speech training samples. The following methods can be used:
[0089] (1) The server obtains each word combination contained in multiple speech training samples.
[0090] The server uses 1 word, 2 words, 3 words, ..., N words as sliding windows to perform word segmentation on the text content corresponding to each speech training sample to obtain the word combinations contained in the multiple speech training samples. N can be the maximum number of word combinations set in the field of speech recognition. For example, for any speech training sample, the text content corresponding to the speech training sample is "Have you eaten today?", the server uses 1 character as a sliding window to perform word segmentation on the speech training sample and obtains single characters "today", "day", "you", "eat", "meal", "have you", and "have you"; the server uses 2 characters as sliding windows to perform word segmentation on the speech training sample and obtains two-character word combinations "today", "day you", "you eat", "eat", "have you eaten", and "have you"; the server uses 3 characters as sliding windows to perform word segmentation on the speech training sample and obtains three-character word combinations "today you", "day you eat", "you eat", and "have you eaten"; the server uses 4 characters as sliding windows to perform word segmentation on the speech training sample and obtains four-character word combinations "today you eat", "day you eat", "you eat", and "have you eaten"; the server uses 5 characters as sliding windows to perform word segmentation on the speech training sample and obtains five-character word combinations "today you eat", "day you eat", and "have you eaten", and so on.
[0091] (2) The server determines the frequency of occurrence of each word combination among word combinations with the same number of characters.
[0092] The server counts the total frequency of all word combinations of each number of characters appearing in the text content corresponding to multiple voice training samples, and counts the total frequency of each word combination appearing in the text content corresponding to multiple voice training samples, and obtains the frequency of occurrence of each word combination in the word combinations with the same number of characters by calculating the ratio of the total frequency of each word combination to the total frequency of all word combinations with the same number of characters.
[0093] Specifically, the server counts the total number of words in the text content corresponding to the multiple voice training samples, and counts the total frequency of each word appearing in the text content corresponding to the multiple voice training samples. The server obtains the frequency of appearance of each word by calculating the ratio of the total frequency of each word to the total number of words.
[0094] The server counts the total frequency of all two-character word combinations that appear in the text content corresponding to multiple speech training samples, and also counts the total frequency of each two-character word combination that appears in the text content corresponding to multiple speech training samples. The server calculates the ratio of the total frequency of each two-character word combination to the total frequency of all two-character word combinations to obtain the occurrence frequency of each two-character word combination.
[0095] By analogy, the server counts the total frequency of all N-character word combinations that appear in the text content corresponding to multiple speech training samples, and also counts the total frequency of each N-character word combination that appears in the text content corresponding to multiple speech training samples. The server calculates the ratio of the total frequency of each N-character word combination to the total frequency of all N-character word combinations to obtain the occurrence frequency of each N-character word combination.
[0096] For example, for any speech training sample, the text content corresponding to this speech training sample is "Have you eaten today?". The server counts that the total number of characters in the text content corresponding to multiple speech training samples is 100,000. In this speech training sample, the total frequency of "今" is 100, the total frequency of "天" is 100, the total frequency of "你" is 1,000, the total frequency of "吃" is 10, the total frequency of "饭" is 10, the total frequency of "了" is 1,000, and the total frequency of "吗" is 10. Then the occurrence frequency of "今" is 0.001, the occurrence frequency of "天" is 0.001, the occurrence frequency of "你" is 0.01, the occurrence frequency of "吃" is 0.0001, the occurrence frequency of "饭" is 0.0001, the occurrence frequency of "了" is 0.001, and the occurrence frequency of "吗" is 0.0001. The server counts that the total frequency of all two-character word combinations in the text content corresponding to multiple speech training samples is 100,000. In this speech training text, the total frequency of "今天" is 1,000, the total frequency of "天你" is 10 times, the total frequency of "你吃" is 20, the total frequency of "吃饭" is 100, the total frequency of "饭了" is 10, and the total frequency of "了吗" is 100. Then the occurrence frequency of "今天" is 0.001, the occurrence frequency of "天你" is 0.00001, the occurrence frequency of "你吃" is 0.00002, the occurrence frequency of "吃饭" is 0.0001, the occurrence frequency of "饭了" is 0.00001, and the occurrence frequency of "了吗" is 0.0001. It should be noted that the above takes the word segmentation and statistics of the text content corresponding to a speech training sample as an example. In fact, word segmentation processing is performed synchronously on multiple speech training samples, and the statistics are based on the word segmentation results of multiple speech training samples.
[0097] (2) The server constructs a speech recognition model based on the occurrence frequencies of word combinations with different numbers of characters.
[0098] The server groups all single words and their occurrence frequencies into unigrams, groups all two-word word combinations and their occurrence frequencies into bigrams, groups all three-word word combinations and their occurrence frequencies into triplets, ..., groups all N-word word combinations and their occurrence frequencies into N-tuples, and then builds a speech recognition model based on unigrams, bigrams, triplets, ..., N-tuples.
[0099] 303. When the target text content containing the target instruction word is obtained, the terminal matches the target text content with multiple instruction text templates. When the target text content matches any instruction text template, step 304 is executed. When the target text content does not match any of the instruction text templates, step 306 is executed.
[0100] In the disclosed embodiment, a plurality of instruction text templates are stored in the terminal, and the instruction text template is a template sentence containing instruction words generated according to the user's language habits. For example, in the elevator service, the instruction text template may be: go to the X floor, go to the X floor, stop at the X floor. When it is identified that the target text content contains the target instruction word, for example, in the elevator service, the target instruction word may be the number of floors. The terminal matches the target text content with the plurality of instruction text templates, and then adopts different processing methods according to the matching results. When the target text content matches any instruction text template, the terminal will execute step 304; when the target text content does not match any of the plurality of instruction text templates, the terminal will execute step 306.
[0101] 304. The terminal detects the position of the target instruction word in the target text content. When the position of the target instruction word in the target text content meets the preset position condition, step 305 is executed. When the position of the target instruction word in the target text content does not meet the preset position condition, step 306 is executed.
[0102] Based on the identified target text content, the terminal detects the position of the target instruction word in the target text content, and then adopts different processing methods according to whether the position of the target instruction word in the target text content meets the preset position condition. Among them, the preset position condition is used to indicate the last position allowed to appear in the instruction sentence. For example, when the instruction sentence is a sentence indicating the stop floor of the elevator, and the target instruction word is a floor, the last position allowed to appear in the instruction sentence can be the third word of the instruction sentence, that is, the preset position condition is that the number of words before the floor number shall not be more than two. This embodiment does not limit the preset position condition, and those skilled in the art can set it according to the needs of the scene. When the position of the target instruction word in the target text content meets the preset position condition, that is, the position of the target instruction word in the target text content is before the preset position, it means that the target voice information is instruction voice information, and the terminal executes step 305 to perform the corresponding operation based on the target instruction word; when the position of the target instruction word in the target text content does not meet the preset position condition, that is, the position is after the preset position, it means that the target voice information is meaningless voice information, and the terminal executes step 306.
[0103] 305. The terminal executes the operation corresponding to the target instruction word.
[0104] 306. The terminal does not execute the operation corresponding to the target instruction word.
[0105] The method provided by the embodiment of the present disclosure, after calling the speech recognition model to obtain the target text content, does not directly perform the corresponding operation based on the target instruction word in the target text content, but matches the target text content with multiple instruction text templates. When the target text content matches any instruction text template, it determines whether to execute the operation corresponding to the target instruction word according to the position of the target instruction word in the target text content, thereby avoiding treating target speech information without instruction intention as instruction speech information, improving the accuracy of the recognition result, and reducing the number of misrecognitions.
[0106] See also Figure 4 , the present disclosure provides a speech recognition device, the device comprising:
[0107] A first acquisition module 401 is used to acquire target voice information;
[0108] The recognition module 402 is used to call a speech recognition model to recognize the target speech information, and the speech recognition model is used to convert the speech information into text content;
[0109] A matching module 403 is used to match the target text content with a plurality of instruction text templates when a target text content containing a target instruction word is obtained;
[0110] The execution module 404 is used to execute the operation corresponding to the target instruction word when the target text content matches any instruction text template and the position of the target instruction word in the target text content meets the preset position condition.
[0111] In another embodiment of the present disclosure, the execution module 404 is used to not execute the operation corresponding to the target instruction word when the target text content does not match any of the multiple instruction text templates; or
[0112] The execution module 404 is used for not executing the operation corresponding to the target instruction word when the target text content matches any instruction text template and the position of the target instruction word in the target text content does not meet the preset position condition.
[0113] In another embodiment of the present disclosure, an apparatus for constructing a speech recognition model includes:
[0114] A second acquisition module is used to acquire a plurality of speech training samples, wherein all single characters with the same pronunciation in the non-command words contained in the plurality of speech training samples are represented by the same representative character;
[0115] The building module is used to build a speech recognition model based on multiple speech training samples.
[0116] In another embodiment of the present disclosure, the multiple speech training samples include multiple speech training positive samples and multiple speech training negative samples, each speech training positive sample contains an instruction word, and the second acquisition module is used to acquire the speech training positive samples and the speech training negative samples according to a preset ratio to obtain multiple speech training samples. The preset ratio is used to ensure that the occurrence frequency of each instruction word in the multiple speech training samples meets the preset frequency condition.
[0117] In another embodiment of the present disclosure, a construction module is used to obtain each word combination included in a plurality of speech training samples; determine the frequency of occurrence of each word combination in word combinations with the same number of characters; and construct a speech recognition model based on the frequency of occurrence of word combinations with different numbers of characters.
[0118] In summary, the device provided by the embodiment of the present disclosure, after calling the speech recognition model to obtain the target text content, does not directly perform the corresponding operation based on the target instruction word in the target text content, but matches the target text content with multiple instruction text templates. When the target text content matches any instruction text template, it determines whether to execute the operation corresponding to the target instruction word according to the position of the target instruction word in the target text content, thereby avoiding taking the target speech information without instruction intention as instruction speech information, improving the accuracy of the recognition result, and reducing the number of misrecognitions.
[0119] Figure 5The structure block diagram of an electronic device 500 provided by an exemplary embodiment of the present disclosure is shown. Generally, the device 500 includes: a processor 501 and a memory 502 .
[0120] The processor 501 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 501 may be implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). The processor 501 may also include a main processor and a coprocessor. The main processor is a processor for processing data in an awake state, also known as a CPU (Central Processing Unit); the coprocessor is a low-power processor for processing data in a standby state. In some embodiments, the processor 501 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 501 may also include an AI (Artificial Intelligence) processor, which is used to process computing operations related to machine learning.
[0121] The memory 502 may include one or more computer-readable storage media, which may be non-transitory. The memory 502 may also include a high-speed random access memory, and a non-volatile memory, such as one or more disk storage devices, flash memory storage devices. In some embodiments, the non-transitory computer-readable storage medium in the memory 502 is used to store at least one instruction, which is used to be executed by the processor 501 to implement the speech recognition method provided by the method embodiment of the present disclosure.
[0122] In some embodiments, the electronic device 500 may further optionally include: a peripheral device interface 503 and at least one peripheral device. The processor 501, the memory 502 and the peripheral device interface 503 may be connected via a bus or a signal line. Each peripheral device may be connected to the peripheral device interface 503 via a bus, a signal line or a circuit board. Specifically, the peripheral device includes: a power supply 504.
[0123] The peripheral device interface 503 may be used to connect at least one peripheral device related to I / O (Input / Output) to the processor 501 and the memory 502. In some embodiments, the processor 501, the memory 502, and the peripheral device interface 503 are integrated on the same chip or circuit board; in some other embodiments, any one or two of the processor 501, the memory 502, and the peripheral device interface 503 may be implemented on a separate chip or circuit board, which is not limited in this embodiment.
[0124] The power supply 504 is used to power various components in the electronic device 500. The power supply 504 can be an alternating current, a direct current, a disposable battery, or a rechargeable battery. When the power supply 504 includes a rechargeable battery, the rechargeable battery can be a wired rechargeable battery or a wireless rechargeable battery. A wired rechargeable battery is a battery that is charged through a wired line, and a wireless rechargeable battery is a battery that is charged through a wireless coil. The rechargeable battery can also be used to support fast charging technology.
[0125] Those skilled in the art will understand that Figure 5 The structure shown in the figure does not constitute a limitation on the electronic device 500, and may include more or less components than those shown in the figure, or combine some components, or adopt a different component arrangement.
[0126] In an exemplary embodiment, a computer-readable storage medium including instructions is also provided, such as a memory including instructions, and the above instructions can be executed by a processor of the electronic device 500 to complete the above speech recognition method. Optionally, the storage medium can be a non-transitory computer-readable storage medium, for example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.
[0127] An embodiment of the present disclosure provides a computer-readable storage medium, in which at least one program code is stored. The at least one program code is loaded and executed by a processor to implement a speech recognition method.
[0128] An embodiment of the present disclosure provides a computer program product, which includes a computer program code. The computer program code is stored in a computer-readable storage medium. A processor of a terminal reads the computer program code from the computer-readable storage medium, and the processor executes the computer program code, so that the terminal performs a speech recognition method.
[0129] A person skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware or by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc.
[0130] The above description is only an optional embodiment of the present disclosure and is not intended to limit the present disclosure. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present disclosure shall be included in the protection scope of the present disclosure.
Claims
1. A speech recognition method, characterized in that: The method comprises: Obtain target voice information; Calling a speech recognition model to recognize the target speech information, wherein the speech recognition model is used to convert the speech information into text content; When a target text content including a target instruction word is obtained, the target text content is matched with a plurality of instruction text templates; When the target text content matches any instruction text template, and the position of the target instruction word in the target text content meets the preset position condition, the operation corresponding to the target instruction word is executed; The construction process of the speech recognition model is as follows: Acquire a plurality of speech training samples, wherein all single characters with the same pronunciation in the non-command words contained in the plurality of speech training samples are represented by the same representative character; The speech recognition model is constructed based on the multiple speech training samples.
2. The method according to claim 1, characterized in that The method further comprises: When the target text content does not match any of the multiple instruction text templates, the operation corresponding to the target instruction word is not performed; or, When the target text content matches any instruction text template, and the position of the target instruction word in the target text content does not meet the preset position condition, the operation corresponding to the target instruction word is not performed.
3. The method according to claim 1, characterized in that The plurality of speech training samples include a plurality of speech training positive samples and a plurality of speech training negative samples, each speech training positive sample includes an instruction word, and the step of obtaining the plurality of speech training samples includes: According to a preset ratio, speech training positive samples and speech training negative samples are obtained to obtain the multiple speech training samples, and the preset ratio is used to ensure that the occurrence frequency of each instruction word in the multiple speech training samples meets a preset frequency condition.
4. The method according to claim 1, characterized in that: The step of constructing the speech recognition model based on the plurality of speech training samples comprises: Acquire each word combination included in the plurality of speech training samples; Determine the frequency of occurrence of each word combination among word combinations with the same number of characters; The speech recognition model is constructed according to the occurrence frequency of word combinations with different numbers of characters.
5. A speech recognition device, characterized in that: The device comprises: A first acquisition module, used to acquire target voice information; A recognition module, used to call a speech recognition model to recognize the target speech information, wherein the speech recognition model is used to convert the speech information into text content; A matching module, for matching the target text content with a plurality of instruction text templates when a target text content containing a target instruction word is obtained; An execution module, configured to execute an operation corresponding to the target instruction word when the target text content matches any instruction text template and the position of the target instruction word in the target text content meets a preset position condition; Wherein, the device for constructing the speech recognition model includes: A second acquisition module is used to acquire a plurality of speech training samples, wherein all single characters with the same pronunciation in the non-command words contained in the plurality of speech training samples are represented by the same representative character; A construction module is used to construct the speech recognition model based on the multiple speech training samples.
6. The device according to claim 5, characterized in that The execution module is used for not executing the operation corresponding to the target instruction word when the target text content does not match any of the multiple instruction text templates; or The execution module is used for not executing the operation corresponding to the target instruction word when the target text content matches any instruction text template and the position of the target instruction word in the target text content does not meet a preset position condition.
7. An electronic device, characterized in that: The electronic device includes a processor and a memory, wherein the memory stores at least one program code, and the at least one program code is loaded and executed by the processor to implement the speech recognition method according to any one of claims 1 to 4.
8. A computer-readable storage medium, characterized in that: At least one program code is stored in the storage medium, and the at least one program code is loaded and executed by the processor to implement the speech recognition method according to any one of claims 1 to 4.
9. A computer program product, characterized in that The computer program product includes a computer program code, which is stored in a computer-readable storage medium. A processor of an electronic device reads the computer program code from the computer-readable storage medium, and the processor executes the computer program code, so that the electronic device performs the speech recognition method as described in any one of claims 1 to 4.
Citation Information
Patent Citations
Speech recognition method and device
CN106098066A
Keyword detection device, keyword detection method, and program
CN112655043A