Keyword detection method, device, equipment and storage medium
By dividing the speech and processing the probability distribution matrix, combined with the fuzzy matching of syllables and words, the problem of inflexible keyword detection in the existing technology is solved, and flexible detection of different keywords is achieved.
Patent Information
- Application Number
- CN202210734292.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-27
- Publication Date
- 2024-08-27
- Estimated Expiration
- 2042-06-27
AI Technical Summary
Existing keyword detection methods are based on filler models. The trained model can only detect fixed keywords. When the keywords change, the model needs to be retrained, resulting in inflexibility.
By dividing the speech, multiple speech segments are obtained and the probability distribution matrix is calculated. Fuzzy matching is performed based on the probability distribution of syllables and words to determine the speech recognition sequence and then determine whether it contains keywords, achieving flexible detection of different keywords.
There is no need to re-perform all the steps for different keywords, the operation is simple and flexible, and it can effectively detect whether the speech contains specific keywords.
Smart Images

Figure CN115132205B
Abstract
Description
Technical Field
[0001] The embodiments of the present disclosure relate to the field of artificial intelligence technology. More specifically, the embodiments of the present disclosure relate to a keyword detection method, device, equipment and storage medium. Background Art
[0002] This section is intended to provide a background or context to the embodiments of the disclosure that are recited in the claims. No description herein is admitted to be prior art by inclusion in this section.
[0003] Keyword detection refers to the process of detecting whether there are keywords in a voice file after obtaining it. With the development of artificial intelligence technology, speech recognition has been widely used in scenarios such as voice search and voice review.
[0004] At present, keyword detection is mainly achieved through the blank filling model. The meaning of blank filling is to fill in the blanks. In the field of keyword detection, the blank filling model considers the keyword detection problem as a frame-by-frame sequence labeling problem. Keywords are defined as different labels, and an additional "blank filling" label is used to match all non-keywords. For a certain keyword, a corresponding blank filling model can be constructed and trained to enable the blank filling model to have the ability to detect the keyword. Then the speech to be detected is input into the blank filling model to obtain the corresponding keyword detection result.
[0005] In the above scheme, since the filler model is trained based on fixed keywords, the trained filler model can only detect the keyword. When the keyword changes, a new filler model needs to be trained to complete keyword detection, which is not flexible enough. Summary of the invention
[0006] The present disclosure provides a keyword detection method, device, equipment and storage medium to solve the problem that current keyword detection solutions are not flexible enough.
[0007] In a first aspect, the present disclosure provides a keyword detection method, comprising:
[0008] Dividing the first speech according to corresponding time steps to obtain a corresponding plurality of speech segments;
[0009] Acquire a probability distribution matrix according to the multiple voice segments, and determine at least one voice recognition sequence according to the probability distribution matrix corresponding to the multiple voice segments, wherein the probability distribution matrix includes a probability vector at each time step, and the probability vector indicates the probability that the character at the time step is each preset character in the preset character set;
[0010] Performing fuzzy matching processing on the at least one speech recognition sequence according to a plurality of associated characters corresponding to the keyword to obtain a category of each of the speech recognition sequences, wherein the categories include a first category and a second category, the first category indicating that the corresponding speech recognition sequence includes at least one of the associated characters, and the second category indicating that the corresponding speech recognition sequence does not include the associated characters;
[0011] According to the category of each of the speech recognition sequences and / or the probability distribution matrix, a detection result of the first speech is obtained, wherein the detection result indicates that the first speech includes the keyword, or the detection result indicates that the first speech does not include the keyword.
[0012] In a possible implementation, acquiring a probability distribution matrix according to the multiple speech segments, and determining at least one speech recognition sequence according to the probability distribution matrix corresponding to the multiple speech segments, includes:
[0013] Performing feature extraction processing on the multiple speech segments to obtain feature vectors;
[0014] The feature vector is encoded by an encoder to obtain encoding features of the multiple speech segments;
[0015] The probability distribution matrix is acquired according to the coding feature, and the at least one speech recognition sequence is determined according to the probability distribution matrix.
[0016] In a possible implementation, acquiring the probability distribution matrix according to the coding feature, and determining the at least one speech recognition sequence according to the probability distribution matrix includes:
[0017] Performing syllable sequence mapping processing on the coding features according to the syllable classifier to obtain a syllable probability distribution matrix, wherein the syllable probability distribution matrix includes syllable probability vectors at each time step, and the bth element in any ath syllable probability vector indicates the syllable corresponding to the ath speech segment, which is the probability of the bth preset syllable in the preset syllable set;
[0018] Performing beam search processing on K preset syllables according to the syllable probability distribution matrix to obtain at least one syllable sequence, wherein the number of syllables included in each of the syllable sequences is L, and L is a positive integer;
[0019] According to the syllable probability distribution matrix and the at least one syllable sequence, a word probability distribution matrix and at least one word sequence are obtained, wherein the word probability distribution matrix includes L word probability vectors, and the dth element in any cth word probability vector indicates the probability that the word corresponding to the cth syllable is the dth preset word in the preset word set;
[0020] Wherein, the probability distribution matrix includes the syllable probability distribution matrix and the word probability distribution matrix, and the speech recognition sequence includes the syllable sequence and the word sequence;
[0021] Among them, a is a positive integer, b is a positive integer greater than or equal to 1 and less than or equal to K, K is the number of preset syllables included in the preset syllable set, K is a positive integer, c is a positive integer greater than or equal to 1 and less than or equal to L, d is a positive integer greater than or equal to 1 and less than or equal to N, and N is the number of preset characters included in the preset character set.
[0022] In a possible implementation, for any time step in the beam search process, if the current syllable path does not include the key syllable corresponding to the keyword, and the current syllable path includes the key syllable after being connected with the i-th preset syllable, the method further includes:
[0023] A weight excitation is performed on the syllable path after the current syllable path and the i-th preset syllable are connected.
[0024] In a possible implementation, acquiring a word probability distribution matrix and at least one word sequence according to the syllable probability distribution matrix and the at least one syllable sequence includes:
[0025] Decoding the at least one syllable sequence and the coding feature according to the decoder and the word classifier to obtain the word probability distribution matrix;
[0026] A beam search process is performed on N preset words according to the word probability distribution matrix to obtain the at least one word sequence, and the number of words included in each of the word sequences is L.
[0027] In a possible implementation, for any time step in the beam search process, if the current word path does not include the keyword corresponding to the keyword, and the current word path includes the keyword after being connected with the i-th preset word, the method further includes:
[0028] A weight excitation is performed on the word path after the current word path and the i-th preset word are connected.
[0029] In a possible implementation, the multiple associated characters include at least one matching syllable and at least one matching word corresponding to the keyword; and performing fuzzy matching processing on the at least one speech recognition sequence according to the multiple associated characters corresponding to the keyword to obtain the category of each of the speech recognition sequences includes:
[0030] Performing fuzzy matching processing on the at least one syllable sequence according to the at least one matching syllable to obtain a category of each of the syllable sequences;
[0031] Performing fuzzy matching processing on the at least one word sequence according to the at least one matching word to obtain a category of each of the word sequences;
[0032] Among them, the category of the target syllable sequence containing the matching syllable and the category of the target word sequence containing the matching word is the first category; the category of the syllable sequence other than the target syllable sequence and the category of the word sequence other than the target word sequence is the second category.
[0033] In a possible implementation, dividing the first speech according to corresponding time steps to obtain a corresponding plurality of speech segments includes:
[0034] The first speech is framed according to a preset time interval and a preset downsampling rate to obtain the multiple speech segments.
[0035] In a possible implementation, acquiring the detection result of the first speech according to the category of each of the speech recognition sequences and / or the probability distribution matrix includes:
[0036] In response to the category of each of the speech recognition sequences being the second category, determining that the detection result of the first speech is that the first speech does not include the keyword;
[0037] In response to each of the speech recognition sequences including the target syllable sequence and the target word sequence of the first category, obtaining a first score of the target syllable sequence according to the syllable probability distribution matrix and the target syllable sequence;
[0038] Obtaining a second score of the target word sequence according to the word probability distribution matrix and the target word sequence;
[0039] The detection result is obtained according to the first score and the second score.
[0040] In a possible implementation, obtaining a first score of the target syllable sequence according to the syllable probability distribution matrix and the target syllable sequence includes:
[0041] Determining a probability peak of the target syllable sequence in the syllable probability distribution matrix, wherein for any syllable in the target syllable sequence, the probability peak is a time period corresponding to a maximum probability value of the syllable in the syllable probability distribution matrix;
[0042] Determining a first target matrix in the syllable probability distribution matrix according to the probability peak of the target syllable sequence;
[0043] The first score is obtained according to the first target matrix and the target syllable sequence.
[0044] In a possible implementation, obtaining a second score of the target word sequence according to the word probability distribution matrix and the target word sequence includes:
[0045] According to the probability peak of the target syllable sequence, determining the probability peak of the target word sequence in the word probability distribution matrix, wherein for any word in the target word sequence, the probability peak is the time period corresponding to the maximum probability value of the word in the word probability distribution matrix;
[0046] Determining a second target matrix in the word probability distribution matrix according to the probability peak of the target word sequence;
[0047] The second score is obtained according to the second target matrix and the target word sequence.
[0048] In a possible implementation manner, obtaining the detection result according to the first score and the second score includes:
[0049] determining a target score among the first score and the second score;
[0050] When the target score is greater than or equal to a preset threshold, determining that the detection result is that the first speech includes the keyword;
[0051] When the target score is less than the preset threshold, it is determined that the detection result is that the first speech does not include the keyword.
[0052] In a possible implementation, the detection result is that the first speech includes the keyword, and the method further includes:
[0053] The time period of the keyword in the first speech is determined according to the time step corresponding to the probability peak, the preset time interval and the downsampling rate.
[0054] In a possible implementation manner, the time period is:
[0055] t=(x*e*f,y*e*f),
[0056] The t is the time period, the x indicates that the time step corresponding to the first character in the keyword is the xth time step, the y indicates that the time step corresponding to the last character in the keyword is the yth time step, the e is the preset time interval, and the f is the preset downsampling rate.
[0057] In a second aspect, the present disclosure provides a keyword detection device, comprising:
[0058] An acquisition module, used for dividing the first speech according to corresponding time steps to obtain a plurality of corresponding speech segments;
[0059] A processing module, configured to obtain a probability distribution matrix according to the plurality of speech segments, and determine at least one speech recognition sequence according to the probability distribution matrix corresponding to the plurality of speech segments, wherein the probability distribution matrix includes a probability vector at each time step, and the probability vector indicates a probability that the character at the time step is a preset character in a preset character set;
[0060] a determination module, configured to perform fuzzy matching processing on the at least one speech recognition sequence according to a plurality of associated characters corresponding to the keyword, to obtain a category of each of the speech recognition sequences, wherein the categories include a first category and a second category, the first category indicating that the corresponding speech recognition sequence includes at least one of the associated characters, and the second category indicating that the corresponding speech recognition sequence does not include the associated characters;
[0061] A detection module is used to obtain a detection result of the first speech according to the category of each speech recognition sequence and / or the probability distribution matrix, wherein the detection result indicates that the first speech includes the keyword, or the detection result indicates that the first speech does not include the keyword.
[0062] In a possible implementation manner, the processing module is specifically used to:
[0063] Performing feature extraction processing on the multiple speech segments to obtain feature vectors;
[0064] The feature vector is encoded by an encoder to obtain encoding features of the multiple speech segments;
[0065] The probability distribution matrix is acquired according to the coding feature, and the at least one speech recognition sequence is determined according to the probability distribution matrix.
[0066] In a possible implementation manner, the processing module is specifically used to:
[0067] Performing syllable sequence mapping processing on the coding features according to the syllable classifier to obtain a syllable probability distribution matrix, wherein the syllable probability distribution matrix includes syllable probability vectors at each time step, and the bth element in any ath syllable probability vector indicates the syllable corresponding to the ath speech segment, which is the probability of the bth preset syllable in the preset syllable set;
[0068] Performing beam search processing on K preset syllables according to the syllable probability distribution matrix to obtain at least one syllable sequence, wherein the number of syllables included in each of the syllable sequences is L, and L is a positive integer;
[0069] According to the syllable probability distribution matrix and the at least one syllable sequence, a word probability distribution matrix and at least one word sequence are obtained, wherein the word probability distribution matrix includes L word probability vectors, and the dth element in any cth word probability vector indicates the probability that the word corresponding to the cth syllable is the dth preset word in the preset word set;
[0070] Wherein, the probability distribution matrix includes the syllable probability distribution matrix and the word probability distribution matrix, and the speech recognition sequence includes the syllable sequence and the word sequence;
[0071] Among them, a is a positive integer, b is a positive integer greater than or equal to 1 and less than or equal to K, K is the number of preset syllables included in the preset syllable set, K is a positive integer, c is a positive integer greater than or equal to 1 and less than or equal to L, d is a positive integer greater than or equal to 1 and less than or equal to N, and N is the number of preset characters included in the preset character set.
[0072] In a possible implementation, for any time step in the beam search process, if the current syllable path does not include the key syllable corresponding to the keyword, and the current syllable path includes the key syllable after being connected with the i-th preset syllable, the processing module is further configured to:
[0073] A weight excitation is performed on the syllable path after the current syllable path and the i-th preset syllable are connected.
[0074] In a possible implementation manner, the processing module is specifically used to:
[0075] Decoding the at least one syllable sequence and the coding feature according to the decoder and the word classifier to obtain the word probability distribution matrix;
[0076] A beam search process is performed on N preset words according to the word probability distribution matrix to obtain the at least one word sequence, and the number of words included in each of the word sequences is L.
[0077] In a possible implementation, for any time step in the beam search process, if the current word path does not include the keyword corresponding to the keyword, and the current word path includes the keyword after being connected with the i-th preset word, the processing module is further configured to:
[0078] A weight excitation is performed on the word path after the current word path and the i-th preset word are connected.
[0079] In a possible implementation, the multiple associated characters include at least one matching syllable and at least one matching word corresponding to the keyword; and the determination module is specifically configured to:
[0080] Performing fuzzy matching processing on the at least one syllable sequence according to the at least one matching syllable to obtain a category of each of the syllable sequences;
[0081] Performing fuzzy matching processing on the at least one word sequence according to the at least one matching word to obtain a category of each of the word sequences;
[0082] Among them, the category of the target syllable sequence containing the matching syllable and the category of the target word sequence containing the matching word is the first category; the category of the syllable sequence other than the target syllable sequence and the category of the word sequence other than the target word sequence is the second category.
[0083] In a possible implementation manner, the determining module is specifically configured to:
[0084] The first speech is framed according to a preset time interval and a preset downsampling rate to obtain the multiple speech segments.
[0085] In a possible implementation, the detection module is specifically used to:
[0086] In response to the category of each of the speech recognition sequences being the second category, determining that the detection result of the first speech is that the first speech does not include the keyword;
[0087] In response to each of the speech recognition sequences including the target syllable sequence and the target word sequence of the first category, obtaining a first score of the target syllable sequence according to the syllable probability distribution matrix and the target syllable sequence;
[0088] Obtaining a second score of the target word sequence according to the word probability distribution matrix and the target word sequence;
[0089] The detection result is obtained according to the first score and the second score.
[0090] In a possible implementation, the detection module is specifically used to:
[0091] Determining a probability peak of the target syllable sequence in the syllable probability distribution matrix, wherein for any syllable in the target syllable sequence, the probability peak is a time period corresponding to a maximum probability value of the syllable in the syllable probability distribution matrix;
[0092] Determining a first target matrix in the syllable probability distribution matrix according to the probability peak of the target syllable sequence;
[0093] The first score is obtained according to the first target matrix and the target syllable sequence.
[0094] In a possible implementation, the detection module is specifically used to:
[0095] According to the probability peak of the target syllable sequence, determining the probability peak of the target word sequence in the word probability distribution matrix, wherein for any word in the target word sequence, the probability peak is the time period corresponding to the maximum probability value of the word in the word probability distribution matrix;
[0096] Determining a second target matrix in the word probability distribution matrix according to the probability peak of the target word sequence;
[0097] The second score is obtained according to the second target matrix and the target word sequence.
[0098] In a possible implementation, the detection module is specifically used to:
[0099] determining a target score among the first score and the second score;
[0100] When the target score is greater than or equal to a preset threshold, determining that the detection result is that the first speech includes the keyword;
[0101] When the target score is less than the preset threshold, it is determined that the detection result is that the first speech does not include the keyword.
[0102] In a possible implementation, the detection result is that the first speech includes the keyword, and the detection module is further configured to:
[0103] The time period of the keyword in the first speech is determined according to the time step corresponding to the probability peak, the preset time interval and the downsampling rate.
[0104] In a possible implementation manner, the time period is:
[0105] t=(x*e*f,y*e*f),
[0106] The t is the time period, the x indicates that the time step corresponding to the first character in the keyword is the xth time step, the y indicates that the time step corresponding to the last character in the keyword is the yth time step, the e is the preset time interval, and the f is the preset downsampling rate.
[0107] In a third aspect, the present disclosure provides a computing device, including: at least one processor and a memory;
[0108] The memory stores computer-executable instructions;
[0109] The at least one processor executes the computer-executable instructions stored in the memory, so that the at least one processor performs the keyword detection method as described in any one of the first aspects.
[0110] In a fourth aspect, the present disclosure provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions. When a processor executes the computer-executable instructions, the keyword detection method as described in any one of the first aspects is implemented.
[0111] The keyword detection method, device, equipment and storage medium provided by the embodiment of the present disclosure first divide the first speech according to the corresponding time step to obtain the corresponding multiple speech segments; then obtain the probability distribution matrix according to the multiple speech segments, and determine at least one speech recognition sequence according to the probability distribution matrix corresponding to the multiple speech segments, wherein the probability distribution matrix includes the probability vector under each time step, and the probability vector indicates the probability that the character under the time step is each preset character in the preset character set; fuzzy matching is performed on at least one speech recognition sequence according to the multiple associated characters corresponding to the keyword to obtain the category of each speech recognition sequence, wherein the first category indicates that the corresponding speech recognition sequence includes at least one associated character, and the second category indicates that the corresponding speech recognition sequence does not include the associated character; according to the category and / or probability distribution matrix of each speech recognition sequence, the detection result of the first speech is obtained, and the detection result indicates that the first speech includes the keyword, or the detection result indicates that the first speech does not include the keyword. In the scheme of the embodiment of the present disclosure, for the first speech to be detected, the probability distribution matrix and at least one speech recognition sequence obtained according to the multiple speech segments corresponding to the first speech are determined, and the category of the speech recognition sequence is subsequently divided according to the keyword, and the detection result of the first speech is obtained according to the category and / or probability distribution matrix of the speech recognition sequence. Compared with the blank-filling model that requires training different models for different keywords (for example, when detecting whether the first speech includes keyword A, a model for keyword A needs to be trained, and when detecting whether the first speech includes keyword B, a model for keyword B needs to be trained), the solution of the embodiment of the present disclosure does not need to re-execute all steps for different keywords, that is, the steps of dividing the first speech into multiple speech segments and obtaining the probability distribution matrix and the speech recognition sequence are the same for any keyword detection, and there is no need to repeat the execution. The operation of the solution is relatively simple and flexible. BRIEF DESCRIPTION OF THE DRAWINGS
[0112] The above and other objects, features and advantages of the exemplary embodiments of the present disclosure will become readily understood by reading the detailed description below with reference to the accompanying drawings. In the accompanying drawings, several embodiments of the present disclosure are shown in an exemplary and non-limiting manner, in which:
[0113] Figure 1 A schematic diagram of an application scenario provided for an embodiment of the present disclosure;
[0114] Figure 2 A flowchart of a keyword detection method provided by an embodiment of the present disclosure;
[0115] Figure 3 A schematic diagram of obtaining a probability distribution matrix and a speech recognition sequence provided by an embodiment of the present disclosure;
[0116] Figure 4 A schematic diagram of a syllable probability distribution matrix provided in an embodiment of the present disclosure;
[0117] Figure 5 A schematic diagram of a beam search provided by an embodiment of the present disclosure;
[0118] Figure 6 A schematic diagram of a word probability distribution matrix provided for an embodiment of the present disclosure;
[0119] Figure 7 A schematic diagram of probability peaks provided for an embodiment of the present disclosure;
[0120] Figure 8 A schematic diagram of a program product provided by an embodiment of the present disclosure;
[0121] Fig. 9 A schematic diagram of the structure of a keyword detection device provided in an embodiment of the present disclosure;
[0122] Fig.10 A schematic diagram of the structure of a computing device provided in an embodiment of the present disclosure.
[0123] In the drawings, the same or corresponding reference numerals represent the same or corresponding parts. DETAILED DESCRIPTION
[0124] The principles and spirit of the present disclosure will be described below with reference to several exemplary embodiments. It should be understood that these embodiments are provided only to enable those skilled in the art to better understand and implement the present disclosure, and are not intended to limit the scope of the present disclosure in any way. On the contrary, these embodiments are provided to make the present disclosure more thorough and complete, and to fully convey the scope of the present disclosure to those skilled in the art.
[0125] Those skilled in the art will appreciate that the embodiments of the present disclosure may be implemented as a system, device, apparatus, method or computer program product. Therefore, the present disclosure may be specifically implemented in the following forms, namely: complete hardware, complete software (including firmware, resident software, microcode, etc.), or a combination of hardware and software.
[0126] According to an embodiment of the present disclosure, a keyword detection method, apparatus, device and storage medium are proposed.
[0127] It should be understood herein that any number of elements in the drawings is for illustration rather than limitation, and any naming is only for distinction rather than having any limiting meaning.
[0128] The principle and spirit of the present disclosure are explained in detail below with reference to several representative embodiments of the present disclosure. SUMMARY OF THE INVENTION
[0130] Keyword Spotting (KWS), also known as wake-up word detection, voice wake-up, etc., is a technology that detects predefined keywords in a continuous audio stream. Keyword detection is usually implemented based on Automatic Speech Recognition (ASR), which is an algorithm technology that converts speech into text. For a continuous audio stream, the audio stream can be converted into text, and then the text can be detected to see if there are keywords, thereby achieving keyword detection.
[0131] At present, keyword detection is mainly achieved through the blanking model, which is also called the junk model. The main process of keyword detection based on the blanking model includes: building a model, and after the construction is completed, the constructed model is trained with corresponding training samples, and the training samples are marked with keywords and non-keywords. After the training is completed, the model has the ability to detect keywords. Then, for the audio to be detected, the audio can be input into the model to obtain the result output by the network model, which is the score of the keywords in the audio. When the score exceeds a certain threshold, the model considers that the keyword is detected, otherwise, the model considers that the keyword is not detected.
[0132] The inventors have found that the keyword detection method based on the blank filling model needs to define the keywords before training the model. If the keywords are changed, it is necessary to collect and annotate the corpus based on the changed keywords and retrain the model. The operation of the scheme is relatively complicated and not flexible enough.
[0133] After introducing the basic principles of the present disclosure, various non-limiting embodiments of the present disclosure are described in detail below.
[0134] Application Scenario Overview
[0135] First reference Figure 1 To describe an applicable application scenario of the embodiment of the present disclosure.
[0136] Figure 1 A schematic diagram of an application scenario provided by an embodiment of the present disclosure, such as Figure 1 As shown, the system includes a client 11 and a server 12, which are connected by wire or wireless. The client 11 can send a first voice to the server 12, and after receiving the first voice, the server 12 performs keyword detection on the first voice and outputs the detection result.
[0137] Figure 1 In the example scenario, the first speech is subjected to keyword detection by the server 12 to obtain a detection result of the first speech. The server 12 is the execution subject of the keyword detection method. Optionally, the execution subject of the keyword detection method can be a device that integrates the functions of the server, such as a client, a terminal device, etc.
[0138] It should be noted that Figure 1 This is merely an example of an applicable application scenario of the embodiment of the present disclosure and does not constitute a limitation on the application scenario.
[0139] Exemplary Methods
[0140] Combine the following Figure 1 For application scenarios, refer to Figure 2 To describe the keyword detection method according to the exemplary embodiment of the present disclosure. It should be noted that the above application scenarios are only shown to facilitate understanding of the spirit and principle of the present disclosure, and the embodiments of the present disclosure are not limited in this respect. On the contrary, the embodiments of the present disclosure can be applied to any applicable scenario.
[0141] Figure 2 A flowchart of a keyword detection method provided by an embodiment of the present disclosure is shown in FIG. Figure 2 As shown, the method may include:
[0142] S21, dividing the first speech according to corresponding time steps to obtain a corresponding plurality of speech segments.
[0143] The first voice is the voice to be detected, and the first voice may include, for example, a recording, a voice emitted by a person or a device, an audio stream, etc. The keyword detection task is to detect whether the first voice includes a keyword.
[0144] After obtaining the first voice, it is possible to divide the first voice according to corresponding time steps to obtain corresponding multiple voice segments. Among them, any voice segment is a part of the first voice, and the multiple voice segments can be arranged according to the corresponding time steps, with the time steps and the voice segments in one-to-one correspondence. For any two adjacent voice segments corresponding to two time steps, these two voice segments may or may not include an overlapping part, and this embodiment does not limit this.
[0145] S22. Obtain a probability distribution matrix according to the multiple voice segments, and determine at least one speech recognition sequence according to the probability distribution matrix corresponding to the multiple voice segments. The probability distribution matrix includes probability vectors at each time step, and the probability vector indicates the probability that the character at the time step is each preset character in the preset character set.
[0146] The preset character set is a set determined according to the character category. The preset character set includes multiple preset characters under the corresponding character category. The character category can be, for example, a Chinese character, a syllable, etc. The preset character set corresponding to Chinese characters can include more than 3,000 common Chinese characters, and the preset character set corresponding to syllables can include more than 400 syllables corresponding to different pronunciations, etc. In the embodiments of the present disclosure, a syllable can be a speech unit formed by the combination of an initial consonant and a final vowel in Chinese. In some cases, a syllable can also include a tone. Taking "你好" (ni hao) as an example, its corresponding syllable is, for example, "ni3 hao3".
[0147] After obtaining the multiple voice segments, sequence mapping processing can be performed on the multiple voice segments to obtain a probability distribution matrix. The probability distribution matrix includes probability vectors at each time step, and each probability vector includes multiple elements, and each element respectively indicates the probability that the character at the time step is each preset character in the preset character set, and the sum of the elements in any probability vector is 1.
[0148] The probability distribution matrix indicates the probability that the character at each time step is each preset character in the preset character set. The greater the probability, the greater the possibility that the character of the voice segment corresponding to the time step is the corresponding preset character. Then, according to the probability distribution matrix, at least one corresponding speech recognition sequence can be obtained.
[0149] The speech recognition sequence includes multiple characters. Obtaining the speech recognition sequence realizes the process of converting the first voice into text. In the embodiments of the present disclosure, for one character category, one or more speech recognition sequences can be obtained. Taking the character category as a syllable as an example, one or more syllable recognition sequences can be obtained according to the probability distribution matrix.
[0150] S23, performing fuzzy matching processing on at least one speech recognition sequence according to multiple associated characters corresponding to the keyword to obtain categories of each speech recognition sequence, wherein the categories include a first category and a second category, the first category indicates that the corresponding speech recognition sequence includes at least one associated character, and the second category indicates that the corresponding speech recognition sequence does not include the associated character.
[0151] For the detection of keywords, the keywords are known, and the number of keywords can be one or more. In the following embodiments, one keyword is used as an example for introduction. For a keyword, a set of associated characters corresponding to the keyword can be determined, and the associated character set includes multiple associated characters corresponding to the keyword. The associated character can be a word with a certain association relationship with the associated character, for example, the associated character can be the keyword itself, can be a word composed of characters with the same pronunciation as the keyword, for example, can be a word composed of characters with a similar pronunciation to the keyword, and so on. Taking the keyword "Wanda Plaza" as an example, the associated characters corresponding to the keyword can include "Wanda Plaza", "Wangda Plaza", "wan da guan chang", "wang daguang chang", and so on.
[0152] After obtaining at least one speech recognition sequence, since the speech recognition sequence exists in text form, it can be determined whether each speech recognition sequence includes the associated character corresponding to the keyword. If it does, the category of the speech recognition sequence is determined to be the first category, otherwise, the category of the speech recognition sequence is determined to be the second category. That is, the speech recognition sequence of the first category includes at least one associated character, and the speech recognition sequence of the second category does not include any associated character.
[0153] S24, obtaining a detection result of the first speech according to the category and / or probability distribution matrix of each speech recognition sequence, wherein the detection result indicates that the first speech includes the keyword, or the detection result indicates that the first speech does not include the keyword.
[0154] After determining the category of each speech recognition sequence, the number of speech recognition sequences of different categories can be obtained. For example, the category of all speech recognition sequences is the second category, that is, any speech recognition sequence does not include the associated characters corresponding to the keyword. For this situation, it can be determined that the first speech does not include the keyword.
[0155] For example, the speech recognition sequence may include one or more speech recognition sequences of the first category, that is, there are one or more speech recognition sequences that include at least one associated character corresponding to a keyword. In this case, the first speech may or may not include the keyword, and further judgment needs to be made in combination with the probability distribution matrix.
[0156] Specifically, for the speech recognition sequence of the first category, since the speech recognition sequence of this category includes the associated characters corresponding to the keywords, and the probability distribution matrix includes the probability vectors at each time step, the probability vectors corresponding to the associated characters in the probability distribution matrix can be determined according to the position of the associated characters in the speech recognition sequence. The probability vector indicates the probability that the character at the corresponding time step is the preset character in the preset character set, and the preset character set includes 3000 common Chinese characters (these 3000 characters are Z1, Z2, Z3, ..., Z 3000 ), the probability vector indicates the probability of the character being each of the 3000 characters at the corresponding time step, that is, each element in the probability vector indicates the probability of the character being Z1, Z2, Z3, ..., Z at the corresponding time step. 3000 The preset character set includes characters corresponding to the keyword. Therefore, according to the probability vector, the probability that the character at the corresponding time step is the character corresponding to the keyword can be obtained, and then the probability that the first speech contains the keyword is obtained, and the probability indicates the detection result of the first speech. When the probability of containing the keyword is greater than or equal to a certain threshold, it is determined that the first speech includes the keyword, otherwise, it is determined that the first speech does not include the keyword.
[0157] The keyword detection method provided by the embodiment of the present disclosure first divides the first speech according to the corresponding time step to obtain the corresponding multiple speech segments; then obtains the probability distribution matrix according to the multiple speech segments, and determines at least one speech recognition sequence according to the probability distribution matrix corresponding to the multiple speech segments, wherein the probability distribution matrix includes the probability vector under each time step, and the probability vector indicates the probability that the character under the time step is each preset character in the preset character set; fuzzy matching is performed on at least one speech recognition sequence according to the multiple associated characters corresponding to the keyword to obtain the category of each speech recognition sequence, wherein the first category indicates that the corresponding speech recognition sequence includes at least one associated character, and the second category indicates that the corresponding speech recognition sequence does not include the associated character; according to the category and / or probability distribution matrix of each speech recognition sequence, the detection result of the first speech is obtained, and the detection result indicates that the first speech includes the keyword, or the detection result indicates that the first speech does not include the keyword. In the scheme of the embodiment of the present disclosure, for the first speech to be detected, the probability distribution matrix and at least one speech recognition sequence obtained according to the multiple speech segments corresponding to the first speech are determined, and the category of the speech recognition sequence is subsequently divided according to the keyword, and the detection result of the first speech is obtained according to the category and / or probability distribution matrix of the speech recognition sequence. Compared with the blank-filling model that requires training different models for different keywords (for example, when detecting whether the first speech includes keyword A, a model for keyword A needs to be trained, and when detecting whether the first speech includes keyword B, a model for keyword B needs to be trained), the solution of the embodiment of the present disclosure does not need to re-execute all steps for different keywords, that is, the steps of dividing the first speech into multiple speech segments and obtaining the probability distribution matrix and the speech recognition sequence are the same for any keyword detection, and there is no need to repeat the execution. The operation of the solution is relatively simple and flexible.
[0158] Based on any of the above embodiments, the scheme of the embodiments of the present disclosure will be further refined in conjunction with the accompanying drawings.
[0159] For the first speech to be detected, it is first necessary to divide the first speech to obtain multiple speech segments. One possible implementation method is to perform frame processing on the first speech according to a preset time interval and a preset downsampling rate to obtain multiple speech segments, and the preset time interval e and the preset downsampling rate can be set as needed. For example, assuming that the preset time interval is 10ms, frame processing is performed on the first speech every 10ms, and the duration of each speech segment is set to 25ms, then the time periods corresponding to the speech segments can be obtained, which are 0-25ms, 10-35ms, 20-45ms, 30-55ms, etc. After obtaining these speech segments, downsampling can be performed, and the downsampling rate is set to f, which means that one sample is taken every f samples, and f is greater than or equal to 1. Taking f=1 as an example, the time periods of the multiple voice segments finally obtained are 0-25ms, 10-35ms, 20-45ms, 30-55ms, etc. Taking f=2 as an example, the time periods of the multiple voice segments finally obtained are 0-25ms, 20-45ms, 40-65ms, 60-85ms, etc.
[0160] The speech segments and time steps correspond one to one. For any x-th time step, the time period of the corresponding speech segment is (x-1)*e*f to (x-1)*e*f+g, where e is the preset time interval, f is the preset downsampling rate, and g is the duration of the speech segment.
[0161] After obtaining multiple speech segments, a probability distribution matrix can be obtained according to the speech segments, and at least one speech recognition sequence corresponding to the probability distribution matrix can be obtained. Figure 3 This process is described.
[0162] Figure 3 A schematic diagram of obtaining a probability distribution matrix and a speech recognition sequence provided by an embodiment of the present disclosure, such as Figure 3 As shown, first, feature extraction processing is performed on multiple speech segments to obtain a feature vector X, X = {x1, x2, x3, ..., xn}, where xn is a feature subvector obtained after feature extraction processing is performed on the speech segment corresponding to the nth time step, and n is the number of multiple speech segments, which is also the number of time steps.
[0163] After the feature vector X is obtained, the feature vector X is input into the encoder, and the encoder performs encoding processing on the feature vector X to obtain encoding features Enc_out of multiple speech segments.
[0164] According to the encoding feature Enc_out, a probability distribution matrix and at least one speech recognition sequence can be obtained, wherein the probability distribution matrix in the embodiment of the present disclosure includes a word probability distribution matrix and a syllable probability distribution matrix, and the speech recognition sequence also includes a syllable sequence and a word sequence.
[0165] After obtaining the encoding feature Enc_out, the encoding feature Enc_out is input into the Connectionist Temporal Classification (CTC) syllable classifier, and the encoding feature Enc_out is mapped to a syllable sequence according to the syllable classifier to obtain a syllable probability distribution matrix. The syllable probability distribution matrix includes the syllable probability vectors at each time step, that is, the number of syllable probability vectors included in the syllable probability distribution matrix is n, where n is both the number of multiple speech segments and the number of time steps. For example, it can be combined with Figure 4 Understand the syllable probability distribution matrix.
[0166] Figure 4 A schematic diagram of a syllable probability distribution matrix provided in an embodiment of the present disclosure is shown in FIG. Figure 4 As shown in the figure, the syllable probability distribution matrix obtained based on the first speech is in the brackets. Figure 4 Each box in represents an element in the syllable probability distribution matrix.
[0167] The syllable probability distribution matrix includes n elements in the horizontal direction and K elements in the vertical direction ( Figure 4 In the introduction, K=6 is taken as an example, and K can also take other values). Each column in the syllable probability distribution matrix is a syllable probability vector, from left to right, it is the first syllable probability vector p1, the second syllable probability vector p2, the third syllable probability vector p3, ..., the nth syllable probability vector p n .
[0168] In the syllable probability distribution matrix, the bth element in any ath syllable probability vector indicates the syllable corresponding to the ath speech segment, which is the probability of the bth preset syllable in the preset syllable set. Wherein, a is a positive integer, b is a positive integer greater than or equal to 1 and less than or equal to K, K is the number of preset syllables included in the preset syllable set, and K is a positive integer. Wherein, the sum of the values of the K elements included in any syllable probability vector is 1.
[0169] The preset syllable set includes K preset syllables, and the K preset syllables include the pronunciations of various common characters. The K preset syllables in the preset syllable set are arranged in a certain order. Figure 4 For example, the K preset syllables are syllable 1, syllable 2, syllable 3, syllable 4, syllable 5, and syllable 6. The meaning indicated by any element can be determined according to its position in the syllable probability distribution matrix. For example, the element in the 3rd row and the 5th column belongs to the 3rd element in the 5th syllable probability vector, and the element indicates the probability that the syllable corresponding to the 5th speech segment is syllable 3.
[0170] After obtaining the syllable probability distribution matrix, a beam search process can be performed on K preset syllables according to the syllable probability distribution matrix to obtain at least one syllable sequence, and the number of syllables included in each syllable sequence is L, where L is a positive integer. For any time step in the beam search, if the current syllable path does not include the key syllable corresponding to the keyword, and the current syllable path includes the key syllable after being connected with the i-th preset syllable, the syllable path after the current syllable path and the i-th preset syllable can be weighted to increase the recall probability of the keyword in the decoding stage. Among them, the key syllable is obtained based on the syllable corresponding to each character in the keyword. For example, when the keyword is "Wanda Plaza", the corresponding key syllable is "wan da guang chang".
[0171] The following will be combined Figure 5 A brief introduction to the beam search process is given. Figure 5 A schematic diagram of a beam search provided by an embodiment of the present disclosure, such as Figure 5 As shown, the example is a matrix corresponding to 4 time steps, involving 4 syllables included in the preset syllable set, namely wan, da, guang and chang. In the speech segment corresponding to the first time step, the probabilities of these 4 syllables are 0.4, 0.3, 0.2, and 0.1 respectively; in the speech segment corresponding to the second time step, the probabilities of these 4 syllables are 0.1, 0.6, 0.1, and 0.2 respectively; in the speech segment corresponding to the third time step, the probabilities of these 4 syllables are 0.05, 0.15, 0.5, and 0.3 respectively; in the speech segment corresponding to the fourth time step, the probabilities of these 4 syllables are 0.2, 0.3, 0.2, and 0.3 respectively. The parameter in the beam search - beam size (beamsize) M = 2.
[0172] Then in the first time step, the paths determined by M are wan and da, and the corresponding scores are 0.4 and 0.3 respectively.
[0173] At the second time step, based on the two paths corresponding to the first time step and the four syllables at the second time step, eight paths and their scores can be obtained. The eight paths and their scores are as follows:
[0174] wan wan(0.4*0.1=0.04);
[0175] wan da (0.4*0.6=0.24);
[0176] wan guang(0.4*0.1=0.04);
[0177] wan chang (0.4*0.2=0.08);
[0178] da wan (0.3*0.1=0.03);
[0179] da da(0.3*0.6=0.18);
[0180] da guang (0.3*0.1=0.03);
[0181] da chang (0.3*0.2=0.06).
[0182] Since the syllable paths corresponding to the second time step do not include the key syllables corresponding to the keywords, no weight excitation is performed on them. Then, at the second time step, according to M, the path includes wan da (score is 0.24) and da da (score is 0.18).
[0183] At the third time step, based on the two paths corresponding to the second time step and the four syllables at the third time step, eight paths and their scores can be obtained. The eight paths and their scores are as follows:
[0184] wan da wan(0.24*0.05=0.012);
[0185] wan da da(0.24*0.15=0.036);
[0186] wan da guang (0.24*0.5=0.12);
[0187] wan da chang (0.24*0.3=0.072);
[0188] da da wan(0.18*0.05=0.009);
[0189] da da da(0.18*0.15=0.027);
[0190] da da guang(0.18*0.5=0.09);
[0191] da da chang(0.18*0.3=0.054);
[0192] Since the syllable paths corresponding to the third time step do not include the key syllables corresponding to the keywords, no weight incentive is given to them. Then, at the third time step, according to M, the path includes wan da guang (score is 0.12) and wanda chang (score is 0.072).
[0193] At the 4th time step, based on the 2 paths corresponding to the 3rd time step and the 4 syllables at the 4th time step, 8 paths and their scores can be obtained. The 8 paths and their scores are as follows:
[0194] wan da guang wan (0.12*0.2=0.024);
[0195] wan da guang da (0.12*0.3=0.036);
[0196] wan da guang guang(0.12*0.2=0.024);
[0197] wan da guang chang (0.12*0.3=0.036);
[0198] wan da chang wan (0.072*0.2=0.0144);
[0199] wan da chang da(0.072*0.3=0.0216);
[0200] wan da chang guang(0.072*0.2=0.0144);
[0201] wan da chang chang(0.072*0.3=0.0216).
[0202] The two paths corresponding to the third time step (i.e., wan da guang and wan da chang) do not include the key syllable "wan da guang chang", while the syllable path corresponding to the fourth time step obtained by connecting the two paths corresponding to the third time step with the preset syllable "chang" in the fourth time step includes the key syllable "wan da guang chang", so the fourth syllable path "wan da guang chang" among the above 8 paths can be weighted. The syllable path corresponding to the fourth time step obtained by connecting the two paths corresponding to the third time step with other preset syllables in the fourth time step does not include the key syllable "wan da guang chang", so no weighted excitation is required.
[0203] There are many ways of weight excitation. For example, a preset weight value can be added to the score of the syllable path including the key syllable to obtain a new score for the syllable path. Then, based on the new score of the syllable path and the scores of other syllable paths, the syllable path corresponding to the fourth time step is selected.
[0204] In the disclosed embodiment, the weight incentive can also be performed by keyword offset. For any time step, the decoding formula based on keyword offset is as follows:
[0205] W i =argmax(f(W)),
[0206] Where f(W) = log(P(W|X)) + α1(logP LM1 (W)))+α2(logP LM2 (W)))+...+S v ;
[0207] W i is the syllable corresponding to the time step, W is the preset syllable, and X is the first speech; P(W|X) is the acoustic model score of the preset syllable W, P LM (W) is the language model score of W under the language model, α1 and α2 are the weights of the corresponding language models; S v is the weighted excitation value of W. If the current syllable path does not include the key syllable and the current syllable path includes the key syllable after connecting with a syllable, then S v is the first preset value, otherwise S v is the second preset value, and the first preset value is greater than or equal to the second preset value; argmax is the maximum independent variable point set function, and argmax(f(W)) represents W corresponding to the maximum value of f(W).
[0208] Through weighted incentives, the ranking of syllable sequences containing key syllables in multiple syllable sequences can be improved, thereby improving the recall probability of keywords in the decoding stage.
[0209] exist Figure 5 It is understood that although the number and the number of preset syllables included in the preset syllable set in the embodiment of the present disclosure are Figure 5 The number of syllables in each time step is different, and the number of syllables included in the syllable sequence is different from Figure 5 , but the process of determining the M syllable sequence is the same as Figure 5 similar.
[0210] After obtaining the syllable probability distribution matrix, the word probability distribution matrix and at least one word sequence can be obtained according to the syllable probability distribution matrix and at least one syllable sequence. Specifically, the decoder and the word classifier decode at least one syllable sequence and the encoding feature Enc_out to obtain the word probability distribution matrix. The word probability distribution matrix includes L word probability vectors, where L is the number of syllables included in the syllable sequence.
[0211] Figure 6A schematic diagram of a word probability distribution matrix provided by an embodiment of the present disclosure, such as Figure 6 As shown, the brackets are the word probability distribution matrix obtained based on the syllable probability distribution matrix and at least one syllable sequence, Figure 6 Each box in represents an element in the word probability distribution matrix.
[0212] The word probability distribution matrix includes L elements in the horizontal direction and N elements in the vertical direction ( Figure 6 In the introduction, N=6 is taken as an example, and N can also take other values). Each column in the word probability distribution matrix is a word probability vector, from left to right, it is the first word probability vector q1, the second word probability vector q2, the third word probability vector q3, ..., the Lth word probability vector q L .
[0213] In the word probability distribution matrix, the dth element in any cth word probability vector indicates the word corresponding to the cth syllable, which is the probability of the dth preset word in the preset word set. c is a positive integer greater than or equal to 1 and less than or equal to L, d is a positive integer greater than or equal to 1 and less than or equal to N, and N is the number of preset words included in the preset word set. Among them, the sum of the values of the N elements included in any word probability vector is 1.
[0214] The preset character set includes N preset characters, which include characters corresponding to various common characters. The N preset characters in the preset character set are arranged in a certain order. Figure 6 For example, the N preset words are word 1, word 2, word 3, word 4, word 5, and word 6 in order. Then, the meaning indicated by any element can be determined according to its position in the word probability distribution matrix. Figure 6 ), which belongs to the first element in the second word probability vector, and this element represents the probability that the word corresponding to the second syllable is word 1.
[0215] After obtaining the word probability distribution matrix, a beam search process can be performed on the N preset words according to the syllable probability distribution matrix to obtain at least one word sequence, and the number of words included in each word sequence is L, where L is a positive integer. In the disclosed embodiment, the syllables included in the syllable sequence correspond one-to-one to the words included in the word sequence, so the number of syllables included in the syllable sequence is equal to the number of words included in the word sequence, both of which are L.
[0216] When performing beam search based on the word probability distribution matrix, if the current word path does not include the keyword corresponding to the keyword, and the current word path includes the keyword after being connected to the i-th preset word, the word path after the connection of the current word path and the i-th preset word can be weighted and stimulated to improve the recall probability of the keyword in the decoding stage. The process of obtaining at least one word sequence by performing beam search based on the word probability distribution matrix is similar to the process of obtaining at least one syllable sequence by performing beam search based on the syllable probability distribution matrix. For specific details, please refer to Figure 5 the relevant introduction in the embodiment, which will not be elaborated here.
[0217] After obtaining at least one syllable sequence and at least one word sequence, the target speech recognition sequence can be determined from the at least one syllable sequence and the at least one word sequence. In the embodiments of the present disclosure, a multi-level matching and fuzzy matching method is adopted to determine the target speech recognition sequence. Among them, multi-level matching refers to performing keyword matching on the syllable sequence and the word sequence simultaneously. For example, when the keyword is "Wanda Plaza", if the syllable sequence contains the complete "wan4 da2 guang3 chang3", or the word sequence contains the complete "万达广场", it means that the matching is successful. Fuzzy matching means that when a word similar to the keyword appears in the syllable sequence or the word sequence, it is also considered that the matching is successful. For example, words similar to the keyword "Wanda Plaza" can include "望大广场", "往大广场", "万大广场", etc., and the corresponding syllables include "wang4 da4 guang3 chang3", "wang3 da4 guang3 chang3", "wan4 da4 guang3 chang3".
[0218] Therefore, in the process of matching, first determine at least one matching syllable and at least one matching word corresponding to the keyword. The matching syllables and matching words are used for fuzzy matching. By performing fuzzy matching processing on the at least one syllable sequence according to the at least one matching syllable, the categories of each syllable sequence can be obtained. Specifically, the category of the target syllable sequence containing the matching syllable can be determined as the first category, and the category of the syllable sequence other than the target syllable sequence can be determined as the second category. By performing fuzzy matching processing on the at least one word sequence according to the at least one matching word, the categories of each word sequence can be obtained. Specifically, the category of the target word sequence containing the matching word can be determined as the first category, and the category of the word sequence other than the target word sequence can be determined as the second category. Among them, both the matching syllables and the matching words are associated characters corresponding to the keyword.
[0219] Taking the following two syllable sequences and two word sequences as an example:
[0220] Syllable sequence 1: quan2 guo2 kai1 chu1 le si4 shi2 wu3 zuo4 wan4 da2 guang3chang3;
[0221] Syllable sequence 2: quan2 guo2 kai1 chu1 le si4 shi2 wu3 zuo4 wang4 da4 guang3chang3;
[0222] Word sequence 1: Forty-five Wanda Plazas have been opened across the country;
[0223] Word sequence 2: Forty-five Wangda Plazas have been opened across the country.
[0224] If we directly match the key syllables and keywords corresponding to the keywords, the matching results are as follows:
[0225] Syllable sequence 1: quan2 guo2 kai1 chu1 le si4 shi2 wu3 zuo4 wan4 da2 guang3chang3 (matched successfully);
[0226] Syllable sequence 2: quan2 guo2 kai1 chu1 le si4 shi2 wu3 zuo4 wang4 da4 guang3chang3 (matching failed);
[0227] Word sequence 1: Forty-five Wanda Plazas have been opened across the country (matching successful);
[0228] Word sequence 2: Forty-five Wangda Squares were opened across the country (matching failed).
[0229] If fuzzy matching is performed on the syllable sequence according to the matching syllables, and fuzzy matching is performed on the word sequence according to the matching words, the matching results are as follows:
[0230] Syllable sequence 1: quan2 guo2 kai1 chu1 le si4 shi2 wu3 zuo4 wan4 da2 guang3chang3 (matched successfully);
[0231] Syllable sequence 2: quan2 guo2 kai1 chu1 le si4 shi2 wu3 zuo4 wang4 da4 guang3chang3 (matched successfully);
[0232] Word sequence 1: Forty-five Wanda Plazas have been opened across the country (matching successful);
[0233] Word sequence 2: Forty-five Wangda Plazas have been opened across the country (match successful).
[0234] When fuzzy matching is not performed, the target speech recognition sequence only includes syllable sequence 1 and word sequence 1. When fuzzy matching is performed, the target speech recognition sequence includes syllable sequence 1, syllable sequence 2, word sequence 1 and word sequence 2. As mentioned above, fuzzy matching can improve the success rate of matching.
[0235] After the category of each speech recognition sequence is determined, the detection result of the first speech can be obtained according to the category of each speech recognition sequence and / or the probability distribution matrix.
[0236] When the categories of each speech recognition sequence are all the second category, that is, after fuzzy matching by matching syllables, it is found that each syllable sequence does not include matching syllables, and after fuzzy matching by matching words, it is found that each word sequence does not include matching words, then it is determined that the first speech does not include keywords.
[0237] When each speech recognition sequence includes a target syllable sequence and a target word sequence of the first category, for the target syllable sequence, a first score of the target syllable sequence is obtained according to the syllable probability distribution matrix and the target syllable sequence. The syllable probability distribution matrix is obtained by performing syllable sequence mapping processing on the coding features by the CTC syllable classifier. The syllable probability distribution matrix output by the CTC syllable classifier corresponds to the number of multiple speech segments. For example, Figure 4 In , the syllable probability distribution matrix has a total of n columns, indicating that the first speech is divided into n speech segments. The syllable probability distribution matrix corresponds to the input duration in the time dimension, that is, when the preset time interval and the preset downsampling rate are the same, the longer the first speech is, the more speech segments are obtained, and thus the syllable probability distribution matrix has more columns.
[0238] However, since the duration corresponding to each character in the first speech is usually greater than the duration of the speech segment, for example, the first speech is a recording of a person speaking, in which the duration of each word spoken by the person is about 500ms, and the duration of each speech segment is 25ms, there are multiple speech segments corresponding to one character, and each syllable in the syllable sequence corresponds to one character, so the number of columns of the syllable probability distribution matrix is much greater than the length of the syllable sequence, and the probability peaks of single syllables are sparsely distributed. Among them, the probability peak of a syllable is the time period corresponding to the maximum probability value of the syllable in the syllable probability distribution matrix.
[0239] For example, you can combine Figure 7 Understand probability spikes. Figure 7 A schematic diagram of probability peaks provided by an embodiment of the present disclosure, such as Figure 7 As shown, the horizontal axis is time and the vertical axis is probability. Figure 7The different types of lines represent the probabilities of different syllables at different time points. The probability peak of a syllable refers to the time period corresponding to the time when the probability of the syllable reaches the peak value on the syllable probability distribution matrix.
[0240] For example, Figure 4 In the example, the probability peaks of the syllables "wan4", "da2", "guang3", and "chang3" in a syllable sequence are illustrated, where the probability peak of the syllable "wan4" corresponds to the m-th syllable probability vector, that is, the probability peak of the syllable "wan4" is the time period corresponding to the m-th syllable probability vector, and the m-th syllable probability vector is obtained based on the m-th voice segment, and the time period of the m-th voice segment is (m-1)*e*f to (m-1)*e*f+g, where e is the preset time interval, f is the preset downsampling rate, and g is the duration of the voice segment. Taking the preset time interval e as 10ms, the preset downsampling rate f as 1, and the duration of the voice segment g as 25ms as an example, the probability peak of the syllable "wan4" is the time period from (10m-10)ms to (10m+15)ms, where m represents the m-th voice segment, and ms is milliseconds.
[0241] Similarly, the probability peak of the syllable "da2" corresponds to the m+2th syllable probability vector, and the time period of the m+2th speech segment is (m+1)*e*f to (m+1)*e*f+g. The probability peak of the syllable "da2" is the time period from (10m+10)ms to (10m+35)ms; the probability peak of the syllable "guang3" corresponds to the m+4th syllable probability vector, and the time period of the m+4th speech segment is (m+3)*e*f to (m +3)*e*f+g, then the probability peak of the syllable "guang3" is from the time period (10m+30)ms to (10m+55)ms; the probability peak of the syllable "chang3" corresponds to the m+7th syllable probability vector, and the time period of the m+7th speech segment is (m+6)*e*f to (m+6)*e*f+g, then the probability peak of the syllable "chang3" is from the time period (10m+60)ms to (10m+85)ms.
[0242] like Figure 7 As shown, the probability peaks of these four syllables are illustrated, that is, the time periods corresponding to the maximum probability values of these four syllables in the syllable probability distribution matrix, as shown on the horizontal axis, where the syllable "wan4" corresponds to the time period (10m-10) ms to (10m+15) ms, the syllable "da2" corresponds to the time period (10m+10) ms to (10m+35) ms, the syllable "guang3" corresponds to the time period (10m+30) ms to (10m+55) ms, and the syllable "chang3" corresponds to the time period (10m+60) ms to (10m+85) ms. The vertical axis reflects the probability of each syllable at the corresponding time.
[0243] According to the probability peak of each syllable, the probability peak of the syllable sequence can be obtained. Figure 4 As shown, assuming that the probability peak of the syllable sequence "wan4 da2 guang3 chang3" corresponding to the keyword "Wanda Plaza" is distributed in the interval (pm, pm+7), the matrix O in this interval can be intercepted in the syllable probability distribution matrix, and the matrix O is the first target matrix. Then, according to the first target matrix and the target syllable sequence, the first score is obtained.
[0244] For example, one way to calculate the first score is to obtain the probability of a single key syllable in the target syllable sequence in the first target matrix, and then add the log values of the probabilities of each single key syllable in the first target matrix to obtain the first score. Figure 4 For example, the probability of a single key syllable in the first target matrix is the probability that the syllable corresponding to the m-th speech segment is "wan4", the probability that the syllable corresponding to the m+2-th speech segment is "da2", the probability that the syllable corresponding to the m+4-th speech segment is "guang3", and the probability that the syllable corresponding to the m+7-th speech segment is "chang3".
[0245] For example, another way to calculate the first score is, after obtaining the first target matrix, for the target syllable sequence, a prefix beam search decoding algorithm can be used to forward calculate the probabilities of all possible CTC strings of the keyword "Wanda Plaza" on the first target matrix, and then the log values of the probabilities of each CTC string are added together as the first score of the target syllable sequence.
[0246] Among them, the keyword is regular string, and the regular string corresponds to the CTC string. One regular string will correspond to multiple CTC strings. The CTC string has more blank placeholders and continuous repetitions than the regular string. Regularization refers to the process of eliminating blanks and continuous repetitions. The regular string is the string obtained after eliminating blanks and continuous repetitions. For example, taking the regular string "cat" as an example, its corresponding CTC string can be "cccaaat", "caaat", "ccc at", etc. The reason for introducing the CTC string is that there is silence in the audio or a sound is dragged for a long time. The number of characters included in the regular string (that is, the final output) must be less than or equal to the input length (that is, the number of multiple strings), so the CTC string is needed to achieve input and output alignment.
[0247] Still Figure 4For example, it has been determined that the syllable probability vectors corresponding to the probability peak of the syllable sequence "wan4 da2 guang3 chang3" are pm, pm+2, pm+4 and pm+7, and from pm to pm+7, there are also pm+1, pm+3, pm+5 and pm+6. These syllable probability vectors are used for blank placeholders and continuous repetitions. The corresponding CTC string obtained according to the first target matrix can be, for example, "wan4 wan4 da2 da2 guang3 guang3 guang3 chang3", for example, "wan4 wan4 da2 da2 guang3 guang3 chang3 chang3", for example, "wan4 da2 da2da2 guang3 guang3 chang3 chang3", and so on. After obtaining multiple CTC strings corresponding to the syllable sequence "wan4 da2 guang3 chang3", the probability of each CTC string can be obtained according to the first target matrix. Among them, the calculation method of the probability of any CTC string can refer to the method of calculating the probability in the beam search method.
[0248] Taking the CTC string "wan4 wan4 da2 da2 guang3 guang3 guang3 chang3" as an example, according to the first target matrix, we can obtain the probability that the syllable corresponding to the mth speech segment is wan4, the probability that the syllable corresponding to the m+1th speech segment is wan4, the probability that the syllable corresponding to the m+2th speech segment is da2, the probability that the syllable corresponding to the m+3th speech segment is da2, the probability that the syllable corresponding to the m+4th speech segment is guang3, the probability that the syllable corresponding to the m+5th speech segment is guang3, the probability that the syllable corresponding to the m+6th speech segment is guang3 and the probability that the syllable corresponding to the m+7th speech segment is chang3. Then, by multiplying these probabilities, we can get the probability of the CTC string "wan4 wan4da2 da2 guang3 guang3 guang3 chang3".
[0249] For any CTC string, the above method can be used to obtain the probability of the CTC string, and then the log values of the probabilities of each CTC string are added together to obtain the first score.
[0250] After obtaining the first score, the second score of the target word sequence can be obtained according to the word probability distribution matrix and the target word sequence. Since the output sequence of the decoder corresponds to the input sequence one by one, the number of word probability vectors included in the word probability distribution matrix output by the decoder is equal to the number of syllables included in the syllable sequence. According to the probability peak of the target syllable sequence, the probability peak of the target word sequence can be determined in the word probability distribution matrix. For any word in the target word sequence, the probability peak of the word is the time period corresponding to the maximum probability value of the word in the word probability distribution matrix. Since the syllables included in the syllable sequence and the words included in the word sequence are in one-to-one correspondence, the syllable sequence and the word sequence can share the probability peak position.
[0251] Then, according to the probability peak of the target word sequence, a second target matrix is determined in the word probability distribution matrix. According to the second target matrix and the target word sequence, a second score is obtained. For example, the probability corresponding to a single keyword in the target word sequence in the second target matrix can be obtained, and then the log value of the probability corresponding to each single keyword in the second target matrix is taken and added to obtain the second score.
[0252] After obtaining the first score and the second score, the target score may be determined from the first score and the second score. For example, the target score may be a larger value of the first score and the second score. Then:
[0253] score=max(score1,score2),
[0254] Among them, score is the target score, score1 is the first score, score2 is the second score, and max means taking the maximum value.
[0255] After determining the target score, the target score can be compared with a preset threshold to obtain a detection result. When the target score is greater than or equal to the preset threshold, the detection result is determined to be that the first speech includes the keyword, and when the target score is less than the preset threshold, the detection result is determined to be that the first speech does not include the keyword.
[0256] In the embodiment of the present disclosure, when the presence of a keyword in the first speech is detected, the time period of the keyword in the first speech can also be output. Specifically, the time period of the keyword in the first speech can be determined according to the time step corresponding to the probability peak, the preset time interval and the downsampling rate. The formula for calculating the time period of the keyword in the first speech is as follows:
[0257] t=(x*e*f,y*e*f),
[0258] t is the time period of the keyword in the first speech, x means the time step corresponding to the first character of the keyword is the xth time step, y means the time step corresponding to the last character of the keyword is the yth time step, Figure 4 For example, the time step corresponding to the first character in the keyword is the mth time step, at this time x=m, the time step corresponding to the last character in the keyword is the m+7th time step, at this time y=m+7, e is the preset time interval, and f is the preset downsampling rate. When determining that the keyword is detected in the first speech, by calculating the time period of the keyword in the first speech, the position of the keyword in the first speech can be output, which is convenient for quickly locating the keyword.
[0259] In summary, the scheme of the embodiment of the present disclosure first divides the first speech according to the corresponding time step to obtain the corresponding multiple speech segments; then obtains the probability distribution matrix according to the multiple speech segments, and determines at least one speech recognition sequence according to the probability distribution matrix corresponding to the multiple speech segments, the probability distribution matrix includes the probability vector under each time step, and the probability vector indicates the probability that the character under the time step is each preset character in the preset character set; fuzzy matching is performed on at least one speech recognition sequence according to the multiple associated characters corresponding to the keyword to obtain the category of each speech recognition sequence; according to the category and / or probability distribution matrix of each speech recognition sequence, the detection result of the first speech is obtained, and the detection result indicates that the first speech includes the keyword, or the detection result indicates that the first speech does not include the keyword. Compared with the blank filling model, which needs to train different models for different keywords, the scheme of the embodiment of the present disclosure does not need to re-execute all steps for different keywords, that is, the steps of dividing the first speech to obtain multiple speech segments and obtaining the probability distribution matrix and the speech recognition sequence are the same for any keyword detection, and do not need to be repeated, and the scheme operation is relatively simple and flexible.
[0260] Exemplary Media
[0261] After introducing the method of the exemplary embodiment of the present disclosure, next, refer to Figure 8 A storage medium according to an exemplary embodiment of the present disclosure is described.
[0262] refer to Figure 8 As shown, a program product 80 for implementing the above method according to an embodiment of the present disclosure is described, which can adopt a portable compact disk read-only memory (CD-ROM) and include program code, and can be run on a terminal device, such as a personal computer. However, the program product of the present disclosure is not limited thereto.
[0263] The program product may use any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0264] The readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, wherein the readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. The readable signal medium may also be any readable medium other than a readable storage medium.
[0265] Program code for performing the operations of the present disclosure may be written in any combination of one or more programming languages, including object-oriented programming languages such as Java, C++, etc., and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, partially on a remote computing device, or entirely on a remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN).
[0266] Exemplary Devices
[0267] After introducing the medium of the exemplary embodiment of the present disclosure, next, reference is made to Fig. 9 A keyword detection device according to an exemplary embodiment of the present disclosure is described, which is used to implement a method in any of the above method embodiments. Its implementation principle and technical effects are similar and will not be repeated here.
[0268] Fig. 9 A schematic diagram of the structure of a keyword detection device provided in an embodiment of the present disclosure is shown in FIG. Fig. 9 As shown, including:
[0269] An acquisition module 91, configured to divide the first speech according to corresponding time steps to obtain a plurality of corresponding speech segments;
[0270] A processing module 92, configured to obtain a probability distribution matrix according to the plurality of speech segments, and determine at least one speech recognition sequence according to the probability distribution matrix corresponding to the plurality of speech segments, wherein the probability distribution matrix includes a probability vector at each time step, and the probability vector indicates a probability that the character at the time step is a preset character in a preset character set;
[0271] A determination module 93 is used to perform fuzzy matching processing on the at least one speech recognition sequence according to the multiple associated characters corresponding to the keyword to obtain the category of each speech recognition sequence, wherein the category includes a first category and a second category, the first category indicates that the corresponding speech recognition sequence includes at least one of the associated characters, and the second category indicates that the corresponding speech recognition sequence does not include the associated characters;
[0272] The detection module 94 is used to obtain the detection result of the first speech according to the category of each speech recognition sequence and / or the probability distribution matrix, wherein the detection result indicates that the first speech includes the keyword, or the detection result indicates that the first speech does not include the keyword.
[0273] In a possible implementation manner, the processing module 92 is specifically configured to:
[0274] Performing feature extraction processing on the multiple speech segments to obtain feature vectors;
[0275] The feature vector is encoded by an encoder to obtain encoding features of the multiple speech segments;
[0276] The probability distribution matrix is acquired according to the coding feature, and the at least one speech recognition sequence is determined according to the probability distribution matrix.
[0277] In a possible implementation manner, the processing module 92 is specifically configured to:
[0278] Performing syllable sequence mapping processing on the coding features according to the syllable classifier to obtain a syllable probability distribution matrix, wherein the syllable probability distribution matrix includes syllable probability vectors at each time step, and the bth element in any ath syllable probability vector indicates the syllable corresponding to the ath speech segment, which is the probability of the bth preset syllable in the preset syllable set;
[0279] Performing beam search processing on K preset syllables according to the syllable probability distribution matrix to obtain at least one syllable sequence, wherein the number of syllables included in each of the syllable sequences is L, and L is a positive integer;
[0280] According to the syllable probability distribution matrix and the at least one syllable sequence, a word probability distribution matrix and at least one word sequence are obtained, wherein the word probability distribution matrix includes L word probability vectors, and the dth element in any cth word probability vector indicates the probability that the word corresponding to the cth syllable is the dth preset word in the preset word set;
[0281] Wherein, the probability distribution matrix includes the syllable probability distribution matrix and the word probability distribution matrix, and the speech recognition sequence includes the syllable sequence and the word sequence;
[0282] Among them, a is a positive integer, b is a positive integer greater than or equal to 1 and less than or equal to K, K is the number of preset syllables included in the preset syllable set, K is a positive integer, c is a positive integer greater than or equal to 1 and less than or equal to L, d is a positive integer greater than or equal to 1 and less than or equal to N, and N is the number of preset characters included in the preset character set.
[0283] In a possible implementation, for any time step in the beam search process, if the current syllable path does not include the key syllable corresponding to the keyword, and the current syllable path includes the key syllable after being connected with the i-th preset syllable, the processing module 92 is further configured to:
[0284] A weight excitation is performed on the syllable path after the current syllable path and the i-th preset syllable are connected.
[0285] In a possible implementation manner, the processing module 92 is specifically configured to:
[0286] Decoding the at least one syllable sequence and the coding feature according to the decoder and the word classifier to obtain the word probability distribution matrix;
[0287] A beam search process is performed on N preset words according to the word probability distribution matrix to obtain the at least one word sequence, and the number of words included in each of the word sequences is L.
[0288] In a possible implementation, for any time step in the beam search process, if the current word path does not include the keyword corresponding to the keyword, and the current word path includes the keyword after being connected with the i-th preset word, the processing module 92 is further configured to:
[0289] A weight excitation is performed on the word path after the current word path and the i-th preset word are connected.
[0290] In a possible implementation, the multiple associated characters include at least one matching syllable and at least one matching word corresponding to the keyword; the determination module 93 is specifically configured to:
[0291] Performing fuzzy matching processing on the at least one syllable sequence according to the at least one matching syllable to obtain a category of each of the syllable sequences;
[0292] Performing fuzzy matching processing on the at least one word sequence according to the at least one matching word to obtain a category of each of the word sequences;
[0293] Among them, the category of the target syllable sequence containing the matching syllable and the category of the target word sequence containing the matching word is the first category, and the category of the syllable sequence other than the target syllable sequence and the word sequence other than the target word sequence is the second category.
[0294] In a possible implementation manner, the determining module 93 is specifically configured to:
[0295] The first speech is framed according to a preset time interval and a preset downsampling rate to obtain the multiple speech segments.
[0296] In a possible implementation, the detection module 94 is specifically used to:
[0297] In response to the category of each of the speech recognition sequences being the second category, determining that the detection result of the first speech is that the first speech does not include the keyword;
[0298] In response to each of the speech recognition sequences including the target syllable sequence and the target word sequence of the first category, obtaining a first score of the target syllable sequence according to the syllable probability distribution matrix and the target syllable sequence;
[0299] Obtaining a second score of the target word sequence according to the word probability distribution matrix and the target word sequence;
[0300] The detection result is obtained according to the first score and the second score.
[0301] In a possible implementation, the detection module 94 is specifically used to:
[0302] Determining a probability peak of the target syllable sequence in the syllable probability distribution matrix, wherein for any syllable in the target syllable sequence, the probability peak is a time period corresponding to a maximum probability value of the syllable in the syllable probability distribution matrix;
[0303] Determining a first target matrix in the syllable probability distribution matrix according to the probability peak of the target syllable sequence;
[0304] The first score is obtained according to the first target matrix and the target syllable sequence.
[0305] In a possible implementation, the detection module 94 is specifically used to:
[0306] According to the probability peak of the target syllable sequence, determining the probability peak of the target word sequence in the word probability distribution matrix, wherein for any word in the target word sequence, the probability peak is the time period corresponding to the maximum probability value of the word in the word probability distribution matrix;
[0307] Determining a second target matrix in the word probability distribution matrix according to the probability peak of the target word sequence;
[0308] The second score is obtained according to the second target matrix and the target word sequence.
[0309] In a possible implementation, the detection module 94 is specifically used to:
[0310] determining a target score among the first score and the second score;
[0311] When the target score is greater than or equal to a preset threshold, determining that the detection result is that the first speech includes the keyword;
[0312] When the target score is less than the preset threshold, it is determined that the detection result is that the first speech does not include the keyword.
[0313] In a possible implementation, the detection result is that the first speech includes the keyword, and the detection module 94 is further configured to:
[0314] The time period of the keyword in the first speech is determined according to the time step corresponding to the probability peak, the preset time interval and the downsampling rate.
[0315] In a possible implementation manner, the time period is:
[0316] t=(x*e*f,y*e*f),
[0317] The t is the time period, the x indicates that the time step corresponding to the first character in the keyword is the xth time step, the y indicates that the time step corresponding to the last character in the keyword is the yth time step, the e is the preset time interval, and the f is the preset downsampling rate.
[0318] The keyword detection device provided in the embodiment of the present disclosure can be used to execute the technical solution of the above method embodiment. Its implementation principle and technical effect are similar and will not be repeated here.
[0319] Exemplary Computing Devices
[0320] After introducing the method, medium and apparatus of the exemplary embodiments of the present disclosure, next, reference is made to Fig.10 A computing device according to an exemplary embodiment of the present disclosure is described.
[0321] Fig.10 The computing device 100 shown is merely an example and should not bring any limitation to the functionality and scope of use of the embodiments of the present disclosure.
[0322] like Fig.10 As shown, the computing device 100 is in the form of a general computing device. The components of the computing device 100 may include but are not limited to: at least one processing unit 101, at least one storage unit 102, and a bus 103 connecting different system components (including the processing unit 101 and the storage unit 102).
[0323] The bus 103 includes a data bus, a control bus, and an address bus.
[0324] The storage unit 102 may include a readable medium in the form of a volatile memory, such as a random access memory (RAM) 1021 and / or a cache memory 1022 , and may further include a readable medium in the form of a non-volatile memory, such as a read-only memory (ROM) 1023 .
[0325] The storage unit 102 may also include a program / utility 1025 having a set (at least one) of program modules 1024, such program modules 1024 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.
[0326] The computing device 100 may also communicate with one or more external devices 104 (e.g., a keyboard, a pointing device, etc.). Such communication may be performed via an input / output (I / O) interface 105. Furthermore, the computing device 100 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) via a network adapter 106. Fig.10 As shown, the network adapter 106 communicates with other modules of the computing device 100 via the bus 103. It should be understood that, although not shown in the figure, other hardware and / or software modules can be used in conjunction with the computing device 100, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0327] It should be noted that, although several units / modules or sub-units / modules of the keyword detection device are mentioned in the above detailed description, such division is merely exemplary and not mandatory. In fact, according to the embodiments of the present disclosure, the features and functions of two or more units / modules described above can be embodied in one unit / module. Conversely, the features and functions of one unit / module described above can be further divided into multiple units / modules to be embodied.
[0328] In addition, although the operations of the disclosed method are described in a specific order in the drawings, this does not require or imply that the operations must be performed in this specific order, or that all the operations shown must be performed to achieve the desired results. Additionally or alternatively, some steps may be omitted, multiple steps may be combined into one step, and / or one step may be decomposed into multiple steps.
[0329] Although the spirit and principle of the present disclosure have been described with reference to several specific embodiments, it should be understood that the present disclosure is not limited to the disclosed specific embodiments, and the division of various aspects does not mean that the features in these aspects cannot be combined to benefit, and such division is only for the convenience of expression. The present disclosure is intended to cover various modifications and equivalent arrangements included in the spirit and scope of the attached claims.
Claims
1. A keyword detection method, comprising: Dividing the first speech according to corresponding time steps to obtain a corresponding plurality of speech segments; Acquire a probability distribution matrix according to the multiple voice segments, and determine at least one voice recognition sequence according to the probability distribution matrix corresponding to the multiple voice segments, wherein the probability distribution matrix includes a probability vector at each time step, and the probability vector indicates the probability that the character at the time step is each preset character in the preset character set; Performing fuzzy matching processing on the at least one speech recognition sequence according to a plurality of associated characters corresponding to the keyword to obtain a category of each of the speech recognition sequences, wherein the categories include a first category and a second category, the first category indicating that the corresponding speech recognition sequence includes at least one of the associated characters, and the second category indicating that the corresponding speech recognition sequence does not include the associated characters; Acquire, according to the category of each of the speech recognition sequences and / or the probability distribution matrix, a detection result of the first speech, wherein the detection result indicates that the first speech includes the keyword, or the detection result indicates that the first speech does not include the keyword; Acquiring a probability distribution matrix according to the plurality of speech segments, and determining at least one speech recognition sequence according to the probability distribution matrix corresponding to the plurality of speech segments, comprising: Performing feature extraction processing on the multiple speech segments to obtain feature vectors; The feature vector is encoded by an encoder to obtain encoding features of the multiple speech segments; The probability distribution matrix is acquired according to the coding feature, and the at least one speech recognition sequence is determined according to the probability distribution matrix.
2. The method according to claim 1, wherein: Acquiring the probability distribution matrix according to the coding feature, and determining the at least one speech recognition sequence according to the probability distribution matrix, comprising: Performing syllable sequence mapping processing on the coding features according to the syllable classifier to obtain a syllable probability distribution matrix, wherein the syllable probability distribution matrix includes syllable probability vectors at each time step, and the bth element in any ath syllable probability vector indicates the syllable corresponding to the ath speech segment, which is the probability of the bth preset syllable in the preset syllable set; Performing beam search processing on K preset syllables according to the syllable probability distribution matrix to obtain at least one syllable sequence, wherein the number of syllables included in each of the syllable sequences is L, and L is a positive integer; According to the syllable probability distribution matrix and the at least one syllable sequence, a word probability distribution matrix and at least one word sequence are obtained, wherein the word probability distribution matrix includes L word probability vectors, and the dth element in any cth word probability vector indicates the probability that the word corresponding to the cth syllable is the dth preset word in the preset word set; Wherein, the probability distribution matrix includes the syllable probability distribution matrix and the word probability distribution matrix, and the speech recognition sequence includes the syllable sequence and the word sequence; Among them, a is a positive integer, b is a positive integer greater than or equal to 1 and less than or equal to K, K is the number of preset syllables included in the preset syllable set, K is a positive integer, c is a positive integer greater than or equal to 1 and less than or equal to L, d is a positive integer greater than or equal to 1 and less than or equal to N, and N is the number of preset characters included in the preset character set.
3. The method according to claim 2, wherein: For any time step in the beam search process, if the current syllable path does not include the key syllable corresponding to the keyword, and the current syllable path includes the key syllable after being connected with the i-th preset syllable, the method further includes: A weight excitation is performed on the syllable path after the current syllable path and the i-th preset syllable are connected.
4. The method according to claim 2, wherein: According to the syllable probability distribution matrix and the at least one syllable sequence, obtaining a word probability distribution matrix and at least one word sequence comprises: Decoding the at least one syllable sequence and the coding feature according to the decoder and the word classifier to obtain the word probability distribution matrix; A beam search process is performed on N preset words according to the word probability distribution matrix to obtain the at least one word sequence, and the number of words included in each of the word sequences is L.
5. The method according to claim 4, wherein: For any time step in the beam search process, if the current word path does not include the keyword corresponding to the keyword, and the current word path includes the keyword after being connected with the i-th preset word, the method further includes: A weight excitation is performed on the word path after the current word path and the i-th preset word are connected.
6. The method according to any one of claims 2 to 5, wherein: The multiple associated characters include at least one matching syllable and at least one matching word corresponding to the keyword; performing fuzzy matching processing on the at least one speech recognition sequence according to the multiple associated characters corresponding to the keyword to obtain the category of each speech recognition sequence includes: Performing fuzzy matching processing on the at least one syllable sequence according to the at least one matching syllable to obtain a category of each of the syllable sequences; Performing fuzzy matching processing on the at least one word sequence according to the at least one matching word to obtain a category of each of the word sequences; Among them, the category of the target syllable sequence containing the matching syllable and the category of the target word sequence containing the matching word is the first category; the category of the syllable sequence other than the target syllable sequence and the category of the word sequence other than the target word sequence is the second category.
7. The method according to claim 6, wherein: The first speech is divided according to corresponding time steps to obtain corresponding multiple speech segments, including: The first speech is framed according to a preset time interval and a preset downsampling rate to obtain the multiple speech segments.
8. The method according to claim 7, wherein: Acquiring a detection result of the first speech according to the category of each of the speech recognition sequences and / or the probability distribution matrix, including: In response to the category of each of the speech recognition sequences being the second category, determining that the detection result of the first speech is that the first speech does not include the keyword; In response to each of the speech recognition sequences including the target syllable sequence and the target word sequence of the first category, obtaining a first score of the target syllable sequence according to the syllable probability distribution matrix and the target syllable sequence; Obtaining a second score of the target word sequence according to the word probability distribution matrix and the target word sequence; The detection result is obtained according to the first score and the second score.
9. The method according to claim 8, wherein: Acquiring a first score of the target syllable sequence according to the syllable probability distribution matrix and the target syllable sequence includes: Determining a probability peak of the target syllable sequence in the syllable probability distribution matrix, wherein for any syllable in the target syllable sequence, the probability peak is a time period corresponding to a maximum probability value of the syllable in the syllable probability distribution matrix; Determining a first target matrix in the syllable probability distribution matrix according to the probability peak of the target syllable sequence; The first score is obtained according to the first target matrix and the target syllable sequence.
10. The method according to claim 9, wherein: Acquiring a second score of the target word sequence according to the word probability distribution matrix and the target word sequence comprises: According to the probability peak of the target syllable sequence, determining the probability peak of the target word sequence in the word probability distribution matrix, wherein for any word in the target word sequence, the probability peak is the time period corresponding to the maximum probability value of the word in the word probability distribution matrix; Determining a second target matrix in the word probability distribution matrix according to the probability peak of the target word sequence; The second score is obtained according to the second target matrix and the target word sequence.
11. The method according to any one of claims 8 to 10, wherein: Acquiring the detection result according to the first score and the second score includes: determining a target score among the first score and the second score; When the target score is greater than or equal to a preset threshold, determining that the detection result is that the first speech includes the keyword; When the target score is less than the preset threshold, it is determined that the detection result is that the first speech does not include the keyword.
12. The method according to claim 11, wherein: The detection result is that the first speech includes the keyword, and the method further includes: The time period of the keyword in the first speech is determined according to the time step corresponding to the probability peak, the preset time interval and the preset downsampling rate.
13. The method according to claim 12, wherein: The time periods are: t=(x*e*f,y*e*f), The t is the time period, the x indicates that the time step corresponding to the first character in the keyword is the xth time step, the y indicates that the time step corresponding to the last character in the keyword is the yth time step, the e is the preset time interval, and the f is the preset downsampling rate.
14. A keyword detection device, comprising: An acquisition module, used for dividing the first speech according to corresponding time steps to obtain a plurality of corresponding speech segments; A processing module, configured to obtain a probability distribution matrix according to the plurality of speech segments, and determine at least one speech recognition sequence according to the probability distribution matrix corresponding to the plurality of speech segments, wherein the probability distribution matrix includes a probability vector at each time step, and the probability vector indicates a probability that the character at the time step is a preset character in a preset character set; a determination module, configured to perform fuzzy matching processing on the at least one speech recognition sequence according to a plurality of associated characters corresponding to the keyword, to obtain a category of each of the speech recognition sequences, wherein the categories include a first category and a second category, the first category indicating that the corresponding speech recognition sequence includes at least one of the associated characters, and the second category indicating that the corresponding speech recognition sequence does not include the associated characters; a detection module, configured to obtain a detection result of the first speech according to the category of each of the speech recognition sequences and / or the probability distribution matrix, wherein the detection result indicates that the first speech includes the keyword, or the detection result indicates that the first speech does not include the keyword; The processing module is specifically used for: Performing feature extraction processing on the multiple speech segments to obtain feature vectors; The feature vector is encoded by an encoder to obtain encoding features of the multiple speech segments; The probability distribution matrix is acquired according to the coding feature, and the at least one speech recognition sequence is determined according to the probability distribution matrix.
15. The device according to claim 14, wherein: The processing module is specifically used for: Performing syllable sequence mapping processing on the coding features according to the syllable classifier to obtain a syllable probability distribution matrix, wherein the syllable probability distribution matrix includes syllable probability vectors at each time step, and the bth element in any ath syllable probability vector indicates the syllable corresponding to the ath speech segment, which is the probability of the bth preset syllable in the preset syllable set; Performing beam search processing on K preset syllables according to the syllable probability distribution matrix to obtain at least one syllable sequence, wherein the number of syllables included in each of the syllable sequences is L, and L is a positive integer; According to the syllable probability distribution matrix and the at least one syllable sequence, a word probability distribution matrix and at least one word sequence are obtained, wherein the word probability distribution matrix includes L word probability vectors, and the dth element in any cth word probability vector indicates the probability that the word corresponding to the cth syllable is the dth preset word in the preset word set; Wherein, the probability distribution matrix includes the syllable probability distribution matrix and the word probability distribution matrix, and the speech recognition sequence includes the syllable sequence and the word sequence; Among them, a is a positive integer, b is a positive integer greater than or equal to 1 and less than or equal to K, K is the number of preset syllables included in the preset syllable set, K is a positive integer, c is a positive integer greater than or equal to 1 and less than or equal to L, d is a positive integer greater than or equal to 1 and less than or equal to N, and N is the number of preset characters included in the preset character set.
16. The device according to claim 15, wherein: For any time step in the beam search process, if the current syllable path does not include the key syllable corresponding to the keyword, and the current syllable path includes the key syllable after being connected with the i-th preset syllable, the processing module is further used to: A weight excitation is performed on the syllable path after the current syllable path and the i-th preset syllable are connected.
17. The device according to claim 15, wherein: The processing module is specifically used for: Decoding the at least one syllable sequence and the coding feature according to the decoder and the word classifier to obtain the word probability distribution matrix; A beam search process is performed on N preset words according to the word probability distribution matrix to obtain the at least one word sequence, and the number of words included in each of the word sequences is L.
18. The device according to claim 17, wherein: For any time step in the beam search process, if the current word path does not include the keyword corresponding to the keyword, and the current word path includes the keyword after being connected with the i-th preset word, the processing module is further used to: A weight excitation is performed on the word path after the current word path and the i-th preset word are connected.
19. The device according to any one of claims 15 to 18, wherein: The multiple associated characters include at least one matching syllable and at least one matching word corresponding to the keyword; the determination module is specifically used for: Performing fuzzy matching processing on the at least one syllable sequence according to the at least one matching syllable to obtain a category of each of the syllable sequences; Performing fuzzy matching processing on the at least one word sequence according to the at least one matching word to obtain a category of each of the word sequences; Among them, the category of the target syllable sequence containing the matching syllable and the category of the target word sequence containing the matching word is the first category; the category of the syllable sequence other than the target syllable sequence and the category of the word sequence other than the target word sequence is the second category.
20. The device according to claim 19, wherein The determination module is specifically used for: The first speech is framed according to a preset time interval and a preset downsampling rate to obtain the multiple speech segments.
21. The device according to claim 20, wherein: The detection module is specifically used for: In response to the category of each of the speech recognition sequences being the second category, determining that the detection result of the first speech is that the first speech does not include the keyword; In response to each of the speech recognition sequences including the target syllable sequence and the target word sequence of the first category, obtaining a first score of the target syllable sequence according to the syllable probability distribution matrix and the target syllable sequence; Obtaining a second score of the target word sequence according to the word probability distribution matrix and the target word sequence; The detection result is obtained according to the first score and the second score.
22. The device according to claim 21, wherein The detection module is specifically used for: Determining a probability peak of the target syllable sequence in the syllable probability distribution matrix, wherein for any syllable in the target syllable sequence, the probability peak is a time period corresponding to a maximum probability value of the syllable in the syllable probability distribution matrix; Determining a first target matrix in the syllable probability distribution matrix according to the probability peak of the target syllable sequence; The first score is obtained according to the first target matrix and the target syllable sequence.
23. The device according to claim 22, wherein: The detection module is specifically used for: According to the probability peak of the target syllable sequence, determining the probability peak of the target word sequence in the word probability distribution matrix, wherein for any word in the target word sequence, the probability peak is the time period corresponding to the maximum probability value of the word in the word probability distribution matrix; Determining a second target matrix in the word probability distribution matrix according to the probability peak of the target word sequence; The second score is obtained according to the second target matrix and the target word sequence.
24. The device according to any one of claims 21 to 23, wherein: The detection module is specifically used for: determining a target score among the first score and the second score; When the target score is greater than or equal to a preset threshold, determining that the detection result is that the first speech includes the keyword; When the target score is less than the preset threshold, it is determined that the detection result is that the first speech does not include the keyword.
25. The device according to claim 24, wherein: The detection result is that the first speech includes the keyword, and the detection module is further used for: The time period of the keyword in the first speech is determined according to the time step corresponding to the probability peak, the preset time interval and the downsampling rate.
26. The device according to claim 25, wherein The time periods are: t=(x*e*f,y*e*f), The t is the time period, the x indicates that the time step corresponding to the first character in the keyword is the xth time step, the y indicates that the time step corresponding to the last character in the keyword is the yth time step, the e is the preset time interval, and the f is the preset downsampling rate.
27. A computing device comprising: at least one processor and memory; The memory stores computer-executable instructions; The at least one processor executes the computer-executable instructions stored in the memory, so that the at least one processor executes the keyword detection method according to any one of claims 1 to 13.
28. A computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and when a processor executes the computer-executable instructions, the keyword detection method according to any one of claims 1 to 13 is implemented.
Citation Information
Patent Citations
Method and device for recognising a phonetic sound sequence or character sequence
AU2001293767A1
Method and device for locating keywords in voice and voice recognition system
CN101154379A
Voice control method, mobile terminal device and voice control system
CN103442130A
Method and device for detecting keywords in voice
CN103730115A
Wakeup word detection method and apparatus employing artificial intelligence, device, and medium
WO2021093449A1
