KSEC: A Knowledge-Enhanced Approach for Variable-Length Chinese Spelling Correction
Chinese Spelling Correction (CSC) is a fundamental task in Natural Language Processing (NLP) aimed at identifying and correcting character errors in Chinese texts. It significantly enhances text readability and semantic accuracy. Most deep learning-based CSC methods focus on isometric correction, ensuring identical lengths for input and output sequences. However, they struggle with variable-length errors like splitting errors—where a single character is incorrectly divided into two (e.g., splitting “明” into “日” and “月”). These errors are challenging because they disrupt token alignment, preventing standard sequence-labeling models from mapping inputs to outputs effectively. To overcome this limitation, we propose KSEC (Knowledge-enhanced Splitting Error Corrector), a novel framework tailored for variable-length corrections. KSEC automatically constructs a splitting character knowledge base from public corpora to provide factual validation for correction outcomes. Furthermore, we design a variable-length architecture integrating an attention mechanism and introduce an alignment-aware loss function that optimizes sequence-to-sequence token mapping. Extensive experiments on standard CSC and CSEC benchmarks demonstrate that KSEC achieves state-of-the-art performance among lightweight models of similar size and outperforms existing methods across multiple evaluation metrics.