View Source SpellChecker (spell_checker v0.1.1)

The SpellChecker module is designed to check the correctness of words against a predefined word list and provide suggestions for incorrect words.

Functions

is_correct?/2 is_correct/1 is_correct!/2

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")
{:ok, true}
iex> SpellChecker.is_correct("worlld")
{:none, false}
Link to this function

is_correct!(word, suggest \\ 5)

View Source

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")
{:ok, true}
iex> SpellChecker.is_correct!("worlld", 5)
["unworldly", "worldling", "word", "world", "worldly"]
Link to this function

is_correct?(word_list, acc \\ [])

View Source

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> SpellChecker.is_correct?(words)
["Programming", "hello"]