# US 11,443,100 B2 · Method and apparatus for correcting character errors, electronic device and storage medium

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 11,443,100 B2
- Document ID: US11443100B2
- Status: Granted
- Kind: B2
- Application number: 16/950,975
- Filed: 2020-11-18
- Published: 2021-12-16
- Granted: 2022-09-13
- Earliest claimed: 2020-06-11
- Assignees: Beijing Baidu Netcom Science Technology Co., Ltd.
- Applicants: Beijing Baidu Netcom Science and Technology Co., Ltd.
- Inventors: Mengdi Xu; Zhuobin Deng; Jiawei Lai; Zhihong Fu; Jingzhou He
- Web page: https://patentgrep.com/patent/US11443100B2

## CPC

- G06F 40/232: Orthographic correction, e.g. spell checking or vowelisation
- G06F 18/2113: by ranking or filtering the set of features, e.g. using a measure of variance or of feature cross-correlation
- G06F 18/2431: Multiple classes
- G06F 40/166: Editing, e.g. inserting or deleting
- G06F 40/20: Natural language analysis (semantic analysis of natural language G06F40/30)
- G06F 40/279: Recognition of textual entities
- G06N 20/00: Machine learning
- Y02D 10/00: Energy efficient computing, e.g. low power processors, power management or thermal management
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)
- G06N: COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- Y02D: CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE

## Abstract

A method and apparatus for correcting character errors, an electronic device and a storage medium are disclosed, which relates to the natural language processing field and the deep learning field. The method may include: for a character to be processed, acquiring the score of each character in a pre-constructed vocabulary, the score being a score of the reasonability of the character in the vocabulary at the position of the character to be processed; selecting top K characters as candidates of the character to be processed, K being a positive integer greater than one; selecting an optimal candidate from the K candidates; and replacing the character to be processed with the optimal candidate if the optimal candidate is different from the character to be processed. With the solution of the present application, the accuracy of an error correction result, or the like, may be improved.

## Claims

### Claim 1

A computer-implemented method for correcting character errors, comprising:
for a character to be processed, acquiring the score of each character in a pre-constructed vocabulary, the score being a score of the reasonability of the character in the vocabulary at the position of the character to be processed; selecting top K characters as candidates of the character to be processed, K being a positive integer greater than one; and
selecting an optimal candidate from the K candidates, and replacing the character to be processed with the optimal candidate if the optimal candidate is different from the character to be processed,
wherein the acquiring the score of each character in a pre-constructed vocabulary comprises: determining the score of each character in the vocabulary with a pre-trained language model,
wherein the acquiring the language model comprises:
acquiring first-class training data, any piece of the first-class training data comprising an input text and an output text which are the same and do not contain wrongly written characters;
pre-training the language model at character granularity utilizing the first-class training data;
acquiring second-class training data, any piece of the second-class training data comprising an input text containing wrongly written characters and an output text which is a correct text corresponding to the input text and does not contain wrongly written characters; and
fine-tuning the language model using the second-class training data, and
in the fine-tuning process, only the position of the wrongly written character is calculated to update the parameters of the language model.

### Claim 2 (depends on 1)

The method according to claim 1, further comprising: using N characters in a text to be processed as the characters to be processed, N being a positive integer and having a maximum value equal to the number of characters comprised in the text to be processed.

### Claim 3 (depends on 1)

The method according to claim 1, wherein the selecting an optimal candidate from the K candidates comprises:
ranking the K candidates, and selecting the top M candidates after ranking, M being a positive integer greater than one and less than K; and
considering context information of the position of the character to be processed for decoding, and selecting the optimal candidate from the M candidates.

### Claim 4 (depends on 3)

The method according to claim 3, wherein the ranking the K candidates comprises:
acquiring predetermined features corresponding to any candidate, and scoring the candidate according to the predetermined features and a pre-trained candidate ranking model; and
ranking the K candidates according to the corresponding scores from high to low.

### Claim 5

An electronic device, comprising:
at least one processor; and
a memory communicatively connected with the at least one processor;
wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform a method for correcting character errors, wherein the method comprises:
for a character to be processed, acquiring the score of each character in a pre-constructed vocabulary, the score being a score of the reasonability of the character in the vocabulary at the position of the character to be processed; selecting top K characters as candidates of the character to be processed, K being a positive integer greater than one; and
selecting an optimal candidate from the K candidates, and replacing the character to be processed with the optimal candidate if the optimal candidate is different from the character to be processed,
wherein the acquiring the score of each character in a pre-constructed vocabulary comprises: determining the score of each character in the vocabulary with a pre-trained language model,
wherein the acquiring the language model comprises:
acquiring first-class training data, any piece of the first-class training data comprising an input text and an output text which are the same and do not contain wrongly written characters;
pre-training the language model at character granularity utilizing the first-class training data;
acquiring second-class training data, any piece of the second-class training data comprising an input text containing wrongly written characters and an output text which is a correct text corresponding s to the input text and does not contain wrongly written characters; and
fine-tuning the language model using the second-class training data, and
in the fine-tuning process, only the position of the wrongly written character is calculated to update the parameters of the language model.

### Claim 6 (depends on 5)

The electronic device according to claim 5, further comprising: using N characters in a text to be processed as the characters to be processed, N being a positive integer and having a maximum value equal to the number of characters comprised in the text to be processed.

### Claim 7 (depends on 5)

The electronic device according to claim 5, wherein the selecting an optimal candidate from the K candidates comprises:
ranking the K candidates, and selecting the top M candidates after ranking, M being a positive integer greater than one and less than K; and
considering context information of the position of the character to be processed for decoding, and selecting the optimal candidate from the M candidates.

### Claim 8 (depends on 7)

The electronic device according to claim 7, wherein the ranking the K candidates comprises:
acquiring predetermined features corresponding to any candidate, and scoring the candidate according to the predetermined features and a pre-trained candidate ranking model; and
ranking the K candidates according to the corresponding scores from high to low.

### Claim 9

A non-transitory computer-readable storage medium storing computer instructions therein, wherein the computer instructions are used to cause the computer to perform a method for correcting character errors, wherein the method comprises:
for a character to be processed, acquiring the score of each character in a pre-constructed vocabulary, the score being a score of the reasonability of the character in the vocabulary at the position of the character to be processed; selecting top K characters as candidates of the character to be processed, K being a positive integer greater than one; and
selecting an optimal candidate from the K candidates, and replacing the character to be processed with the optimal candidate if the optimal candidate is different from the character to be processed,
wherein the acquiring the score of each character in a pre-constructed vocabulary comprises: determining the score of each character in the vocabulary with a pre-trained language model,
wherein the acquiring the language model comprises:
acquiring first-class training data, any piece of the first-class training data comprising an input text and an output text which are the same and do not contain wrongly written characters;
pre-training the language model at character granularity utilizing the first-class training data;
acquiring second-class training data, any piece of the second-class training data comprising an input text containing wrongly written characters and an output text which is a correct text corresponding to the input text and does not contain wrongly written characters; and
fine-tuning the language model using the second-class training data, and
in the fine-tuning process, only the position of the wrongly written character is calculated to update the parameters of the language model.

### Claim 10 (depends on 9)

The non-transitory computer-readable storage medium according to claim 9, further comprising: using N characters in a text to be processed as the characters to be processed, N being a positive integer and having a maximum value equal to the number of characters comprised in the text to be processed.

### Claim 11 (depends on 9)

The non-transitory computer-readable storage medium according to claim 9, wherein the selecting an optimal candidate from the K candidates comprises:
ranking the K candidates, and selecting the top M candidates after ranking, M being a positive integer greater than one and less than K; and
considering context information of the position of the character to be processed for decoding, and selecting the optimal candidate from the M candidates.
