Dynamic lexicon integration and update in BERT for enhanced named entity recognition in Chinese legal contracts
摘要
In this study, we address the specific challenges of Named Entity Recognition (NER) in Chinese legal contracts. Traditional Chinese NER systems struggle to balance the loss of important lexical information when using character-based segmentation and the high accuracy and extensive data requirements of word-level segmentation. To bridge this gap, we propose CW-BERT (Character-Word BERT), a novel framework that integrates external lexicon knowledge into BERT through two modules: Character Adapters (CA) and Word Adapters (WA). The Character Adapter enriches each character representation with weighted word-level features using a bilinear attention mechanism, while the Word Adapter updates word representations based on associated character sequences. These adapters are jointly trained with BERT and are injected into intermediate transformer layers, enabling a more expressive and lexically-aware contextual encoding. Extensive comparative experiments on Chinese legal contract datasets demonstrate that CW-BERT achieves better performance in legal contract NER tasks. Furthermore, the dynamic lexicon update mechanism not only proves valuable for enhancing legal knowledge extraction through transferable domain-specific vocabulary, but also demonstrates strong generalization potential in other fields such as medicine-validating its adaptability to diverse domain-specific linguistic features.