Hi All,
I want to show Sheldon library for spell checking based on Erlang. This is a small but pretty cool lib which can be useful in different projects. The Sheldon also is available on hex.pm. Here is how it’s works:
1> sheldon:check("I want to check this correct text").
ok
2> sheldon:check("I want to check this misspeled text").
#{bazinga => <<"That's no reason to cry. One cries because one is sad. For example, I cry because others are stupid, and that ma"...>>,
misspelled_words => [#{candidates => ["misspeed","misspelled"],
line_number => 1,
word => "misspeled"}]}
The Sheldon is use his English dictionary for spell checking, however you can set your own dictionary just set in config default_dictionary
:
...
{sheldon, [
{default_dictionary, "path/to/custom/dictionary.txt"}
]},
...
Or you can extend the existing Sheldon dictionary with the config parameter default_dictionary
:
...
{sheldon, [
{additional_dictionaries, [
"path/to/custom/dictionary_1.txt",
"path/to/custom/dictionary_2.txt"
]}
]},
...
If set default_dictionary
and additional_dictionaries
- will be used default dictionary what was set plus additional dictionaries to it as an extension:
...
{sheldon, [
{default_dictionary, "path/to/custom/dictionary.txt"},
{additional_dictionaries, [
"path/to/custom/dictionary_1.txt",
"path/to/custom/dictionary_2.txt"
]}
]},
...
You can also read more in Erlang Blog Posts - #9 by vkatsuba.
Enjoy! And feel free to leave any questions, opinions and feedback.