pycorrector is a Python toolkit for Chinese text error correction that supports multiple neural models out of the box.
The toolkit addresses the problem of correcting various types of Chinese text errors including phonetic similarities, visual similarities, grammatical mistakes, and proper noun errors. It implements multiple correction approaches: Kenlm language models for statistical correction, sequence-to-sequence models like ConvSeq2Seq, and transformer-based models including BERT, MacBERT, ELECTRA, ERNIE, and large language models like ChatGLM3 and Qwen. Users can select the model that best fits their use case, whether they need lightweight statistical approaches or more sophisticated neural methods.
The toolkit is most suitable for projects handling Chinese text that need to address multiple error types simultaneously. Different input methods and downstream tasks have varying priorities: pinyin input methods and speech recognition focus on phonetic errors, while OCR and handwriting recognition focus on visual errors, and search engines need to handle all error types. The project provides pre-trained models and evaluation benchmarks to help developers choose the right approach for their specific scenario.
The project maintains active development with regular model updates and performance improvements. Recent work has focused on integrating newer large language models and optimizing inference speed for specialized correction components. The toolkit includes comprehensive documentation and model releases on public model repositories to support adoption.