-
Notifications
You must be signed in to change notification settings - Fork 8
Suggestions ranking
melisa-qordoba edited this page Sep 23, 2020
·
1 revision
ReplaCy supports multiple suggestions, which by default are not ranked. If you would like the suggestions to be sorted, replaCy allows ranking by LM perplexity. Currently, we support one LM: KenLM.
To use this feature, you must first install KenLM from GitHub, using something like pip install git+https://github.com/kpu/kenlm#egg=kenlm
or poetry add git+https://github.com/kpu/kenlm@master
, or whatever way you deal with the nightmare that are Python dependencies.
Load your KenLM model by passing lm_path
when instantiating an instance of ReplaceMatcher
:
lm_path='/path/to/your/kenlm/model.bin'
rmatcher = ReplaceMatcher(nlp, match_dict=match_dict, lm_path=lm_path)