View Source CredoSpellchecker
Spellchecker for Credo
This is a fairly simple spellchecker which uses word lists from http://app.aspell.net/create.
Installation
Add credo_spellchecker to your list of dependencies in mix.exs.
def deps do
[
{:credo_spellchecker, "~> 0.1", only: [:dev, :test], runtime: false}
]
endAdd the CredoSpellchecker.NoMisspelledWords check to your list of Credo checks in .credo.exs (you can generate this file with mix credo.gen.config if you do not already have it).
{CredoSpellchecker.NoMisspelledWords, [language_code: "en_CA", user_dictionary: "user_dictionary.list"]},Options
language_codedefines the language code of the dictionary to be used. Defaults toen_CAwhich is the language code for Canadian English.user_dictionarydefines the location the user dictionary. Create auser_dictionary.listto add allowed words to. The user dictionary file should contain a word per line that should be allowed by the spellchecker. Alternatively, you can remove theuser_dictionaryand you do not have to create a user dictionary file.
Case Insensitivity
The spell checker works by breaking down PascalCase and snake_case into downcased words that are checked individually.
Supported Languages
Currently the Spellchecker only support en_CA,en_GB and en_US. That can easily be changed with a new library and a pull request. See the priv/dictionaries/README.md for some helpful details.