Text error correction method, device and equipment
By combining phoneme similarity and linguistic logic features to evaluate candidate characters in the text correction method and dynamically adjusting the weights, the problem of miscorrection in traditional methods is solved, and higher error correction accuracy and semantic preservation are achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-15
- Publication Date
- 2026-04-03
AI Technical Summary
Existing text correction methods are prone to miscorrection when replacing words in the text to be corrected. This is because traditional methods determine similarity based on edit distance, phonological rules, or simple pinyin distance, which leads to the misreplacement of hot words. They also lack linguistic logic constraints and the weights are fixed and cannot be dynamically adjusted.
Candidate characters are determined by comparing the characters at each position in the text to be corrected with multiple predefined correction characters. The candidate characters are then evaluated using phoneme similarity and matching scores, combined with linguistic logical feature information. The weights are dynamically adjusted to select the target character sequence, and finally, the corrected text is generated.
It improves the accuracy of text correction, reduces the replacement of semantically incorrect text, dynamically adjusts weights to adapt to different contexts, and enhances the precision of error correction.
Smart Images

Figure CN121789682A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of speech recognition, and more particularly to a text error correction method, apparatus, and device. Background Technology
[0002] Automatic speech recognition (ASR) is prone to misidentification of words with low frequency or strong relevance to the user, such as names of people and places, and named entities. Mainstream ASR interfaces only provide the final recognized text and cannot obtain internal probability distribution information, making it impossible to implement hot word bias at the decoding level. Traditional bias decoding requires adjusting probabilities during the neural network decoding stage, which is not feasible for black-box ASR systems. Therefore, error correction of speech recognition results is necessary.
[0003] Existing text correction methods typically use similar pronunciation replacement schemes. These schemes determine the similarity between words in the text to be corrected and set hot words based on edit distance, phonological rules, or simple phonetic distance. If the similarity exceeds a set threshold, the words in the text to be corrected are replaced with the set hot words. However, this method is too crude. If words in the text to be corrected that should not be replaced have similar pronunciations to hot words, it is easy for hot words to be incorrectly corrected.
[0004] Therefore, improving the accuracy of text correction has become an urgent problem to be solved. Summary of the Invention
[0005] This application provides a text correction method, apparatus, and device to improve the accuracy of text correction.
[0006] In a first aspect, embodiments of this application provide a text correction method, including: Based on the characters at each position in the text to be corrected and multiple set correction characters, candidate characters at each position in the text to be corrected are determined; Take each candidate character at the initial character position in the text to be corrected as the first character sequence, and take the initial character position as the current character position, and repeat the following operations: For each first character sequence, based on the first character sequence and the text to be corrected, a first score is determined to characterize the degree of penalty for the phoneme similarity between the first character sequence and the text to be corrected; based on the first character sequence and a plurality of set correction character sequences, a second score is determined to characterize the degree of matching between the first character sequence and the plurality of set correction character sequences; based on the first score and the second score, a target score for the first character sequence is determined. Based on the target scores of each first character sequence, select the target character sequence from each first character sequence; Based on the target character sequence and each candidate character at the next character position in the text to be corrected, a second character sequence is determined, and the second character sequence is used as the new first character sequence, and the next character position is used as the new current character position, until the next character position exceeds the terminating character position in the text to be corrected; Based on the target scores of each target character sequence, select the target text from each target character sequence.
[0007] In this embodiment, based on the characters at each character position in the text to be corrected and multiple set correction characters, candidate characters at each character position in the text to be corrected are determined, i.e., possible characters located at each character position in the text data to be corrected; each candidate character at the initial character position in the text to be corrected is taken as a first character sequence, and the initial character position is taken as the current character position, and the following operations are repeated: for each first character sequence, a first score is determined based on the first character sequence and the text to be corrected, to characterize the degree of penalty for the phoneme similarity between the first character sequence and the text to be corrected; a second score is determined based on the first character sequence and multiple set correction character sequences, to be used for... The method involves: representing the degree of matching between a first character sequence and multiple predefined error-correcting character sequences; determining a target score for the first character sequence based on a first score and a second score; selecting a target character sequence from each first character sequence based on its target score; determining a second character sequence based on the target character sequence and each candidate character at the next character position in the text to be corrected, and using the second character sequence as the new first character sequence and the next character position as the new current character position, until the next character position exceeds the termination character position in the text to be corrected; and selecting the target text, i.e., the corrected text, from each target character sequence based on its target score. This application can correct character sequences with the same or similar pronunciations appearing in the text data to be corrected, thereby improving the accuracy of text correction.
[0008] Optionally, before determining the target score of the first character sequence based on the first score and the second score, the method further includes: Based on the linguistic logic feature information of the first character sequence, a third score is determined to characterize the degree to which the first character sequence conforms to linguistic logic; Determining the target score of the first character sequence based on the first score and the second score includes: Based on the first score, the second score, and the third score, a target score for the first character sequence is determined.
[0009] Optionally, determining the third score, based on the linguistic logic feature information of the first character sequence, to characterize the degree to which the first character sequence conforms to linguistic logic includes: Feature extraction is performed on the first character sequence to obtain the language logic feature information of the first character sequence; Based on the linguistic logic feature information of the first character sequence, the first character sequence is scored to obtain the third score.
[0010] Optionally, determining a first score based on the first character sequence and the text to be corrected, to characterize the phonemic similarity between the first character sequence and the text to be corrected, includes: Based on the character position in the text to be corrected corresponding to each character in the first character sequence and the text to be corrected, a third character sequence is determined; Feature extraction is performed on the first character sequence to obtain the first phoneme feature information, and feature extraction is performed on the third character sequence to obtain the second phoneme feature information; Based on the first phoneme feature information and the second phoneme feature information, the phoneme similarity between the first character sequence and the third character sequence is determined; The first score is determined based on the phoneme similarity and set similarity between the first character sequence and the third character sequence.
[0011] Optionally, determining a second score based on the first character sequence and a plurality of predetermined error-correcting character sequences to characterize the degree of matching between the first character sequence and the plurality of predetermined error-correcting character sequences includes: Each character in the first character sequence is matched sequentially with the plurality of predefined error correction character sequences to determine the matching error correction character sequence; The second score is determined based on the weights corresponding to the matched error-correcting character sequence and the weights corresponding to each error-correcting character in the matched error-correcting character sequence.
[0012] Optionally, determining candidate characters for each position in the text to be corrected based on the characters at each position and multiple predefined correction characters includes: For any given character position, determine the phonemic similarity between the character at that given character position in the text to be corrected and the plurality of set correction characters; The error correction character whose phoneme similarity exceeds a set threshold and the character at any given character position are used as candidate characters for that given character position.
[0013] Optionally, determining the phonemic similarity between the character at any given position in the text to be corrected and the plurality of predefined correction characters includes: For any error-correcting character, feature extraction is performed on the character at that position to obtain the third phoneme feature information, and feature extraction is performed on the error-correcting character to obtain the fourth phoneme feature information; Based on the third phoneme feature information and the fourth phoneme feature information, the phoneme similarity between the character at any given character position and any given error-correcting character is determined.
[0014] Optionally, the text to be corrected is obtained through the following method: Acquire the speech data to be recognized; The speech data to be identified is subjected to feature extraction to obtain speech feature information; Based on the speech feature information, speech recognition is performed on the speech data to obtain text data, and the text data is used as the text to be corrected.
[0015] Secondly, embodiments of this application provide a text correction device, comprising: The first determining module is used to determine candidate characters for each character position in the text to be corrected based on the characters at each character position in the text to be corrected and multiple set correction characters. The execution module includes a second determining module, a first selecting module, and a third determining module. The execution module is used to take each candidate character at the initial character position in the text to be corrected as a first character sequence, and take the initial character position as the current character position, and repeatedly perform the following operations: The second determining module is configured to, for each first character sequence, determine a first score representing the degree of penalty for the phoneme similarity between the first character sequence and the text to be corrected, based on the first character sequence and the text to be corrected; determine a second score representing the degree of matching between the first character sequence and the multiple set error-correcting character sequences, based on the first character sequence and the multiple set error-correcting character sequences; and determine a target score for the first character sequence based on the first score and the second score. The first selection module is used to select a target character sequence from each first character sequence based on the target score of each first character sequence; The third determining module is used to determine a second character sequence based on the target character sequence and each candidate character at the next character position in the text to be corrected, and to use the second character sequence as the new first character sequence and the next character position as the new current character position, until the next character position exceeds the terminating character position in the text to be corrected; The second selection module is used to select target text from each target character sequence based on the target score of each target character sequence.
[0016] Optionally, before determining the target score of the first character sequence based on the first score and the second score, the second determining module is further configured to: Based on the linguistic logic feature information of the first character sequence, a third score is determined to characterize the degree to which the first character sequence conforms to linguistic logic; The second determining module is used for: Based on the first score, the second score, and the third score, a target score for the first character sequence is determined.
[0017] Optionally, the second determining module is used to: Feature extraction is performed on the first character sequence to obtain the language logic feature information of the first character sequence; Based on the linguistic logic feature information of the first character sequence, the first character sequence is scored to obtain the third score.
[0018] Optionally, the second determining module is used to: Based on the character position in the text to be corrected corresponding to each character in the first character sequence and the text to be corrected, a third character sequence is determined; Feature extraction is performed on the first character sequence to obtain the first phoneme feature information, and feature extraction is performed on the third character sequence to obtain the second phoneme feature information; Based on the first phoneme feature information and the second phoneme feature information, the phoneme similarity between the first character sequence and the third character sequence is determined; The first score is determined based on the phoneme similarity and set similarity between the first character sequence and the third character sequence.
[0019] Optionally, the second determining module is used to: Each character in the first character sequence is matched sequentially with the plurality of predefined error correction character sequences to determine the matching error correction character sequence; The second score is determined based on the weights corresponding to the matched error-correcting character sequence and the weights corresponding to each error-correcting character in the matched error-correcting character sequence.
[0020] Optionally, the first determining module is used to: For any given character position, determine the phonemic similarity between the character at that given character position in the text to be corrected and the plurality of set correction characters; The error correction character whose phoneme similarity exceeds a set threshold and the character at any given character position are used as candidate characters for that given character position.
[0021] Optionally, the first determining module is used to: For any error-correcting character, feature extraction is performed on the character at that position to obtain the third phoneme feature information, and feature extraction is performed on the error-correcting character to obtain the fourth phoneme feature information; Based on the third phoneme feature information and the fourth phoneme feature information, the phoneme similarity between the character at any given character position and any given error-correcting character is determined.
[0022] Optionally, the first determining module is used to obtain the text to be corrected by the following method: Acquire the speech data to be recognized; The speech data to be identified is subjected to feature extraction to obtain speech feature information; Based on the speech feature information, speech recognition is performed on the speech data to obtain text data, and the text data is used as the text to be corrected.
[0023] Thirdly, this application provides an electronic device, comprising: Memory, used to store program instructions; A processor is configured to invoke program instructions stored in the memory and execute the steps of the method described in any one of the first aspects according to the obtained program instructions.
[0024] Fourthly, this application provides a computer-readable storage medium storing a computer program, the computer program including program instructions, which, when executed by a computer, cause the computer to perform the method described in any one of the first aspects.
[0025] Fifthly, this application provides a computer program product comprising: computer program code, which, when run on a computer, causes the computer to perform the method described in any one of the first aspects. Attached Figure Description
[0026] Figure 1 This is a schematic diagram illustrating an application scenario provided in the embodiments of this application; Figure 2 A flowchart illustrating a text correction method provided in this application embodiment; Figure 3 A detailed flowchart of a text correction method provided in this application embodiment; Figure 4A flowchart illustrating a method for obtaining text to be corrected, provided in an embodiment of this application; Figure 5 A flowchart illustrating a method for determining text data provided in an embodiment of this application; Figure 6 A flowchart illustrating a method for determining candidate characters at the positions of characters in a text to be corrected, provided in an embodiment of this application; Figure 7 A flowchart illustrating a method for determining the phonemic similarity between a character at any given position and any error-correcting character, provided in an embodiment of this application; Figure 8 A detailed flowchart illustrating a method for determining the phonemic similarity between a character at any given position and an error-correcting character, provided in an embodiment of this application; Figure 9 A flowchart illustrating a training method for a phoneme similarity scoring model provided in an embodiment of this application; Figure 10 A flowchart illustrating a method for performing a single iterative training of a phoneme similarity scoring model, as provided in an embodiment of this application. Figure 11 A flowchart illustrating a method for determining a first score, provided in an embodiment of this application; Figure 12 A flowchart illustrating a method for determining a second score, provided as an embodiment of this application; Figure 13 A flowchart illustrating a method for determining a third score, provided as an embodiment of this application; Figure 14 A detailed flowchart of a method for determining a third score provided in an embodiment of this application; Figure 15 A flowchart illustrating a training method for a language logic scoring model provided in this application embodiment; Figure 16 A flowchart illustrating a training method for performing a single iterative training of a language logic scoring model, as provided in an embodiment of this application. Figure 17 This is a schematic diagram of the structure of a text correction device provided in an embodiment of this application; Figure 18 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0027] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application. Unless otherwise specified, the embodiments and features in the embodiments of this application can be arbitrarily combined with each other. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than that shown here.
[0028] The terms "first" and "second" in the specification, claims, and accompanying drawings of this application are used to distinguish different objects, not to describe a specific order. Furthermore, the term "comprising" and any variations thereof are intended to cover non-exclusive protection. For example, a process, method, system, product, or device that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products, or devices. The term "multiple" in this application can mean at least two, for example, two, three, or more, and the embodiments of this application do not impose limitations.
[0029] The data collection, dissemination, and use in this application all comply with relevant national laws and regulations.
[0030] Before introducing the text correction method provided in the embodiments of this application, for ease of understanding, the technical background of the embodiments of this application will be described in detail below.
[0031] Existing text correction methods typically use similar pronunciation replacement schemes. These schemes determine the similarity between words in the text to be corrected and set hot words based on edit distance, phonological rules, or simple phonetic distance. If the similarity exceeds a set threshold, the words in the text to be corrected are replaced with the set hot words. However, this method is too crude. If words in the text that should not be replaced have similar pronunciations to hot words, it is easy for hot words to be incorrectly corrected. Therefore, improving the accuracy of text correction has become an urgent problem to be solved.
[0032] To address the aforementioned problems, this application proposes a text correction method, apparatus, and device to improve the accuracy of text correction.
[0033] First refer to Figure 1This is a schematic diagram illustrating an application scenario of an embodiment of this application, including a user device 11 and a server 12. The user device 11 and server 12 communicate via a network, which can be a local area network (LAN), a wide area network (WAN), etc. The user device 11 can be a portable device (e.g., a mobile phone, tablet, laptop, etc.) or a personal computer (PC). The server 12 can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, and big data and artificial intelligence platforms. The user 10 logs into the server 12 through a client installed on the user device 11. The client can be a web browser or an application client installed on a mobile user device, such as a mobile phone or tablet.
[0034] In this embodiment of the application, as an optional implementation, server 12 responds to a text correction command triggered by user 10 on a client on user device 11, obtains the text to be corrected, and determines candidate characters for each character position in the text to be corrected based on the characters at each character position and a plurality of set correction characters; each candidate character at the initial character position in the text to be corrected is taken as a first character sequence, and the initial character position is taken as the current character position, and the following operations are repeated: for each first character sequence, based on the first character sequence and the text to be corrected, a first score is determined to characterize the phoneme similarity between the first character sequence and the text to be corrected; based on the first character sequence and a plurality of... Given a set error-correcting character sequence, a second score is determined to characterize the degree of matching between the first character sequence and multiple set error-correcting character sequences. Based on the first and second scores, a target score for the first character sequence is determined. Based on the target scores of each first character sequence, a target character sequence is selected from each first character sequence. Based on the target character sequence and each candidate character at the next character position in the text to be corrected, a second character sequence is determined, and the second character sequence is used as the new first character sequence, with the next character position as the new current character position, until the next character position exceeds the termination character position in the text to be corrected. Based on the target scores of each target character sequence, a target text is selected from each target character sequence.
[0035] The following is for reference. Figure 2 The flowchart shown illustrates a text correction method, which clarifies the technical solution provided in the embodiments of this application: Step 201: Based on the characters at each position in the text to be corrected and multiple set correction characters, determine the candidate characters at each position in the text to be corrected.
[0036] Among them, the text to be corrected can be the speech recognition result obtained by performing speech recognition on speech data, or other text data that needs to be corrected. The set correction characters can be set according to the actual situation. For example, the set correction characters can be each character in some hot words. Hot words are usually some words that are prone to errors in speech recognition. For example, some words such as personal names, place names, and product names.
[0037] Step 202: Take each candidate character at the initial character position in the text to be corrected as the first character sequence, and take the initial character position as the current character position, and repeat the following operations.
[0038] Among them, the initial character position is the first character position in the text to be corrected. For example, if the text to be corrected is "Xiaoming is good", this text to be corrected includes 3 character positions. The first character position, that is, the initial character position is the position where "Xia" is located. In this application, the initial character position is first taken as the current character position.
[0039] Step 203: For each first character sequence, based on the first character sequence and the text to be corrected, determine a first score for characterizing the penalty degree of the phoneme similarity between the first character sequence and the text to be corrected; based on the first character sequence and multiple set correction character sequences, determine a second score for characterizing the matching degree between the first character sequence and the multiple set correction character sequences; based on the first score and the second score, determine the target score of the first character sequence.
[0040] [[ID=12]]Among them, the set correction character sequences can be set according to the actual situation. For example, the set correction character sequences can be some hot words.
[0041] Optionally, determining the target score of the first character sequence based on the first score and the second score includes: taking the difference between the second score and the first score as the target score of the first character sequence. In the embodiments of this application, the target score total_score of a certain first character sequence can be determined using the following formula: total_score = bias_score - similarity_penalty; where bias_score is the second score of the first character sequence, and similarity_penalty is the first score of the first character sequence.
[0042] Since the traditional similar pronunciation replacement scheme lacks language logic constraints, it is prone to semantic error replacement, and the weights are fixed and cannot be dynamically adjusted. To solve the above technical problems, before determining the target score of the first character sequence based on the first score and the second score, this application determines a third score for characterizing the degree to which the first character sequence conforms to the language logic based on the language logic feature information of the first character sequence.
[0043] Optionally, determining the target score of the first character sequence based on the first score and the second score includes: determining the target score of the first character sequence based on the first score, the second score, and the third score. In this embodiment of the application, determining the target score of the first character sequence based on the first score, the second score, and the third score includes: determining the sum of the second score and the third score, and using the difference between the sum and the first score as the target score of the first character sequence.
[0044] In this embodiment of the application, the target score total_score of a certain first character sequence can be determined using the following formula: total_score = lm_score + bias_score - similarity_penalty; where bias_score is the second score of the first character sequence, similarity_penalty is the first score of the first character sequence, and lm_score is the third score of the first character sequence.
[0045] Step 204: Select a target character sequence from each first character sequence based on the target score of each first character sequence.
[0046] Optionally, based on the target scores of each first character sequence, a target character sequence is selected from each first character sequence, including: sorting the target scores of each first character sequence in descending order, and selecting a predetermined number of first character sequences as target character sequences in a forward-to-back order; or, sorting the target scores of each first character sequence in ascending order, and selecting a predetermined number of first character sequences as target character sequences in a backward-to-forward order. The predetermined number can be set according to actual conditions; for example, the predetermined number can be 2.
[0047] For example, the target score for the first character sequence 1 is 89, the target score for the first character sequence 2 is 99, the target score for the first character sequence 3 is 85, and the target score for the first character sequence 4 is 92. If the target scores of each first character sequence are sorted in descending order, the resulting sequence is {first character sequence 2, first character sequence 4, first character sequence 1, first character sequence 3}. When the number of sequences is set to 2, first character sequence 2 and first character sequence 4 are selected as the target character sequences. If the target scores of each first character sequence are sorted in ascending order, the resulting sequence is {first character sequence 3, first character sequence 1, first character sequence 4, first character sequence 2}. When the number of sequences is set to 2, first character sequence 2 and first character sequence 4 are selected as the target character sequences.
[0048] Optionally, based on the target scores of each first character sequence, a target character sequence is selected from each first character sequence, including: sorting the target scores of each first character sequence in descending order, determining the ranking of each first character sequence, and selecting the first character sequence with a ranking lower than a set ranking as the target character sequence; or, sorting the target scores of each first character sequence in ascending order, determining the ranking of each first character sequence, and selecting the first character sequence with a ranking higher than a set ranking as the target character sequence. The set ranking can be determined according to actual circumstances; for example, the set ranking could be 3.
[0049] For example, the target score for the first character sequence 1 is 90, the target score for the first character sequence 2 is 99, the target score for the first character sequence 3 is 85, and the target score for the first character sequence 4 is 95. If we sort the target scores of each first character sequence in descending order, we determine the ranking of the first character sequence 1 as 3, the ranking of the first character sequence 2 as 1, the ranking of the first character sequence 3 as 4, and the ranking of the first character sequence 4 as 2. When the ranking is set to 3, the rankings of the first character sequence 2 and the first character sequence 4 are less than 3. Therefore, the first character sequence 2 and the first character sequence 4 are selected as the target character sequences. If we sort the target scores of each first character sequence in ascending order, we determine the ranking of the first character sequence 1 as 2, the ranking of the first character sequence 2 as 4, the ranking of the first character sequence 3 as 1, and the ranking of the first character sequence 4 as 3. When the ranking is set to 2, the rankings of the first character sequence 2 and the first character sequence 4 are greater than 2. Therefore, the first character sequence 2 and the first character sequence 4 are selected as the target character sequences.
[0050] Optionally, based on the target scores of each first character sequence, a target character sequence is selected from each first character sequence, including: selecting the first character sequence whose target score is greater than a set score threshold as the target character sequence. The set score threshold can be set according to actual circumstances; for example, the set score threshold is 90.
[0051] For example, the target score for the first character sequence 1 is 92, the target score for the first character sequence 2 is 99, the target score for the first character sequence 3 is 85, and the target score for the first character sequence 4 is 90. If the set score threshold is 90, then the target scores for the first character sequence 1 and the first character sequence 2 are determined to be greater than 90. Therefore, the first character sequence 1 and the first character sequence 2 are taken as the target character sequences.
[0052] Step 205: Based on the target character sequence and each candidate character at the next character position in the text to be corrected, determine the second character sequence, and use the second character sequence as the new first character sequence, and use the next character position as the new current character position until the next character position exceeds the termination character position in the text to be corrected.
[0053] Wherein, the termination character position in the text to be corrected is the last character position in the text to be corrected. For example, if the text to be corrected is "Xiaoming is good", this text to be corrected includes 3 character positions, and the third character position, that is, the termination character position, is the position where "good" is located. In the embodiments of the present application, that the next character position exceeds the termination character position in the text to be corrected means that the current character position in the text to be corrected has already been the termination character position in the text to be corrected, and the next character position does not exist in the text to be corrected. For example, if the text to be corrected is "Xiaoming is good", if the current character position is the third character position and the next character position is the fourth character position, but there is no fourth character position in the text to be corrected. Therefore, it is determined that the next character position exceeds the termination character position in the text to be corrected.
[0054] Step 206: Select the target text from each target character sequence based on the target scores of each target character sequence.
[0055] Optionally, selecting the target text from each target character sequence based on the target scores of each target character sequence includes: Based on the target scores of each target character sequence, using the target character sequence corresponding to the highest target score as the target text. For example, the target score of target character sequence 1 is 98, the target score of target character sequence 2 is 88, and the target score of target character sequence 3 is 96. Based on the target scores of each target character sequence, it is determined that the target score of target character sequence 1 is the highest. Therefore, target character sequence 1 is used as the target text.
[0056] In this embodiment, the Beam Search algorithm can be used to implement steps 202-206 above: The Beam Size of the Beam Search algorithm is set to k, where k is a natural number greater than 1; each candidate character at the initial character position in the text to be corrected is taken as a first character sequence, and the initial character position is taken as the current character position. The following operations are repeated: For each first character sequence, a first score is determined based on the first character sequence and the text to be corrected; a second score is determined based on the first character sequence and multiple set correction character sequences; a target score for the first character sequence is determined based on the first score and the second score; k target character sequences are selected from each first character sequence based on the target scores of each first character sequence; a second character sequence is determined based on the k target character sequences and each candidate character at the next character position in the text to be corrected, and the second character sequence is taken as a new first character sequence, with the next character position taken as the new current character position, until the next character position exceeds the termination character position in the text to be corrected; target text is selected from each target character sequence based on the target scores of each target character sequence. Beam Search is a heuristic graph search algorithm, typically used when the solution space of a graph is large. To reduce the space and time required for the search, some low-quality nodes are pruned and high-quality nodes are retained during each depth expansion step. Beamsize is the number of optimal states retained at each time step in the Beam Search algorithm.
[0057] In this embodiment, steps 202-206 can be implemented using a greedy search algorithm. In each iteration, based on the target score of each first character sequence, the first character sequence with the highest target score is selected as the target character sequence. Alternatively, this application can use an exhaustive search algorithm to determine all possible character sequences based on candidate characters at each character position in the text to be corrected; calculate the target score of all possible character sequences; and select the target text from each character sequence based on its target score.
[0058] In this embodiment, based on the characters at each character position in the text to be corrected and multiple set correction characters, candidate characters at each character position in the text to be corrected are determined, i.e., possible characters located at each character position in the text data to be corrected; each candidate character at the initial character position in the text to be corrected is taken as a first character sequence, and the initial character position is taken as the current character position, and the following operations are repeated: for each first character sequence, a first score is determined based on the first character sequence and the text to be corrected, to characterize the degree of penalty for the phoneme similarity between the first character sequence and the text to be corrected; a second score is determined based on the first character sequence and multiple set correction character sequences, to be used for... The method involves: representing the degree of matching between a first character sequence and multiple predefined error-correcting character sequences; determining a target score for the first character sequence based on a first score and a second score; selecting a target character sequence from each first character sequence based on its target score; determining a second character sequence based on the target character sequence and each candidate character at the next character position in the text to be corrected, and using the second character sequence as the new first character sequence and the next character position as the new current character position, until the next character position exceeds the termination character position in the text to be corrected; and selecting the target text, i.e., the corrected text, from each target character sequence based on its target score. This application can correct character sequences with the same or similar pronunciations appearing in the text data to be corrected, thereby improving the accuracy of text correction.
[0059] The following will provide a detailed explanation of the specific steps involved in the text correction method described above, such as... Figure 3 As shown: Step 301: Based on the characters at each position in the text to be corrected and multiple set correction characters, determine the candidate characters at each position in the text to be corrected.
[0060] In this embodiment of the application, the candidate characters for each character position in the text to be corrected are determined based on the characters at each character position in the text to be corrected and a plurality of set correction characters. This includes: for any character position, taking the characters at any character position in the text to be corrected and a plurality of set correction characters as candidate characters for any character position.
[0061] Since there may be duplicate characters at any position in the text to be corrected that are the same as multiple set correction characters, resulting in duplicate candidate characters at any position, in order to improve the correction efficiency, the candidate characters at any position are deduplicated to obtain the candidate characters at any position after deduplication.
[0062] For example, the multiple set error-correcting characters are Li, Hui, Zhang, Ling, Wang, and Chang. The text to be error-corrected is "Li Hui, do you know Wang Chang", and the text to be error-corrected includes 7 character positions. In theory, for each character position, it may correspond to the character itself at that character position and multiple set error-correcting characters. Therefore, the candidate characters for the 1st character position include {Li, Hui, Zhang, Ling, Wang, Chang}; the candidate characters for the 2nd character position include {Hui, Li, Hui, Zhang, Ling, Wang, Chang}; the candidate characters for the 3rd character position include {you, Li, Hui, Zhang, Ling, Wang, Chang}; the candidate characters for the 4th character position include {ren, Li, Hui, Zhang, Ling, Wang, Chang}; the candidate characters for the 5th character position include {shi, Li, Hui, Zhang, Ling, Wang, Chang}; the candidate characters for the 6th character position include {Li, Hui, Zhang, Ling, Wang, Chang}; the candidate characters for the 7th character position include {Chang, Li, Hui, Zhang, Ling, Wang, Chang}.
[0063] Step 302, use each candidate character at the initial character position in the text to be error-corrected as the first character sequence, and use the initial character position as the current character position.
[0064] In the embodiments of the present application, each candidate character at the initial character position in the text to be error-corrected is used as a first character sequence respectively. For example, if the candidate characters at the initial character position in the text to be error-corrected are {Li, Hui, Zhang, Ling, Wang, Chang}, then based on each candidate character at the initial character position in the text to be error-corrected, 6 first character sequences are obtained. The 1st first character sequence is {Li}, the 2nd first character sequence is {Hui}, the 3rd first character sequence is {Zhang}, the 4th first character sequence is {Ling}, the 5th first character sequence is {Wang}, and the 6th first character sequence is {Chang}.
[0065] Step 303, for each first character sequence, based on the first character sequence and the text to be error-corrected, determine a first score for characterizing the degree of penalty of the phoneme similarity between the first character sequence and the text to be error-corrected.
[0066] Step 304, based on the first character sequence and multiple set error-correcting character sequences, determine a second score for characterizing the matching degree between the first character sequence and the multiple set error-correcting character sequences.
[0067] Step 305, based on the language logic feature information of the first character sequence, determine a third score for characterizing the degree to which the first character sequence conforms to the language logic.
[0068] Among them, the execution order of the above steps 303, step 304, and step 305 can be executed in parallel, or can be executed in a set order according to the actual situation.
[0069] Step 306: Determine the target score of the first character sequence based on the first score, the second score, and the third score.
[0070] Step 307: Select the target character sequence from each of the first character sequences based on the target scores of the first character sequences.
[0071] Step 308: Determine whether the next character position exceeds the termination character position in the text to be corrected. If so, execute Step 309; otherwise, execute Step 311.
[0072] Step 309: Determine the second character sequence based on the target character sequence and each candidate character at the next character position in the text to be corrected.
[0073] In the embodiments of the present application, for each target character sequence, the target character sequence is respectively concatenated with each candidate character at the next character position in the text to be corrected to obtain the second character sequence. For example, the candidate characters at the first character position of the text to be corrected include {Li, Hui, Zhang, Ling, Wang, Chang}, and the candidate characters at the second character position of the text to be corrected include {Hui, Li, Hui, Zhang, Ling, Wang, Chang}. If the current target position is the first character position of the text to be corrected and the determined target character sequences are two, namely {Li} and {Ling}, then for the two target character sequences, each target character sequence is respectively concatenated with each candidate character at the next character position (the second character position) in the text to be corrected to obtain 14 second character sequences. The first second character sequence is {Li Hui}, the second second character sequence is {Li Li}, the third second character sequence is {Li Hui}, the fourth second character sequence is {Li Zhang}, the fifth second character sequence is {Li Ling}, the sixth second character sequence is {Li Wang}, the seventh second character sequence is {Li Chang}, the eighth second character sequence is {Ling Hui}, the ninth second character sequence is {Ling Li}, the tenth second character sequence is {Ling Hui}, the eleventh second character sequence is {Ling Zhang}, the twelfth second character sequence is {Ling Ling}, the thirteenth second character sequence is {Ling Wang}, and the fourteenth second character sequence is {Ling Chang}.
[0074] Step 310: Use the second character sequence as the new first character sequence and the next character position as the new current character position.
[0075] Step 311: Select the target text from each of the target character sequences based on the target scores of the target character sequences.
[0076] In the embodiments of the present application, the text to be corrected in Step 301 above can be obtained by performing speech recognition on the speech data to be recognized. Figure 4 This is a flowchart of a method for obtaining the text to be corrected provided by the embodiments of the present application, as Figure 4As shown, it includes at least the following steps 401-403: Step 401: Obtain the speech data to be recognized.
[0077] Step 402: Extract features from the speech data to be recognized to obtain speech feature information.
[0078] Step 403: Perform speech recognition on the speech data based on speech feature information to obtain text data, and use the text data as the text to be corrected.
[0079] In this embodiment, the speech data to be recognized is input into a speech recognition model to extract features from the speech data, obtain speech feature information, and then perform speech recognition based on the speech feature information to obtain text data, which is then used as the text to be corrected. The speech recognition model can be pre-trained using machine learning methods (such as supervised learning). The base model used to train the speech recognition model, i.e., the preset speech recognition model, can be various models with recognition functions, such as convolutional neural network models, neural network models, etc.
[0080] In this embodiment of the application, text data is determined based on the speech data to be recognized by the following method: feature extraction is performed on the speech data to be recognized to obtain speech feature information, and speech recognition is performed on the speech data based on the speech feature information to obtain text data. Figure 5 A flowchart illustrating a method for determining text data provided in this application embodiment is shown below. Figure 5 As shown, it includes at least the following steps 501-502: Step 501: Input the speech data to be recognized into the feature extraction layer of the trained speech recognition model, and extract the speech feature information of the speech data to be recognized through the feature extraction layer.
[0081] Step 502: Input the speech feature information into the output layer of the speech recognition model, and use the output layer to perform speech recognition on the speech data based on the speech feature information to obtain text data.
[0082] The training process of the speech recognition model is an existing technology and will not be described in detail here.
[0083] In this embodiment, candidate characters for each position in the text to be corrected are determined based on the characters at each position and multiple predefined correction characters. Since the phonemes of the multiple predefined correction characters are not all similar to the phonemes of the characters at each position in the text to be corrected, to improve the efficiency of text correction, it is necessary to filter based on the phoneme similarity between the characters at each position in the text to be corrected and the multiple predefined correction characters, thereby reducing the number of candidate characters at each position. Figure 6The following is a flowchart of a method for determining candidate characters at each character position in a text to be corrected provided by an embodiment of the present application. As Figure 6 shown, step 301 at least includes the following steps 601-602: Step 6:For any character position, determine the phoneme similarity between the character at any character position in the text to be corrected and multiple set error-correction characters respectively.
[0084] Among them, a phoneme is the smallest speech unit divided according to the natural attributes of speech. Analyzing according to the pronunciation actions in a syllable, one action constitutes one phoneme. Phonemes are divided into two major categories: vowels and consonants. For example, the Chinese syllable "啊" ( ) has only one phoneme, "爱" (ài) has two phonemes, "代" (dài) has three phonemes, etc.
[0085] Step 602:Take the error-correction characters with phoneme similarity exceeding the set threshold and the character at any character position as the candidate characters at any character position.
[0086] Among them, the set threshold can be set according to the actual situation. For example, the set threshold can be 5. In the embodiment of the present application, since there may be a situation where the characters at any character position in the text to be corrected are repeated with multiple set error-correction characters, resulting in duplicate characters among the candidate characters at any character position, therefore, in order to improve the error-correction efficiency, the candidate characters at any character position are de-duplicated to obtain the de-duplicated candidate characters at any character position.
[0087] In the embodiment of the present application, determine the phoneme similarity between the character at any character position in the text to be corrected and multiple set error-correction characters respectively. Figure 7 The following is a flowchart of a method for determining the phoneme similarity between the character at any character position and any error-correction character provided by an embodiment of the present application. As Figure 7 shown, step 601 at least includes the following steps 701-702: Step 701:For any error-correction character, extract the features of the character at any character position to obtain the third phoneme feature information, and extract the features of any error-correction character to obtain the fourth phoneme feature information.
[0088] Step 702:Based on the third phoneme feature information and the fourth phoneme feature information, determine the phoneme similarity between the character at any character position and any error-correction character.
[0089] In the embodiments of the present application, based on the third phoneme feature information and the fourth phoneme feature information, the phoneme similarity between the character at any character position and any error correction character can be determined by using existing similarity methods. The existing similarity methods can be methods such as Euclidean Distance, Manhattan Distance, etc.
[0090] In the embodiments of the present application, the candidate characters at each character position in the text to be error-corrected can also be determined based on the characters at each character position in the text to be error-corrected and multiple set error correction characters by the following method: Input the character at any character position and any error correction character into the phoneme similarity scoring model to extract features of the character at any character position to obtain the third phoneme feature information, and extract features of any error correction character to obtain the fourth phoneme feature information, and score based on the third phoneme feature information and the fourth phoneme feature information, so as to determine the phoneme similarity between the character at any character position and any error correction character. Among them, the phoneme similarity scoring model can be pre-trained by using machine learning methods (such as supervised learning methods). The basic model used for training the phoneme similarity scoring model, that is, the preset phoneme similarity scoring model, can be various models with scoring functions, such as convolutional neural network models, neural network models, etc.
[0091] For example, the multiple set error correction characters are Li, Hui, Zhang, Ling, Wang, and Chang, the set threshold is 5, and the text to be error-corrected is "Li Hui, do you know Wang Chang". The text to be error-corrected includes 7 character positions. The phoneme similarity between the character at any character position and any error correction character is calculated by using the phoneme similarity scoring model. For the 1st character position in the text to be error-corrected, the phoneme similarity between the character "Li" at the 1st character position in the text to be error-corrected and the set error correction character "Li" is 10, and the phoneme similarity between the character "Li" at the 1st character position in the text to be error-corrected and the set error correction character "Ling" is 6. The phoneme similarities corresponding to other set error correction characters do not exceed 5. Based on the set error correction characters with phoneme similarity exceeding 5 and the character at the 1st character position, the candidate characters at the 1st character position are {Li, Ling, Li}. Since there are duplicate characters in the candidate characters at the 1st character position, the candidate characters at the 1st character position are de-duplicated, and the de-duplicated candidate characters at the 1st character position are obtained, that is, {Li, Ling}.
[0092] For the second character position of the text to be corrected, the phoneme similarity between the character "慧" at the second character position in the text to be corrected and the set correction character "会" is 10, and the phoneme similarities corresponding to other set correction characters do not exceed 5. Based on the set correction characters with phoneme similarity exceeding 5 and the character at the second character position, the candidate characters for the second character position are obtained, namely {慧, 会}. For the third character position of the text to be corrected, the phoneme similarity between the character "你" at the third character position in the text to be corrected and the set correction character "李" is 7, and the phoneme similarity between the character "你" at the third character position in the text to be corrected and the set correction character "陵" is 5.5. The phoneme similarities corresponding to other set correction characters do not exceed 5. Based on the set correction characters with phoneme similarity exceeding 5 and the character at the third character position, the candidate characters for the third character position are obtained, namely {你, 李, 陵}. For the fourth character position of the text to be corrected, the phoneme similarity between the character "认" at the fourth character position in the text to be corrected and each set correction character does not exceed 5. The character at the fourth character position is used as the candidate character for the fourth character position, namely {认}. For the fifth character position of the text to be corrected, the phoneme similarity between the character "识" at the fifth character position in the text to be corrected and each set correction character does not exceed 5. The character at the fifth character position is used as the candidate character for the fifth character position, namely {识}.
[0093] For the sixth character position of the text to be corrected, the phoneme similarity between the character "王" at the sixth character position in the text to be corrected and the set correction character "王" is 10, the phoneme similarity between the character "王" at the sixth character position in the text to be corrected and the set correction character "昶" is 6, and the phoneme similarity between the character "王" at the sixth character position in the text to be corrected and the set correction character "张" is 6. The phoneme similarities corresponding to other set correction characters do not exceed 5. Based on the set correction characters with phoneme similarity exceeding 5 and the character at the sixth character position, the candidate characters for the sixth character position are {王, 昶, 张, 王}. Since there are duplicate characters in the candidate characters for the sixth character position, the candidate characters for the sixth character position are de-duplicated, and the de-duplicated candidate characters for the sixth character position are obtained, namely {王, 昶, 张}. For the seventh character position of the text to be corrected, the phoneme similarity between the character "长" at the seventh character position in the text to be corrected and the set correction character "昶" is 10, the phoneme similarity between the character "长" at the seventh character position in the text to be corrected and the set correction character "张" is 6, and the phoneme similarity between the character "长" at the seventh character position in the text to be corrected and the set correction character "王" is
[0094] In this embodiment of the application, the phoneme similarity between a character at any given position and any correction character is determined by the following method: feature extraction is performed on the character at any given position to obtain third phoneme feature information, and feature extraction is performed on any correction character to obtain fourth phoneme feature information. Based on the third and fourth phoneme feature information, the phoneme similarity between a character at any given position and any correction character is determined. Figure 8 A detailed flowchart illustrating a method for determining the phonemic similarity between a character at any given position and an error-correcting character, as provided in this application embodiment, is shown below. Figure 8 As shown, it includes at least the following steps 801-802: Step 801: Input the character at any character position and any error correction character into the feature extraction layer of the trained phoneme similarity scoring model. Extract the third phoneme feature information of the character at any character position through the feature extraction layer, and extract the fourth phoneme feature information of any error correction character through the feature extraction layer.
[0095] The phoneme similarity scoring model consists of an input layer, a feature extraction layer, and an output layer. The phoneme similarity scoring model can be a Transformer (a neural network architecture) model.
[0096] Step 802: Input the third phoneme feature information and the fourth phoneme feature information into the output layer of the phoneme similarity scoring model. The output layer scores based on the third phoneme feature information and the fourth phoneme feature information to obtain the phoneme similarity between a character at any character position and any error correction character.
[0097] In this embodiment of the application, a phoneme similarity scoring model is trained based on the acquired training dataset. Figure 9 A flowchart illustrating a training method for a phoneme similarity scoring model provided in this application embodiment is shown below. Figure 9 As shown, it includes at least the following steps 901-902: Step 901: Obtain the training dataset.
[0098] The training dataset includes multiple training samples. Each training sample includes any two characters and a label, where the label is the phoneme similarity between the two characters.
[0099] Step 902: Based on the training samples in the training dataset, perform iterative training on the preset phoneme similarity scoring model. When the preset iteration termination condition is met, the phoneme similarity scoring model is obtained.
[0100] The aforementioned preset iteration termination condition can be set according to the actual situation. For example, the preset iteration termination condition can be that the current iteration number reaches a set iteration number, and the set iteration number can be set according to the actual situation. The preset iteration termination condition can also be that the preset phoneme similarity scoring model converges.
[0101] In this embodiment, the backpropagation algorithm is used to continuously optimize the parameters of the preset phoneme similarity scoring model. The method for performing a single iterative training of the phoneme similarity scoring model will be described in detail below, such as... Figure 10 As shown: Step 101: Input any training sample from the training dataset into the preset phoneme similarity scoring model for processing to obtain the predicted phoneme similarity of any training sample.
[0102] Step 102: Based on the predicted phoneme similarity of any training sample and the label of any training sample, determine the loss value corresponding to any training sample.
[0103] In this embodiment, determining the loss value corresponding to any training sample based on the predicted phoneme similarity and the label of any training sample includes: determining the loss value corresponding to any training sample using a defined loss function based on the predicted phoneme similarity and the label of any training sample. The loss function is a non-negative real-valued function that can be used to characterize the difference between the predicted result of any training sample and the label (true result) of any training sample. Generally, the smaller the loss value, the better the robustness of the preset phoneme similarity scoring model. The loss function can be set according to the actual situation. For example, the loss function can be cross-entropy loss, Kullback-Leibler Divergence, Mean Absolute Error (MAE), Mean Squared Error (MSE), etc.
[0104] Step 103: Update the parameters of the preset phoneme similarity scoring model using the loss value corresponding to any training sample.
[0105] In this embodiment, candidate characters for each character position in the text to be corrected can also be determined using the following method based on the characters at each position and multiple predefined correction characters: For any given character position, the phoneme similarity between the character at that position and multiple target characters in the target character set corresponding to that position is determined; target characters with phoneme similarity exceeding a predefined threshold are used as candidate characters for that position. The predefined threshold can be set according to actual conditions; for example, it can be 5. The character set corresponding to any given character position includes multiple predefined correction characters and the character at that given position.
[0106] In this embodiment of the application, based on multiple set error correction characters and characters at any character position, an initial target character set corresponding to any character position is obtained. The characters in the initial target character set corresponding to any character position are deduplicated to obtain the target character set corresponding to any character position.
[0107] In this embodiment, a character at any position and a target character can be input into a phoneme similarity scoring model to extract features from the character at any position to obtain the fifth phoneme feature information, and to extract features from the target character to obtain the sixth phoneme feature information. Based on the fifth and sixth phoneme feature information, a score is calculated to determine the phoneme similarity between the character at any position and the target character.
[0108] In this embodiment, when determining candidate characters for each character position using the above method, for any given character position, a penalty score is determined based on the phoneme similarity and a set similarity between the character at any given character position in the text to be corrected and the candidate character at any given character position; a first score for the first character sequence is determined based on the penalty score corresponding to each character in the first character sequence. The set similarity can be set according to actual conditions; for example, the set similarity can be 10. In this embodiment, the set similarity can also be determined by the following method: inputting two identical character sequences into a phoneme similarity scoring model, and using the phoneme similarity output by the phoneme similarity scoring model as the set similarity.
[0109] Optionally, based on the phoneme similarity and set similarity between a character at any character position in the text to be corrected and a candidate character at any character position, a penalty score corresponding to a candidate character at any character position is determined, including: using the difference between the phoneme similarity and set similarity between a character at any character position in the text to be corrected and a candidate character at any character position as the penalty score corresponding to the candidate character at any character position.
[0110] Optionally, determining a first score of the first character sequence based on the penalty scores corresponding to each character in the first character sequence includes: taking the sum of the penalty scores corresponding to each character in the first character sequence as the first score of the first character sequence.
[0111] For example, multiple set error-correction characters are Li, Hui, Zhang, Ling, Wang, and Chang, the set threshold is 5, the set similarity is 10, the text to be error-corrected is "Li Hui, do you know Wang Chang", and the text to be error-corrected includes 7 character positions. For the 1st character position in the text to be error-corrected, based on the character at the 1st character position and multiple set error-correction characters, the initial target character set corresponding to the 1st character position is {Li, Li, Hui, Zhang, Ling, Wang, Chang}, and after removing duplicates from the characters in the initial target character set corresponding to the 1st character position, the target character set corresponding to the 1st character position is {Li, Hui, Zhang, Ling, Wang, Chang}. Using the phoneme similarity scoring model to calculate the phoneme similarity between the character at the 1st character position in the text to be error-corrected and each target character, the phoneme similarity between the character "Li" at the 1st character position in the text to be error-corrected and the target character "Li" is 10, the phoneme similarity between the character "Li" at the 1st character position in the text to be error-corrected and the target character "Ling" is 6, and the phoneme similarities corresponding to other target characters do not exceed 5. Taking the target characters with phoneme similarity exceeding 5 as the candidate characters for the 1st character position, that is, {Li, Ling}. The penalty score of the candidate character {Li} for the 1st character position is 10 - 10 = 0, and the penalty score of the candidate character {Ling} for the 1st character position is 10 - 6 = 4.
[0112] For the 2nd character position in the text to be error-corrected, based on the character at the 2nd character position and multiple set error-correction characters, the initial target character set corresponding to the 2nd character position is {Hui, Li, Hui, Zhang, Ling, Wang, Chang}. Since there are no duplicate characters in the initial target character set corresponding to the 2nd character position, therefore, taking it as the target character set corresponding to the 2nd character position, that is, the target character set corresponding to the 2nd character position is {Hui, Li, Hui, Zhang, Ling, Wang, Chang}. Using the phoneme similarity scoring model to calculate the phoneme similarity between the character at the 2nd character position in the text to be error-corrected and each target character, the phoneme similarity between the character "Hui" at the 2nd character position in the text to be error-corrected and the target character "Hui" is 10, the phoneme similarity between the character "Hui" at the 2nd character position in the text to be error-corrected and the target character "Hui" is 10, and the phoneme similarities corresponding to other target characters do not exceed 5. Taking the target characters with phoneme similarity exceeding 5 as the candidate characters for the 2nd character position, that is, {Hui, Hui}. The penalty score of the candidate character {Hui} for the 2nd character position is 10 - 10 = 0, and the penalty score of the candidate character {Hui} for the 2nd character position is 10 - 10 = 0.
[0113] For the 3rd character position in the text to be corrected, based on the character at the 3rd character position and multiple set correction characters, the initial target character set corresponding to the 3rd character position is obtained as {you, li, hui, zhang, ling, wang, chang}. Since there are no duplicate characters in the initial target character set corresponding to the 3rd character position, therefore, it is used as the target character set corresponding to the 3rd character position, that is, the target character set corresponding to the 3rd character position is {you, li, hui, zhang, ling, wang, chang}. The phoneme similarity scoring model is used to calculate the phoneme similarity between the character at the 3rd character position in the text to be corrected and each target character. The phoneme similarity between the character "you" at the 3rd character position in the text to be corrected and the target character "you" is 10. The phoneme similarity between the character "you" at the 3rd character position in the text to be corrected and the target correction character "li" is 7. The phoneme similarity between the character "you" at the 3rd character position in the text to be corrected and the target correction character "ling" is 5.5. The phoneme similarities corresponding to other target characters do not exceed 5. The target characters with phoneme similarity exceeding 5 are used as the candidate characters for the 3rd character position, that is, {you, li, ling}. The penalty score of the candidate character {you} at the 3rd character position is 10 - 10 = 0. The penalty score of the candidate character {li} at the 3rd character position is 10 - 7 = 3. The penalty score of the candidate character {ling} at the 3rd character position is 10 - 5.5 = 4.5.
[0114] For the 4th character position in the text to be corrected, based on the character at the 4th character position and multiple set correction characters, the initial target character set corresponding to the 4th character position is {Ren, Li, Hui, Zhang, Ling, Wang, Chang}. Since there are no duplicate characters in the initial target character set corresponding to the 4th character position, it is used as the target character set corresponding to the 4th character position, that is, the target character set corresponding to the 4th character position is {Ren, Li, Hui, Zhang, Ling, Wang, Chang}. Use the phoneme similarity scoring model to calculate the phoneme similarity between the character at the 4th character position in the text to be corrected and each target character. The phoneme similarity between the character "Ren" at the 4th character position in the text to be corrected and the target character "Ren" is 10, and the phoneme similarity corresponding to other target characters does not exceed 5. The target characters with phoneme similarity exceeding 5 are used as the candidate characters for the 4th character position, that is, {Ren}. The penalty score of the candidate character {Ren} at the 4th character position is 10 - 10 = 0. For the 5th character position in the text to be corrected, based on the character at the 5th character position and multiple set correction characters, the initial target character set corresponding to the 5th character position is {Shi, Li, Hui, Zhang, Ling, Wang, Chang}. Since there are no duplicate characters in the initial target character set corresponding to the 5th character position, it is used as the target character set corresponding to the 5th character position, that is, the target character set corresponding to the 5th character position is {Shi, Li, Hui, Zhang, Ling, Wang, Chang}. Use the phoneme similarity scoring model to calculate the phoneme similarity between the character at the 5th character position in the text to be corrected and each target character. The phoneme similarity between the character "Shi" at the 5th character position in the text to be corrected and the target character "Shi" is 10, and the phoneme similarity corresponding to other target characters does not exceed 5. The target characters with phoneme similarity exceeding 5 are used as the candidate characters for the 5th character position, that is, {Shi}. The penalty score of the candidate character {Ren} at the 5th character position is 10 - 10 = 0.
[0115] For the 6th character position in the text to be corrected, based on the character at the 6th character position and multiple set correction characters, the initial target character set corresponding to the 6th character position is obtained as {Wang, Li, Hui, Zhang, Ling, Wang, Chang}. After removing duplicates from the characters in the initial target character set corresponding to the 6th character position, the target character set corresponding to the 6th character position is obtained as {Li, Hui, Zhang, Ling, Wang, Chang}. Use the phoneme similarity scoring model to calculate the phoneme similarity between the character at the 6th character position in the text to be corrected and each target character. The phoneme similarity between the character 'Wang' at the 6th character position in the text to be corrected and the target character 'Wang' is 10, the phoneme similarity between the character 'Wang' at the 6th character position in the text to be corrected and the target character 'Chang' is 6, the phoneme similarity between the character 'Wang' at the 6th character position in the text to be corrected and the target character 'Zhang' is 6, and the phoneme similarities corresponding to other target characters do not exceed 5. The target characters with phoneme similarity exceeding 5 are used as candidate characters for the 6th character position, i.e., {Wang, Chang, Zhang}. The penalty score of the candidate character {Wang} at the 6th character position is 10 - 10 = 0, the penalty score of the candidate character {Chang} at the 6th character position is 10 - 6 = 4, and the penalty score of the candidate character {Zhang} at the 6th character position is 10 - 6 = 4.
[0116] For the 7th character position in the text to be corrected, based on the character at the 7th character position and multiple set correction characters, the initial target character set corresponding to the 7th character position is obtained as {Chang, Li, Hui, Zhang, Ling, Wang, Chang}. Since there are no duplicate characters in the initial target character set corresponding to the 7th character position, therefore, it is used as the target character set corresponding to the 7th character position, that is, the target character set corresponding to the 7th character position is {Chang, Li, Hui, Zhang, Ling, Wang, Chang}. Use the phoneme similarity scoring model to calculate the phoneme similarity between the character at the 7th character position in the text to be corrected and each target character. The phoneme similarity between the character 'Chang' at the 7th character position in the text to be corrected and the target character 'Chang' is 10, the phoneme similarity between the character 'Chang' at the 7th character position in the text to be corrected and the target character 'Chang' is 10, the phoneme similarity between the character 'Chang' at the 7th character position in the text to be corrected and the target character 'Zhang' is 6, the phoneme similarity between the character 'Chang' at the 7th character position in the text to be corrected and the target character 'Wang' is 6, and the phoneme similarities corresponding to other target characters do not exceed 5. The target characters with phoneme similarity exceeding 5 are used as candidate characters for the 7th character position, i.e., {Chang, Chang, Zhang, Wang}. The penalty score of the candidate character {Chang} at the 7th character position is 10 - 10 = 0, the penalty score of the candidate character {Chang} at the 7th character position is 10 - 10 = 0, the penalty score of the candidate character {Zhang} at the 7th character position is 10 - 6 = 4, and the penalty score of the candidate character {Wang} at the 7th character position is 10 - 6 = 4.
[0117] If the first character sequence is {Li Huiling}, the penalty score for the character {Li} in the first character sequence is 0, the penalty score for the character {Hu} in the first character sequence is 0, and the penalty score for the character {Ling} in the first character sequence is 4.5, then the first score similarity_penalty of this first character sequence = 0 + 0 + 4.5 = 4.5. If the first character sequence is {Ling Hu Li knows Chang Chang}, the penalty score for the character {Ling} in the first character sequence is 4, the penalty score for the character {Hu} in the first character sequence is 0, the penalty score for the character {Li} in the first character sequence is 3, the penalty score for the character {Ren} in the first character sequence is 0, the penalty score for the character {Shi} in the first character sequence is 0, the penalty score for the character {Chang} in the first character sequence is 4, and the penalty score for the character {Chang} in the first character sequence is 0, then the first score similarity_penalty of this first character sequence = 4 + 0 + 3 + 0 + 0 + 4 + 0 = 11.
[0118] In the embodiments of the present application, based on the first character sequence and the text to be corrected, a first score is determined to characterize the penalty degree of the phoneme similarity between the first character sequence and the text to be corrected. Figure 11 It is a flowchart of a method for determining the first score provided by the embodiments of the present application, as Figure 11 shown, the above step 303 at least includes the following steps 111 - 113: Step 111, based on the character positions of the characters corresponding to each character in the first character sequence in the text to be corrected and the text to be corrected, determine a third character sequence.
[0119] For example, the first character sequence is "Li Hui Ni", and the text to be corrected is "Li Hu Ni knows Wang Chang". It is determined that the character "Li" in the first character sequence corresponds to the 1st character position in the text to be corrected, the character "Hui" in the first character sequence corresponds to the 2nd character position in the text to be corrected, and the character "Ni" in the first character sequence corresponds to the 3rd character position in the text to be corrected. Based on the characters at the 1st character position, the 2nd character position, and the 3rd character position in the text to be corrected, a third character sequence is obtained, that is, {Li Hu Ni}.
[0120] Step 112, perform feature extraction on the first character sequence to obtain first phoneme feature information, and perform feature extraction on the third character sequence to obtain second phoneme feature information.
[0121] Step 113, based on the first phoneme feature information and the second phoneme feature information, determine the phoneme similarity between the first character sequence and the third character sequence.
[0122] In an embodiment of the present application, the first character sequence and the third character sequence are input into a phoneme similarity scoring model to extract features of the first character sequence to obtain first phoneme feature information, and to extract features of the third character sequence to obtain second phoneme feature information, and based on the first phoneme feature information and the second phoneme feature information, the phoneme similarity between the first character sequence and the third character sequence is determined. This phoneme similarity scoring model may be the same as or different from the phoneme similarity scoring model in step 801.
[0123] Step 114, determine a first score based on the phoneme similarity between the first character sequence and the third character sequence and a set similarity.
[0124] In an embodiment of the present application, the difference between the set similarity and the phoneme similarity between the first character sequence and the third character sequence is used as the first score. For example, the set similarity is 10. If the first character sequence 1 is {Li}, the third character sequence is {Li}, and the phoneme similarity between the first character sequence 2 and the third character sequence is 10, then the first score similarity_penalty(1) of the first character sequence 1 = 10 - 10 = 0. If the first character sequence 2 is {Ling}, the third character sequence is {Li}, and the phoneme similarity between the first character sequence 2 and the third character sequence is 6, then the first score similarity_penalty(2) of the first character sequence 2 = 10 - 6 = 4.
[0125] In an embodiment of the present application, based on the first character sequence and multiple set error correction character sequences, a second score is determined to represent the matching degree between the first character sequence and the multiple set error correction character sequences. Figure 12 The flowchart of a method for determining a second score provided by an embodiment of the present application is as Figure 12 shown. The above step 304 at least includes the following steps 121-122: Step 121, sequentially match each character in the first character sequence with multiple set error correction character sequences to determine the matching error correction character sequences.
[0126] In an embodiment of the present application, before sequentially matching each character in the first character sequence with multiple set error correction character sequences to determine the matching error correction character sequences, the user sets corresponding weights (final_weight, final weight / reward score) for each set error correction character sequence according to the actual situation to represent its importance, and sets corresponding weights (incremental_score, incremental score) for each error correction character of each set error correction character sequence.
[0127] Step 122: Determine a second score based on the weight corresponding to the matched error correction character sequence and the weights corresponding to each error correction character in the matched error correction character sequence.
[0128] In an embodiment of the present application, determining the second score based on the weight corresponding to the matched error correction character sequence and the weights corresponding to each error correction character in the matched error correction character sequence includes: summing the weights corresponding to each error correction character in the matched error correction character sequence to obtain a first sum value; using the sum of the weight corresponding to the matched error correction character sequence and the first sum value as the second score of the first character sequence.
[0129] For example, the first character sequence is {Li Hui Ni}, the error correction character sequence 1 is {Li Hui}, the weight corresponding to the error correction character sequence 1 is 5, the weight corresponding to "Li" in the error correction character sequence 1 is 2, the weight corresponding to "Hui" in the error correction character sequence 1 is 2, the error correction character sequence 2 is {Zhang Ling}, the weight corresponding to the error correction character sequence 2 is 6, the weight corresponding to "Zhang" in the error correction character sequence 2 is 2, and the weight corresponding to "Ling" in the error correction character sequence 2 is 2. Each character in the first character sequence is sequentially matched with the error correction character sequence 1 and the error correction character sequence 2 to determine that the matched error correction character sequence is the error correction character sequence 1. The second score (bias_score) of this first character sequence is equal to the sum of the weight corresponding to the error correction character sequence 1 and the weights corresponding to each character in the error correction character sequence 1, that is, bias_score = 2 + 2 + 5 = 9.
[0130] In an embodiment of the present application, the following method can also be used to determine the second score based on the first character sequence and multiple set error correction character sequences: sequentially match each character in the first character sequence with the multiple set error correction character sequences to determine the matched error correction character sequence and the partially matched error correction character sequence, where the partially matched error correction character sequence is an error correction character sequence in which a part of the error correction characters match the characters in the first character sequence and another part of the error correction characters have not been matched with the characters in the first character sequence; determine the second score based on the weight corresponding to the matched error correction character sequence, the weights corresponding to the matched error correction characters in the partially matched error correction character sequence, and the weights corresponding to each error correction character in the matched error correction character sequence.
[0131] In an embodiment of the present application, the second score can be determined based on the first character sequence and multiple set error correction character sequences by using the N-gram (N-ary grammar, a statistical language model based on the Markov model) model. The training method of the N-gram model is prior art and will not be elaborated here.
[0132] Since the traditional N-gram model lacks a hot word incentive mechanism and cannot perform dynamic bias adjustment, and a large amount of labeled data is required to train the N-gram model, in the embodiments of this application, the Aho-Corasick (string search, AC) algorithm can also be used to sequentially match each character in the first character sequence with multiple set error correction character sequences to determine the matching result, and determine the second score based on the matching result. The main idea of the AC algorithm is to construct a state transition machine, and the state transition machine will perform pattern string matching according to the input.
[0133] Specifically, the AC algorithm is used to construct a state transition machine for all set error correction character sequences, and incremental_score is stored at the node corresponding to the error correction character of each error correction character sequence. Taking the error correction character sequence as {Hello, world} as an example: when the "世" in the first character sequence matches the "世" in the error correction character sequence, the incremental_score corresponding to "世" is obtained; when the "界" in the first character sequence matches the "界" in the error correction character sequence, the incremental_score corresponding to "界" is obtained again, and so on, accumulating for each error correction character. When the entire error correction character sequence is completely matched, in addition to accumulating the incremental_score corresponding to all error correction characters of the error correction character sequence, the final_weight corresponding to the error correction character sequence is also obtained additionally. If the matching is interrupted (such as encountering a non-matching character), it will backtrack to the appropriate state through failurelinks (failure links) and retain the accumulated score obtained. Through this progressive scoring mechanism, even partial matching can obtain corresponding incentives, and complete matching can obtain the maximum reward.
[0134] Taking 3 error correction character sequences as an example, according to the importance of each error correction character sequence, the final_weight corresponding to each error correction character sequence is set, and the incremental_score corresponding to each error correction character in each error correction character sequence is set to 2. The error correction character sequence 1 is {Li Hui}, and its corresponding final_weight is 5. The error correction character sequence 2 is {Zhang Ling}, and its corresponding final_weight is 6. The error correction character sequence 3 is {Wang Chang}, and its corresponding final_weight is 7. Based on each error correction character sequence, the following state transition machine is established using the AC algorithm: <start> 0 plum 2 Meeting--2 <end> 5 <start> 0 open 2 Mausoleum 2 <end> 6 <start> 0 king 2 Chang 2 <end>7 As in the state transition machine above, an incremental_score is obtained for each error correction character matched. For example, for a perfect match like "Li Hui", the resulting bias_score = 2 + 2 + 5 = 9. For an imperfect match like "Li Huì", the resulting bias_score = 2 - 2 = 0. Since "Li Huì" is not a perfect match, the previously obtained incremental_score is rolled back via failure links, thus subtracting 2.
[0135] For example, for the first character sequence {Li Hui, do you know Wang}, for the character "Li" in the first character sequence, there is a "Li" in the state transition machine above, and the incremental_score corresponding to "Li" is obtained. The current bias_score = 0 + 2. For the character "Hui" in the first character sequence, after matching "Li", "Hui" is matched, and the incremental_score corresponding to "Hui" is obtained. At the same time, since the error correction character sequence {Li Hui} is perfectly matched, the final_weight corresponding to {Li Hui} is obtained. The current bias_score = 0 + 2 + 2 + 5. For the character "you" in the first character sequence, there is no such character in the state transition machine above, and the current bias_score = 0 + 2 + 2 + 5 + 0. For the character "ren" in the first character sequence, there is no such character in the state transition machine above, and the current bias_score = 0 + 2 + 2 + 5 + 0 + 0. For the character "shi" in the first character sequence, there is no such character in the state transition machine above, and the current bias_score = 0 + 2 + 2 + 5 + 0 + 0 + 0. For the character "Wang" in the first character sequence, there is a "Wang" in the state transition machine above, and the incremental_score corresponding to "Wang" is obtained. The current bias_score = 0 + 2 + 2 + 5 + 0 + 0 + 0 + 2. Therefore, the bias_score of this first character sequence is 11. If the first character sequence is {Li Hui, do you know Wang Chang}, then for the character "Wang" in the first character sequence, there is a "Wang" in the state transition machine above, and the incremental_score corresponding to "Wang" is obtained. After the current bias_score = 0 + 2 + 2 + 5 + 0 + 0 + 0 + 2, for the character "Chang" in the first character sequence, there is no such character in the state transition machine above, and no complete error correction character sequence is matched. So the previous score is rolled back, and the current bias_score = 0 + 2 + 2 + 5 + 0 + 0 + 0 + 2 - 2. Therefore, the bias_score of this first character sequence is 9.
[0136] In this embodiment of the application, in order to ensure the accuracy of the language logic of the first character sequence, a third score is determined based on the language logic feature information of the first character sequence to characterize the degree to which the first character sequence conforms to language logic. Figure 13 A flowchart of a method for determining a third score provided in an embodiment of this application is shown below. Figure 13 As shown, step 305 above includes at least the following steps 131-132: Step 131: Extract features from the first character sequence to obtain the language logic feature information of the first character sequence.
[0137] Step 132: Based on the linguistic logic feature information of the first character sequence, score the first character sequence to obtain the third score.
[0138] In this embodiment, a first character sequence is input into a language logic scoring model to extract features from the first character sequence, obtain language logic feature information, and score the first character sequence based on the language logic feature information, thereby determining a third score. The language logic scoring model can be pre-trained using machine learning methods (such as supervised learning methods). The basic model used by the language logic scoring model, i.e., the preset language logic scoring model, can be various models with scoring functions, such as convolutional neural network models, neural network models, etc.
[0139] In this embodiment of the application, the third score is determined based on the first character sequence by the following method: feature extraction is performed on the first character sequence to obtain the language logic feature information of the first character sequence, and the first character sequence is scored based on the language logic feature information of the first character sequence to obtain the third score. Figure 14 A detailed flowchart of a method for determining a third score provided in an embodiment of this application is shown below. Figure 14 As shown, it includes at least the following steps 141-142: Step 141: Input the first character sequence into the feature extraction layer of the trained language logic scoring model, and extract the language logic feature information of the first character sequence through the feature extraction layer.
[0140] The language logic scoring model consists of an input layer, a feature extraction layer, and an output layer. The language logic scoring model can be a model trained on a neural network or an N-gramm model.
[0141] Step 142: Input the language logic feature information into the output layer of the language logic scoring model, and score the first character sequence based on the language logic feature information to obtain the third score.
[0142] In this embodiment, a higher third score for the first character sequence indicates that the first character sequence conforms more to linguistic logic; a lower third score indicates that the first character sequence does not conform to linguistic logic. For example, if the first character sequence 1 is {Do you know?}, inputting the first character sequence 1 into the linguistic logic scoring model yields a third score lm_score of 20; if the first character sequence 2 is {Ni Zhi Dao Ma}, inputting the first character sequence 2 into the linguistic logic scoring model yields a third score lm_score of 5.
[0143] In this embodiment of the application, a language logic scoring model is trained based on the acquired training dataset. Figure 15 A flowchart illustrating a training method for a language logic scoring model provided in this application embodiment is shown below. Figure 15 As shown, it includes at least the following steps 151-152: Step 151: Obtain the training dataset.
[0144] The training dataset includes multiple training samples, each of which includes a character sequence and a label, where the label is the third score of the character sequence.
[0145] Step 152: Based on the training samples in the training dataset, perform iterative training on the preset language logic scoring model. When the preset iteration termination condition is met, the language logic scoring model is obtained.
[0146] The aforementioned preset iteration termination condition can be set according to the actual situation. For example, the preset iteration termination condition can be that the current iteration number reaches a set iteration number, and the set iteration number can be set according to the actual situation. The preset iteration termination condition can also be that the preset language logic scoring model converges.
[0147] In this embodiment, the preset iteration termination condition includes: real-time monitoring of the change trend of the loss function and evaluation metric, and termination of training when the metric remains stable and reaches a preset threshold. The preset threshold can be determined based on actual circumstances. The loss function can be MAE or MSE. The evaluation metric can be R0. 2 It can also refer to accuracy.
[0148] In this embodiment, the backpropagation algorithm is used to continuously optimize the parameters of the preset language logic scoring model. The method for performing a single iterative training of the language logic scoring model will be described in detail below, such as... Figure 16 As shown: Step 161: Input any training sample from the training dataset into the preset language logic scoring model for processing to obtain the predicted third score of any training sample.
[0149] Step 162: Using the predicted third score of any training sample and the label of any training sample, determine the loss value corresponding to any training sample.
[0150] In this embodiment, determining the loss value corresponding to any training sample based on the predicted third score and label of any training sample includes: determining the loss value corresponding to any training sample using a defined loss function based on the predicted third score and label of any training sample. The defined loss function can be set according to actual conditions; for example, it can be a cross-entropy loss function, KL divergence, MAE, MSE, or other loss functions.
[0151] Step 163: Update the parameters of the preset language logic scoring model using the loss value corresponding to any training sample.
[0152] The following example illustrates the text correction method described above: Step 1: The multiple error-correcting characters are set as Li, Hui, Zhang, Ling, Wang, and Chang. Three error-correcting character sequences are set: Error-correcting character sequence 1 is {Li Hui}, with a final_weight of 5; Error-correcting character sequence 2 is {Zhang Ling}, with a final_weight of 6; and Error-correcting character sequence 3 is {Wang Chang}, with a final_weight of 7. The incremental_score for each error-correcting character in each sequence is set to 2. The following state transition machine is established using the AC algorithm: <start> 0 plum 2 Meeting--2 <end> 5 <start> 0 open 2 Mausoleum 2 <end> 6 <start> 0 king 2 Chang 2 <end>7 Step 2: Obtain the text to be corrected as "Li Hui, do you know Wang Chang". Based on the phoneme similarities between the characters at each character position in the text to be corrected and multiple predefined correction characters, filter to determine the candidate characters at each character position in the text to be corrected: The candidate characters at the 1st character position are {Li, Ling}, the candidate characters at the 2nd character position are {Hui, Hui}, the candidate characters at the 3rd character position are {You, Li, Ling}, the candidate characters at the 4th character position are {Ren}, the candidate characters at the 5th character position are {Shi}, the candidate characters at the 6th character position are {Wang, Chang, Zhang}, and the candidate characters at the 7th character position are {Chang, Chang, Zhang, Wang}.
[0153] Step 3: Take each candidate character at the 1st character position as the first character sequence respectively, and calculate the total_score of each first character sequence: Take the candidate character {Li} at the 1st character position as the first character sequence 1. Based on the first character sequence 1 and the text to be corrected, determine that the similarity_penalty of the first character sequence 1 is 0. Based on the first character sequence 1, use the state transition machine established in Step 1 to determine that the bias_score of the first character sequence 1 is 2. Use the language logic scoring model to process the first character sequence 1, and obtain the lm_score of the first character sequence 1 as 100. Therefore, the total_score of the first character sequence 1 = 100 + 2 - 0 = 102. Take the candidate character {Ling} at the 1st character position as the first character sequence 2. Based on the first character sequence 2 and the text to be corrected, determine that the similarity_penalty of the first character sequence 2 is 4. Based on the first character sequence 2, use the state transition machine established in Step 1 to determine that the bias_score of the first character sequence 2 is 0. Use the language logic scoring model to process the first character sequence 2, and obtain the lm_score of the first character sequence 2 as 90. Therefore, the total_score of the first character sequence 2 = 90 + 0 - 4 = 86.
[0154] Step 4: Sort the total_scores of each first character sequence from largest to smallest, and select beam = 2 first character sequences from front to back as the target character sequences: The target character sequence 1 is {Li}, and the target character sequence 2 is {Ling}.
[0155] Step 5: For the target character sequence 1 and the candidate characters {Hui, Hui} at the 2nd character position in the text to be corrected, obtain 2 second character sequences, namely {Li Hui} and {Li Hui}; for the target character sequence 2 and the candidate characters {Hui, Hui} at the 2nd character position in the text to be corrected, obtain 2 second character sequences, namely {Ling Hui} and {Ling Hui}.
[0156] Step 6: Take each second character sequence as the new first character sequence, and calculate the total_score of each first character sequence: Take the second character sequence {Li Hui} as the first character sequence 1. Based on the first character sequence 1 and the text to be corrected, determine that the similarity_penalty of the first character sequence 1 is 0. Based on the first character sequence 1, use the state transition machine established in Step 1 to determine that the bias_score of the first character sequence 1 is 2 + 2 + 5 = 9. Use the language logic scoring model to process the first character sequence 1, and obtain the lm_score of the first character sequence 1 as 90. Therefore, the total_score of the first character sequence 1 is 90 + 9 - 0 = 99. Take the second character sequence {Li Hui} as the first character sequence 2. Based on the first character sequence 2 and the text to be corrected, determine that the similarity_penalty of the first character sequence 2 is 0. Based on the first character sequence 2, use the state transition machine established in Step 1 to determine that the bias_score of the first character sequence 2 is 2 - 2 = 0. Use the language logic scoring model to process the first character sequence 2, and obtain the lm_score of the first character sequence 2 as 90. Therefore, the total_score of the first character sequence 2 is 90 + 0 - 0 = 90.
[0157] Take the second character sequence {Ling Hui} as the first character sequence 3. Based on the first character sequence 3 and the text to be corrected, determine that the similarity_penalty of the first character sequence 3 is 4. Based on the first character sequence 3, use the state transition machine established in Step 1 to determine that the bias_score of the first character sequence 3 is 0. Use the language logic scoring model to process the first character sequence 3, and obtain the lm_score of the first character sequence 3 as 80. Therefore, the total_score of the first character sequence 3 is 80 + 0 - 4 = 76. Take the second character sequence {Ling Hui} as the first character sequence 4. Based on the first character sequence 4 and the text to be corrected, determine that the similarity_penalty of the first character sequence 4 is 4. Based on the first character sequence 4, use the state transition machine established in Step 1 to determine that the bias_score of the first character sequence 4 is 0. Use the language logic scoring model to process the first character sequence 4, and obtain the lm_score of the first character sequence 4 as 80. Therefore, the total_score of the first character sequence 4 is 80 + 0 - 4 = 76.
[0158] Step 7: Sort the total_score of each first character sequence from largest to smallest, and select beam = 2 first character sequences from front to back as the target character sequences. That is, the target character sequence 1 is {Li Hui}, and the target character sequence 2 is {Li Hui}.
[0159] Step 8. For the candidate characters {Ni, Li, Ling} at the 3rd character position in the target character sequence 1 and the text to be corrected, three second character sequences are obtained, namely {Li Hui Ni}, {Li Hui Li}, and {Li Hui Ling}; for the candidate characters {Ni, Li, Ling} at the 3rd character position in the target character sequence 2 and the text to be corrected, three second character sequences are obtained, namely {Li Hui Ni}, {Li Hui Li}, and {Li Hui Ling}.
[0160] Step 9. Take each second character sequence as the new first character sequence and calculate the total_score of each first character sequence: Take the second character sequence {Li Hui Ni} as the first character sequence 1. Based on the first character sequence 1 and the text to be corrected, determine that the similarity_penalty of the first character sequence 1 is 0. Based on the first character sequence 1, use the state transition machine established in Step 1 to determine that the bias_score of the first character sequence 1 is 9. Use the language logic scoring model to process the first character sequence 1 to obtain the lm_score of the first character sequence 1 as 90. Therefore, the total_score of the first character sequence 1 is 90 + 9 - 0 = 99. Take the second character sequence {Li Hui Li} as the first character sequence 2. Based on the first character sequence 2 and the text to be corrected, determine that the similarity_penalty of the first character sequence 2 is 3. Based on the first character sequence 2, use the state transition machine established in Step 1 to determine that the bias_score of the first character sequence 2 is 9. Use the language logic scoring model to process the first character sequence 2 to obtain the lm_score of the first character sequence 2 as 80. Therefore, the total_score of the first character sequence 2 is 80 + 9 - 3 = 86. Take the second character sequence {Li Hui Ling} as the first character sequence 3. Based on the first character sequence 3 and the text to be corrected, determine that the similarity_penalty of the first character sequence 3 is 4.5. Based on the first character sequence 3, use the state transition machine established in Step 1 to determine that the bias_score of the first character sequence 3 is 9. Use the language logic scoring model to process the first character sequence 3 to obtain the lm_score of the first character sequence 3 as 80. Therefore, the total_score of the first character sequence 3 is 80 + 9 - 4.5 = 84.5.
[0161] Take the second character sequence {Li Hui Ni} as the first character sequence 4. Based on the first character sequence 4 and the text to be corrected, determine that the similarity_penalty of the first character sequence 4 is 0. Based on the first character sequence 4, use the state transition machine established in step 1 to determine that the bias_score of the first character sequence 4 is 0. Use the language logic scoring model to process the first character sequence 4, and obtain the lm_score of the first character sequence 4 as 90. Therefore, the total_score of the first character sequence 4 is 90 + 0 - 0 = 90. Take the second character sequence {Li Hui Li} as the first character sequence 5. Based on the first character sequence 5 and the text to be corrected, determine that the similarity_penalty of the first character sequence 5 is 3. Based on the first character sequence 5, use the state transition machine established in step 1 to determine that the bias_score of the first character sequence 5 is 0. Use the language logic scoring model to process the first character sequence 5, and obtain the lm_score of the first character sequence 5 as 80. Therefore, the total_score of the first character sequence 5 is 80 + 0 - 3 = 77. Take the second character sequence {Li Hui Ling} as the first character sequence 6. Based on the first character sequence 6 and the text to be corrected, determine that the similarity_penalty of the first character sequence 6 is 4.5. Based on the first character sequence 6, use the state transition machine established in step 1 to determine that the bias_score of the first character sequence 6 is 0. Use the language logic scoring model to process the first character sequence 6, and obtain the lm_score of the first character sequence 6 as 80. Therefore, the total_score of the first character sequence 6 is 80 + 0 - 4.5 = 75.5.
[0162] Step 10: Sort the total_scores of each first character sequence from largest to smallest, and select beam = 2 first character sequences from front to back as the target character sequences. That is, the target character sequence 1 is {Li Hui Ni}, and the target character sequence 2 is {Li Hui Ni}.
[0163] Step 11: For the candidate character {Ren} at the 4th character position in the target character sequence 1 and the text to be corrected, obtain 1 second character sequence, that is, {Li Hui Ni Ren}; for the candidate character {Ren} at the 3rd character position in the target character sequence 2 and the text to be corrected, obtain 1 second character sequence, that is, {Li Hui Ni Ren}.
[0164] Step 12: Take each second character sequence as the new first character sequence, and calculate the total_score of each first character sequence: Take the second character sequence {Li Hui, do you recognize} as the first character sequence 1. Based on the first character sequence 1 and the text to be error-corrected, determine that the similarity_penalty of the first character sequence 1 is 0. Based on the first character sequence 1, use the state transition machine established in step 1 to determine that the bias_score of the first character sequence 1 is 9. Use the language logic scoring model to process the first character sequence 1, and obtain the lm_score of the first character sequence 1 as 90. Therefore, the total_score of the first character sequence 1 is 90 + 9 - 0 = 99. Take the second character sequence {Li Hui, do you recognize} as the first character sequence 2. Based on the first character sequence 2 and the text to be error-corrected, determine that the similarity_penalty of the first character sequence 2 is 0. Based on the first character sequence 2, use the state transition machine established in step 1 to determine that the bias_score of the first character sequence 2 is 9. Use the language logic scoring model to process the first character sequence 2, and obtain the lm_score of the first character sequence 2 as 90. Therefore, the total_score of the first character sequence 2 is 90 + 9 - 0 = 99.
[0165] Step 13: Sort the total_scores of each first character sequence from largest to smallest, and select beam = 2 first character sequences from front to back as the target character sequences. That is, the target character sequence 1 is {Li Hui, do you recognize}, and the target character sequence 2 is {Li Hui, do you recognize}.
[0166] Step 14: For the candidate character {recognize} at the 5th character position in the target character sequence 1 and the text to be error-corrected, obtain 1 second character sequence, that is, {Li Hui, do you recognize}; for the candidate character {recognize} at the 5th character position in the target character sequence 2 and the text to be error-corrected, obtain 1 second character sequence, that is, {Li Hui, do you recognize}.
[0167] Step 15: Take each second character sequence as the new first character sequence, and calculate the total_score of each first character sequence: Take the second character sequence {Li Hui, do you know} as the first character sequence 1. Based on the first character sequence 1 and the text to be corrected, determine that the similarity_penalty of the first character sequence 1 is 0. Based on the first character sequence 1, use the state transition machine established in step 1 to determine that the bias_score of the first character sequence 1 is 9. Use the language logic scoring model to process the first character sequence 1, and obtain the lm_score of the first character sequence 1 as 90. Therefore, the total_score of the first character sequence 1 is 90 + 9 - 0 = 99. Take the second character sequence {Li Hui, do you know} as the first character sequence 2. Based on the first character sequence 2 and the text to be corrected, determine that the similarity_penalty of the first character sequence 2 is 0. Based on the first character sequence 2, use the state transition machine established in step 1 to determine that the bias_score of the first character sequence 2 is 9. Use the language logic scoring model to process the first character sequence 2, and obtain the lm_score of the first character sequence 2 as 90. Therefore, the total_score of the first character sequence 2 is 90 + 9 - 0 = 99.
[0168] Step 16: Sort the total_scores of each first character sequence from largest to smallest, and select beam = 2 first character sequences from front to back as the target character sequences. That is, the target character sequence 1 is {Li Hui, do you know}, and the target character sequence 2 is {Li Hui, do you know}.
[0169] Step 17: For the candidate characters {Wang, Chang, Zhang} at the 6th character position in the target character sequence 1 and the text to be corrected, obtain 3 second character sequences, namely {Li Hui, do you know Wang}, {Li Hui, do you know Chang}, and {Li Hui, do you know Zhang}; for the candidate characters {Wang, Chang, Zhang} at the 6th character position in the target character sequence 2 and the text to be corrected, obtain 3 second character sequences, namely {Li Hui, do you know Wang}, {Li Hui, do you know Chang}, and {Li Hui, do you know Zhang}.
[0170] Step 18: Take each second character sequence as the new first character sequence, and calculate the total_score of each first character sequence: Take the second character sequence {Li Hui, do you know Wang} as the first character sequence 1. Based on the first character sequence 1 and the text to be error-corrected, determine that the similarity_penalty of the first character sequence 1 is 0. Based on the first character sequence 1, use the state transition machine established in step 1 to determine that the bias_score of the first character sequence 1 is 11. Use the language logic scoring model to process the first character sequence 1, and obtain the lm_score of the first character sequence 1 as 90. Therefore, the total_score of the first character sequence 1 is 90 + 11 - 0 = 101. Take the second character sequence {Li Hui, do you know Chang} as the first character sequence 2. Based on the first character sequence 2 and the text to be error-corrected, determine that the similarity_penalty of the first character sequence 2 is 4. Based on the first character sequence 2, use the state transition machine established in step 1 to determine that the bias_score of the first character sequence 2 is 9. Use the language logic scoring model to process the first character sequence 2, and obtain the lm_score of the first character sequence 2 as 80. Therefore, the total_score of the first character sequence 2 is 80 + 9 - 4 = 85. Take the second character sequence {Li Hui, do you know Zhang} as the first character sequence 3. Based on the first character sequence 3 and the text to be error-corrected, determine that the similarity_penalty of the first character sequence 3 is 4. Based on the first character sequence 3, use the state transition machine established in step 1 to determine that the bias_score of the first character sequence 3 is 9. Use the language logic scoring model to process the first character sequence 3, and obtain the lm_score of the first character sequence 3 as 80. Therefore, the total_score of the first character sequence 3 is 80 + 9 - 4 = 85.
[0171] Take the second character sequence {Li Hui, do you know Wang} as the first character sequence 4. Based on the first character sequence 4 and the text to be error-corrected, determine that the similarity_penalty of the first character sequence 4 is 0. Based on the first character sequence 4, use the state transition machine established in step 1 to determine that the bias_score of the first character sequence 4 is 2. Use the language logic scoring model to process the first character sequence 4, and obtain the lm_score of the first character sequence 4 as 90. Therefore, the total_score of the first character sequence 4 is 90 + 2 - 0 = 92. Take the second character sequence {Li Hui, do you know Chang} as the first character sequence 5. Based on the first character sequence 5 and the text to be error-corrected, determine that the similarity_penalty of the first character sequence 5 is 4. Based on the first character sequence 5, use the state transition machine established in step 1 to determine that the bias_score of the first character sequence 5 is 0. Use the language logic scoring model to process the first character sequence 5, and obtain the lm_score of the first character sequence 5 as 80. Therefore, the total_score of the first character sequence 5 is 80 + 0 - 4 = 76. Take the second character sequence {Li Hui, do you know Zhang} as the first character sequence 6. Based on the first character sequence 6 and the text to be error-corrected, determine that the similarity_penalty of the first character sequence 6 is 4. Based on the first character sequence 6, use the state transition machine established in step 1 to determine that the bias_score of the first character sequence 6 is 2. Use the language logic scoring model to process the first character sequence 6, and obtain the lm_score of the first character sequence 6 as 80. Therefore, the total_score of the first character sequence 6 is 80 + 2 - 4 = 78.
[0172] Step 19, sort the total_scores of each first character sequence from largest to smallest, and select beam = 2 first character sequences from front to back as the target character sequences. That is, the target character sequence 1 is {Li Hui, do you know Wang}, and the target character sequence 2 is {Li Hui, do you know Wang}.
[0173] Step 20, for the candidate characters {Chang, Wang, Chang, Zhang} at the 7th character position in the target character sequence 1 and the text to be error-corrected, obtain 4 second character sequences, namely {Li Hui, do you know Wang Chang}, {Li Hui, do you know Wang Wang}, {Li Hui, do you know Wang Chang}, and {Li Hui, do you know Wang Zhang}; for the candidate characters {Chang, Wang, Chang, Zhang} at the 7th character position in the target character sequence 2 and the text to be error-corrected, obtain 4 second character sequences, namely {Li Hui, do you know Wang Chang}, {Li Hui, do you know Wang Wang}, {Li Hui, do you know Wang Chang}, and {Li Hui, do you know Wang Zhang}.
[0174] Step 21, take each second character sequence as a new first character sequence, and calculate the total_score of each first character sequence: Take the second character sequence {Li Hui, do you know Wang Chang} as the first character sequence 1. Based on the first character sequence 1 and the text to be error-corrected, determine that the similarity_penalty of the first character sequence 1 is 0. Based on the first character sequence 1, use the state transition machine established in step 1 to determine that the bias_score of the first character sequence 1 is 9. Use the language logic scoring model to process the first character sequence 1, and obtain the lm_score of the first character sequence 1 as 90. Therefore, the total_score of the first character sequence 1 is 90 + 9 - 0 = 99. Take the second character sequence {Li Hui, do you know Wang Wang} as the first character sequence 2. Based on the first character sequence 2 and the text to be error-corrected, determine that the similarity_penalty of the first character sequence 2 is 4. Based on the first character sequence 2, use the state transition machine established in step 1 to determine that the bias_score of the first character sequence 2 is 9. Use the language logic scoring model to process the first character sequence 2, and obtain the lm_score of the first character sequence 2 as 80. Therefore, the total_score of the first character sequence 2 is 80 + 9 - 4 = 85. Take the second character sequence {Li Hui, do you know Wang Chang} as the first character sequence 3. Based on the first character sequence 3 and the text to be error-corrected, determine that the similarity_penalty of the first character sequence 3 is 0. Based on the first character sequence 3, use the state transition machine established in step 1 to determine that the bias_score of the first character sequence 3 is 20. Use the language logic scoring model to process the first character sequence 3, and obtain the lm_score of the first character sequence 3 as 90. Therefore, the total_score of the first character sequence 3 is 90 + 20 - 0 = 110. Take the second character sequence {Li Hui, do you know Wang Zhang} as the first character sequence 4. Based on the first character sequence 4 and the text to be error-corrected, determine that the similarity_penalty of the first character sequence 4 is 4. Based on the first character sequence 4, use the state transition machine established in step 1 to determine that the bias_score of the first character sequence 4 is 9. Use the language logic scoring model to process the first character sequence 4, and obtain the lm_score of the first character sequence 4 as 80. Therefore, the total_score of the first character sequence 4 is 80 + 9 - 4 = 85.
[0175] Take the second character sequence {Li Hui, do you know Wang Chang} as the first character sequence 5. Based on the first character sequence 5 and the text to be corrected, determine that the similarity_penalty of the first character sequence 5 is 0. Based on the first character sequence 5, use the state transition machine established in step 1 to determine that the bias_score of the first character sequence 5 is 0. Use the language logic scoring model to process the first character sequence 5, and obtain the lm_score of the first character sequence 5 as 90. Therefore, the total_score of the first character sequence 5 is 90 + 0 - 0 = 90. Take the second character sequence {Li Hui, do you know Wang Wang} as the first character sequence 6. Based on the first character sequence 6 and the text to be corrected, determine that the similarity_penalty of the first character sequence 6 is 4. Based on the first character sequence 6, use the state transition machine established in step 1 to determine that the bias_score of the first character sequence 6 is 0. Use the language logic scoring model to process the first character sequence 6, and obtain the lm_score of the first character sequence 6 as 80. Therefore, the total_score of the first character sequence 6 is 80 + 0 - 4 = 76. Take the second character sequence {Li Hui, do you know Wang Chang} as the first character sequence 7. Based on the first character sequence 7 and the text to be corrected, determine that the similarity_penalty of the first character sequence 7 is 0. Based on the first character sequence 7, use the state transition machine established in step 1 to determine that the bias_score of the first character sequence 7 is 11. Use the language logic scoring model to process the first character sequence 7, and obtain the lm_score of the first character sequence 7 as 90. Therefore, the total_score of the first character sequence 7 is 90 + 11 - 0 = 101. Take the second character sequence {Li Hui, do you know Wang Zhang} as the first character sequence 8. Based on the first character sequence 8 and the text to be corrected, determine that the similarity_penalty of the first character sequence 8 is 4. Based on the first character sequence 8, use the state transition machine established in step 1 to determine that the bias_score of the first character sequence 8 is 0. Use the language logic scoring model to process the first character sequence 8, and obtain the lm_score of the first character sequence 8 as 80. Therefore, the total_score of the first character sequence 8 is 80 + 0 - 4 = 76.
[0176] Step 22, determine that the total_score of the first character sequence 3 is the highest, and take the first character sequence 3 {Li Hui, do you know Wang Chang} as the target text.
[0177] Therefore, after correcting the text to be corrected {Li Hui, do you know Wang Chang}, the obtained target text is {Li Hui, do you know Wang Chang}.
[0178] Based on the same technical concept, the present application exemplarily provides a text correction device, such as Figure 17 As shown, the device includes: The first determining module 171 is used to determine candidate characters for each character position in the text to be corrected based on the characters at each character position in the text to be corrected and multiple set correction characters. Execution module 172, comprising a second determining module 1721, a first selecting module 1722, and a third determining module 1723, is used to repeatedly perform the following operations: taking each candidate character at the initial character position in the text to be corrected as a first character sequence, and taking the initial character position as the current character position. The second determining module 1721 is configured to, for each first character sequence, determine a first score representing the degree of penalty for the phoneme similarity between the first character sequence and the text to be corrected, based on the first character sequence and the text to be corrected; determine a second score representing the degree of matching between the first character sequence and the multiple set error-correcting character sequences, based on the first character sequence and the multiple set error-correcting character sequences; and determine a target score for the first character sequence based on the first score and the second score. The first selection module 1722 is used to select a target character sequence from each first character sequence based on the target score of each first character sequence; The third determining module 1723 is used to determine a second character sequence based on the target character sequence and each candidate character at the next character position in the text to be corrected, and to use the second character sequence as a new first character sequence and the next character position as a new current character position, until the next character position exceeds the terminating character position in the text to be corrected. The second selection module 173 is used to select target text from each target character sequence based on the target score of each target character sequence.
[0179] Since the principle of the above-mentioned text correction device in solving the problem is similar to that of the text correction method, the implementation of the above-mentioned text correction device can be referred to the implementation of the method, and the repeated parts will not be described again.
[0180] Based on the same inventive concept, this application provides an electronic device that can realize the function of the text correction device described above. Please refer to... Figure 18 The device includes a processor 181 and a memory 182, wherein the memory 182 is used to store program instructions; The processor 181 calls the program instructions stored in the memory and executes the program instructions to perform the following steps: Based on the characters at each position in the text to be corrected and multiple set correction characters, candidate characters at each position in the text to be corrected are determined; Take each candidate character at the initial character position in the text to be corrected as the first character sequence, and take the initial character position as the current character position, and repeat the following operations: For each first character sequence, based on the first character sequence and the text to be corrected, a first score is determined to characterize the degree of penalty for the phoneme similarity between the first character sequence and the text to be corrected; based on the first character sequence and a plurality of set correction character sequences, a second score is determined to characterize the degree of matching between the first character sequence and the plurality of set correction character sequences; based on the first score and the second score, a target score for the first character sequence is determined. Based on the target scores of each first character sequence, select the target character sequence from each first character sequence; Based on the target character sequence and each candidate character at the next character position in the text to be corrected, a second character sequence is determined, and the second character sequence is used as the new first character sequence, and the next character position is used as the new current character position, until the next character position exceeds the terminating character position in the text to be corrected; Based on the target scores of each target character sequence, select the target text from each target character sequence.
[0181] The processor 181 calls the program instructions stored in the memory and executes the program instructions to implement the text correction method provided in the above embodiments.
[0182] Based on the same inventive concept, embodiments of this application provide a computer-readable storage medium. The computer program product includes computer program code, which, when executed on a computer, causes the computer to perform any of the text correction methods discussed above. Since the principle by which the above-described computer-readable storage medium solves the problem is similar to that of the text correction methods, the implementation of the above-described computer-readable storage medium can be referred to the implementation of the method; repeated details will not be elaborated further.
[0183] Based on the same inventive concept, this application also provides a computer program product, which includes computer program code that, when run on a computer, causes the computer to execute any of the text correction methods discussed above. Since the principle by which the above computer program product solves the problem is similar to that of the text correction method, the implementation of the above computer program product can be referred to the implementation of the method, and repeated details will not be elaborated further.
[0184] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0185] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to this application. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0186] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0187] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of user-operated steps to be executed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0188] Obviously, those skilled in the art can make various modifications and variations to this application without departing from the spirit and scope of this application. Therefore, if such modifications and variations fall within the scope of the claims of this application and their equivalents, this application also intends to include such modifications and variations.< / end> < / start> < / end> < / start> < / end> < / start> < / end> < / start> < / end> < / start> < / end> < / start>
Claims
1. A text error correction method, characterized in that, include: Based on the characters at each position in the text to be corrected and multiple set correction characters, candidate characters at each position in the text to be corrected are determined; Take each candidate character at the initial character position in the text to be corrected as the first character sequence, and take the initial character position as the current character position, and repeat the following operations: For each first character sequence, based on the first character sequence and the text to be corrected, a first score is determined to characterize the degree of penalty for the phoneme similarity between the first character sequence and the text to be corrected; Based on the first character sequence and multiple set error-correcting character sequences, a second score is determined to characterize the degree of matching between the first character sequence and the multiple set error-correcting character sequences; based on the first score and the second score, a target score for the first character sequence is determined. Based on the target scores of each first character sequence, select the target character sequence from each first character sequence; Based on the target character sequence and each candidate character at the next character position in the text to be corrected, a second character sequence is determined, and the second character sequence is used as the new first character sequence, and the next character position is used as the new current character position, until the next character position exceeds the terminating character position in the text to be corrected; Based on the target scores of each target character sequence, select the target text from each target character sequence.
2. The method as described in claim 1, characterized in that, Before determining the target score of the first character sequence based on the first score and the second score, the method further includes: Based on the linguistic logic feature information of the first character sequence, a third score is determined to characterize the degree to which the first character sequence conforms to linguistic logic; Determining the target score of the first character sequence based on the first score and the second score includes: Based on the first score, the second score, and the third score, a target score for the first character sequence is determined.
3. The method as described in claim 2, characterized in that, The determination of a third score, based on the linguistic logic feature information of the first character sequence, to characterize the degree to which the first character sequence conforms to linguistic logic includes: Feature extraction is performed on the first character sequence to obtain the language logic feature information of the first character sequence; Based on the linguistic logic feature information of the first character sequence, the first character sequence is scored to obtain the third score.
4. The method as described in claim 1, characterized in that, The step of determining a first score, based on the first character sequence and the text to be corrected, to characterize the degree of penalty for the phoneme similarity between the first character sequence and the text to be corrected, includes: Based on the character position in the text to be corrected corresponding to each character in the first character sequence and the text to be corrected, a third character sequence is determined; Feature extraction is performed on the first character sequence to obtain the first phoneme feature information, and feature extraction is performed on the third character sequence to obtain the second phoneme feature information; Based on the first phoneme feature information and the second phoneme feature information, the phoneme similarity between the first character sequence and the third character sequence is determined; The first score is determined based on the phoneme similarity and set similarity between the first character sequence and the third character sequence.
5. The method as described in claim 1, characterized in that, The step of determining a second score, based on the first character sequence and a plurality of predefined error-correcting character sequences, to characterize the degree of matching between the first character sequence and the plurality of predefined error-correcting character sequences, includes: Each character in the first character sequence is matched sequentially with the plurality of predefined error correction character sequences to determine the matching error correction character sequence; The second score is determined based on the weights corresponding to the matched error-correcting character sequence and the weights corresponding to each error-correcting character in the matched error-correcting character sequence.
6. The method as described in claim 1, characterized in that, The process of determining candidate characters for each position in the text to be corrected, based on the characters at each position and multiple predefined correction characters, includes: For any given character position, determine the phonemic similarity between the character at that given character position in the text to be corrected and the plurality of set correction characters; The error correction character whose phoneme similarity exceeds a set threshold and the character at any given character position are used as candidate characters for that given character position.
7. The method as described in claim 6, characterized in that, The step of determining the phonemic similarity between a character at any position in the text to be corrected and the plurality of preset correction characters includes: For any error-correcting character, feature extraction is performed on the character at that position to obtain the third phoneme feature information, and feature extraction is performed on the error-correcting character to obtain the fourth phoneme feature information; Based on the third phoneme feature information and the fourth phoneme feature information, the phoneme similarity between the character at any given character position and any given error-correcting character is determined.
8. The method as described in claim 1, characterized in that, The text to be corrected was obtained through the following method: Acquire the speech data to be recognized; The speech data to be identified is subjected to feature extraction to obtain speech feature information; Based on the speech feature information, speech recognition is performed on the speech data to obtain text data, and the text data is used as the text to be corrected.
9. A text correction device, characterized in that, include: The first determining module is used to determine candidate characters for each character position in the text to be corrected based on the characters at each character position in the text to be corrected and multiple set correction characters. The execution module includes a second determining module, a first selecting module, and a third determining module. The execution module is used to take each candidate character at the initial character position in the text to be corrected as a first character sequence, and take the initial character position as the current character position, and repeatedly perform the following operations: The second determining module is configured to, for each first character sequence, determine a first score, based on the first character sequence and the text to be corrected, a first score representing the degree of penalty for the phoneme similarity between the first character sequence and the text to be corrected; Based on the first character sequence and multiple set error-correcting character sequences, a second score is determined to characterize the degree of matching between the first character sequence and the multiple set error-correcting character sequences; based on the first score and the second score, a target score for the first character sequence is determined. The first selection module is used to select a target character sequence from each first character sequence based on the target score of each first character sequence; The third determining module is used to determine a second character sequence based on the target character sequence and each candidate character at the next character position in the text to be corrected, and to use the second character sequence as the new first character sequence and the next character position as the new current character position, until the next character position exceeds the terminating character position in the text to be corrected; The second selection module is used to select target text from each target character sequence based on the target score of each target character sequence.
10. An electronic device, characterized in that, include: Memory, used to store program instructions; A processor is configured to invoke program instructions stored in the memory and execute the steps of the method according to any one of claims 1-8.