View Source SpellChecker (spell_checker v0.1.0)
The SpellChecker
module is designed to check the correctness of words against a predefined word list and provide suggestions for incorrect words.
Functions
Summary
Functions
is_correct/1
This function checks if a single word is correct.
is_correct!/2
This function checks if a single word is correct and provides suggestions if it is not.
is_correct?/2
This function checks if a list of words are correct and returns a list of the correct words.
Functions
is_correct/1
This function checks if a single word is correct.
Parameters:
word (string): A word to check.
Returns: A tuple indicating if the word is correct.
Examples
iex> SpellChecker.is_correct("hello")
iex> {:ok, true}
iex> SpellChecker.is_correct("worlld")
iex> {:none, false}
is_correct!/2
This function checks if a single word is correct and provides suggestions if it is not.
Parameters:
word
(string): A word to check.
suggest
(integer, optional): The number of suggestions to return (defaults to 5).
Examples
iex> SpellChecker.is_correct!("hello")
iex> {:ok, true}
iex> SpellChecker.is_correct!("worlld", 3)
iex> ["world", "word", "would"]
is_correct?/2
This function checks if a list of words are correct and returns a list of the correct words.
Parameters:
word_list
(list): A list of words to check.
acc
(list, optional): An accumulator for correct words (used internally, defaults to an empty list).
Returns: A list of correct words.
Examples
iex> words = ["hello", "worlld", "Programming"]
iex> correct_words = SpellChecker.is_correct?(words)
iex> ["hello", "Programming"]