# Grammar Correction for Multiple Errors in Chinese Based on Prompt Templates
## 1 Introduction  
Grammar correction, an incredibly crucial application task, plays a role in education, official document processing, and many pre-processing stages of natural language processing tasks. While grammatical errors can occur in any language, this paper only focuses on the grammar-correction task in Chinese text. Influenced by Chinese text's inherent characteristics and usage habits, Chinese grammar error correction (CGEC) errors show noticeable differences and diversity. Furthermore, for non-native speakers' Chinese sentences, multiple types of errors often occur in a single sentence. Under such high-error density conditions, accurately detecting and correcting complex and diverse Chinese grammatical errors is a challenging task. The types of grammatical errors can be broadly divided into redundancy errors (R), missing errors (M), word order errors (W), and wrong word errors (S), based on their characteristics [1]. R-type errors refer to the existence of unnecessary or repetitive linguistic elements in a sentence, leading to verbosity or unnecessary repetition. M-type errors denote the absence of essential linguistic elements or structures in asentence, causing the sentence to be incomplete or not fluent. W-type errors point to an incorrect word or phrase order in a sentence, resulting in grammar rules or unclear meaning violations. S-type errors signify the presence of misspelled words in a sentence, making the sentence inaccurate or hard to understand. For example, Table 1 shows situations of these four types of errors in Chinese text. Two essential methods are typically employed in solving the Chinese grammar error correction (CGEC) problem: sequence labeling and text generation. The sequence labeling approach first assigns labels to each character in the text, indicating whether it should be \"added, deleted, modified, or retained\". Then, by learning the dependencies between the labels, they allocate corresponding labels to the characters and finally modify the text sequence according to the labels to obtain the correct text. The text generation approach, meanwhile, focuses on understanding the relationships between characters in the input text and employs generative language models to produce corrected text. However, due to the interference of erroneous characters, these methods often learn incorrect dependencies on the semantic information of erroneous characters, thus modifying correct characters into erroneous ones. Furthermore, when multiple errors exist in a single sentence, they overlook the consideration of information corrected from previous errors. In response to the characteristics of Chinese text data in high-error-density domains and the problems with the above methods, this paper proposes a Chinese multi-error grammar-correction method based on a prompt template. This method follows a three-step framework: error detection, template construction, and prediction correction. Specifically, in the error-detection module, we have built a sequence labeling model for grammar error detection based on the pre-trained masked model MacBERT [2] (MLM as correction BERT) -BiLSTM-CRF architecture, to identify the positions and types of grammar errors in sentences. Then, in the prompt template construction module, we designed corresponding prompt template construction strategies according to the positions and types of grammar errors obtained. We use [MASK] to hide the information of erroneous characters in the prompt template and then use BERT's masking prediction capability to predict the [MASK] position in the prompt template. At the same time, the information on corrected errors is dynamically updated in the prompt template during the masking prediction process. Finally, we have integrated BERT's predictions with confusion sets to generate a more accurate final correction. These confusion sets include phonetically or visually similar characters; for instance, due to visual similarity, the characters '\(\lambda\)' and '\(\lambda\)' would be in the same confusion set.