Skip to content

Takes a list of words specified by user and spellchecks input text to that dictionary

License

Notifications You must be signed in to change notification settings

AndrewWritesCode/Custom-Spellcheck

Repository files navigation

Custom-Spellcheck

Takes a list of words specified by user and spellchecks input text to that dictionary

Flow Chart of Valid Word Initialization & Word Selection

graph TD;
    A[valid word added]-->B[wordScore calculated];
    C[charScores used to determine character weights and dimensionality]-->B[wordScore calculated];
    B[wordScore calculated]-->D[wordScore and data associated with word stored in Valid Dictionary hash map];
    D[wordScore and data associated with word stored in Valid Dictionary hash map]-->E[WordBook];
    D-->A
    E[WordBook initialized]-->F[user input read];
    F[user input read]-->G[input wordScore calculated];
    G[input wordScore calculated]-->H[input wordScore compared to wordScores in Valid Dictionary];
    H[input wordScore compared to wordScores in Valid Dictionary]-->J[Valid Dictionary entry with closest wordScore match returned];
    J[Valid Dictionary entry with closest wordScore match returned]-->F[user input read];
Loading

Example (color_example.py):

import json

import custom_spellcheck as sc

with open('colors.json', encoding="utf-8") as json_file:
    colors = json.load(json_file)

color_book = sc.WordBook()
color_book.add_dictionary_to_WordBook(colors)

rgb = color_book.spellcheck_word("ponk")

print(rgb[0])

print(rgb[1])

print(color_book.spellcheck_word("ponk")[1]["RGB"])

Unchecked Input

INPUT (without Custom Spellcheck): `rgb = color_book["ponk"]["RGB"]`

OUTPUT: Key Error

Spellchecked Input

INPUT (with Custom Spellcheck): `rgb = color_book.spellcheckword("ponk")[1]["RGB"]`

OUTPUT: rgb = color_book["pink"]["RGB"]

Note: color_book.spellcheckword("ponk")[1] gets the information of the word (RGB in this case), color_book.spellcheckword("ponk")[0] is the word

About

Takes a list of words specified by user and spellchecks input text to that dictionary

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages