A method for event triggering processing based on speech recognition
Through speech signal preprocessing and feature extraction, neural network model and Bayesian network priority calculation, the problem of low speech recognition accuracy and inaccurate event triggering is solved, efficient recognition and processing of speech interaction is achieved, and the system's efficiency is improved. Response accuracy and user experience.
Patent Information
- Application Number
- CN202410545734.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-06
- Publication Date
- 2024-10-18
- Estimated Expiration
- 2044-05-06
AI Technical Summary
The accuracy of speech recognition in the existing technology is low, and the intention in the voice command cannot be fully understood, resulting in a low accuracy of event triggering. In addition, the existing technology fails to effectively consider command priority and application status, resulting in inaccurate responses.
Through speech signal preprocessing, Mel cepstrum coefficient feature extraction, neural network speech recognition model training, lexical analysis and semantic analysis, combined with Bayesian network to calculate event priority, dynamically build priority message queues to realize voice interaction commands Accurate identification and processing.
It improves the recognition and response accuracy of voice interactive commands, realizes intelligent scheduling and efficient processing of event triggers, and enhances the real-time nature and user experience of the system.
Smart Images

Figure CN118486305B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of speech recognition technology, and in particular to an event trigger processing method based on speech recognition. Background Art
[0002] Speech recognition technology based on deep learning can accurately convert speech signals into text; semantic parsing technology can analyze the grammar and semantics in text and accurately understand the intention of the text; and personalized voice interaction can be achieved by modeling user habits. How to organically combine speech recognition, semantic parsing and personalized modeling to improve the recognition and response accuracy of voice interaction is a current technical challenge.
[0003] The accuracy of voice command triggering events depends on the understanding of the voice command intent and the reasonable response to the event. In the existing technology, voice recognition has a low accuracy rate and cannot fully understand the intent of the voice command; the event triggering mechanism is simple and direct, and does not consider the command priority and application status, resulting in inaccurate response.
[0004] In the related technology, for example, Chinese patent document CN115376500A provides an intelligent voice recognition processing method and system, which relates to the technical field of rail transit security system. To reduce the requirements for users and improve the efficiency of security incident response. The method includes: activating the voice processing function of the security platform; collecting user voice information, parsing the user voice information, judging whether the parsed voice information matches the established voice command action of the security platform, if not, inputting the user voice information into the security platform in the form of text; judging the mode of the security platform, if it is a real scene mode, executing the voice command action corresponding to the user voice information or the input text, controlling the corresponding physical device based on the voice command action, and performing human-computer interaction feedback according to the user voice information; if it is a voice learning mode, performing human-computer interaction feedback according to the user voice information. However, the voice recognition of this scheme relies on simple voice command matching and cannot process complex semantic expressions, resulting in incomplete understanding of user voice commands. Therefore, the event triggering accuracy of this scheme needs to be further improved. Summary of the invention
[0005] In response to the problem of low accuracy of voice interaction trigger events in the prior art, the present application provides an event trigger processing method based on voice recognition, which achieves accurate recognition and analysis of voice interaction commands by accurately understanding the intention of the user's voice commands and prioritizing candidate events based on the application status.
[0006] The purpose of this application is achieved through the following technical solutions.
[0007] This specification provides an event-triggered processing method based on speech recognition, including: a speech signal acquisition and preprocessing stage, in which the original speech signal data is acquired through a microphone or other audio input device. The original speech signal is preprocessed, such as noise reduction, echo removal, endpoint detection, etc., to obtain relatively clean speech segment data. In the speech feature extraction stage, the preprocessed speech segment data is subjected to feature extraction using the Mel Cepstral Coefficient (MFCC) algorithm. The MFCC feature extraction process includes steps such as pre-emphasis, framing, windowing, fast Fourier transform, Mel filtering, and logarithm, and finally obtains an MFCC feature vector that can characterize the characteristics of the speech signal. In the speech recognition model training stage, the extracted MFCC feature vector is used as the input of the neural network speech recognition model, and together with the corresponding text annotation data, the acoustic model and language model of speech recognition are trained. Common neural network speech recognition models include hybrid models based on HMM-DNN, end-to-end CTC models, and Attention models. In the speech recognition and semantic understanding stage, the trained neural network speech recognition model is used to perform speech recognition on the real-time input MFCC features, and the corresponding speech recognition text is decoded. Perform lexical analysis on the speech recognition text, divide the text into word sequences, and perform part-of-speech tagging, named entity recognition and other processing. Perform semantic analysis on the word sequence, infer the speaker's intention by identifying keywords, context, etc., and obtain structured command text and intention labels. In the event query and priority calculation stage, query the predefined command-event mapping table based on the obtained command text and intention label to obtain the corresponding event to be triggered. Obtain the user's historical voice interaction data from the relational database, including historical voice text, intention label and triggered events, as user portrait data. Obtain the current state data of the system from the memory database, including the list of events to be triggered. Use the user portrait data and system state data as the input of the Bayesian network model to calculate the priority of each event to be triggered. In the event scheduling and processing stage, according to the priority of the event, use the priority queue to build the event message queue, and the event with high priority is placed at the front of the queue. Take the highest priority events from the message queue in turn, call the corresponding event processing function or service according to the event type and parameters, and execute the corresponding business logic. After the event is processed, delete the event from the queue and continue to process the next highest priority event until the queue is empty.
[0008] Specifically, the extracted features are used to train the speech recognition model, including: preprocessing the input speech signal, such as removing silent intervals and normalizing. Divide the speech signal into frames, each frame is usually 20-30 milliseconds, and the frame shift is about 10 milliseconds. Perform fast Fourier transform (FFT) on each frame of the speech signal to obtain a spectrum. Map the spectrum to the Mel frequency scale to obtain a Mel spectrum. The Mel frequency scale takes into account the auditory characteristics of the human ear for different frequencies. Take the logarithm of the Mel spectrum to obtain a logarithmic Mel spectrum. Perform discrete cosine transform (DCT) on the logarithmic Mel spectrum to obtain Mel cepstral coefficient (MFCC) features. Usually the first 12-20 coefficients are taken as feature vectors. Concatenate the MFCC feature vectors of each frame into a feature sequence as the input of the neural network speech recognition model. Select a suitable neural network architecture, such as convolutional neural network (CNN), recurrent neural network (RNN), long short-term memory network (LSTM), etc. Design the hyperparameters of the neural network such as the number of layers, number of neurons, and activation function according to the characteristics of the speech recognition task. Prepare a training dataset, including speech feature sequences and corresponding text transcriptions. The training dataset needs to cover diversity such as different speakers, different languages, and different environmental conditions. Divide the training dataset into training set, validation set, and test set for model training, parameter adjustment, and performance evaluation. Use the training set data to optimize the weight parameters of the neural network through forward propagation and backpropagation algorithms to minimize the loss function between the predicted output and the true text transcription. During the training process, use the validation set data to evaluate the generalization performance of the model, adjust the hyperparameters and network structure, and avoid overfitting. Train to obtain the optimal neural network speech recognition model, and evaluate its performance indicators on the test set, such as recognition accuracy and word error rate. Preprocess and extract features of the speech signal to be recognized to obtain the Mel-frequency cepstral coefficient feature sequence. Input the extracted feature sequence into the trained neural network speech recognition model. The neural network model calculates the probability distribution of phonemes or characters corresponding to each frame feature through the forward propagation algorithm. Use decoding algorithms such as greedy decoding and beam search decoding to convert the frame-level prediction results into the optimal text sequence. The decoded text sequence is post-processed, such as removing repetitions, restoring punctuation, restoring uppercase and lowercase letters, etc., to obtain the final speech recognition text.
[0009] Specifically, a speech signal is obtained, and a pre-emphasis processing is performed on the speech signal to strengthen the energy of the high-frequency part. The pre-emphasized speech signal is windowed, and an improved Hamming window function is used, and the speech frame signal is segmented according to a preset overlapping frame mode to obtain a speech frame signal. The speech frame signal is subjected to a fast Fourier transform (FFT) to convert the time domain signal into frequency domain spectrum information. Among them, a block FFT method is adopted to perform forward and reverse FFT on the low-frequency block and the high-frequency block respectively to obtain a low-frequency positive spectrum, a low-frequency complex spectrum, a high-frequency positive spectrum and a high-frequency complex spectrum, which are combined into complete spectrum information. The spectrum information is subjected to Mel filtering processing by a Mel triangular filtering algorithm. The central Mel frequencies of M key bands are calculated according to the formula of the key band center frequency, and the corresponding M triangular window functions are constructed to form a Mel filter bank. The spectrum information is input into the Mel filter bank, and the energy response of each triangular window function is obtained by a dot product operation, and normalization processing is performed. The spectrum information after the Mel filter processing is logarithmized to obtain the Mel cepstral coefficient (MFCC) feature of the speech signal. Specifically, the method includes: performing logarithmic operation on the Mel filter result of each speech frame to obtain the logarithmic Mel spectrum; performing feature fusion on the logarithmic Mel spectrum of multiple consecutive speech frames along the time dimension to obtain the final MFCC feature. The extracted MFCC feature is used as input to train the neural network speech recognition model. The trained speech recognition model is used to recognize the input speech signal to obtain the speech recognition text. The speech recognition text is subjected to lexical analysis and semantic parsing to obtain the command text and intent label representing the speech command. According to the command text and intent label, the predefined command mapping table is queried to determine the event to be triggered. The user historical interaction data is obtained from the relational database, including the historical speech text, intent label and corresponding triggering event; the current state data is obtained from the memory database, including the list of events to be triggered. Based on the Bayesian network model, the priority of the event to be triggered is calculated with the historical interaction data and the current state data as input. The message queue is constructed according to the event priority using the priority queue structure. The highest priority events are extracted from the message queue in turn for processing. The improved Hamming window function is adopted, and the control factor is introduced to adjust the main lobe width, thereby improving the windowing effect of the speech frame. The speech frame signal is divided into blocks and FFT is performed on the low-frequency block and the high-frequency block respectively, which improves the resolution and integrity of the spectrum information. The frequency correction coefficient is introduced to correct the Mel frequency and improve the frequency mapping accuracy of the Mel filter. The feature fusion of the time dimension is adopted, and the logarithmic Mel spectra of multiple consecutive speech frames are fused through the time window to capture the dynamic change information of the speech signal. The Bayesian network model is used to calculate the event priority in combination with the historical interaction data and the current state, realizing the personalized and intelligent event processing. The message queue is constructed with the priority queue structure to ensure the timely processing of high-priority events and improve the response efficiency of the system.
[0010] Specifically, after obtaining the speech recognition text, it is necessary to obtain the command text and intent label representing the speech command through lexical analysis and semantic parsing, including: Lexical analysis: Segment the text obtained by speech recognition and divide the text into independent vocabulary units, such as words, phrases, punctuation marks, etc. Word segmentation can adopt rule-based methods, such as forward maximum matching, reverse maximum matching, etc., or statistical methods, such as conditional random field (CRF), hidden Markov model (HMM), etc. Part-of-speech tagging is performed on the word segmentation results to determine the part of speech of each vocabulary unit, such as noun, verb, adjective, etc. Part-of-speech tagging can use a predefined part-of-speech tag set and part-of-speech tagging model. Semantic parsing: Syntactic analysis is performed on the results after word segmentation and part-of-speech tagging, a syntax tree or dependency graph is constructed, and the grammatical relationship and structure between vocabulary units are identified. According to predefined semantic rules and domain knowledge, semantic role labeling and semantic structuring are performed on the grammatical analysis results to extract command text and intent labels. Command text usually contains information such as keywords, operation objects, parameters, etc., which are used to represent specific instructions of users. Intent labels abstractly represent the user's operation intention, such as "turn on the device", "query information", "perform tasks", etc. Semantic parsing can use rule-based methods, such as regular expression matching, keyword matching, etc., or statistical methods, such as conditional random fields (CRF), recursive neural networks (RNN), etc. Domain adaptation: For specific domains or application scenarios, domain dictionaries and domain grammar rules are constructed to improve the accuracy and coverage of semantic parsing. Domain dictionaries contain professional terms, named entities, abbreviations, etc. in specific domains, which are used to improve the accuracy of word segmentation and part-of-speech tagging. Domain grammar rules define specific grammatical structures and semantic templates based on domain characteristics, which are used to extract command text and intent labels. Ambiguity resolution: For ambiguous voice commands, ambiguity resolution is performed through context information, user conversation history, knowledge base, etc., to determine the most likely command text and intent label. Ambiguity resolution can use rule-based methods, such as priority rules, context matching, etc., or statistical methods, such as Bayesian networks, Markov decision processes, etc. Preferably, dialogue management and context tracking are introduced to achieve semantic parsing in multi-round interactions. In the process of semantic parsing, the user's dialogue history and current dialogue status are considered and context information is tracked. The semantic parsing process in multi-round interactions is controlled through dialogue management models such as finite state machines, slot filling, seq2seq, etc. Context information and dialogue strategies are used to solve problems such as coreference resolution, omission recovery, and intent tracking, and achieve coherent and natural multi-round semantic understanding.
[0011] Specifically, after obtaining the speech recognition text, the command text and intention label representing the speech command are obtained through lexical analysis and semantic parsing. Then, according to the command text and the intention label, a predefined command mapping table is queried to determine the event to be triggered, including: pre-defining a command mapping table for storing the corresponding relationship between the command text, the intention label and the event to be triggered. The command mapping table can be implemented by a relational database, a key-value pair storage or other data structure. Each table item contains three fields: command text, intention label and event to be triggered. Among them, the command text represents the text form of the voice command that the user may say; the intention label represents the operation intention or purpose represented by the command; and the event to be triggered represents the specific event or operation associated with the command. The text obtained by speech recognition is lexically analyzed and the text is segmented into independent vocabulary units, such as words, phrases, punctuation marks, etc. The segmented vocabulary units are semantically parsed, and the command text and intention label are identified through predefined grammatical rules and domain knowledge. The command text usually contains information such as keywords, operation objects, parameters, etc., which are used to represent the specific instructions of the user. The intent label abstractly represents the user's operation intention, such as "open the device", "query information", "perform a task", etc. The command text and intent label obtained by semantic analysis are used as query conditions to match and search in the command mapping table. The query process can use exact matching or fuzzy matching. Exact matching requires that the command text and intent label are completely consistent with the table item; fuzzy matching allows a certain degree of difference, such as using regular expressions, edit distance and other methods to calculate similarity. If a matching table item is found, the event to be triggered corresponding to the table item is returned as the query result. According to the result of querying the command mapping table, the event to be triggered corresponding to the user's voice command is determined. The event to be triggered can be a specific operation, function call, parameter setting, etc., which is used to instruct the system to perform the corresponding action. If the query result is empty, that is, no corresponding event is matched, the default processing can be adopted or an error prompt can be returned.
[0012] Specifically, message processing includes: querying and obtaining user historical interaction data from a relational database, including historical voice text, intent labels, and corresponding triggering events. Obtaining current state data from a memory database, including a list of events to be triggered. Preprocessing the acquired historical interaction data and current state data, such as data cleaning and feature extraction, to convert them into a format suitable for input into a Bayesian network model. Based on the Bayesian network model, the priority of each event to be triggered is calculated using the preprocessed historical interaction data and current state data as input. The Bayesian network model estimates the probability of each event being triggered in the current state by learning the conditional probability distribution of events in historical data. Priority calculation can consider a variety of factors, such as the historical triggering frequency of events, user preferences, context relevance, etc., and adjust the priority calculation results by setting different feature weights. Using the Priority Queue data structure, a message queue is constructed according to the calculated event priority. The priority queue supports dynamic insertion and deletion of elements, and always ensures that the top element of the queue has the highest priority. The events to be triggered are inserted into the priority queue in order from high to low priority to form a message queue based on priority sorting. The highest priority events are extracted from the message queue in sequence for processing. According to the type and parameters of the event, the corresponding processing function or service is called to perform the operation corresponding to the event. Event processing can be synchronous, that is, executed in sequence according to the queue order; it can also be asynchronous, and the concurrency performance of event processing can be improved through multi-threading or distributed processing. Preferably, in addition to considering the historical trigger frequency and user preferences of the event, more dimensional features can be introduced, such as the time urgency of the event, resource occupancy, and dependency with other events. A multi-dimensional feature combination is adopted to build a more comprehensive and accurate event priority calculation model through feature engineering and weight adjustment. Preferably, the event processing process is distributedly deployed, and message queue middleware (such as Kafka, Rabbit MQ, etc.) is introduced to realize asynchronous processing and load balancing of events. Events are processed in parallel by multiple processing nodes to improve the throughput and response speed of event processing. Distributed cache (such as Redis) is used to store current state data to achieve state sharing and consistency maintenance. Preferably, the historical interaction data in the relational database is partitioned and indexed to improve the efficiency of data query. Use column storage or time series databases (such as Influx DB, Open TSDB, etc.) to store current status data, supporting high-concurrency writes and aggregate queries. Use cache mechanisms (such as Redis, Memcached) to cache hot data and reduce database access pressure.
[0013] Furthermore, the Mel cepstral coefficient features are obtained, including: pre-emphasis processing. After the speech signal is collected by the microphone, the energy in the high-frequency part is often weak, and the human ear is more sensitive to the high-frequency part. In order to compensate for the energy of the high-frequency signal, the speech signal needs to be pre-emphasized. Pre-emphasis processing can be achieved with a first-order high-pass filter, and its transfer function is: H(z)-1-a×z -1 , where a is the pre-emphasis coefficient, usually between 0.9 and 1.0. The pre-emphasized speech signal: y(n) = x(n)-a×x(n-1), where x(n) is the original speech signal. After this processing, the energy of the high-frequency part is improved. Windowing and framing processing, the speech signal is a non-stationary signal, but it can be approximately considered to be stable in a short time (10 to 30ms). In order to perform short-term analysis, the speech signal needs to be windowed and framed. Windowing processing is to reduce the impact of signal discontinuity at the edge of the frame on subsequent spectrum analysis. Commonly used window functions include Hamming window, Hanning window and rectangular window.
[0014] An improved Hamming window function is used here, which is defined as:
[0015] Where N is the window length, n is the number of the sample point, and α is the parameter for controlling the sidelobe attenuation. The introduction of α can better suppress the sidelobe while ensuring the width of the main lobe. Framing processing is to divide the windowed speech signal according to the preset frame length and frame shift to obtain a series of speech frame signals. The frame length is generally 10 to 30ms, and the frame shift is generally 1 / 2 or 1 / 3 of the frame length. Common configurations include 25ms frame length and 10ms frame shift. Suppose the original speech signal is x(n), the window function is w(n), the frame length is N, and the frame shift is M, then the speech signal of the mth frame is: x m (n) = x(m×M+n)×w(n), 0≤n≤N-1, Fast Fourier Transform (FFT). In order to perform frequency domain analysis, it is necessary to perform Fast Fourier Transform on each frame of speech signal to obtain its spectrum information. m (n) Perform FFT transformation: 0≤k≤N-1, where X m (k) is the spectrum of the mth frame of speech signal, k is the number of the frequency point. The amplitude of the spectrum |X m (k)| reflects the energy distribution of the speech signal at each frequency point. Mel filtering: the human ear has different perception abilities for sounds of different frequencies. In order to make the extracted features consistent with the auditory characteristics of the human ear, the spectrum needs to be filtered using the Mel scale. The relationship between the Mel scale frequency f_mel and the linear frequency f_Hz is: Mel filtering is actually a set of triangular filters whose center frequencies are equally spaced in Mel scale. The number of filter banks is generally 20 to 40. Suppose the spectrum of the mth frame speech signal is X m (k), the frequency response of the Mel filter bank is H_l(k), where l is the filter number, then the Mel spectrum of the mth frame speech signal is 0≤l≤L-1, where K is the number of FFT transform points and L is the number of Mel filter banks. Take the logarithm and discrete cosine transform (DCT). In order to further compress the feature dimension and decorrelation, it is necessary to take the logarithm of the Mel spectrum and perform DCT transform to obtain the final MFCC feature. Taking the logarithm operation can convert the multiplication operation of the spectrum into an addition operation, which is closer to the loudness perception of the human ear. Perform DCT transform on the Mel spectrum after taking the logarithm: 0≤n≤N_c-1, where c_m(n) is the MFCC feature of the mth frame, and N_c is the order of the MFCC feature, usually 12 to 20. The final MFCC feature vector can be expressed as: MFCC m =[c m (0),c m (1),.......,c m (N c-1 )].
[0016] Furthermore, the improved Hamming window function is expressed as follows:
[0017] Wherein, n represents the serial number of the window function sample point, and its value range is 0 to N-1; N represents the window length of the improved Hamming window function, that is, the total number of sample points contained in the window function; α represents the newly added control factor, which is used to control the weight coefficient of the sine term and adjust the main lobe width; w(n) represents the value of the improved Hamming window function at the sample point n, and varies between 0 and 1 according to the different values of n. Compared with the conventional Hamming window function, the improved Hamming window function proposed in this application introduces a new sine term on the original basis, which is in the form of Introducing a new control factor α, a new control factor α is added to the improved Hamming window function to adjust the weight coefficient of the second sine term. The expression of the conventional Hamming window function is:
[0018] There is only one fixed cosine term. The improved Hamming window introduces α as the weight of the second cosine term. By adjusting the value of α, the contribution of the second cosine term can be flexibly controlled. When α is 0, the improved Hamming window function degenerates into a conventional Hamming window function. The frequency of the second cosine term is doubled, and the cosine term in the conventional Hamming window function The frequency is The corresponding normalized angular frequency is 2π / N. The second cosine term introduced by the improved Hamming window function The frequency is doubled to The corresponding normalized angular frequency is 4π / N. Doubling the frequency means that the period of the second cosine term is shortened to half of the original, which can contribute higher-frequency components in the time domain.
[0019] Furthermore, the obtained speech frame signal is subjected to a fast Fourier transform to obtain the spectrum information of the speech frame, including: frequency band segmentation, according to the preset frequency band range, the speech frame signal is divided into a low-frequency block and a high-frequency block. Assuming the sampling frequency is fs, a frequency band segmentation point f0 is set, then the frequency band can be divided into a low-frequency part of [0, f0] and a high-frequency part of (f0, fs / 2]. Corresponding to the discrete time signal, assuming that the speech frame length is N, the length of the low-frequency block is The length of the high-frequency block is N2=N-N1. Band segmentation can be achieved by low-pass filtering and high-pass filtering in the time domain to obtain the low-frequency block signal x1(n) and the high-frequency block signal x2(n). FFT of the low-frequency block, forward N1-point FFT of the low-frequency block signal x1(n), obtain the low-frequency positive spectrum X1(k) of the low-frequency block: 0≤k≤N1-1. Perform an inverse N1-point FFT on the low-frequency block signal x1(n) to obtain the low-frequency complex spectrum X1'(k) of the low-frequency block: 0≤k≤N1-1. The forward FFT obtains the positive frequency components of the low-frequency part, and the reverse FFT obtains the negative frequency (conjugate) components of the low-frequency part. The FFT of the high-frequency block performs a forward N2-point FFT on the high-frequency block signal x2(n) to obtain the high-frequency positive spectrum X2(k) of the high-frequency block: 0≤k≤N2-1. Perform an inverse N2-point FFT on the high-frequency block signal x2(n) to obtain the high-frequency complex spectrum X2'(k) of the high-frequency block: 0≤k≤N2-1. The forward FFT obtains the positive frequency components of the high frequency part, and the reverse FFT obtains the negative frequency (conjugate) components of the high frequency part. The combination of spectrum information, the low-frequency positive spectrum X1(k), the low-frequency complex spectrum X1'(k), the high-frequency positive spectrum X2(k) and the high-frequency complex spectrum X2'(k) are combined to obtain the complete speech frame spectrum information X(k):
[0020] The combined spectrum information X(k) contains the positive and negative frequency components of the low frequency part, as well as the positive and negative frequency components of the high frequency part. The length of the spectrum information X(k) is 2(N1+N2), covering the complete frequency range of the speech frame signal, and can be used as the input for subsequent Mel filter processing.
[0021] Among them, the low-frequency block uses N1-point FFT, and the high-frequency block uses N2-point FFT, and N1 is greater than N2. The low-frequency part contains the main energy of the speech signal and key information such as fundamental pitch and formant, which contributes more to speech recognition. Therefore, using a longer FFT window (N1) can obtain higher frequency resolution and more accurately characterize low-frequency features. The high-frequency part mainly contains detailed information and noise components of the speech, which has a relatively small impact on speech recognition. Using a shorter FFT window (N2) can reduce the computational complexity and provide sufficient frequency resolution to capture high-frequency features. In the time domain, the duration of the N1-point FFT window is greater than that of the N2-point FFT window, which means that the time domain analysis granularity of the low-frequency part is finer, while the time domain analysis granularity of the high-frequency part is relatively coarse. This allocation method of time-frequency resolution is adapted to the characteristics of the speech signal.
[0022] Furthermore, the spectral information is subjected to Mel filtering by using a Mel triangular filtering algorithm, including: calculating the central Mel frequencies of M key bands according to the key band central frequency formula, constructing M triangular window functions according to the calculated M key band central Mel frequencies, and forming a Mel filter bank. The peak position of each triangular window function is related to the corresponding key band central Mel frequency f c (m), and the left and right boundaries are aligned with the Mel frequencies of the adjacent key band centers. Let the Mel frequencies corresponding to the left boundary, peak position, and right boundary of the mth triangular window function be f l (m), f c (m), f r (m), then the triangular window function H m (k) is defined as: H m (k)=0,k<f l (m) or k>f r (m), f l (m)<k<f c (m), f c (m)<k<f r (m), where 0≤m≤M-1, and k is the index of the frequency point. Arrange the M triangular window functions in frequency order to form a complete Mel filter bank. Calculate the energy response, input the spectrum information of the speech frame signal into the constructed Mel filter bank, and calculate the energy response of each triangular window function to the spectrum information in the corresponding key band through dot product operation. Suppose the spectrum information of the speech frame signal is X(k), and the mth triangular window function is H m (k), then the energy response S(m) of the mth key band is: 0≤m≤M-1, where the range of the summation operation is the non-zero interval of the mth triangular window function. Through the dot product operation, the energy of the spectrum information in each key band is accumulated and weighted to form the energy distribution in the Mel frequency domain. Normalization processing is performed on the output energy response of each triangular window function to eliminate the influence of the energy scale.
[0023] Common normalization methods include maximum normalization and mean normalization. Maximum normalization: S_norm(m) = S(m) / max(S), 0≤m≤M-1, where max(S) is the maximum value of the energy response. Mean normalization: 0≤m≤M-1, where mean(S) and std(S) are the mean and standard deviation of the energy response, respectively. Output the Mel filter result, and use the normalized energy response as the Mel filter result of the speech signal spectrum information, expressed as an M-dimensional feature vector: S mel =[S norm (0),S norm (1),......,S norm (M-1)], the Mel filtering result S_mel reflects the energy distribution of the speech signal in the Mel frequency domain, and captures the frequency band information related to the auditory characteristics of the human ear. The key to the Mel triangular filtering algorithm is to design a triangular window function filter group that matches the Mel frequency scale according to the auditory characteristics of the human ear, and to realize the energy accumulation and weighting of the spectrum information in the Mel frequency domain through dot product operations. Among them, the division of the key band and the construction of the triangular window function are the core of the algorithm, which directly affects the effect of Mel filtering. By adjusting the number of key bands M, the frequency band resolution and feature dimension of the Mel filtering result can be balanced. The value of M is usually between 20 and 40, and needs to be selected according to the sampling frequency, frequency band characteristics of the speech signal, and the requirements of subsequent feature extraction and modeling.
[0024] Furthermore, the formula for the center Mel frequency of the critical band is as follows:
[0025] Where: f represents the linear frequency, which represents the linear frequency of the speech signal, in Hz; fc represents the lower edge frequency of the cth key band, in Hz; β represents the frequency correction coefficient; f(bark) represents the central Mel frequency of the cth key band.
[0026] Furthermore, β represents a frequency correction coefficient, which is calculated by the following formula: β=k(fn-fc), where: k is a proportional coefficient; fn represents the upper edge frequency of the nth key band, in Hz; fc represents the lower edge frequency of the cth key band, in Hz.
[0027] Furthermore, the spectral information after Mel filtering is processed by logarithm to obtain the Mel-Frequency Cepstral Coefficient feature of the speech signal. In order to further extract stable and compact feature representation, the Mel filtering result can be processed logarithmically and feature fused to obtain the Mel-Frequency Cepstral Coefficient (MFCC) feature of the speech signal. Including: logarithmic Mel spectrum calculation, logarithmic operation is performed on the spectral information of each speech frame signal obtained by Mel filtering, and the logarithmic Mel spectrum of the corresponding speech frame is obtained. Suppose the Mel filtering result of the nth speech frame is: S mel (n)=[S mel (n,0),S mel (n,1),......,S mel (n,M-1)], where M is the number of triangular window functions in the Mel filter bank. Take the base 10 logarithm of each element in S_mel(n) to get the logarithmic Mel spectrum L mel (n):
[0028] L mel (n,m)=log 10 (S mel (n,m)), 0≤m≤M-1, logarithmic operation can compress the energy response in the Mel filter result into a smaller dynamic range, so that the frequency bands of different energy levels can be represented more balanced. At the same time, logarithmic operation is also in line with the human ear's perception of sound intensity, that is, the Weber-Fechner law, which shows that the human ear's perception of sound intensity is proportional to the logarithm of the sound intensity. Feature fusion, in order to capture the dynamic changes of speech signals in the time dimension, the logarithmic Mel spectra of multiple consecutive speech frames can be feature fused. Suppose the logarithmic Mel spectra of N consecutive speech frames are: L mel (n),L mel (n+1),........,L mel (n+N-1), where N is the time window length of feature fusion. These N logarithmic Mel spectra are concatenated in the time dimension to form an M×N two-dimensional feature matrix L fused :
[0029] L fused =[L mel (n),L mel (n+1),........,L mel(n+N-1)], feature fusion can use the correlation of speech signals in the time dimension to capture the dynamic evolution information of speech and improve the robustness and distinguishability of features. Common feature fusion methods include simple splicing, weighted splicing, statistical fusion, etc. The mean and standard deviation of the logarithmic Mel spectrum of N speech frames can be calculated as the fused feature vector. Mel cepstral coefficient feature, the fused logarithmic Mel spectrum feature L_fused is used as the Mel cepstral coefficient feature of the speech signal, represented as an M×N dimensional feature matrix. The Mel cepstral coefficient feature contains both the energy distribution information of the speech signal in the Mel frequency domain and the dynamic change information in the time dimension, and has good recognition performance and robustness. In order to further improve the compactness and distinguishability of the features, the Mel cepstral coefficient feature can be reduced in dimension, such as using discrete cosine transform (DCT) or principal component analysis (PCA). The Mel cepstral coefficient feature after dimensionality reduction is usually of low dimension, but can still effectively represent the key features of the speech signal, reducing the computational overhead of subsequent model training and recognition. The extraction process of Mel-frequency cepstral coefficient features comprehensively considers the frequency domain characteristics, time domain dynamics and human hearing characteristics of speech signals, and obtains compact, stable and well-distinguishing feature representation through operations such as logarithmic transformation and feature fusion. Among them, logarithmic transformation can compress the energy dynamic range, so that frequency bands of different energy levels can be represented more evenly; feature fusion can capture the dynamic evolution information of speech signals in the time dimension, and improve the robustness and recognition performance of features.
[0030] Furthermore, a logarithmic operation is performed on the spectrum information of each speech frame signal obtained by the Mel filter, and the logarithmic operation adopts the following formula: Wherein, S(m) represents the logarithmic Mel spectrum of the m-th speech frame, M(m,k) represents the output energy response of the k-th Mel filter of the m-th speech frame, and K represents the total number of filters in the Mel filter bank.
[0031] Furthermore, along the time dimension, the logarithmic Mel spectrum of multiple consecutive speech frame signals is fused, and the fused logarithmic Mel spectrum feature is calculated using the following formula: Among them, F(n) represents the fused logarithmic Mel spectrum feature of the nth time step, S(n+i) represents the logarithmic Mel spectrum of the n+ith speech frame, and W represents the time window length of feature fusion, which is used to control the context range of fusion.
[0032] Compared with the prior art, the advantages of this application are:
[0033] By performing pre-emphasis, windowing, framing and other preprocessing operations on the speech signal and using an improved Hamming window function for windowing, the accuracy and robustness of speech feature extraction are improved, and spectrum leakage and energy loss are effectively reduced.
[0034] When extracting the Mel-cepstral coefficient features, the block fast Fourier transform and Mel-triangular filtering algorithm are used. By performing forward and reverse fast Fourier transform on the low-frequency and high-frequency areas respectively, the spectral resolution and computational efficiency are improved. At the same time, the Mel filter group is used to filter and integrate the energy of the spectral information, highlighting the perceptual characteristics of the speech signal and improving the feature recognition performance.
[0035] When training the neural network speech recognition model, the extracted Mel-frequency cepstral coefficient features are used as input, and the high-level semantic representation of the speech signal is automatically learned through an end-to-end deep learning method, avoiding the complex acoustic modeling and language modeling processes in traditional speech recognition, and improving the recognition accuracy and generalization ability.
[0036] When performing event trigger processing, the command text and intent label are obtained through lexical analysis and semantic parsing, and the event priority is calculated using the Bayesian network model in combination with the user's historical interaction data and current status data. The priority message queue is dynamically constructed to achieve intelligent scheduling and efficient processing of events, thereby improving the real-time performance and user experience of the system.
[0037] By introducing an improved critical band center frequency formula and frequency correction coefficient, the design of the Mel filter bank is optimized to make it more in line with the auditory characteristics of the human ear, improve the representation ability and discrimination of the Mel cepstral coefficient features, and further enhance the performance of speech recognition.
[0038] In the process of calculating the logarithmic Mel spectrum and fusion of features, optimized logarithmic operation formula and time dimension fusion formula are used to effectively compress the dynamic range of the spectrum and highlight the key information of the speech signal. At the same time, through the fusion of time context, the long-term dependency of speech is captured, which improves the robustness of features and recognition accuracy. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] This specification will be further described in the form of exemplary embodiments, which will be described in detail by the accompanying drawings. These embodiments are not restrictive, and in these embodiments, the same number represents the same structure, wherein:
[0040] Figure 1 is an exemplary flow chart of an event trigger processing method based on speech recognition according to some embodiments of this specification;
[0041] Figure 2 is an exemplary flow chart of obtaining Mel-cepstral coefficient features according to some embodiments of this specification;
[0042] Figure 3 This is an exemplary flowchart for obtaining spectrum information according to some embodiments of this specification. DETAILED DESCRIPTION
[0043] The method and system provided in the embodiments of this specification are described in detail below with reference to the accompanying drawings.
[0044] Figure 1 This is an exemplary flow chart of an event trigger processing method based on speech recognition shown in some embodiments of the present specification, an event trigger processing method based on speech recognition, comprising: obtaining a speech signal; extracting the Mel-cepstral coefficient features of the speech signal through a Mel-cepstral coefficient algorithm for the obtained speech signal; using the extracted Mel-cepstral coefficient features as input to train a neural network speech recognition model; using the trained neural network speech recognition model to perform speech recognition on the speech signal to obtain a speech recognition text; based on the obtained speech recognition text, obtaining a command text and an intent label representing a speech command through lexical analysis and semantic parsing; based on the command text and the intent label, querying a predefined command mapping table to determine an event to be triggered; obtaining user historical interaction data containing historical speech text, intent labels and corresponding trigger events from a relational database, and obtaining current state data containing a list of events to be triggered from a memory database; based on a Bayesian network model, using historical interaction data and current state data as input, calculating the priority of the event to be triggered; using a priority queue structure to build a message queue according to the calculated event priority; extracting the highest priority events from the message queue in turn for processing.
[0045] Acquire the voice signal. The user's voice commands are collected through a microphone or other audio input device to obtain the original voice signal data. First, a series of preprocessing operations are performed on the acquired voice signal, including pre-emphasis, framing and windowing. The pre-emphasis processing uses a first-order high-pass filter to enhance the energy of the high-frequency part of the voice signal. The pre-emphasized voice signal y(n) can be expressed as: y(n) = x(n)-a×x(n-1), where x(n) is the original voice signal and α is the pre-emphasis coefficient, which is usually 0.97. Next, the pre-emphasized voice signal is framed. The overlapping framing method is adopted, the frame length is set to 20-30 milliseconds, and the frame shift is 10 milliseconds. Assuming that the sampling rate of the voice signal is 16kHz, the number of sampling points contained in each frame is 320-480. The framed voice signal is windowed to reduce the impact of spectral leakage. The improved Hamming window function is selected here, and its mathematical expression is:
[0046] Where n is the sample point number, ranging from 0 to N-1; N is the window length; α is the control factor, which is used to adjust the main lobe width of the window function. The larger the value of α, the narrower the main lobe and the higher the frequency resolution.
[0047] Before performing Fast Fourier Transform (FFT) on the speech frame signal, in order to better utilize the characteristics of the speech signal in different frequency bands, the segmented FFT method can be used. The specific implementation is as follows: First, according to the preset frequency band range, each speech frame signal x(n) is divided into a low-frequency part x L (n) and the high frequency part x H (n). Assuming the sampling rate of the speech signal is fs, the frequency range of the low-frequency part is [0, fs / 4], and the frequency range of the high-frequency part is (fs / 4, fs / 2]. For the low-frequency part x L (n) Perform N1-point FFT to obtain the low-frequency positive spectrum X L (k) and the low-frequency complex spectrum X L *(k). The calculation formula of FFT is: k = 0, 1, ..., N1-1, where j is an imaginary unit, k is the frequency domain sampling point number, and N1 is the number of FFT points, which is usually an integer power of 2, such as 512 or 1024. Similarly, for the high frequency part x H (n) Perform N2-point FFT to obtain the high-frequency positive spectrum X H (k) and high frequency complex spectrum X H *(k). The calculation formula of FFT is: k = 0, 1, ..., N2-1, where N2 is also an integer power of 2, but is smaller than N1, and is commonly 256 or 512. This is because the signal in the high-frequency part changes quickly, and the frequency resolution requirement is not high, while the signal in the low-frequency part changes relatively slowly, and a higher frequency resolution is required.
[0048] After obtaining the FFT results of the low frequency and high frequency, they need to be combined to form the complete speech frame spectrum information. Specifically, they can be spliced as follows:
[0049]
[0050] Among them, X(k) is the positive spectrum after splicing, and X*(k) is the complex spectrum after splicing. It should be noted that only the first half of the low-frequency and high-frequency FFT results, that is, the positive frequency part, is taken, because according to the conjugate symmetry, the negative frequency part is mirror-symmetric with the positive frequency part. Through the above-mentioned segmented FFT method, the frequency resolution of different frequency bands can be more flexibly controlled, and the frequency domain characteristics of the speech signal can be fully utilized. At the same time, using different FFT points can also reduce the amount of calculation and memory usage to a certain extent. A speech frame signal contains 320 sampling points and the sampling rate is 16kHz. Then, the number of sampling points of the low-frequency part is 160, and the number of sampling points of the high-frequency part is also 160. Performing a 256-point FFT on the low-frequency part, 256 frequency domain sampling points are obtained, and the frequency resolution is 62.5Hz (16000 / 256). Performing a 128-point FFT on the high-frequency part, 128 frequency domain sampling points are obtained, and the frequency resolution is 125Hz (16000 / 128). Finally, the spliced spectrum information contains 192 frequency domain sampling points (256 / 2+128 / 2), covering the frequency band range of 0 to 8kHz. The frequency resolution of the low-frequency part is higher, which is conducive to capturing subtle changes in the speech signal; while the frequency resolution of the high-frequency part is lower, but it is enough to reflect the main characteristics of the high-frequency signal.
[0051] Figure 2 This is an exemplary flow chart of obtaining Mel cepstral coefficient features according to some embodiments of this specification. After obtaining the frequency domain signal, a Mel triangular filter bank is used to filter it to extract the perceptual features of the speech. The specific steps of Mel filtering are as follows: According to the key band center frequency formula, the center Mel frequencies of M key bands are calculated. The key band center frequency formula is: Where: f represents the linear frequency, which represents the linear frequency of the speech signal, in Hz; fc represents the lower edge frequency of the cth key band, in Hz; β represents the frequency correction coefficient; f(bark) represents the central Mel frequency of the cth key band. It should be noted that fc here needs to be adjusted by the frequency correction coefficient β, the formula is: β=k(fn-fc), where k is the proportional coefficient; fn is the upper edge frequency of the nth key band; fc is the lower edge frequency of the cth key band.
[0052] Construct M triangular window functions, and the peak position of each triangular window function matches the corresponding key band center Mel frequency to form a Mel filter bank. Input the spectrum information of the speech frame signal into the Mel filter bank, and calculate the energy response of each triangular window function to the spectrum information in the corresponding key band through dot product operation. Normalize the output energy response of each triangular window function. Use the normalized energy response as the Mel filtering result of the speech signal spectrum information.
[0053] Figure 3This is an exemplary flow chart for obtaining spectrum information according to some embodiments of this specification. The spectrum information of each speech frame signal obtained by Mel filtering is logarithmically operated. First, the Mel filter output energy response of the m-th speech frame signal is logarithmically operated. Suppose the energy response vector obtained after the m-th speech frame is processed by K Mel filters is E_m=[E_m1, E_m2, ..., E_mK], where E_mk represents the output energy response of the k-th Mel filter, k=1, 2, ..., K. Perform a logarithmic operation on E_m to obtain the logarithmic Mel spectrum S(m) of the m-th speech frame: Among them, S(m) represents the logarithmic Mel spectrum of the mth speech frame, M(m,k) represents the output energy response of the kth Mel filter of the mth speech frame, and K represents the total number of filters in the Mel filter bank. Next, the logarithmic Mel spectrum of multiple consecutive speech frames is feature fused along the time dimension.
[0054] The logarithmic Mel spectrum of the speech frame corresponding to the nth time step is L_n, and the time window length of feature fusion is W. The calculation formula of the fused logarithmic Mel spectrum feature F(n) is: Wherein, F(n) represents the fused logarithmic Mel spectrum feature of the nth time step, S(n+i) represents the logarithmic Mel spectrum of the n+ith speech frame, and W represents the time window length of feature fusion, which is used to control the context range of fusion. In a specific embodiment of the present application, the dimension of the logarithmic Mel spectrum is K=40, and the time window length of feature fusion is W=5. Then, the dimension of the logarithmic Mel spectrum feature F_n after fusion at the nth time step is 40*5=200, which contains the logarithmic Mel spectrum information of the nth speech frame and the two frames before and after it. F_n=[L_{n-2}, L_{n-1}, L_n, L_{n+1}, L_{n+2}], wherein L_{n-2}, L_{n-1}, L_n, L_{n+1}, L_{n+2} represent the 40-dimensional logarithmic Mel spectrum vectors of the n-2th, n-1th, n, n+1, and n+2th speech frames, respectively.
[0055] The extracted features are used to train the speech recognition model. The extracted Mel cepstral coefficient features are input into the neural network, and the speech recognition model is obtained through end-to-end training. The output of the model is the probability distribution of the speech recognition results. The trained model is used to recognize new speech signals. The new speech signal is processed, the Mel cepstral coefficient features are extracted, and then input into the trained neural network model for prediction to obtain the text representation of the recognition result.
[0056] Specifically, the speech signal is subjected to pre-emphasis, framing, windowing and other operations in sequence, and then the MFCC feature sequence F_new(n) of the speech signal is obtained through fast Fourier transform, Mel filtering and logarithmic operation, where n is the time step, ranging from 1 to T_new. The extracted MFCC feature sequence F_new(n) is input into the trained neural network model, and the output state sequence H_new(n) of each time step is obtained through the forward propagation process. For the LSTM-based RNN model, the forward propagation process is as follows: i_new(n) = σ(W_i*[H_new(n-1), F_new(n)]+b_i), f_new(n) = σ(W_f*[H_new(n-1), F_new(n)]+b_f), o_new(n) = σ(W_o*[H_new(n-1), F_new(n)]+b_o), C'_new(n) = tan h(W_c*[H_new(n-1), F_new(n)]+b_c), C_new(n)=f_new(n)*C_new(n-1)+i_new(n)*C'_new(n), H_new(n)=o_new(n)*tanh(C_new(n)), where W_i, W_f, W_o, W_c, b_i, b_f, b_o, b_c are the trained model parameters, which are the same as the definition. The output state sequence H_new(n) of the LSTM network is sent to the fully connected layer to obtain the output vector y_new(n) for each time step: y_new(n)
[0057] =W_y*H_new(n)+b_y, where W_y and b_y are the trained parameters of the fully connected layer. Apply the Softmax function to the output y_new(n) of the fully connected layer to obtain the posterior probability distribution p_new(n) at each time step: p_new_k(n)=exp(y_new_k(n)) / ∑exp(y_new_j(n)), k=1, 2, ..., K, where p_new_k(n) represents the probability that the recognition result is the kth category at time step n.
[0058] Next, the obtained probability distribution sequence needs to be converted into the final recognition result text. Greedy decoding can be used here, that is, the category with the highest probability is selected as the recognition result at each time step: r(n) = argmax(p_new_k(n)), k = 1, 2, ..., K, where r(n) represents the recognition result category at time step n. The recognition result categories of all time steps are concatenated to obtain a complete recognition result sequence R: R = [r(1), r(2), ..., r(T_new)], and finally, according to the predefined category-text mapping relationship, the recognition result sequence R is converted into the corresponding text representation. Assuming that the text corresponding to category k is s_k, the final recognition result text S is: S = s_{r(1)}+s_{r(2)}+...+s_{r(T_new)}, where ""+"" represents the string concatenation operation. At this point, the recognition process of the new speech signal is completed using the trained speech recognition model, and the text representation of the recognition result is obtained.
[0059] Perform semantic understanding and intent analysis on the recognition results. Through natural language processing technology, perform lexical and grammatical analysis on the recognized text, extract keywords and semantic structures, and obtain standardized command text and corresponding intent tags. Query the command mapping table according to the intent tag to determine the event to be triggered. Predefine a command-event mapping table and search the mapping table for the corresponding event to be triggered according to the intent tag. Obtain user portrait and system status data from the database. Read the user's historical interaction records from the relational database, including voice commands, intent tags, and triggered events, to form user portrait data. At the same time, obtain the current status of the system in real time from the in-memory database, such as running applications, available resources, etc.
[0060] Specifically, first, the recognized text is subjected to lexical analysis using natural language processing (NLP) technology. Through operations such as word segmentation and part-of-speech tagging, the text is segmented into independent lexical units, and the part of speech of each unit is annotated, such as noun, verb, adjective, etc. Next, grammatical analysis is performed. According to predefined grammatical rules and syntactic structures, lexical units are combined into phrases and clauses to construct a grammatical tree representation of the text. Common grammatical analysis methods include dependency syntactic analysis and component syntactic analysis. Based on lexical and grammatical analysis, keywords and semantic structures in the text are extracted. Keywords usually refer to core words that play a decisive role in command intent, such as actions, objects, attributes, etc. The semantic structure describes the logical relationship and dependency relationship between keywords, such as subject-predicate-object structure, modification relationship, etc. Based on the extracted keywords and semantic structure, the command text is normalized and converted into a standardized representation. For example, synonyms are replaced with unified standard words, sentence structures are simplified to subject-predicate-object format, and irrelevant modification components are removed. Finally, the normalized command text is mapped to a predefined intent label through the intent recognition model. Intent labels are usually a set of discrete categories that represent the semantic purpose of a command, such as "play music", "set an alarm", "check the weather", etc. Common intent recognition methods include rule-based methods and machine learning-based methods (such as support vector machines, decision trees, neural networks, etc.). According to the intent label, query the command mapping table to determine the event to be triggered. The specific implementation plan is as follows: pre-define a command-event mapping table to establish a correspondence between intent labels and events to be triggered. The mapping table can be stored in the form of key-value pairs, where the key is the intent label and the value is the corresponding event identifier or event processing function. After obtaining the intent label of the command, search for the event corresponding to the label in the mapping table. If the search is successful, the event identifier or event processing function to be triggered is returned; if the search fails, the default processing logic can be adopted, such as returning a general error event. Obtain user portrait and system status data from the database. The specific implementation plan is as follows: The user portrait data is stored in a relational database (such as MySQL, PostgreSQL, etc.), which contains the user's historical interaction records, such as voice commands, intent labels, triggered events, etc. Through SQL query statements, according to the current user's identifier (such as user ID), the relevant historical records of the user are retrieved to form user portrait data. System status data is stored in an in-memory database (such as Redis, Memcached, etc.), which reflects the real-time operating status of the system, such as running applications, available resources, etc. The current status data of the system can be obtained in real time through the API interface provided by the in-memory database.
[0061] Calculate the priority of the event to be triggered. Using the Bayesian network model, with user portrait data and system status data as input, calculate the posterior probability of each event to be triggered as a quantitative indicator of priority. Build an event priority queue. According to the priority of the event, insert the event to be triggered into the priority queue, and the event with high priority is at the head of the queue. Process the highest priority events in turn. Take the head event from the priority queue and execute the corresponding business logic according to the event type and parameters, such as controlling smart devices, retrieving information, triggering reminders, etc. After processing, delete the event from the queue and repeat until the queue is empty.
[0062] Specifically, in a specific embodiment of the present application, the Bayesian network has the following nodes: User portrait node:
[0063] "user_activity": user activity, the value is {"high", "medium", "low"}, "user_preference": user preference, the value is {"music", "video", "game"}. System status node: "cpu_usage": CPU usage, the value is {"high", "medium", "low"}, "memory_usage": memory usage, the value is {"high", "medium", "low"}. Event node: "event_type": the type of event to be triggered, the value is {"play music", "play video", "start game"}. The current user profile data is {"user_activity": "high", "user_preference": "music"}, and the system status data is {"cpu_usage": "medium", "memory_usage": "low"}. According to the inference algorithm of the Bayesian network, the posterior probability distribution of the event node is calculated as follows: P("event_type" = "play music" | "user_activity" = "high", "user_preference" = "music", "cpu_usage" = "medium", "memory_usage" = "low") = 0.8. P("event_type" = "play video" | "user_activity" = "high", "user_preference" = "music", "cpu_usage" = "medium", "memory_usage" = "low") = 0.15.
[0064] P("event_type" = "Start Game" | "user_activity" = "High", "user_preference" = "Music", "cpu_usage" = "Medium", "memory_usage" = "Low") = 0.05. Therefore, under the current user profile and system status, the "play music" event has the highest priority, and its posterior probability is 0.8.
[0065] According to the priority of the event, an event priority queue is constructed. The specific implementation plan is as follows: Create a priority queue data structure to store the events to be triggered. The priority queue supports the following operations: Insert: Insert an event into the queue and determine its position in the queue according to its priority. Delete: Delete the highest priority event from the queue. View: View the head event, that is, the event with the highest priority. The priority queue can be implemented using data structures such as heaps and balanced binary trees to ensure that the time complexity of insertion and deletion operations is O(logn), where n is the number of events in the queue. The calculated posterior probability of each event is used as the priority, and the event is inserted into the priority queue. Events with high priority (i.e. events with large posterior probability) will be placed at the front of the queue. According to the calculated posterior probability of the event, the event priority queue constructed is as follows: [("Play music", 0.8), ("Play video", 0.15), ("Start game", 0.05)], where each element is a tuple containing the event type and the corresponding priority (posterior probability). The queue is sorted from high to low by priority. The highest priority events are processed in turn. The specific implementation plan is as follows: Take out the first event from the event priority queue, that is, the event with the highest priority. According to the event type and related parameters, execute the corresponding business logic, such as controlling smart devices, retrieving information, triggering reminders, etc. The specific business logic can be implemented through a predefined event processing function or a rule engine. The event processing function calls the corresponding API interface or service according to the event type and parameters to complete the specific operation. The rule engine determines whether the event meets the triggering condition according to the predefined condition-action rule and executes the corresponding action. After the event is processed, the event is deleted from the priority queue and repeated until the queue is empty. This ensures that all events to be triggered are processed in order from high to low priority. Take out the events from the event priority queue and process them in sequence: take out the first event ("play music", 0.8), call handle_event ("play music", parameters), and execute the operation of playing music. Delete ("play music", 0.8) from the queue, and the queue becomes [("play video", 0.15), ("start game", 0.05)]. Take out the new head event ("Play Video", 0.15) and call handle_event ("Play Video", parameters).
Claims
1. An event trigger processing method based on speech recognition, include: Acquire speech signals; For the acquired speech signal, the Mel-cepstral coefficient feature of the speech signal is extracted by using the Mel-cepstral coefficient algorithm; The extracted Mel-frequency cepstral coefficient features are used as input to train the neural network speech recognition model; Using the trained neural network speech recognition model, the speech signal is recognized to obtain the speech recognition text; According to the speech recognition text, the command text and the intention label representing the speech command are obtained through lexical analysis and semantic parsing; According to the command text and intent tag, query the predefined command mapping table to determine the event to be triggered; Obtain user historical interaction data including historical voice text, intent labels and corresponding trigger events from the relational database, and obtain current state data including a list of events to be triggered from the in-memory database; Based on the Bayesian network model, historical interaction data and current state data are used as input to calculate the priority of the event to be triggered; Using the priority queue structure, a message queue is constructed based on the calculated event priority; The highest priority events are extracted from the message queue in turn for processing.
2. The event trigger processing method based on speech recognition according to claim 1, Features: Get Mel cepstral coefficient features, including: The acquired speech signal is pre-emphasized to enhance the energy of the high-frequency part; Performing windowing processing on the speech signal after pre-emphasis processing, using an improved Hamming window function to window the speech signal, and dividing the windowed speech signal according to a preset overlapping frame division method to obtain a speech frame signal; Performing fast Fourier transform on the obtained speech frame signal to convert the speech frame signal in the time domain into spectrum information in the frequency domain; The spectral information is processed by Mel-triangle filtering algorithm; The spectral information after Mel filtering is logarithmically processed to obtain the Mel cepstral coefficient characteristics of the speech signal.
3. The event trigger processing method based on speech recognition according to claim 2, Features: The improved Hamming window function is expressed as follows: Among them, n represents the sequence number of the window function sample point, and its value range is 0 to N-1; N represents the window length of the improved Hamming window function, that is, the total number of sample points contained in the window function; α represents the newly added control factor, which is used to control the weight coefficient of the sine term and adjust the main lobe width; w(n) represents the value of the improved Hamming window function at the sample point n, which varies between 0 and 1 according to the different values of n.
4. The event trigger processing method based on speech recognition according to claim 2, Features: Perform fast Fourier transform on the obtained speech frame signal to obtain the spectrum information of the speech frame, including: According to a preset frequency band range, the speech frame signal is divided into a low-frequency block and a high-frequency block; For the low-frequency block, perform a fast Fourier transform of the forward N1-point length window to obtain the low-frequency positive spectrum of the low-frequency block; For the low-frequency block, perform a reverse N1-point length window fast Fourier transform to obtain the low-frequency complex spectrum of the low-frequency block; For the high-frequency block, perform a fast Fourier transform of the forward N2-point length window to obtain the high-frequency positive spectrum of the high-frequency block; For the high-frequency block, perform a reverse N2-point length window fast Fourier transform to obtain the high-frequency complex spectrum of the high-frequency block; The obtained low-frequency positive spectrum, low-frequency complex spectrum, high-frequency positive spectrum and high-frequency complex spectrum are combined into the spectrum information of the speech frame signal as the input of the Mel filter processing; N1 is greater than N2, and N1 and N2 are integers.
5. The event trigger processing method based on speech recognition according to claim 4, Features: The spectral information is subjected to Mel filtering through the Mel triangle filtering algorithm, including: According to the formula of the center frequency of the key band, the center Mel frequencies of the M key bands are calculated; Construct M triangular window functions, where the peak position of each triangular window function matches the corresponding key band center Mel frequency to form a Mel filter bank; The spectrum information of the speech frame signal is input into the constructed Mel filter bank, and the energy response of each triangular window function to the spectrum information in the corresponding key band is calculated through dot product operation; The output energy response of each triangular window function is normalized; The normalized energy response is used as the Mel filtering result of the speech signal spectrum information; M is a positive integer, indicating the number of triangular window functions in the Mel filter bank.
6. The event trigger processing method based on speech recognition according to claim 5, Features: The formula for the center Mel frequency of the critical band is as follows: Where: f represents the linear frequency, which represents the linear frequency of the speech signal, in Hz; fc represents the lower edge frequency of the cth key band, in Hz; β represents the frequency correction coefficient; f(bark) represents the central Mel frequency of the cth key band.
7. The event trigger processing method based on speech recognition according to claim 6, Features: β is the frequency correction coefficient, which is calculated by the following formula: β=k(fn-fc) Where: k is the proportionality coefficient; fn represents the upper edge frequency of the nth key band, in Hz; fc represents the lower edge frequency of the cth key band, in Hz.
8. The event trigger processing method based on speech recognition according to claim 5 or 6, Features: The spectral information after Mel filtering is processed by taking logarithm to obtain the Mel cepstral coefficient characteristics of the speech signal, including: Performing logarithmic operation on the frequency spectrum information of each speech frame signal obtained by Mel filtering to obtain the logarithmic Mel spectrum of the corresponding speech frame; Along the time dimension, the logarithmic Mel spectrum of multiple consecutive speech frame signals is fused to obtain the fused logarithmic Mel spectrum features; The fused logarithmic Mel spectrum features are used as the Mel cepstral coefficient features of the speech signal.
9. The event trigger processing method based on speech recognition according to claim 8, Features: Perform logarithmic operation on the spectrum information of each speech frame signal obtained by Mel filtering, and the logarithmic operation adopts the following formula: Wherein, S(m) represents the logarithmic Mel spectrum of the m-th speech frame, M(m,k) represents the output energy response of the k-th Mel filter of the m-th speech frame, and K represents the total number of filters in the Mel filter bank.
10. The event trigger processing method based on speech recognition according to claim 8, Features: Along the time dimension, the logarithmic Mel spectrum of multiple consecutive speech frame signals is fused, and the fused logarithmic Mel spectrum features are calculated using the following formula: Among them, F(n) represents the fused logarithmic Mel spectrum feature of the nth time step, S(n+i) represents the logarithmic Mel spectrum of the n+ith speech frame, and W represents the time window length of feature fusion, which is used to control the context range of fusion.
Citation Information
Patent Citations
Intelligent speech recognition processing method and system
CN115376500A
Intelligent voice dialogue scene verbal skill intervention method and system based on customer portrait
CN116049360A
Bionic robot in aspect of voice recognition control
CN117894311A
