{"id":21623486,"url":"https://github.com/dylanfoster/spelly","last_synced_at":"2026-01-02T10:05:12.251Z","repository":{"id":57367370,"uuid":"46186196","full_name":"dylanfoster/spelly","owner":"dylanfoster","description":"Pure JavaScript spellcheck that learns ftw","archived":false,"fork":false,"pushed_at":"2015-11-17T09:49:18.000Z","size":786,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-04-23T22:09:50.944Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dylanfoster.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-11-14T18:15:43.000Z","updated_at":"2021-07-16T06:04:44.000Z","dependencies_parsed_at":"2022-08-23T20:10:22.388Z","dependency_job_id":null,"html_url":"https://github.com/dylanfoster/spelly","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dylanfoster%2Fspelly","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dylanfoster%2Fspelly/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dylanfoster%2Fspelly/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dylanfoster%2Fspelly/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dylanfoster","download_url":"https://codeload.github.com/dylanfoster/spelly/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235510120,"owners_count":19001653,"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":[],"created_at":"2024-11-25T00:13:07.997Z","updated_at":"2025-10-06T07:31:32.251Z","avatar_url":"https://github.com/dylanfoster.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Spelly\n\n[![Build Status](https://travis-ci.org/dylanfoster/spelly.svg?branch=master)](https://travis-ci.org/dylanfoster/spelly)\n\nPure JavaScript spellchecker that learns as you use it \u003csup\u003e1\u003c/sup\u003e\n\n## Installation\n\n```\nnpm install spelly\n```\n\n## Usage\n\n### Get suggestions\n\n```javascript\nconst Spelly = require(\"spelly\");\n\nlet options = {\n  cache: {\n    type: \"configstore\",\n    store: new Configstore(\"foo\")\n    // optional, defaults to internal Configstore instance under \"spelly\"\n  }\n};\n\nconst spelly = new Spelly(\"/usr/share/dict/words\", options);\n\nlet suggestions = spelly.check(\"wierd\");\n\n/**\n * {\n *   original: \"wierd\",\n *   suggestions: [{\n *     word: \"wired\",\n *     score: 5\n *   }, {\n *     word: \"weird\",\n *     score: 5\n *   }, {\n *     word: \"wield\",\n *     score: 4\n *   }]\n * }\n */\n```\n\nResults will be cached in the chosen store, making Spelly smarter and faster\neach time it is used.\n\n### Managing your own cache\n\nYou can manage your own cache of words by adding/removing them to/from the store.\nWhen adding a word, all suggestions beneath its score will be shifted down 1.\n(e.g. a score of `4` goes to `3`). If the suggestion already exists, it will be\nmoved appropriately according to the score given.\n\n```javascript\n\n// add 'wired' with score '1' or move it to the bottom position\nspelly.cache(\"weird\", { word: \"wired\", score: 1 });\n\n// remove a suggestion for a misspelling\nspelly.clearCache(\"somthing\", \"something\");\n\n// remove all suggestions for a misspelling\nspelly.clearCache(\"somthing\");\n\n// clear all cache\nspelly.clearCache();\n\n\n// retrieve cached suggestions for a misspelling\nspelly.getCache(\"somthing\");\n\n// retrieve all cached suggestions\nspelly.getCache();\n```\n\n### Feeling lucky?\n\nGrab the first suggestion out of the list\n\n```javascript\nlet suggestion = spelly.first(\"wierd\");\n\n/**\n *{\n *  original: \"wierd\",\n *  suggestion: {\n *    word: \"weird\",\n *    score: 5\n *  }\n *}\n */\n```\n\n### Learning\n\nSpelly uses [configstore](https://github.com/yeoman/configstore) by default for\nthe suggestion cache, helping make it both fast and smart. Each time a misspelled\nword is given to Spelly, it finds it in the store, or generates a suggestion,\nthen adds it to the store.\n\n### API\n\n#### `Spelly(dictionary, options)`\n\nSpelly constructor.\n\n  - **dictionary** Type: `Array|String` An array of words or path to a file\n    containing a newline separated list of words.\n  - **options.cache** Type: `Object` Spelly cache options.\n\n    - **cache.type** Type: `String` Cache type (`configstore`).\n    - **cache.store** Type: `Object` configstore instance (optional) for `configstore`.\n\n#### `check(word)`\n\nSpellcheck a word. returns a promise with the suggestions Object.\n\n - **word**: Type: `String` The word to spellcheck.\n\n#### `cache(misspelledWord, suggestion)`\n\nAdd a suggestion to a mispelled word.\n\n - **misspelledWord** Type: `String` The misspelled word to cache.\n - **suggestion** Type: `Object`\n   - **suggestion.word** Type: `String` The suggestion to add for the misspelled word.\n   - **suggestion.score** Type: `Number` Score the suggestion. If the suggestion\n     exists for the word, it will be re-scored based on the given score and all\n     others below will be shifted down (or up depending on how you look at it) by 1.\n\n#### `clearCache([misspelledWord][,suggestion])`\n\nClear the cache of a single suggestion, multiple suggestions or all suggestions.\n\n - **missppelledWord** Type: `String`(optional) The misspelled word to clear.\n - **suggestion** Type: `String`(optional) the suggestion to remove from the\n   misspelled word.\n\n#### `getCache([misspelledWord])`\n\nRetrieve the cache for a mispelled word or all words.\n\n - **misspelledWord** Type: `String`(optional) The misspelled word to retrieve\n   cache for.\n\n#### `first(misspelledWord)`\n\nRetrieve the first suggestion for a mispelled word\n\n\n## License\n\nSee [LICENSE](LICENSE.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdylanfoster%2Fspelly","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdylanfoster%2Fspelly","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdylanfoster%2Fspelly/lists"}