Domain-shift Conditioning using Adaptable Filtering via Hierarchical Embeddings for Robust Chinese Spell Check
Spell check for Chinese poses unresolved problems due to the large number of characters, the sparse distribution of errors, and the dearth of resources with sufficient coverage of shifting error domains. Hierarchical Embedding Adaptable filter (HeadFilt) is a scalable adaptable filter that exploits Hierarchical character embeddings to improve Chinese spell check accuracy. HeadFilt (1) obviates the need for handcrafted resources covering different error domains and (2) resolves sparsity problems related to infrequent errors. Both Simplified and Traditional Chinese input are supported.
If you use this code, please cite as appropriate:
@article{nguyen2021domain,
title={Domain-shift Conditioning using Adaptable Filtering via Hierarchical Embeddings for Robust Chinese Spell Check},
author={Nguyen, Minh and Ngo, Gia H and Chen, Nancy F},
journal={IEEE/ACM Transactions on Audio, Speech, and Language Processing},
year={2021}
publisher={IEEE}
}
Python and PyTorch are required for the current codebase. To setup the required environment
- Install Anaconda
- Run
conda env create -f env.yml -n spell
Processed data from the Chinese Spelling Check (CSC) Task in 2013, 2014, and 2015 (both Traditional and Simplified scripts) are included.
HeadFilt model weights can be downloaded from:
- For Simplified text: hierEmbWeights_d512_m0.4_simp_ft.pt
- For CSC 2013 Traditional text: hierEmbWeights_d512_m0.4_trad_ft13.pt
- For CSC 2014 Traditional text: hierEmbWeights_d512_m0.4_trad_ft14.pt
- For CSC 2015 Traditional text: hierEmbWeights_d512_m0.4_trad_ft15.pt
source activate spell./csc_base.py --config conf/15.trad.json --seed 1 --outpath out/csc15.trad.s1./csc_fixedfilt.py --config conf/15.trad.json --checkpoint out/csc15.trad.s1/./estimateNegDist.py --margin 0.4 -c hierEmbWeights_d512_m0.4_trad_ft15.pt./csc_headfilt.py --config conf/15.trad.json --checkpoint out/csc15.trad.s1/ --margin 0.4 \
--emb_weights hierEmbWeights_d512_m0.4_trad_ft15.pt --factor 0.09843067824840546source activate spell./csc_base.py --config conf/15.simp.json --seed 1 --outpath out/csc15.simp.s1 --max_train_epoch 3./csc_fixedfilt.py --config conf/15.simp.json --checkpoint out/csc15.simp.s1/./estimateNegDist.py --margin 0.4 -c hierEmbWeights_d512_m0.4_simp_ft.pt --simplified./csc_headfilt.py --config conf/15.simp.json --checkpoint out/csc15.simp.s1/ --margin 0.4 \
--emb_weights hierEmbWeights_d512_m0.4_simp_ft.pt --factor 0.07925131916999817./imitation.py --lr 3e-3 --batch_size 500 -t 150000 --dim 512 --margin .4 --out hierEmbWeights_d512_m0.4_trad.pt./adapt.py --config conf/15.trad.json --lr 3e-3 --batch_size 500 -t 50000 --dim 512 --margin 0.4 -c hierEmbWeights_d512_m0.4_trad.pt \
--out hierEmbWeights_d512_m0.4_trad_ft15.pt