Voice text correction and replacement method
By introducing a speech text correction replacement method in the speech recognition system, and using AC automaton to match and correct replacement of keywords, the problem of inaccurate text in the speech recognition system is solved, and higher text accuracy and information effectiveness are achieved.
Patent Information
- Application Number
- CN202411979557.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-31
- Publication Date
- 2025-04-29
AI Technical Summary
The existing speech recognition system is inaccurate when processing customer recordings, which affects the validity of the information and may lead to errors and losses in subsequent processes.
A speech text correction replacement method is adopted to initialize pre-configured speech text conversion configuration rules, and an AC automaton is built, and the speech text is positioned based on the target regular expression, the AC automaton is used to match keywords, and the matching keywords are corrected and replaced based on the correct text pattern.
Improve text accuracy, improve information effectiveness, reduce errors in subsequent processes, and efficient matching and replacement are achieved through AC automatons, avoiding performance problems.
Smart Images

Figure CN119903218A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the fields of natural language processing and speech recognition, and in particular to a speech text correction and replacement method. Background Art
[0002] With the rapid development of speech recognition technology, more and more industries have begun to rely on recorded text for information recording and subsequent processing. However, existing speech recognition systems often have inaccurate text when processing customer recordings. This inaccuracy not only affects the effectiveness of the information, but may also lead to errors and unnecessary losses in subsequent processes.
[0003] At present, the effect of simply relying on recording hot word technology to recognize and process text is not ideal, especially in complex contexts. In order to solve this problem, more efficient technical means must be introduced to post-process the generated recording text to ensure the accuracy of the final text. Summary of the invention
[0004] In view of the problems existing in the prior art, a speech text correction and replacement method is provided to improve the text accuracy by forcibly adjusting and replacing inaccurate words.
[0005] The technical solution adopted by the present invention is as follows: a method for correcting and replacing speech text, comprising:
[0006] Initializing a pre-configured speech-to-text conversion configuration rule; wherein the speech-to-text conversion configuration rule includes a target regular expression, an error text pattern, and a correct text pattern;
[0007] Construct AC automata based on error text patterns;
[0008] Locating a target text segment of a speech text based on a target regular expression;
[0009] Use AC automata to match keywords in the target text segment;
[0010] Correct and replace the matched keywords based on the correct text pattern.
[0011] As a preferred solution, the construction of an AC automaton based on an error text pattern specifically includes:
[0012] Construct a dictionary tree: parse all error text patterns and generate a complete keyword list; insert each keyword into the dictionary tree, and each node represents a character; in the dictionary tree, the path from the root node to the leaf node represents a complete keyword, and the leaf node marks the complete keyword corresponding to the path;
[0013] Build a failure pointer: For each node, build its failure pointer, pointing to the node corresponding to the longest suffix of the current character sequence, so as to quickly jump to the next possible matching position when the match fails.
[0014] As a preferred solution, each node of the dictionary tree includes an output set storing all keywords that may be matched when passing through the node.
[0015] As a preferred solution, the target text segment positioning of the speech text based on the target regular expression specifically includes:
[0016] Compile all regular expressions into pattern objects;
[0017] Associating all pattern objects with corresponding processing rule lists, wherein the processing rules include error text patterns and corresponding correct text patterns;
[0018] Each pattern object is used to process the speech text, determine all matching target text segments, and record the position information.
[0019] As a preferred solution, the method of using AC automaton to perform keyword matching in the target text segment specifically includes:
[0020] Use the dictionary tree of the AC automaton to transfer the state of each character in the target text segment and determine the nodes through which the state transfer passes;
[0021] Collect the outputs of the passed nodes to obtain all matching keywords, and record the location information of the keywords in the target text segment.
[0022] As a preferred solution, the state transfer process includes:
[0023] Starting from the first character of the target text segment to be matched, the state is transferred in the dictionary tree;
[0024] After each state transition, check whether the current node is the terminal node of a keyword. If so, add the corresponding keyword to the output set; if not, continue to process the next character;
[0025] When encountering an unmatched character that cannot be transferred, the failure pointer jumps to other possible matching positions. If the position pointed to by the failure pointer still does not match, continue to backtrack until a matching position is found or backtracks to the root node.
[0026] As a preferred solution, the correcting and replacing of the matched keywords based on the correct text pattern specifically includes:
[0027] For each keyword matched by the AC automaton, determine the corresponding processing rule;
[0028] The keywords of the target text segment are replaced according to the processing rules.
[0029] As a preferred solution, after each keyword replacement is completed, the method further includes: calculating the length difference between the new and old texts, and updating the global offset; and determining the position of the subsequent target text segment and the keyword through the updated global offset.
[0030] As a preferred solution, it also includes using a regular expression to verify again whether the keyword completely complies with the regular error text pattern.
[0031] As a preferred solution, during the correction and replacement process, the speech-to-text conversion configuration rule is used as a cache key to cache the compiled object; and the corresponding cache is cleared when the speech-to-text conversion configuration rule changes.
[0032] Compared with the prior art, the beneficial effects of adopting the above technical solution are:
[0033] 1. Performance advantages:
[0034] (1) Search efficiency: For a text of length n, the search time complexity is only O(n); the time complexity of the preprocessing stage is O(m), where m is the total length of all keywords. Compared with traditional multiple regular matching, the efficiency is significantly improved.
[0035] (2) Space utilization: A hash table is used to store child nodes to ensure O(1) search efficiency. The fail pointer mechanism avoids redundant storage space. The overall space complexity is O(m), where m is the total length of all keywords.
[0036] 2. Realize advantages:
[0037] (1) Reliability: Ensure performance in high-frequency access scenarios through a caching mechanism; support dynamic updating of matching rules without restarting the service; use thread-safe data structures to support concurrent access.
[0038] (2) Scalability: Supports flexible dynamic addition and deletion of keywords; matching rules can be customized according to business needs. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] Figure 1 This is a flow chart of the speech text correction and replacement method according to an embodiment of the present application.
[0040] Figure 2 A schematic diagram of an electronic device according to an embodiment of the present application.
[0041] Figure 3 A schematic diagram of the structure of a computer system suitable for implementing the embodiments of the present application. DETAILED DESCRIPTION
[0042] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this application will be more comprehensive and complete and fully convey the concept of the example embodiments to those skilled in the art.
[0043] In addition, described feature, structure or characteristic can be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present application. However, those skilled in the art will appreciate that the technical scheme of the present application can be put into practice without one or more of the specific details, or other methods, components, devices, steps, etc. can be adopted. In other cases, known methods, devices, realizations or operations are not shown or described in detail to avoid blurring the various aspects of the application.
[0044] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities may be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.
[0045] The flowcharts shown in the accompanying drawings are only exemplary and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps can be decomposed, and some operations / steps can be combined or partially combined, so the actual execution order may change according to actual conditions.
[0046] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution in the embodiment of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiment of the present invention. Obviously, the described embodiment is only a part of the embodiment of the present invention, not all the embodiments. Based on the embodiment of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0047] In order to solve the problem of inaccurate transcription in speech-to-text conversion, the embodiment of the present application proposes a solution for post-processing the generated speech text, that is, a speech-to-text correction and replacement method is proposed to achieve efficient replacement of inaccurate words in the recorded text, ensure that the generated text is more accurate, effectively improve the accuracy of the text, and provide a reliable foundation for subsequent data analysis and processing. At the same time, based on the use of AC automata, it can maintain high efficiency in memory usage and avoid performance problems caused by excessive memory. Please refer to Figure 1 , the specific solution is as follows:
[0048] Step 1: Initialize the configuration rules for speech text conversion.
[0049] Before correcting and replacing the speech text, it is necessary to configure the transcribing configuration rules for the speech text first. These transcribing configuration rules for the speech text mainly represent the replacement rules in the subsequent correction process. In practical applications, according to the requirements, the transcribing configuration rules for the speech text can be designed in advance, formed into a configuration file or stored in a database. When in use, through the initialization process, all conversion rules of a specific project (which can be identified by estateId) can be loaded from the database or the configuration file.
[0050] Specifically, each speech text conversion configuration rule includes three key components: The target regular expression (targetRegex) is used to locate the text range that needs to be replaced, which ensures that the replacement operation is only carried out in a specific context; the wrong text pattern (wrongText) defines the text pattern that needs to be replaced, which can include multiple variants. For example, a pattern like "[你您]好" can match both "你好" and "您好" at the same time; the correct text pattern (correctText) specifies the standard text form after replacement. These speech text conversion configuration rules are organized into a structured set, providing a basis for subsequent text processing. In this embodiment, the "pattern" in the wrong text pattern and the correct text pattern refers to a defined text specification, a simplified regular Pattern that only supports a constraint of some special symbols. For example, it only supports: |[] Chinese English numbers.
[0051] Step 2: Build an AC automaton based on the wrong text pattern.
[0052] In this embodiment, the construction of the AC automaton mainly includes several parts: trie tree construction, failure pointer construction, and output setting.
[0053] When building the trie tree, it is necessary to first parse the wrong text patterns in all speech text conversion configuration rules to generate a complete keyword list; then insert each keyword into the trie tree. In the trie tree, each node represents a character (except for the root node). The path from the root node to the leaf node represents a complete keyword, and the leaf node marks the complete keyword corresponding to that path. The keyword insertion process is as follows:
[0054] 1. First, construct the root node. This node does not contain any character information and only serves as the entry point of the trie tree;
[0055] 2. For each keyword to be inserted, start from the first character and traverse down the dictionary tree layer by layer: if the current character does not exist at the current level, create a new node; if it already exists, use the existing node directly;
[0056] 3. At the node corresponding to the last character of each keyword, mark the node as the terminal node and store the complete keyword information.
[0057] For the construction of the failure pointer, first use the breadth-first search (BFS) to traverse the entire dictionary tree; for each node, establish its failure pointer, pointing to the node corresponding to the longest suffix of the current character sequence; the establishment of the failure pointer allows you to quickly jump to the next possible matching position when the match fails; at the same time, merge the output of the failed node into the current node to ensure that no match is missed. The specific steps are as follows:
[0058] 1. For each node current, traverse all its child nodes child;
[0059] 2. Get the failed node failNode pointed to by the failure pointer of the node current;
[0060] 3. Search for the node with the same character as the child node child in the child nodes of the failed node failNode;
[0061] 4. If found, point the failure pointer of the child node child to the node. If not found, continue to backtrack along the failure pointer of the failed node failNode.
[0062] By introducing the failure pointer, the backtracking operation in brute force matching is avoided, while ensuring the linear time complexity of O(n), where n is the length of the text to be matched. Compared with simple multi-pattern string matching, a large number of repeated comparisons are reduced. In addition, the failure pointer reuses existing nodes and does not require additional storage space. Through the node sharing mechanism, storage redundancy is reduced, and the overall space complexity is maintained at O(m), where m is the total length of all pattern strings.
[0063] Regarding output settings. In this embodiment, an output set is maintained on each node of the dictionary tree, storing all keywords that may be matched when passing through the node. Through this setting, when traversing to a certain node, all possible matching results can be immediately known.
[0064] Step 3: Locate the target text segment of the speech text based on the target regular expression.
[0065] Before matching, the position of the corresponding target text segment needs to be determined by the target regular expression. In this embodiment, the target regular expression in each speech-to-text conversion configuration rule is compiled into a pattern object Pattern, and the compilation process performs syntax checking and optimization on the regular expression. In order to avoid the performance overhead caused by repeated compilation, the pattern object Pattern is cached after the compilation is completed.
[0066] In order to further improve the search efficiency, in this embodiment, a Map structure is created to associate all the pattern objects Pattern with the corresponding processing rule list. Through the mapping relationship, the corresponding processing rule can be quickly located after finding the matching text segment. In practical applications, the processing rule is an object, which includes the error text pattern and the correct text pattern. After being associated with the pattern object, the processing rule can be directly read in the subsequent replacement to ensure the search efficiency. In this embodiment, HashMap is preferably used to store the mapping relationship to ensure O(1) search efficiency.
[0067] After the target regular expression is compiled and mapped, each compiled pattern object Pattern is used to enter and exit the recording text. Specifically, a Matcher object is created through the Pattern.matcher() method, and a while loop and find() method are used to continuously search for all matching target text segments.
[0068] For each target text segment found, its starting position and ending position in the original text need to be recorded. These position information plays an important role in the subsequent accurate replacement process. In order to manage the position information, this embodiment introduces an offset to track the position change caused by the replacement operation.
[0069] Step 4: Use AC automaton to match keywords in the target text segment.
[0070] After locating the target text segment, this embodiment uses the constructed AC automaton to perform efficient keyword matching, which mainly includes two processes: text scanning and matching collection.
[0071] For text scanning, the AC automaton starts processing the text from the current state (initial root node), and performs state transfer along the dictionary tree for each character in the text. When direct transfer is not possible, it jumps to the appropriate state through the failure pointer. The specific process is as follows:
[0072] 1. Starting from the first character of the text to be matched, the state is transferred in the dictionary tree; after each state transfer, check whether the current node is the end node of a keyword. If so, add the corresponding keyword to the result set, if not, continue to process the next character.
[0073] 2. When encountering unmatched characters, first try to jump to other possible matching positions through the failure pointer; if the position pointed to by the failure pointer still does not match, continue to backtrack; until a matching position is found or backtrack to the root node.
[0074] For matching collection. During the state transfer process, the outputs of all passed nodes are collected. In order to avoid keyword duplication, in this embodiment, a Set data structure is used to store all found matching keywords, and each matching result contains the keyword itself and its position information in the text.
[0075] Step 5: Correct and replace the matched keywords based on the correct text pattern.
[0076] After determining the matching keywords in the target text segment, it is also necessary to use the corresponding processing rules in the corresponding speech-to-text conversion configuration rules, which contain the error text pattern and the corresponding correct text pattern. In this process, regular expressions can also be used to verify again whether the keywords fully conform to the error text pattern of the rules, further ensuring the accuracy of the replacement and avoiding incorrect replacement.
[0077] After confirming that the rules are met, keyword replacement is performed according to the content of the correct text pattern. In one embodiment, StringBuilder is used to perform text replacement, providing efficient string modification capabilities.
[0078] In this embodiment, the offset is used to manage text position changes. Therefore, after each keyword replacement, it is necessary to calculate the length difference between the new and old texts and update the global offset to ensure the position accuracy of subsequent replacement operations and avoid possible overlapping replacements.
[0079] In order to intuitively display the replacement results, the result recording and report generation steps are also included. In this embodiment, a ConvertShotDTO object is created to store the replacement results; for each replacement, the original text, error text, correct text and rule ID are recorded, and ConcurrentHashMap is used to ensure thread-safe record storage. Finally, the information of all replacement operations is summarized, and a detailed report containing the comparison of the text before and after the replacement is generated, and whether the text has changed is marked.
[0080] In order to improve the actual system performance, this embodiment also proposes a cache management mechanism. Specifically, Spring Cache annotation is used to manage cache; the project ID (estateId) is used as the cache key, and objects generated after cache initialization are avoided from repeated construction.
[0081] At the same time, a cache invalidation mechanism is also proposed, that is, when the speech-to-text conversion configuration rules change, it is necessary to clear the object cache generated based on the corresponding speech-to-text conversion configuration rules to ensure that the latest rules are always used for text processing.
[0082] Please refer to Figure 2 The embodiment of the present invention further proposes an electronic device, including a memory 101 and a processor 102, wherein the memory 101 stores a computer program corresponding to the aforementioned speech text correction and replacement method that can be loaded and executed by the processor 102.
[0083] Figure 3 A schematic diagram of the structure of a computer system suitable for implementing an electronic device of an embodiment of the present application is shown.
[0084] It should be noted that Figure 3 The computer system 200 of the electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0085] like Figure 3 As shown, the computer system 200 includes a central processing unit (CPU) 201, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 202 or the program loaded from the storage part 208 to the random access memory (RAM) 203, such as executing the method described in the above embodiment. In the RAM 203, various programs and data required for system operation are also stored. The CPU 201, ROM 202 and RAM 203 are connected to each other through a bus 204. An input / output (I / O) interface 205 is also connected to the bus 204.
[0086] The following components are connected to the I / O interface 205: an input section 206 including a keyboard, a mouse, etc.; an output section 207 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 208 including a hard disk, etc.; and a communication section 209 including a network interface card such as a LAN (Local Area Network) card, a modem, etc. The communication section 209 performs communication processing via a network such as the Internet. A drive 210 is also connected to the I / O interface 205 as needed. A removable medium 211, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 210 as needed so that a computer program read therefrom is installed into the storage section 208 as needed.
[0087] In particular, according to an embodiment of the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication section 209, and / or installed from a removable medium 211. When the computer program is executed by a central processing unit (CPU) 201, various functions defined in the system of the present application are executed.
[0088] It should be noted that the computer-readable medium shown in the embodiment of the present application may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, - but not limited to - an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by an instruction execution system, device or device or used in combination with it. In the present application, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, wherein a computer-readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate, or transmit programs for use by or in conjunction with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.
[0089] The flowchart and block diagram in the accompanying drawings illustrate the possible architecture, functions and operations of the system, method and computer program product according to various embodiments of the present application. Wherein, each box in the flowchart or block diagram can represent a module, a program segment, or a part of the code, and the above-mentioned module, program segment, or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of boxes in the block diagram or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0090] The units involved in the embodiments described in this application may be implemented by software or hardware, and the units described may also be set in a processor. The names of these units do not, in some cases, constitute limitations on the units themselves.
[0091] As another aspect, the present application also provides a computer program product or a computer program, which includes a computer instruction stored in a computer-readable storage medium. A processor of a computer device reads the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device executes the speech text correction and replacement method described in the above embodiment.
[0092] As another aspect, the present application also provides a computer-readable medium, which may be included in the electronic device described in the above embodiment; or may exist independently without being assembled into the electronic device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by an electronic device, the electronic device implements the speech text correction and replacement method described in the above embodiment.
[0093] It should be noted that, although several modules or units of the equipment for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiments of the present application, the features and functions of two or more modules or units described above can be embodied in one module or unit. On the contrary, the features and functions of one module or unit described above can be further divided into being embodied by multiple modules or units.
[0094] Through the description of the above implementation methods, it is easy for those skilled in the art to understand that the example implementation methods described here can be implemented by software or by combining software with necessary hardware. Therefore, the technical solution according to the implementation methods of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which can be a personal computer, a server, a touch terminal, or a network device, etc.) to execute the method according to the implementation methods of the present application.
[0095] For those skilled in the art, the specific meanings of the above terms in the present invention can be understood in specific situations; the drawings in the embodiments are used to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Generally, the components of the embodiments of the present invention described and shown in the drawings herein can be arranged and designed in various different configurations.
[0096] Although the embodiments of the present application have been shown and described above, it can be understood that the above embodiments are exemplary and cannot be understood as limitations on the present application. Ordinary technicians in this field can change, modify, replace and modify the above embodiments within the scope of the present application.
Claims
1. A method for correcting and replacing speech text, characterized in that: include: Initializing a pre-configured speech-to-text conversion configuration rule; wherein the speech-to-text conversion configuration rule includes a target regular expression, an error text pattern, and a correct text pattern; Construct AC automata based on error text patterns; Locating a target text segment of a speech text based on a target regular expression; Use AC automata to match keywords in the target text segment; Correct and replace the matched keywords based on the correct text pattern.
2. The method for correcting and replacing speech text according to claim 1, characterized in that: The AC automaton is constructed based on the error text pattern, specifically comprising: Construct a dictionary tree: parse all error text patterns and generate a complete keyword list; insert each keyword into the dictionary tree, and each node represents a character; in the dictionary tree, the path from the root node to the leaf node represents a complete keyword, and the leaf node marks the complete keyword corresponding to the path; Build a failure pointer: For each node, build its failure pointer, pointing to the node corresponding to the longest suffix of the current character sequence, so as to quickly jump to the next possible matching position when the match fails.
3. The method for correcting and replacing speech text according to claim 2, characterized in that: Each node of the dictionary tree includes an output set, which stores all keywords that may be matched when passing through the node.
4. The method for correcting and replacing speech text according to claim 1 or 2, characterized in that: The target text segment positioning of the speech text based on the target regular expression specifically includes: Compile all regular expressions into pattern objects; Associating all pattern objects with corresponding processing rule lists, wherein the processing rules include error text patterns and corresponding correct text patterns; Each pattern object is used to process the speech text, determine all matching target text segments, and record the position information.
5. The method for correcting and replacing speech text according to claim 2, characterized in that: The use of the AC automaton to perform keyword matching in the target text segment specifically includes: Use the dictionary tree of the AC automaton to transfer the state of each character in the target text segment and determine the nodes through which the state transfer passes; Collect the outputs of the passed nodes to obtain all matching keywords, and record the location information of the keywords in the target text segment.
6. The method for correcting and replacing speech text according to claim 5, characterized in that: The state transfer process includes: Starting from the first character of the target text segment to be matched, the state is transferred in the dictionary tree; After each state transition, check whether the current node is the terminal node of a keyword. If so, add the corresponding keyword to the output set; if not, continue to process the next character; When encountering an unmatched character that cannot be transferred, the failure pointer jumps to other possible matching positions. If the position pointed to by the failure pointer still does not match, continue to backtrack until a matching position is found or backtracks to the root node.
7. The method for correcting and replacing speech text according to claim 4, characterized in that: The correcting and replacing of the matched keywords based on the correct text pattern specifically includes: For each keyword matched by the AC automaton, determine the corresponding processing rule; The keywords of the target text segment are replaced according to the processing rules.
8. The method for correcting and replacing speech text according to claim 7, characterized in that: After each keyword replacement is completed, the process also includes: calculating the length difference between the new and old texts, and updating the global offset; and determining the position of the subsequent target text segment and the keyword through the updated global offset.
9. The method for correcting and replacing speech text according to claim 7, characterized in that: Before replacing, it also includes using regular expressions to verify again whether the keyword completely conforms to the regular error text pattern.
10. The method for correcting and replacing speech text according to claim 1, characterized in that: During the correction and replacement process, the objects generated by the compilation are cached using the speech-to-text conversion configuration rules as cache keys; and the corresponding cache is cleared when the speech-to-text conversion configuration rules change.