A speech recognition method and system based on AC automaton hot word enhancement
Through the combination of AC automata structure and dictionary tree, the problem of low efficiency in identifying proper nouns is solved, efficient hot word recognition is achieved, and the recognition accuracy and speed are improved.
Patent Information
- Application Number
- CN202210103668.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-28
- Publication Date
- 2024-12-03
- Estimated Expiration
- 2042-01-28
AI Technical Summary
The existing speech recognition system is inefficient in identifying proper nouns, has limited effect on enhancing hot word, and is difficult to adapt to the adjustment of decoding paths.
The AC automata structure is used to store the hot word list, combine the dictionary tree structure and decoding path search, and achieve hot word matching through the token structure and the cache mechanism to ensure recognition accuracy and speed.
It improves the accuracy and speed of hot words recognition, reduces the amount of calculation, and ensures the accuracy and efficiency of the recognition results, especially when identifying a large number of hot words, it hardly affects the recognition speed.
Smart Images

Figure CN114187902B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of speech recognition, and in particular to a speech recognition method and system based on AC automaton hot word enhancement. Background Art
[0002] Speech recognition technology is often used in various specific fields in production environments. Each field has its own specific nouns, and it is difficult for speech recognition systems in general scenarios to accurately recognize these nouns. Hot word enhancement refers to improving the recognition rate of hot words in speech recognition results based on the hot words of the proper nouns provided by users.
[0003] In the prior art, the traditional speech recognition system mainly solves the problem of hot word recognition by integrating hot words into the language model. This method cannot modify the hot word list. Once modified, it is necessary to rebuild the training language model. Another method is to match the recognition results with the hot words in the hot word list one by one. The matching time is long and the efficiency is low. In addition, the increase of hot words will increase the recognition speed exponentially, and the effect of hot word enhancement is very limited. Summary of the invention
[0004] In order to solve the above technical problems, the present invention proposes a speech recognition method and system based on AC automaton hot word enhancement, which uses AC automaton structure to store hot word list. The dictionary tree structure in the AC automaton can be well adapted to the path search method in the decoding process, which facilitates the adjustment of the hot word list, and has high hot word recognition accuracy and fast recognition speed.
[0005] In order to achieve the above object, the present invention adopts the following technical solution:
[0006] The first object of the present invention is to provide a speech recognition method based on AC automaton hot word enhancement, comprising the following steps:
[0007] Step 1: Construct language models based on characters and words respectively, use the speech to be recognized as the input of the speech recognition system, and generate a decoding graph from the language model;
[0008] Step 2: Get the hot word list, use the characters and words in the language model as the dictionary, segment each hot word in the hot word list, and build an AC automaton based on the hot words;
[0009] Step 3: In the decoding path search process of speech recognition, a token structure is established to store all node pointers and total costs of the current decoding path on the decoding graph, the node pointer of the current matching path on the AC automaton and the reduced cost value of the node; the token structure is transferred along with the node decoded at the current moment in the decoding graph;
[0010] Dynamically match the recognition result output by the current node in the decoding graph with the AC automaton based on the hot words. If the match is successful, the total cost of the current decoding path in the decoding graph is updated to reduce the updated total cost. If the match fails, the total cost of the current decoding path in the decoding graph remains unchanged.
[0011] Different decoding paths in the decoding graph form a competition mechanism, and the path with the lowest cost is the target path, which outputs the speech recognition result.
[0012] A second object of the present invention is to provide a speech recognition system based on AC automaton hotword enhancement, comprising:
[0013] A language model module, which integrates a language model based on characters and a language model based on words;
[0014] A decoding graph generation module, which is used to generate a decoding graph corresponding to the speech to be recognized;
[0015] AC automaton building module, which is used to obtain a hot word list, use the characters and words in the language model module as a dictionary, segment each hot word in the hot word list, and obtain an AC automaton based on the hot word;
[0016] A token structure module, which is used to store all node pointers and total costs of the current decoding path on the decoding graph, and the node pointer of the current matching path on the AC automaton and the reduced cost value of the node;
[0017] The decoding graph search module is used to dynamically match the recognition result output by the current node in the decoding graph with the AC automaton based on the hot words. If the match is successful, the total cost of the current decoding path in the decoding graph is updated to reduce the updated total cost; if the match fails, the total cost of the current decoding path in the decoding graph remains unchanged;
[0018] The speech recognition output module is used to take the path with the minimum cost in the decoding graph search module as the target path and output the speech recognition result corresponding to the target path.
[0019] Compared with the prior art, the advantages of the present invention are:
[0020] 1. The present invention uses an AC automaton structure to store a hot word list, wherein the dictionary tree structure can be well adapted to the path search method in the decoding process, and realizes synchronous search of the decoding graph and the AC automaton, which is fast and hardly affects the recognition speed; utilizing the fail pointer structure of the node in the AC automaton, when the current hot word fails to match, it quickly jumps to another hot word with the same suffix and matches it, thereby reducing the amount of calculation.
[0021] 2. The present invention establishes a cache mechanism in the decoding path search process of speech recognition, which is used to cache the AC automaton node pointers that have been matched by the output edge corresponding to the current node, so as to avoid searching the same hot word in the AC automaton multiple times at the same time, reduce the amount of calculation, and improve the speed of hot word matching. In addition, the historically reduced cost value is recorded in the token structure, which can quickly restore the total cost of the current path when the match fails, without negatively affecting the recognition result.
[0022] 3. The present invention integrates a language model based on characters into the traditional language model based on words, ensuring that hot words can be segmented into characters or words that have appeared in the language model, and that paths containing hot word segmentation combinations will appear in the decoding graph, thus solving the problem that the hot word function cannot take effect for words that do not exist in the language model. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0024] Figure 1 is an AC automaton structure shown according to an exemplary embodiment;
[0025] Figure 2 is a flow chart of a speech recognition method based on AC automaton hot word enhancement according to an exemplary embodiment;
[0026] Figure 3 A decoding graph structure is shown according to an exemplary embodiment;
[0027] Figure 4 A partial dictionary tree structure in an AC automaton is shown according to an exemplary embodiment. DETAILED DESCRIPTION
[0028] In order to make the purpose, technical solution and advantages of the present application clearer, the technical solution of the present application will be clearly and completely described below in combination with the specific embodiments of the present application and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present application.
[0029] The present invention proposes a speech recognition method based on AC automaton hot word enhancement, which mainly includes the following steps:
[0030] 1. Construct language models with characters and words as units respectively, use the speech to be recognized as the input of the speech recognition system, and generate a decoding graph by the language model. In the present invention, a language model with characters as units is integrated into the traditional language model with words as units, ensuring that hot words can be segmented into characters or words that have appeared in the language model, ensuring that a path containing a hot word segmentation combination will appear in the decoding graph, and solving the problem that the hot word function cannot take effect for words that do not exist in the language model.
[0031] 2. Obtain a hot word list, use the characters and words in the language model as a dictionary, segment each hot word in the hot word list, and build an AC automaton based on the hot words.
[0032] The present invention adopts the AC automaton structure to store the hot word list, which can be well adapted to the path search method in the decoding process, and realizes the synchronous search of the decoding graph and the AC automaton. The AC automaton construction method is:
[0033] Step 2.1: Use the characters and words in the language model as the dictionary to segment each hot word in the hot word list. In the segmentation process, first segment the words in words. If it is not possible to segment the words in words, then segment the words in characters. For example, for the hot word "Zhejiang people", first segment the words in words. The word "Zhejiang" has appeared in the dictionary, so "Zhejiang people" is divided into "Zhejiang" and "people", and "Zhejiang" does not need to be segmented further; "people" cannot be segmented in words, so it is segmented in characters. For "I want I feel", first segment the words in words. "I want", "want me", "I want me" cannot be segmented in words, so they need to be segmented in characters, and finally divided into "I", "want", "I", "feel".
[0034] After word segmentation, mark the position of each word or character in the corresponding hot word. For example, for the word segmentation results of the hot word "Zhejiang people", "Zhejiang" is in the first position and "people" is in the second position.
[0035] Step 2.2: According to the word segmentation results, the word or character at the jth position is used as a node of the jth layer of the AC automaton. If there is a complete hot word in the dictionary, the hot word is used as a node of the first layer; the next pointer of the jth layer node is connected to the j+1th layer node. The nodes corresponding to the words with a common prefix share a parent node, and all nodes of the first layer are connected to the root node. This step requires traversing all hot words in the hot word table.
[0036] For example, for the word segmentation results of the hot word "Zhejiang people", "Zhejiang" is taken as a node of the first layer, and "people" is taken as a node of the second layer. Because the complete hot word "Zhejiang people" exists in the dictionary, "Zhejiang people" is also taken as a node of the first layer.
[0037] Step 2.3: If there are identical participles, point the fail pointer of the node with the longest participle suffix to the nodes with the other longest participle suffixes. For example, for the three hot words "ABCD", "BCD", and "CD", there is an identical hot word "C". "BCD" is the longest participle suffix of "ABCD", and "CD" is the longest participle suffix of "BCD". Therefore, point the fail pointer of node "C" in "ABCD" to node "C" in "BCD", and point the fail pointer of node "C" in "BCD" to node "C" in "CD".
[0038] According to step 2.1 to step 2.3, the constructed AC automaton is obtained. For example, according to the above word segmentation method, Figure 1 The AC automaton corresponding to the three hot words "Zhejiang Hangzhou", "Zhejiang people" and "Hangzhou West Lake" is shown. Each node in the AC automaton corresponds to a preset cost ratio between (0-1], for example, the cost ratio of the first layer is 0.9, and the cost ratio of the second layer is 0.8, or different cost ratios can be set for different nodes in the first layer, for example, the cost ratio of "Zhejiang" in the first layer is 0.92, the cost ratio of "Zhejiang people" is 0.72, and the cost ratio of "Hangzhou" is 0.85, and the same applies to the second layer.
[0039] 3. In the decoding path search process of speech recognition, a token structure is established to store all node pointers and total costs of the current decoding path on the decoding graph, the node pointer of the current matching path on the AC automaton and the reduced cost value of the node; the token structure is passed along with the node decoded at the current moment in the decoding graph.
[0040] like Figure 2 As shown, the recognition result output by the current node in the decoding graph is dynamically matched with the hot word-based AC automaton. If the match is successful, the total cost of the current decoding path in the decoding graph is updated to reduce the updated total cost; if the match fails, the total cost of the current decoding path in the decoding graph remains unchanged; different decoding paths in the decoding graph form a competition mechanism, and the path with the lowest final cost is the target path, and the speech recognition result is output.
[0041] The process of speech recognition decoding is a process of searching for the path with the minimum cost on the decoding graph. Each node in the decoding graph generated in step 1 of the present invention has a number of output edges, each edge has an input label and an output label, and the output label represents the text recognized at the current moment, that is, the recognition result.
[0042] by Figure 3 Taking the decoding graph shown in the figure as an example, the circles are the nodes of the decoding graph. Each edge of the decoding graph has an input label and an output label, and each node may correspond to several output edges. In the dynamic matching process, the recognition results corresponding to each output edge of the current node in the decoding graph need to be dynamically matched with the AC automaton based on hot words.
[0043] by Figure 3 For example, when the system receives the voice "Hangzhou", the pinyin it recognizes may be "hangzhou", "hanzhou", or "hangzhuo", but the output label is "Hangzhou". For example, to put it in a more standard way, the cost of "hangzhou" may be 1 (the lower the cost, the closer the pronunciation is to the pinyin, and the smaller the total cost of the path where the pinyin is located, the more likely it is to become the optimal path), and the cost of "hanzhou" and "hangzhuo" may be 10.
[0044] In a specific implementation of the present invention, the dynamic matching is specifically:
[0045] First, determine whether there is an AC automaton node pointer in the token structure of the current node of the decoding graph;
[0046] In the first case, there is a pointer to the AC automaton node, which is defined as node a. Then all the output edges of the current node in the decoding graph are matched with the node pointed to by the next pointer of the AC automaton node a.
[0047] In the second case, if there is no AC automaton node pointer, all output edges of the current node of the decoding graph are matched with the first-layer nodes of the AC automaton;
[0048] Afterwards, the matching result is determined;
[0049] If the match is successful in the first or second case, the reduced cost value v_i=q*(1-pi) corresponding to the node of the current matching path on the AC automaton is calculated, where q represents the inherent cost of the current edge of the decoding graph, pi represents the cost ratio corresponding to the currently matched i-th layer node on the AC automaton, and vi_i represents the reduced cost corresponding to the node of the current matching path on the AC automaton; the matched node pointer and reduced cost in the AC automaton are stored in the token of the current node of the decoding graph, and the total cost of the current decoding path corresponding to the output edge is updated, and the updated total cost Q'=Q -v_i, Q is the total cost before the update; if the matching result is the end of the hot word, the historical reduced cost corresponding to the matching node in the AC automaton stored in the token is cleared; if the matching result is not the end of the hot word, the content stored in the token is retained and passed to the next node to be matched in the decoding graph;
[0050] If the match fails in the first case, the node at the next layer of the node pointed to by the fail pointer of the AC automaton node a is matched, and part of the historical reduction cost is restored to determine the matching result as the first case; if the AC automaton node a does not have a fail pointer, the node at the first layer of the AC automaton is matched to determine the matching result as the second case;
[0051] If the match fails in the second case, it means that there is no hot word in the AC automaton that matches the recognition result of the output edge of the current node. The total cost of the current decoding path in the decoding graph remains unchanged, and the current token structure is passed to the next node to be matched in the decoding graph.
[0052] More specifically, see Figure 2 The dynamic matching process shown:
[0053] Step 3.1: At a certain moment of decoding, check whether there is an AC automaton node pointer in the token structure of the decoding graph at the current moment. If so, for the convenience of expression, the AC automaton node is recorded as node a and execute step 3.2. If not, execute step 3.3.
[0054] Step 3.2: Match the recognition results of all edges starting from the current node of the decoding graph with the next layer of nodes corresponding to the AC automaton node a. If the match is successful, execute step 3.4; if the match fails, execute step 3.5.
[0055] Step 3.3: Match the recognition results of all edges starting from the current node of the decoding graph with the nodes of the first layer of the AC automaton. If the match is successful, execute step 3.4; if the match fails, execute step 3.6.
[0056] Step 3.4: Reduce the total cost of the decoding path of the current edge of the decoding graph according to the cost ratio stored in the successfully matched nodes in the AC automaton, store the reduced cost value and the AC automaton node pointer in the token structure, and then execute step 3.7.
[0057] Step 3.5: Change the AC automaton node a to the node pointed to by the fail pointer, that is, use the node pointed to by the fail pointer as the new AC automaton node a, return to step 3.2, and restore the partial reduction cost. If the AC automaton node a does not have a fail pointer, this embodiment can be understood as the node pointed to by fail is the root node of the AC automaton, and return to step 3.3.
[0058] Step 3.6: According to the normal decoding result of the decoding graph, the total cost is not updated, that is, no hot word related operations are performed, and then step 3.8 is executed.
[0059] Step 3.7: If the current word is the end of a hot word, clear the historical reduction cost corresponding to the matching node in the AC automaton stored in the token structure; if the matching result is not the end of the hot word, retain the contents of all token structures; then execute step 3.8.
[0060] Step 3.8: Pass the current token structure to the next node to be matched in the decoding graph.
[0061] In a specific implementation of the present invention, at the same time, there may be multiple paths in the decoding graph that match the same hot word (e.g. Figure 3 The matching results of the three edges in the decoding graph are all "Hangzhou"), based on this, the present invention establishes a cache mechanism for storing the AC automaton node pointers that have been matched with the output edge corresponding to the current node of the decoding graph, which can avoid searching the same hot word in the AC automaton multiple times at the same time. When performing dynamic matching, it is prioritized to search whether there is an AC automaton node in the cache that matches the current edge of the decoding graph. If so, it is used directly; if not, the AC automaton is searched normally and added to the cache. By setting the above-mentioned cache mechanism, the present invention avoids searching the same hot word in the AC automaton multiple times at the same time, reduces the amount of calculation, and improves the speed of hot word matching. For example, in the case of Figure 3 When matching the first output edge, the node pointer of the AC automaton corresponding to the matching result is recorded in the cache. Before matching the second and third edges, the matching result of the first edge can be directly read to avoid performing three repeated "Hangzhou" matching processes. The recovery part of step 3.5 reduces the cost, specifically:
[0062] Create a list in the token structure to store the corresponding reduction cost each time a node in the AC automaton is successfully matched, and obtain the historical reduction cost table [v_1, v_2,…, v_n], where n represents the node that has been matched to the nth layer in the AC automaton, and v_n represents the historical reduction cost corresponding to the node in the nth layer;
[0063] When the node matching of the n+1th layer in the AC automaton fails, the node pointed to by the fail pointer of the nth layer node in the AC automaton is returned. Assuming that the pointed node is in the mth layer of the AC automaton, m<n, the first nm cost values in the historical reduction cost table are restored, and the total cost of the current decoding path is updated Q'=Q+ sum([v_1, v_2,…, v_(nm)]).
[0064] The present invention records the historically reduced cost value in the token structure, and can quickly restore the total cost of the current path when the matching fails, without causing a negative impact on the recognition result.
[0065] Combination Figure 3 and Figure 4 , Figure 3 This is an example of a decoding diagram introduced above. Figure 4 It is a partial dictionary tree structure in the AC automaton. Assuming that the node that needs to be matched in the decoding graph is node 2, it is necessary to traverse all the output edges of node 2 and record the cost of each path. Since the node "Zhejiang" in the AC automaton has been matched in the process from node 1 to node 2 in the decoding graph, if there is no cache mechanism, the three edges in node 2 in the decoding graph must be traversed for 4 steps in the order of [Central, People, Tourism, Hangzhou] in the AC automaton to match the word "Hangzhou" in the AC automaton, which is a large workload and slow. The cache mechanism introduced in the present invention can record the matched "Hangzhou" into the cache during the matching process of the first edge of node 2 in the decoding graph, and then the two edges can directly read "Hangzhou" from the cache, saving two traversal times.
[0066] Corresponding to the aforementioned embodiment of a speech recognition method based on AC automaton hotword enhancement, the present application also provides an embodiment of a speech recognition system based on AC automaton hotword enhancement, which includes:
[0067] A language model module, which integrates a language model based on characters and a language model based on words;
[0068] A decoding graph generation module, which is used to generate a decoding graph corresponding to the speech to be recognized;
[0069] AC automaton building module, which is used to obtain a hot word list, use the characters and words in the language model module as a dictionary, segment each hot word in the hot word list, and obtain an AC automaton based on the hot word;
[0070] A token structure module, which is used to store all node pointers and total costs of the current decoding path on the decoding graph, and the node pointer of the current matching path on the AC automaton and the reduced cost value of the node;
[0071] The decoding graph search module is used to dynamically match the recognition result output by the current node in the decoding graph with the AC automaton based on the hot words. If the match is successful, the total cost of the current decoding path in the decoding graph is updated to reduce the updated total cost; if the match fails, the total cost of the current decoding path in the decoding graph remains unchanged;
[0072] The speech recognition output module is used to take the path with the minimum cost in the decoding graph search module as the target path and output the speech recognition result corresponding to the target path.
[0073] In this embodiment, the AC automaton building module includes:
[0074] The word segmentation unit is used to use the characters and words in the language model module as a dictionary to perform word segmentation on each hot word in the hot word list. In the word segmentation process, the word segmentation is first performed on a word basis. If the word basis is not possible, the word segmentation is performed on a character basis. The position of each word or character after the word segmentation process in the corresponding hot word is marked.
[0075] The node and pointer construction module is used to use the word or character at the jth position as a node of the jth layer of the AC automaton according to the segmentation result of the segmentation unit. If there is a complete hot word in the dictionary, the hot word is used as a node of the first layer; the next pointer of the jth layer node is connected to the j+1th layer node, the nodes corresponding to the words with a common prefix share a parent node, and all the nodes of the first layer are connected to the root node; if there are identical segmentations, the fail pointer of the node with the longest segmentation suffix is pointed to the node with the other longest segmentation suffixes.
[0076] In this embodiment, the decoding graph search module includes:
[0077] A first judgment unit, which is used to judge whether there is an AC automaton node pointer in the token structure of the current node of the decoding graph;
[0078] A first matching unit, configured to perform a matching process according to a judgment result of the first judgment unit;
[0079] If there is a pointer to the AC automaton node a, all the output edges of the current node of the decoding graph are matched with the node pointed to by the next pointer of the AC automaton node a; if there is no AC automaton node pointer, all the output edges of the current node of the decoding graph are matched with the first-layer nodes of the AC automaton;
[0080] A second judging unit, which is used to judge the matching result of the first matching unit;
[0081] If the pointer to the AC automaton node a exists or does not exist, and the first matching unit matches successfully, then the reduction cost value corresponding to the node of the current matching path on the AC automaton is calculated; the matched node pointer and the reduction cost in the AC automaton are stored in the token structure of the current node of the decoding graph, and the total cost of the current decoding path corresponding to the output edge is updated; if the matching result is the end of the hot word, the historical reduction cost corresponding to the matching node in the AC automaton stored in the token structure is cleared; if the matching result is not the end of the hot word, all the contents stored in the token structure are retained and passed to the next node to be matched in the decoding graph;
[0082] If the pointer of AC automaton node a exists, and the first matching unit fails to match, then match from the next layer of nodes pointed to by the fail pointer of AC automaton node a, restore part of the historical reduction cost, return to the initial judgment process of the second judgment unit, and still judge as the case where the pointer of AC automaton node a exists; if AC automaton node a does not have a fail pointer, match with the first layer of nodes of AC automaton, return to the initial judgment process of the second judgment unit, and judge as the case where the pointer of AC automaton node a does not exist;
[0083] If there is no pointer to the AC automaton node a, the first matching unit fails to match, indicating that there is no hot word in the AC automaton that matches the recognition result of the output edge of the current node. The total cost of the current decoding path in the decoding graph remains unchanged, and the current token structure is passed to the next node to be matched in the decoding graph.
[0084] For the system embodiment, since it basically corresponds to the method embodiment, the relevant parts can refer to the partial description of the method embodiment. The system embodiment described above is only schematic, wherein the decoding graph search module may or may not be physically separated. In addition, the functional modules in the present invention may be integrated into a processing unit, or each module may exist physically separately, or two or more modules may be integrated into one unit. The above-mentioned integrated modules or units can be implemented in the form of hardware or in the form of software functional units, so as to select some or all of the modules according to actual needs to achieve the purpose of the present application.
[0085] In order to more intuitively demonstrate the implementation effect of the present invention, this embodiment conducted an experiment of hot word enhancement on a professional field data set, the data set size was 500 sentences, and the hot words were professional terms in the professional field. The word error rate and real-time rate commonly used in speech recognition systems were used as evaluation indicators.
[0086] Word error rate = (number of wrong words + number of missing words + number of extra words) / number of marked words
[0087] Real-time rate = time spent on speech recognition / audio duration
[0088] Table 1 Experimental results
[0089]
[0090] It can be seen from the experimental results shown in Table 1 that the hot word enhancement method of the present invention enables the speech recognition system to obtain a better recognition rate in professional fields. Moreover, adding a large number of hot words can also ensure that the speed of speech recognition is minimally affected.
[0091] The above examples are only specific embodiments of the present invention. Obviously, the present invention is not limited to the above examples, and many variations are possible. All variations that can be directly derived or associated with the contents disclosed by a person skilled in the art should be considered as the protection scope of the present invention.
Claims
1. A speech recognition method based on AC automaton hot word enhancement, characterized in that: The following steps are involved: Step 1: Construct language models based on characters and words respectively, use the speech to be recognized as the input of the speech recognition system, and generate a decoding graph from the language model; Step 2: Get the hot word list, use the characters and words in the language model as the dictionary, segment each hot word in the hot word list, and build an AC automaton based on the hot words; Step 3: In the decoding path search process of speech recognition, a token structure is established to store all node pointers and total costs of the current decoding path on the decoding graph, the node pointer of the current matching path on the AC automaton and the reduced cost value of the node; the token structure is transferred along with the node decoded at the current moment in the decoding graph; Dynamically match the recognition result output by the current node in the decoding graph with the AC automaton based on the hot words. If the match is successful, the total cost of the current decoding path in the decoding graph is updated to reduce the updated total cost. If the match fails, the total cost of the current decoding path in the decoding graph remains unchanged; Different decoding paths in the decoding graph form a competition mechanism, and the path with the lowest cost is the target path, which outputs the speech recognition result.
2. The speech recognition method based on AC automaton hot word enhancement according to claim 1 is characterized in that: The AC automaton construction method is: Step 2.1: Use the characters and words in the language model as the dictionary to segment each hot word in the hot word list. In the segmentation process, first segment the words in units of words. If it is not possible to segment the words in units of words, then segment the words in units of characters. Mark the position of each word or character in the corresponding hot word after segmentation. Step 2.2: According to the word segmentation result, the word or character at the jth position is used as a node of the jth layer of the AC automaton. If there is a complete hot word in the dictionary, the hot word is used as a node of the first layer; the next pointer of the jth layer node is connected to the j+1th layer node. The nodes corresponding to the words with a common prefix share a parent node, and all nodes of the first layer are connected to the root node; traverse all hot words in the hot word table; Step 2.3: If there are identical participles, point the fail pointer of the node with the longest participle suffix to the nodes with the other longest participle suffixes to obtain the constructed AC automaton.
3. The speech recognition method based on AC automaton hot word enhancement according to claim 2 is characterized in that: Each node in the AC automaton corresponds to a preset cost ratio between (0-1].
4. The speech recognition method based on AC automaton hotword enhancement according to claim 1 is characterized in that: Each node in the decoding graph has several output edges, each edge corresponds to a recognition result. In the dynamic matching process, the recognition result corresponding to each output edge of the current node in the decoding graph needs to be dynamically matched with the AC automaton based on the hot word. The dynamic matching is specifically as follows: First, determine whether there is an AC automaton node pointer in the token structure of the current node of the decoding graph; In the first case, there is an AC automaton node pointer, denoted as node a, then all output edges of the current node of the decoding graph are matched with the node pointed to by the next pointer of AC automaton node a; In the second case, if there is no AC automaton node pointer, all output edges of the current node of the decoding graph are matched with the first-layer nodes of the AC automaton; Afterwards, the matching result is determined; If the match is successful in the first or second case, the reduction cost corresponding to the node of the current matching path on the AC automaton is calculated; the matching node pointer and the reduction cost in the AC automaton are stored in the token structure of the current node of the decoding graph, and the total cost of the current decoding path corresponding to the output edge is updated; if the matching result is the end of the hot word, the historical reduction cost corresponding to the matching node in the AC automaton stored in the token structure is cleared; If the matching result is not the end of the hot word, the token structure is passed to the next node to be matched in the decoding graph; If the match fails in the first case, the node at the next layer of the node pointed to by the fail pointer of the AC automaton node a is matched, and part of the historical reduction cost is restored to determine the matching result as the first case; if the AC automaton node a does not have a fail pointer, the node at the first layer of the AC automaton is matched to determine the matching result as the second case; If the match fails in the second case, it means that there is no hot word in the AC automaton that matches the recognition result of the output edge of the current node. The total cost of the current decoding path in the decoding graph remains unchanged, and the current token structure is passed to the next node to be matched in the decoding graph.
5. The speech recognition method based on AC automaton hotword enhancement according to claim 4 is characterized in that: Establishing a cache mechanism during the dynamic matching process, the cache mechanism is used to store the pointers of the AC automaton nodes that have been matched to the output edges corresponding to the current node of the decoding graph; Before performing dynamic matching on the output edge of the current node of the decoding graph, first determine whether there is a matched AC automaton node pointer in the cache. If so, directly obtain the matched result. If not, automatically search for the AC automaton.
6. The speech recognition method based on AC automaton hotword enhancement according to claim 4 is characterized in that: In the dynamic matching process, the cost of restoring part of the history is specifically as follows: Create a list in the token structure to store the corresponding reduction cost each time a node in the AC automaton is successfully matched, and obtain the historical reduction cost table [v_1, v_2,…, v_n], where n represents the node that has been matched to the nth layer in the AC automaton, and v_n represents the historical reduction cost corresponding to the node in the nth layer; When the node matching of the n+1th layer in the AC automaton fails, the node pointed to by the fail pointer of the nth layer node in the AC automaton is returned. Assuming that the pointed node is in the mth layer of the AC automaton, m<n, the first nm cost values in the historical reduction cost table are restored and the total cost of the current decoding path is updated.
7. A speech recognition system based on AC automaton hot word enhancement, characterized in that: For implementing the speech recognition method according to claim 1, the speech recognition system comprises: A language model module, which integrates a language model based on characters and a language model based on words; A decoding graph generation module, which is used to generate a decoding graph corresponding to the speech to be recognized; AC automaton building module, which is used to obtain a hot word list, use the characters and words in the language model module as a dictionary, segment each hot word in the hot word list, and obtain an AC automaton based on the hot word; A token structure module, which is used to store all node pointers and total costs of the current decoding path on the decoding graph, and the node pointer of the current matching path on the AC automaton and the reduced cost value of the node; The decoding graph search module is used to dynamically match the recognition result output by the current node in the decoding graph with the AC automaton based on the hot words. If the match is successful, the total cost of the current decoding path in the decoding graph is updated to reduce the updated total cost; if the match fails, the total cost of the current decoding path in the decoding graph remains unchanged; The speech recognition output module is used to take the path with the minimum cost in the decoding graph search module as the target path and output the speech recognition result corresponding to the target path.
8. The speech recognition system based on AC automaton hotword enhancement according to claim 7 is characterized in that: The AC automaton building blocks include: The word segmentation unit is used to use the characters and words in the language model module as a dictionary to perform word segmentation on each hot word in the hot word list. In the word segmentation process, the word segmentation is first performed on a word basis. If the word basis is not possible, the word segmentation is performed on a character basis. The position of each word or character after the word segmentation process in the corresponding hot word is marked. The node and pointer construction module is used to use the word or character at the jth position as a node of the jth layer of the AC automaton according to the segmentation result of the segmentation unit. If there is a complete hot word in the dictionary, the hot word is used as a node of the first layer; the next pointer of the jth layer node is connected to the j+1th layer node, the nodes corresponding to the words with a common prefix share a parent node, and all the nodes of the first layer are connected to the root node; if there are identical segmentations, the fail pointer of the node with the longest segmentation suffix is pointed to the node with the other longest segmentation suffixes.
9. The speech recognition system based on AC automaton hotword enhancement according to claim 7 is characterized in that: The decoding graph search module comprises: A first judgment unit, which is used to judge whether there is an AC automaton node pointer in the token structure of the current node of the decoding graph; A first matching unit, configured to perform a matching process according to a judgment result of the first judgment unit; If there is a pointer to the AC automaton node a, all the output edges of the current node of the decoding graph are matched with the node pointed to by the next pointer of the AC automaton node a; if there is no AC automaton node pointer, all the output edges of the current node of the decoding graph are matched with the first-layer nodes of the AC automaton; A second judging unit, which is used to judge the matching result of the first matching unit; If the first matching unit matches successfully, the reduction cost value corresponding to the node of the current matching path on the AC automaton is calculated; the matched node pointer and the reduction cost in the AC automaton are stored in the token structure of the current node of the decoding graph, and the total cost of the current decoding path corresponding to the output edge is updated; if the matching result is the end of the hot word, the historical reduction cost corresponding to the matching node in the AC automaton stored in the token structure is cleared; if the matching result is not the end of the hot word, the token structure is passed to the next node to be matched in the decoding graph; If the pointer of AC automaton node a exists, and the first matching unit fails to match, then match from the next layer of nodes pointed to by the fail pointer of AC automaton node a, restore part of the historical reduction cost, return to the initial judgment process of the second judgment unit, and still judge as the case where the pointer of AC automaton node a exists; if AC automaton node a does not have a fail pointer, match with the first layer of nodes of AC automaton, return to the initial judgment process of the second judgment unit, and judge as the case where the pointer of AC automaton node a does not exist; If there is no pointer to the AC automaton node a, the first matching unit fails to match, indicating that there is no hot word in the AC automaton that matches the recognition result of the output edge of the current node. The total cost of the current decoding path in the decoding graph remains unchanged, and the current token structure is passed to the next node to be matched in the decoding graph.
