Your question is Build a Spell Checker. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Capsule needs to validate text entered into a prescription note. Given a string text and an array valid_words, identify words that are misspelled or incorrectly capitalized.
Return a dictionary with three lists:
misspelled: words whose lowercase form does not appear in valid_words, preserving text order and spelling.uncapitalized_sentence_starts: words at the beginning of the text or immediately after ., !, or ? that begin with a lowercase letter.uncapitalized_proper_nouns: words that begin with a lowercase letter but match, case-insensitively, a proper noun in valid_words. A proper noun is represented by a word beginning with an uppercase letter followed by lowercase letters, such as Robert or Japan.Words may contain letters and an optional apostrophe, such as patient's. Ignore punctuation when identifying words. Preserve duplicate occurrences in the output lists.
def spell_check(text, valid_words):