{"id":23684771,"url":"https://github.com/mrchristensen/spellingcorrector","last_synced_at":"2026-01-07T11:30:18.186Z","repository":{"id":54094966,"uuid":"208156266","full_name":"mrchristensen/SpellingCorrector","owner":"mrchristensen","description":null,"archived":false,"fork":false,"pushed_at":"2022-08-06T20:06:34.000Z","size":6229,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-12-29T20:48:13.781Z","etag":null,"topics":["trie-structure"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mrchristensen.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-09-12T22:25:31.000Z","updated_at":"2022-08-06T20:46:45.000Z","dependencies_parsed_at":"2022-08-13T06:40:42.884Z","dependency_job_id":null,"html_url":"https://github.com/mrchristensen/SpellingCorrector","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrchristensen%2FSpellingCorrector","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrchristensen%2FSpellingCorrector/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrchristensen%2FSpellingCorrector/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrchristensen%2FSpellingCorrector/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mrchristensen","download_url":"https://codeload.github.com/mrchristensen/SpellingCorrector/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239742366,"owners_count":19689307,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["trie-structure"],"created_at":"2024-12-29T20:48:17.175Z","updated_at":"2026-01-07T11:30:16.122Z","avatar_url":"https://github.com/mrchristensen.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Spelling Corrector\n\nThis program suggests possible corrections for a misspelled word.\n\nThe main highlight of this project is the use of a handbuilt [trie (data structure)](https://en.wikipedia.org/wiki/Trie) to store the possible words.\nThis data structure store letters as nodes, where words can be built up through a DFS.  Additionally, words in the graph are given a value weight.\n\nFor example:\n\n![](images/trie_example.jpg)\n\n*\"A trie for keys \"A\", \"to\", \"tea\", \"ted\", \"ten\", \"i\", \"in\", and \"inn\". Each complete English word has an arbitrary integer value associated with it.\"*\n\n## The Algorithm\n\nThe algorithm takes in a give word and tries to find a matching word that appears in our word bank.\nThis is achieved by editing the given word and checking for matches.\n\nEdits can happen in four diferent ways, each with a different distance:\n- **Deletion Distance**: A string s has a deletion distance 1 from another string t if and only if t\nis equal to s with one character removed. The only strings that are a deletion distance of\n1 from “bird” are “ird”, “brd”, “bid”, and “bir”. Note that if a string s has a deletion distance\nof 1 from another string t then |s| = |t| -1. Also, there are exactly | t | strings that are a\ndeletion distance of 1 from t . The dictionary may contain 0 to n of the strings one deletion\ndistance from t .\n- **Transposition Distance**: A string s has a transposition distance 1 from another string t if\nand only if t is equal to s with two adjacent characters transposed. The only strings that\nare a transposition Distance of 1 from “house” are “ohuse”, “huose”, “hosue” and\n“houes”. Note that if a string s has a transposition distance of 1 from another string t then\n|s| = |t|. Also, there are exactly | t | - 1 strings that are a transposition distance of 1 from t .\nThe dictionary may contain 0 to n of the strings one transposition distance from t .\n- **Alteration Distance**: A string s has an alteration distance 1 from another string t if and\nonly if t is equal to s with exactly one character in s replaced by a lowercase letter that is\nnot equal to the original letter. The only strings that are a alternation distance of 1 from\n“top” are “aop”, “bop”, …, “zop”, “tap”, “tbp”, …, “tzp”, “toa”, “tob”, …, and “toz”. Note that\nif a string s has an alteration distance of 1 from another string t then |s| = |t|. Also, there\nare exactly 25* | t | strings that are an alteration distance of 1 from t . The dictionary may\ncontain 0 to n of the strings one alteration distance from t .\n- **Insertion Distance**: A string s has an insertion distance 1 from another string t if and only\nif t has a deletion distance of 1 from s . The only strings that are an insertion distance of 1\nfrom “ask” are “aask”, “bask”, “cask”, … “zask”, “aask”, “absk”, “acsk”, … “azsk”, “asak”,\n“asbk”, “asck”, … “aszk”, “aska”, “askb”, “askc”, … “askz”. Note that if a string s has an\ninsertion distance of 1 from another string t then |s| = |t|+1. Also, there are exactly 26* (| t |\n+ 1) strings that are an insertion distance of 1 from t . The dictionary may contain 0 to n of\nthe strings one insertion distance from t .\n\nFor this project, we try for a distance of 1 first, and then increase it to 2 if no match is found.\n\nTo review the implementation, see [SpellCorrector.java](src/spell/SpellCorrector.java).\n\n## Running the Program\n\n```java spell.Main *bank* *word*```\n\n#### Example\n```java spell.Main notsobig.txt congradulatons```\n\n![](images/example.PNG)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrchristensen%2Fspellingcorrector","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmrchristensen%2Fspellingcorrector","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrchristensen%2Fspellingcorrector/lists"}