Skip to content

Spellcheck UML Class Diagram

Dawson Whitehead edited this page Apr 30, 2018 · 9 revisions

Spellcheck UML Class Diagram First Draft

Google Drive Sharing

Mirror in draw.io

(try the mirror link if the first one doesn't work)

Class Breakdown

Class: Word

Data Types:

  • is_misspelled: bool
  • has_suggestion: bool

Functions:

  • parse(string): Word

    Takes an input and turns it into a word

  • parse_file(file): *words

    Walks through a file and generates a list of words

Class: Dictionary

Data Type:

  • dict: trie

Functions:

  • valid_word(string, dict): bool

    Takes in a word and returns true if the word is contained in the dictionary

  • add_word(string): word

    Add the specified word into the dictionary

  • parse_dictionary(file): dict

    Takes a file containing a list of words to make up a dictionary, then creates a trie containing the dictionary of those words

Class: Word_Suggestion

Data Types:

  • correct_word: string
  • misspelled_word: string
  • min_lev_distance: int
  • max_number_suggestions: int
  • trie

Functions:

  • remove_punctuation(string):void

    Strips a string of any punctuation. Do not strip the character "'"

  • find_lev_distance(string, string): int

    finds the levenshtein distance between the misspelled word and words from the trie

  • generate_suggestions(string, int, trie): *string

    Generates a list of suggestions for a misspelled word

  • remove_capitalization(string): string

    Removes capitalization from a string

Class: Interface

Data Types:

Functions:

  • identify_word(string): void

    Identifies the misspelled word

  • save_file(file): file

    An option to save the file automatically after a correction

  • save_as_another(file): file

    An option to save the corrections as a new file after a correction

Class: Interactive

Data Types:

  • file: file

Functions:

  • parse_file(file): string

    Takes in a file and goes through each word int the file

  • ignore_word(string): void

    Allows the user to ignore a word suggestion they do not prefer

  • replace_word(string):string

    Replaces the misspelled word with the correct word

  • alternate_spelling(string, spelling): string

    Allows the user to specify an alternate spelling for a misspelled word

  • welcome_screen(): void

    Displays the welcome screen

  • help_screen(): void

    Displays the help screen

  • display_suggestions(*string): void

    Shows the list of suggestions (might take in a trie instead)

Class: Batch_mode

Data Structures:

  • suggested_words_list: *string

Functions:

  • generate_replacement(file):file

    Generates a file similar to the input file, except all misspelled words are replaced with their closest suggestions

  • generate_misspelled_words(file):file

    Generates a file containing a list of all misspelled words from the input file and their closest replacements

  • show_changes(): void

    Displays the changes made while in spellcheck

Clone this wiki locally