Speech recognition method, electronic device and computer-readable storage medium
Through dictionary tree matching technology, the problem of high complexity of hot word function algorithms in the prior art is solved, and faster speech recognition speed and higher recognition accuracy are achieved.
Patent Information
- Application Number
- CN202111292450.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-03
- Publication Date
- 2025-08-01
- Estimated Expiration
- 2041-11-03
AI Technical Summary
The existing hot word functions implemented based on finite state machine (fst) technology rely heavily on the fst component, resulting in high algorithm complexity and slow speech recognition speed.
The dictionary tree is used to match hot words. By processing the speech to be recognized to be translated into words, multiple decoding paths are generated, and the dictionary tree is traversed to identify whether the phrase matches hot words, and the target words are determined based on the posterior probability and matching results, reducing dependence on the fst component.
It reduces the algorithm complexity of hot word functions and improves the speed and accuracy of speech recognition.
Smart Images

Figure CN113889093B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of speech recognition, and in particular, to a speech recognition method, an electronic device, and a computer-readable storage medium. Background Art
[0002] In daily life, speech recognition technology faces a challenge - the hotword function. The hotword function means that without additional training of the speech recognition model, within an extremely short time, the recognition probability of certain specific sentences is improved, and these specific sentences are user-defined. Conventional speech recognition technology generally relies on a finite state machine for decoding the posterior probability of a neural network, and the hotword function is also implemented based on the finite state transducer (fst) technology.
[0003] However, the hotword function implemented based on the fst technology heavily depends on the fst component, and the amounts of the fst library file and header file are both large, which increases the algorithm complexity of the hotword function and results in a slow speech recognition speed. Summary of the Invention
[0004] In view of this, an object of the present invention is to provide a speech recognition method, an electronic device, and a computer-readable storage medium, which can improve the problem that the hotword function implemented based on the existing fst technology heavily depends on the fst component, increases the algorithm complexity of the hotword function, and results in a slow speech recognition speed.
[0005] To achieve the above object, the technical solutions adopted in the embodiments of the present invention are as follows.
[0006] In a first aspect, the present application provides a speech recognition method, adopting the following technical solutions.
[0007] A speech recognition method, the method comprising:
[0008] Performing text conversion on the speech to be recognized to obtain a plurality of recognized words recognized at each time step and the posterior probability of each recognized word;
[0009] Combining each recognized word at each time step with all recognized words at the previous and next two time steps one by one to obtain a plurality of decoding paths;
[0010] For each decoding path, traversing a preset dictionary tree to check whether all recognized words on the decoding path match the hotwords on the dictionary tree to obtain a matching result; wherein, the dictionary tree includes a root node, a plurality of child nodes, and a plurality of leaf nodes, and a hotword is formed by a path from the root node to a leaf node;
[0011] Based on the posterior probability of each of the recognition words and the matching result, obtain the confidence score of each decoding path, and determine the target sentence according to the confidence score from each decoding path.
[0012] In a feasible implementation manner, the method further includes the step of constructing a dictionary tree, and this step includes:
[0013] Based on the decoding dictionary, perform word segmentation on each hot word in the hot word list with the finest granularity to obtain the word segmentation results of each hot word, and the word segmentation results include a plurality of ordered basic words;
[0014] Set the root node, use the first basic word of the first hot word as the child node of the root node, use each remaining basic word of this hot word as the child node of the basic word before this basic word, and use the last basic word as the leaf node;
[0015] For the first basic word of each remaining hot word, query whether this basic word is the same as at least one child node of the root node. If not, create a new child node, and based on this child node and the remaining basic words, create the child nodes after this child node;
[0016] Otherwise, based on this child node of the root node and the remaining basic words, create subsequent child nodes;
[0017] Until all the hot words are processed, obtain the dictionary tree.
[0018] In a feasible implementation manner, after the step of obtaining the matching result and before the step of obtaining the confidence score of each decoding path based on the posterior probability of each recognition word and the matching result, the method further includes:
[0019] Add a preset probability value to each decoding path with a successful matching result.
[0020] In a feasible implementation manner, the step of obtaining the confidence score of each decoding path based on the posterior probability of each recognition word and the matching result includes:
[0021] Add up the posterior probabilities of each recognition word on each decoding path and add the probability value to obtain the confidence scores of each decoding path;
[0022] Wherein, the probability value of the decoding path with a failed matching result is less than the probability value of the decoding path with a successful matching result.
[0023] In a feasible implementation, after the step of obtaining multiple recognized words recognized at each time step and the posterior probability of each recognized word, before the step of combining each recognized word at each time step with all the recognized words in the previous and next two time steps one by one, the method further includes:
[0024] Compare the posterior probability of each recognized word with a threshold respectively, and eliminate the recognized words whose posterior probability is less than the threshold.
[0025] In a feasible implementation, the step of traversing a preset trie tree for each decoding path to check whether all the words on the decoding path match the hot words on the trie tree includes:
[0026] For each decoding path, if the first recognized word to the last recognized word on the decoding path correspond to the hot words formed by at least one child node of the root node of the trie tree to at least one leaf node, then the decoding path matches the hot words on the trie tree, otherwise the decoding path does not match the hot words on the trie tree.
[0027] In a feasible implementation, the step of performing speech-to-text processing on the speech to be recognized to obtain multiple recognized words recognized at each time step and the posterior probability of the recognized words includes:
[0028] Input the speech to be recognized into a preset neural network. At every other time step, multiple recognized words and the posterior probability of each recognized word are recognized. The neural network is trained to predict the recognized words corresponding to the speech to be recognized and the posterior probability of the recognized words when the speech to be recognized is used as the input. The posterior probability represents the accuracy rate of the recognized words.
[0029] In a feasible implementation, the total length of each time step is consistent with the pronunciation duration of the speech to be recognized.
[0030] In a second aspect, the present application provides an electronic device, adopting the following technical solution.
[0031] An electronic device includes a processor and a memory. The memory stores machine-executable instructions that can be executed by the processor. The processor can execute the machine-executable instructions to implement the speech recognition method as described in the first aspect.
[0032] In a third aspect, the present application provides a computer-readable storage medium, adopting the following technical solution.
[0033] A computer-readable storage medium has a computer program stored thereon. When the computer program is executed by a processor, it implements the speech recognition method as described in the first aspect.
[0034] The speech recognition method provided by the embodiments of the present invention combines each of the multiple recognition words at multiple time steps obtained by performing speech-to-text processing on the speech to be recognized one by one to obtain multiple decoding paths, traverses the trie tree, and queries whether the phrase composed of all the recognition words of each decoding path matches the hot words on the trie tree. If there is a match, it indicates that the hot word recognition is successful. Furthermore, the target sentence can be determined from the decoding paths according to the matching result and the posterior probability. Using the trie tree for hot word matching greatly eliminates the dependence on the fst component and reduces the algorithm complexity of the hot word function, so that the hot words can be recognized faster, and thus the speed and accuracy of speech recognition can be improved.
[0035] To make the above objects, features, and advantages of the present invention more obvious and understandable, the following specifically describes preferred embodiments in conjunction with the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] To more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the accompanying drawings required for the embodiments. It should be understood that the following drawings only show some embodiments of the present invention and should not be regarded as limiting the scope. For those of ordinary skill in the art, other related drawings can be obtained based on these drawings without creative efforts.
[0037] Figure 1 The block diagram of the electronic device provided by this embodiment is shown.
[0038] Figure 2 The structural diagram of the speech recognition system provided by this embodiment is shown.
[0039] Figure 3 The block diagram of the terminal provided by this embodiment is shown.
[0040] Figure 4 The partial flow diagram of the speech recognition method provided by this embodiment is shown.
[0041] Figure 5 Another flow diagram of the speech recognition method provided by this embodiment is shown.
[0042] Figure 6 Shows Figure 5 The flow diagram of some sub-steps of step S100 in
[0043] Figure 7 The partial trie tree diagram provided by this embodiment is shown.
[0044] Figure 8 Another trie tree diagram provided by this embodiment is shown.
[0045] Figure 9 Another schematic flowchart of the speech recognition method provided by this embodiment is shown.
[0046] Figure 10 A schematic diagram of a partial decoding path provided by this embodiment is shown.
[0047] Figure 11 A block diagram of the speech recognition device provided by this embodiment is shown.
[0048] Icons: 110 - electronic device; 120 - memory; 130 - processor; 140 - communication module; 150 - terminal; 160 - sound receiving device; 170 - speech recognition module; 180 - speech recognition device; 190 - conversion module; 200 - matching module; 210 - processing module. Specific embodiments
[0049] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. Usually, the components of the embodiments of the present invention described and shown in the accompanying drawings here can be arranged and designed in various different configurations.
[0050] Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the claimed present invention, but merely represents the selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative efforts belong to the scope of protection of the present invention.
[0051] It should be noted that relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprising", "including" or any other variant thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements not only includes those elements, but also includes other elements not expressly listed, or also includes elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "including one..." does not exclude the presence of additional identical elements in the process, method, article or device including the said element.
[0052] With the continuous increase of speech-tagged data and the continuous development of neural network methods, speech recognition technology has also been constantly improving. Speech recognition technology can already achieve satisfactory accuracy and recognition speed in conventional general scenarios. Although general speech technology has achieved good success, there are still quite a few challenges in daily applications.
[0053] In daily life, one of the challenges faced by speech recognition technology is the hotword function. The hotword function refers to the ability to increase the recognition probability of certain specific sentences within an extremely short time without additional training of the speech recognition model, and these specific sentences are user-defined. In conventional speech recognition technology, the neural network posterior probability decoding generally relies on a finite state transducer (FST), and the hotword function is also implemented based on FST technology.
[0054] However, the hotword function implemented based on FST technology highly depends on FST components, and the amounts of the FST library files and header files are both large, which increases the algorithm complexity of the hotword function and results in a slow speech recognition speed.
[0055] In view of the above considerations, the present invention provides a speech recognition method.
[0056] Please refer to Figure 1 , which is a block diagram of an electronic device 110. The electronic device 110 includes a memory 120, a processor 130, and a communication module 140. The components of the memory 120, the processor 130, and the communication module 140 are electrically connected directly or indirectly to each other to achieve data transmission or interaction. For example, these components can be electrically connected to each other through one or more communication buses or signal lines.
[0057] Among them, the memory 120 is used to store programs or data. The memory 120 can be, but is not limited to, a random access memory 120 (RAM), a read-only memory 120 (ROM), a programmable read-only memory 120 (PROM), an erasable programmable read-only memory 120 (EPROM), an electrically erasable programmable read-only memory 120 (EEPROM), etc.
[0058] The processor 130 is used to read / write data, computer programs, or machine-executable instructions stored in the memory 120 and perform corresponding functions. Specifically, the processor 130 can execute computer programs or machine-executable instructions to implement the speech recognition method.
[0059] The communication module 140 is used to establish a communication connection between the electronic device 110 and other communication terminals 150 through the network and is used to send and receive data through the network.
[0060] It should be understood that Figure 1 The structure shown is only a schematic diagram of the structure of the electronic device 110. The electronic device 110 may also include more or fewer components than those shown Figure 1 in, or have a different configuration from that shown Figure 1 in. Figure 1 Each component shown in can be implemented by hardware, software, or a combination thereof.
[0061] Among them, the electronic device 110 can be, but is not limited to: a computer, a mobile phone, an iPad, a server, a laptop computer, a mobile Internet device, etc.
[0062] More specifically, please refer to Figure 2 and Figure 3 , Figure 2 which is a schematic diagram of the structure of the speech recognition system, Figure 3 and which is a block diagram of the terminal 150. The speech recognition method provided by the present invention can be applied to this speech recognition system. The speech recognition system includes a terminal 150. A sound collection device 160 is provided on the terminal 150. The terminal 150 also includes a screen supporting human-computer interaction, and virtual keys can also be provided on the terminal 150 and a speech recognition module 170 is installed. After clicking the speech recognition option on the terminal 150, the virtual keys are automatically displayed on the screen. At this time, long-pressing the virtual keys, the sound collection device 160 can recognize the speech to record the speech to be recognized. After the speech to be recognized is recorded, the speech recognition module 170 starts to use the speech recognition method to recognize the speech to be recognized. Finally, the target sentence corresponding to the speech to be recognized can be displayed on the screen of the terminal 150. Among them, the terminal 150 can be, but is not limited to: a computer, a mobile phone, an iPad, a mobile Internet device, etc.
[0063] In addition, the virtual keys can also be replaced by physical keys.
[0064] In one implementation manner, refer to Figure 4 , which is a schematic flowchart of a speech recognition method provided by the present invention. This implementation manner mainly takes the execution subject of this method as the speech recognition module 170 in the figure as an example for illustration. In this implementation manner, this method may include the following steps.
[0065] S101, Perform speech-to-text conversion on the speech to be recognized to obtain multiple recognized words identified at each time step and the posterior probability of each recognized word.
[0066] Specifically, the user long-presses the virtual button displayed on the screen of the terminal 150 after selecting the speech recognition option and starts speaking. The sound collection device 160 collects the sound to obtain the speech to be recognized. The speech recognition module performs speech-to-text conversion on the speech to be recognized collected by the sound collection device 160 to obtain multiple recognized words identified at each time step and the posterior probability of each recognized word.
[0067] S103, Combine each recognized word at each time step with all the recognized words in the two adjacent time steps one by one to obtain multiple decoding paths.
[0068] Specifically, the speech recognition module 170 combines each recognized word at each time step with all the recognized words in the two adjacent time steps one by one to obtain multiple decoding paths.
[0069] For example, when performing speech-to-text conversion on the speech information to be recognized, there are a total of 400 time steps, and 100 recognized words are identified at each time step. After completing the speech-to-text conversion, there are a total of 100 400 decoding paths.
[0070] S105, For each decoding path, traverse the preset trie tree to check whether all the recognized words on the decoding path match the hot words on the trie tree to obtain the matching result.
[0071] Among them, the trie tree includes a root node, multiple child nodes, and multiple leaf nodes. A hot word is composed of a path from the root node to a leaf node.
[0072] The root node is the starting node, and the leaf node is the terminal 150 node. There are many first-level child nodes under the root node of the trie tree, that is, the child nodes of the root node, and there are also many child nodes of the child nodes. All the nodes are sequentially combined during the period from the root node to a leaf node to form a hot word.
[0073] Specifically, for each decoding path, the speech recognition module 170 traverses the preset trie tree to check whether all the recognized words on the decoding path match the hot words on the trie tree. If so, the decoding path matches successfully; otherwise, it fails. Therefore, the matching result includes success and failure.
[0074] S107, According to the posterior probability of each recognized word and the matching result, obtain the confidence score of each decoding path. According to the confidence score, determine the target sentence from each decoding path.
[0075] Specifically, the speech recognition module 170 obtains the confidence score of each decoding path according to the posterior probability of each recognized word and the matching result, and determines the target sentence from each decoding path according to the confidence score.
[0076] In the above speech recognition method, after combining the multiple recognized words at multiple time steps obtained by performing speech-to-text processing on the speech to be recognized one by one, multiple decoding paths are obtained, and the trie is traversed to query whether the phrase composed of all the recognized words in each decoding path matches the hot word on the trie. If it matches, it indicates that the hot word is successfully recognized. Furthermore, the target sentence can be determined from each decoding path according to the matching result and the posterior probability of the recognized word. Using the trie for hot word matching greatly eliminates the dependence on the fst component, reduces the algorithm complexity of the hot word function, so that the hot word can be recognized faster, and thus the speed of speech recognition can be improved, and the accuracy of speech recognition can also be improved.
[0077] The above speech recognition method is implemented based on the trie. Therefore, referring to Figure 5 , the speech recognition method provided in this embodiment further includes step S100, which is executed before step S101. It should be noted that each time steps S101 - S107 are executed, it is not necessary to perform step S100 each time. After step S100 is executed once, it only needs to be updated regularly.
[0078] S100, construct a trie.
[0079] It should be understood that the trie can be constructed on another device and then stored in the terminal 150 in the figure for use.
[0080] Please continue to refer to Figure 5 , the speech recognition method provided in this embodiment further includes step S106. Step S106 is executed after step S105 and before step S107.
[0081] S106, add a preset probability value to each decoding path with a successful matching result.
[0082] By increasing the probability value of the decoding path with a successful match, it helps the target sentence corresponding to the speech to be recognized obtained subsequently to be more accurate.
[0083] In one embodiment, referring to Figure 6 , it is a flowchart of some sub-steps of step S100, including the following steps.
[0084] S100-1, based on the decoding dictionary, segment each hot word on the hot word list with the finest granularity to obtain the segmentation result of each hot word.
[0085] Among them, the word segmentation result includes multiple ordered basic words. When the hot word list can be provided to the user, the hot words in the hot word list are the hot words determined by the user himself.
[0086] For example, when the hot word is "speech recognition", after word segmentation, the word segmentation results are "language", "sound", "recognition" and "identification".
[0087] Moreover, any word segmenter can be adopted to segment each hot word with the finest granularity based on the decoding dictionary. In Chinese word segmentation, the finest granularity is a single character.
[0088] S100-2, set the root node.
[0089] Among them, there are no words on the root node, and the root node can be any character that does not belong to a word. For example, for a Chinese dictionary tree, the root node can be "root".
[0090] S100-3, take the first basic word of the first hot word as the child node of the root node, take each remaining basic word of this hot word as the child node of the basic word before it, and take the last basic word as the leaf node.
[0091] Specifically, when initially constructing the dictionary tree, that is, when there is only the root node, take the first basic word of the first hot word as the child node of the root, then take the second basic word of the first hot word as the child node of the first basic word, and the subsequent basic words also follow this rule until the last basic word of the first hot word is used as the leaf node.
[0092] For example, referring to the figure, the word segmentation results of "hot word construction" are "hot", "word", "construction", "creation". At this time, if "hot word construction" is the first hot word, then "hot" is the first child node of the root node "root", "word" is the first child node of "hot", "construction" is the first child node of "word", and "creation" is the first child node of "construction".
[0093] S100-4, for the first basic word of each remaining hot word, query whether this basic word is the same as at least one child node of the root node. If not, execute step S100-5; otherwise, go to step S100-6. S100-5, create a new child node, and based on this child node and the remaining basic words, create the child nodes after this child node.
[0094] For example, referring to Figure 7If "hot word recognition" is not the first hot word and the first hot word is "hot word construction", and the word segmentation result of "hot word recognition" is "hot", "word", "recognition", and "identification". Then, after the first hot word, "hot" and "word" already exist in the trie, but "recognition" does not. Therefore, a new child node is created under "word", and "recognition" is used as the content of this child node, and "identification" is used as the child node of "recognition".
[0095] S100-6, based on this child node of the root node and the remaining basic words, create subsequent child nodes.
[0096] For example, referring to Figure 8 , the hot word to be added to the trie is "speech recognition", and its word segmentation result is "language", "sound", "recognition", and "identification". And currently, only "hot word construction" and "hot word recognition" exist in the trie. Then, a new child node "language" is created on the root node "root", and subsequent nodes "sound", "recognition", and "identification" are created based on the child node "language".
[0097] S100-7, if all the hot words in the hot word list have been processed, the trie is obtained.
[0098] Through the above method, a trie can be constructed.
[0099] Moreover, when a new hot word needs to be added to the built trie, the method of steps S100-4 to S100-6 can be used.
[0100] In addition, after adding "language" and "sound" of the hot word "speech recognition" to the trie, the existing "recognition" in the trie cannot be directly used as the child node of "sound".
[0101] Continue to refer to Figure 8 , but when the hot word added to the trie is "speech recognition technology", the "recognition" of the existing hot word "hot word recognition" in the trie cannot be used as the child node of "sound" of the hot word "speech recognition technology". That is, when creating a trie, follow the principle that only from the root node to the leaf node is a hot word, and the subsequent added hot words cannot damage the existing hot words in the trie. In other words, the leaf nodes that make up a complete hot word cannot have child nodes, that is, the existing leaf nodes in the trie cannot be used as the parent node of a certain basic word of a new hot word.
[0102] In one implementation, step S101 can be implemented by the following method: input the speech to be recognized into a preset neural network, and every other time step, multiple recognition words and the posterior probability of each recognition word are recognized.
[0103] Among them, the neural network is trained to predict the recognition word corresponding to the speech to be recognized and the posterior probability of the recognition word when the speech to be recognized is used as the input. The posterior probability characterizes the accuracy rate of the recognition word.
[0104] In addition, the neural network for processing the speech to be recognized into text can be trained by any algorithm. Using a neural network for speech-to-text processing, that is, performing speech decoding, is a common method for speech recognition decoding such as speech recognition decoding based on fst and ctc speech recognition decoding.
[0105] It should be noted that when processing a speech to be recognized into text, there are multiple time steps.
[0106] Moreover, the total length of each time step is consistent with the pronunciation time of the speech to be recognized.
[0107] For example, for a 4-second speech to be recognized, with each 10 ms as a time step, there are a total of 400 time steps. In order to avoid, to a certain extent, increasing the matching complexity of the recognition words obtained after processing the speech to be recognized into text during subsequent matching, referring to Figure 9 , the speech recognition method provided in this embodiment further includes step S102.
[0108] S102, respectively compare the posterior probabilities of each recognition word with a threshold, and eliminate the recognition words with posterior probabilities less than the threshold.
[0109] For a recognition word with a posterior probability lower than the threshold, the probability that it is the correct recognition word is extremely small.
[0110] In one embodiment, the "for each decoding path, traverse the preset trie and check whether all the recognition words on this decoding path match the hot words on the trie" in S105 can be implemented through the following steps:
[0111] For each decoding path, if the first recognition word to the last recognition word of this decoding path correspond to the hot words formed by at least one child node of the root node of the trie to at least one leaf node, then this decoding path matches the hot words on the trie; otherwise, this decoding path does not match the hot words on the trie.
[0112] For example, all the recognition words on the decoding path are "hot word recognition", and on the trie from the root node to the leaf node, there are "hot", "word", "recognition", and "identification". At this time, the recognition words on the decoding path correspond to the hot words formed by the root node to the leaf node on the trie, and the matching is successful.
[0113] All the recognized words on the decoding path are "image recognition", and there is no word corresponding to "image recognition" among the hot words formed from the root node to the leaf node in the trie. At this time, the recognized words on the decoding path do not correspond to the hot words in the trie, and the matching fails.
[0114] For example, referring to Figure 10 , it is the decoding path obtained by recognizing a voice to be measured. This voice to be measured has a total of four time steps, and each time step has 3 recognized words, so there are a total of 81 decoding paths. Among them, "eps" means empty. The correct target sentence corresponding to the voice to be recognized is "hot word construction".
[0115] After matching these 81 decoding paths with the trie respectively, it can be obtained that the decoding paths "hot -> word -> construction -> build" and "hot word -> eps -> eps -> build" correspond to the hot words formed from the root node to the leaf node in the trie. Therefore, these two paths match successfully, and the other two paths match fail.
[0116] In one implementation, the following steps can be used to achieve "obtaining the confidence score of each decoding path according to the posterior probability of each recognized word and the matching result, and according to the confidence score" in step S107:
[0117] Add the posterior probabilities of the recognized words on each decoding path and add the probability value to obtain the confidence scores of each decoding path.
[0118] Among them, the probability value of the decoding path with a failed matching result is less than the probability value of the decoding path with a successful matching result.
[0119] Specifically, the probability value of the decoding path with a failed matching result can be zero or any value less than the probability value of the decoding path with a successful matching result.
[0120] Further, when multiple decoding paths have been obtained after executing step S103, the decoding paths with scores less than a certain value obtained by adding the posterior probabilities of the recognized words can be eliminated to reduce the matching time when matching with the trie subsequently.
[0121] Moreover, the eliminated decoding paths will be eliminated forever and will not enter the process of determining the target sentence in the subsequent step S107.
[0122] On the above basis, the following steps can be used to achieve "determining the target sentence from each of the decoding paths according to the confidence score" in step S107:
[0123] Compare the confidence scores of each decoding path, and combine the recognized words on the decoding path with the highest confidence score in order to obtain the target sentence.
[0124] In other embodiments, the recognition words on the decoding paths with confidence scores greater than a certain threshold can be combined in order to obtain multiple target sentences.
[0125] The target sentence is the text finally recognized from the speech to be measured.
[0126] Compared with the hotword function in conventional speech recognition technologies, the speech recognition method provided by the present invention performs hotword matching based on a trie, has very little dependence on other components, only requires the trie data structure, and its algorithm complexity is lgN, making the algorithm complexity extremely small. Therefore, it can greatly improve the matching speed and thus improve the speech recognition speed.
[0127] To execute the corresponding steps in the above embodiments and all possible ways, an implementation of a speech recognition device 180 is given below. Optionally, the speech recognition device 180 may adopt the device structure of the electronic device 110 shown above. Figure 1 Please refer further to Figure 11 , Figure 11 FIG. is a functional module diagram of a speech recognition device 180 provided by an embodiment of the present invention. It should be noted that for the speech recognition device 180 provided in this embodiment, its basic principle and the technical effects produced are the same as those in the above embodiments. For the sake of brief description, for the parts not mentioned in this embodiment, reference may be made to the corresponding content in the above embodiments. The speech recognition device 180 includes a conversion module 190, a matching module 200, and a processing module 210.
[0128] The conversion module 190 is configured to perform text conversion on the speech to be recognized, obtain multiple recognition words recognized at each time step and the posterior probability of each recognition word, and combine each recognition word at each time step with all recognition words in the previous and next two time steps one by one to obtain multiple decoding paths.
[0129] The matching module 200 is configured to traverse a preset trie for each decoding path to check whether all recognition words on the decoding path match the hotwords on the trie to obtain a matching result.
[0130] Among them, the trie includes a root node, multiple child nodes, and multiple leaf nodes. A hotword is formed by a path from the root node to a leaf node.
[0131] The processing module 210 is configured to obtain the confidence score of each decoding path according to the posterior probability of each recognition word and the matching result, and determine the target sentence from each decoding path according to the confidence score.
[0132] Optionally, the above modules may be stored in the form of software or firmware (Firmware) in Figure 1Stored in the memory 120 shown or in the operating system (OS) of the electronic stylus, and can be executed by Figure 1 the processor 130 therein. Meanwhile, the data, program codes, etc. required for executing the above modules can be stored in the memory 120.
[0133] In several embodiments provided in the present application, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely illustrative. For example, the flowcharts and block diagrams in the drawings show the possible architectures, functions, and operations of the devices, methods, and computer program products according to multiple embodiments of the present invention. In this regard, each block in the flowchart or block diagram can represent a module, a program segment, or a part of code, and the module, program segment, or part of code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than marked in the drawings. For example, two consecutive blocks can actually be executed substantially in parallel, and they can sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagram and / or flowchart, and the combination of blocks in the block diagram and / or flowchart, can be implemented by a dedicated hardware-based system for performing the specified functions or actions, or can be implemented by a combination of dedicated hardware and computer instructions.
[0134] In addition, the functional modules in each embodiment of the present invention can be integrated together to form an independent part, or each module can exist alone, or two or more modules can be integrated to form an independent part.
[0135] If the above functions are implemented in the form of software functional modules and sold or used as an independent product, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or a part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in each embodiment of the present invention. The aforementioned storage medium includes: various media such as USB flash drives, mobile hard disks, read-only memories (ROMs), random access memories (RAMs), magnetic disks, or optical discs that can store program codes.
[0136] The above are only the preferred embodiments of the present invention and are not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included within the protection scope of the present invention.
Claims
1. A voice recognition method, characterized in that, The method includes: Performing speech-to-text processing on the speech to be recognized to obtain multiple recognized words recognized at each time step and the posterior probability of each recognized word; Combining each of the recognized words at each of the time steps with all the recognized words at the two adjacent time steps one by one to obtain multiple decoding paths; wherein, each of the decoding paths includes one recognized word at each time step; For each decoding path, traversing a preset trie tree to check whether all the recognized words on the decoding path match the hot words on the trie tree to obtain a matching result; wherein, the trie tree includes a root node, multiple child nodes and multiple leaf nodes, and a hot word is formed by a path from the root node to a leaf node; Adding a preset probability value to each of the decoding paths with a successful matching result; According to the posterior probability of each of the recognized words and the matching result, obtaining the confidence score of each of the decoding paths, and determining a target sentence according to the confidence score from each of the decoding paths; The step of obtaining the confidence score of each of the decoding paths according to the posterior probability of each of the recognized words and the matching result includes: Adding up the posterior probabilities of each of the recognized words on each of the decoding paths and adding the probability value to obtain the confidence score of each of the decoding paths; Wherein, the probability value of the decoding path with a failed matching result is less than the probability value of the decoding path with a successful matching result.
2. The speech recognition method according to claim 1, wherein The method further includes a step of constructing a trie tree, and this step includes: Based on a decoding dictionary, performing word segmentation on each of the hot words on the hot word list with the finest granularity to obtain the word segmentation result of each of the hot words, and the word segmentation result includes multiple ordered basic words; Setting a root node, taking the first basic word of the first hot word as the child node of the root node, taking each of the remaining basic words of the hot word as the child node of the basic word before it, and taking the last basic word as the leaf node; For the first basic word of each of the remaining hot words, querying whether the basic word is the same as at least one of the child nodes of the root node, if not, creating a new child node, and creating the child nodes after the child node based on the child node and the remaining basic words; Otherwise, creating subsequent child nodes based on the child node of the root node and the remaining basic words; Until all the hot words are processed to obtain a trie tree.
3. The speech recognition method according to claim 1 or 2, characterized in that After the step of obtaining multiple recognized words recognized at each time step and the posterior probability of each recognized word, and before the step of combining each of the recognized words at each of the time steps with all the recognized words at the two adjacent time steps one by one, the method further includes: Comparing the posterior probability of each of the recognized words with a threshold respectively, and removing the recognized words with a posterior probability less than the threshold.
4. The voice recognition method according to claim 1 or 2, characterized in that, The step of, for each decoding path, traversing a preset trie tree to check whether all the words on the decoding path match the hot words on the trie tree includes: For each of the decoding paths, if the first recognized word to the last recognized word of the decoding path correspond to a hot word formed by at least one child node of the root node of the trie tree to at least one leaf node, then the decoding path matches the hot word on the trie tree; otherwise, the decoding path does not match the hot word on the trie tree.
5. The voice recognition method according to claim 1, characterized in that, The step of performing speech-to-text processing on the speech to be recognized to obtain a plurality of recognized words and the posterior probabilities of the recognized words recognized at each time step includes: Inputting the speech to be recognized into a preset neural network, and recognizing a plurality of recognized words and the posterior probabilities of each recognized word at every other time step. The neural network is trained to predict the recognized words corresponding to the speech to be recognized and the posterior probabilities of the recognized words when the speech to be recognized is used as the input. The posterior probability represents the accuracy rate of the recognized word.
6. The voice recognition method according to claim 1 or 5, characterized in that The total length of each of the time steps is consistent with the pronunciation time of the speech to be recognized.
7. An electronic device, characterized in that, It includes a processor and a memory. The memory stores machine-executable instructions that can be executed by the processor. The processor can execute the machine-executable instructions to implement the speech recognition method according to any one of claims 1-6.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the speech recognition method according to any one of claims 1-6.
Citation Information
Patent Citations
Voice recognition method and system
CN102592595A
Voice keyword recognition method and device, electronic equipment and storage medium
CN110610707A