Refactor spellcheck candidate extraction.