simple-spell-checker


Namesimple-spell-checker JSON
Version 0.0.1 PyPI version JSON
download
home_page
Summary
upload_time2023-02-03 09:31:21
maintainer
docs_urlNone
authorYour Name
requires_python>=3.9,<4.0
license
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # simple_spell_checker

[![Coverage Status](https://img.shields.io/badge/%20Python%20Versions-%3E%3D3.9-informational)](https://pypi.org/project/fuzzy_multi_dict/)
[![Coverage Status](https://coveralls.io/repos/github/SemioTricks/fuzzy-multi-dict/badge.svg?branch=feature/initial)](https://coveralls.io/github/SemioTricks/fuzzy-multi-dict?branch=feature/initial)

[![Coverage Status](https://img.shields.io/badge/Version-0.0.1-informational)](https://github.com/SemioTricks/simple-spell-checker)
[![Coverage Status](https://img.shields.io/badge/Docs-passed-green)](https://github.com/SemioTricks/simple-spell-checker/tree/main/simple_spell_checker_doc)


Simple Spell Checker is a spell checker based on prefix tree search. It find nearest to input word from known words (from input list). 
The algorithm finds mistakes in a word (insertions, deletions, replacements).

# Installation

> pip install simple_spell_checker

# Quickstart

```python
from simple_spell_checker.spell_checker import SpellChecker

cities = [
    "Kyiv", "Kharkiv", "Odesa", "Dnipro", "Donetsk", "Zaporizhzhia", "Lviv", 
    "Kryvyi Rih", "Mykolaiv", "Luhansk", "Vinnytsia", "Simferopol", "Chernihiv", 
    "Kherson", "Poltava", "Khmelnytskyi", "Cherkasy", "Chernivtsi", "Zhytomyr", "Sumy",
    "Rivne", "Ivano-Frankivsk", "Ternopil", "Kropyvnytskyi", "Lutsk", "Uzhhorod"
]

spell_checker = SpellChecker(max_mistakes_number_part=.5)
spell_checker.add_words(cities)

spell_checker.correction('Kiev')
# [{'word': 'Kyiv',
#   'corrections': [{'mistake_type': 'missing symbol "y"', 'position': 1},
#    {'mistake_type': 'extra symbol "e"', 'position': 2}]}]

spell_checker.correction('odessa')
# [{'word': 'Odesa',
#   'corrections': [{'mistake_type': 'wrong symbol "o": replaced on "O"',
#     'position': 0},
#    {'mistake_type': 'extra symbol "s"', 'position': 4}]}]

spell_checker.correction('Hmelnitskiy', max_mistakes_number_part=.5)
# [{'word': 'Khmelnytskyi',
#   'corrections': [{'mistake_type': 'missing symbol "K"', 'position': 0},
#    {'mistake_type': 'wrong symbol "H": replaced on "h"', 'position': 0},
#    {'mistake_type': 'wrong symbol "i": replaced on "y"', 'position': 5},
#    {'mistake_type': 'missing symbol "y"', 'position': 9},
#    {'mistake_type': 'extra symbol "y"', 'position': 10}]}]

spell_checker.correction('Kharkiv')
# [{'word': 'Kharkiv', 'corrections': []}]
```

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "simple-spell-checker",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.9,<4.0",
    "maintainer_email": "",
    "keywords": "",
    "author": "Your Name",
    "author_email": "you@example.com",
    "download_url": "https://files.pythonhosted.org/packages/a8/20/b8b2e10f835e4e84910c564b41c7eeef84e8a43d36ec6e7f3936b06efec4/simple_spell_checker-0.0.1.tar.gz",
    "platform": null,
    "description": "# simple_spell_checker\n\n[![Coverage Status](https://img.shields.io/badge/%20Python%20Versions-%3E%3D3.9-informational)](https://pypi.org/project/fuzzy_multi_dict/)\n[![Coverage Status](https://coveralls.io/repos/github/SemioTricks/fuzzy-multi-dict/badge.svg?branch=feature/initial)](https://coveralls.io/github/SemioTricks/fuzzy-multi-dict?branch=feature/initial)\n\n[![Coverage Status](https://img.shields.io/badge/Version-0.0.1-informational)](https://github.com/SemioTricks/simple-spell-checker)\n[![Coverage Status](https://img.shields.io/badge/Docs-passed-green)](https://github.com/SemioTricks/simple-spell-checker/tree/main/simple_spell_checker_doc)\n\n\nSimple Spell Checker is a spell checker based on prefix tree search. It find nearest to input word from known words (from input list). \nThe algorithm finds mistakes in a word (insertions, deletions, replacements).\n\n# Installation\n\n> pip install simple_spell_checker\n\n# Quickstart\n\n```python\nfrom simple_spell_checker.spell_checker import SpellChecker\n\ncities = [\n    \"Kyiv\", \"Kharkiv\", \"Odesa\", \"Dnipro\", \"Donetsk\", \"Zaporizhzhia\", \"Lviv\", \n    \"Kryvyi Rih\", \"Mykolaiv\", \"Luhansk\", \"Vinnytsia\", \"Simferopol\", \"Chernihiv\", \n    \"Kherson\", \"Poltava\", \"Khmelnytskyi\", \"Cherkasy\", \"Chernivtsi\", \"Zhytomyr\", \"Sumy\",\n    \"Rivne\", \"Ivano-Frankivsk\", \"Ternopil\", \"Kropyvnytskyi\", \"Lutsk\", \"Uzhhorod\"\n]\n\nspell_checker = SpellChecker(max_mistakes_number_part=.5)\nspell_checker.add_words(cities)\n\nspell_checker.correction('Kiev')\n# [{'word': 'Kyiv',\n#   'corrections': [{'mistake_type': 'missing symbol \"y\"', 'position': 1},\n#    {'mistake_type': 'extra symbol \"e\"', 'position': 2}]}]\n\nspell_checker.correction('odessa')\n# [{'word': 'Odesa',\n#   'corrections': [{'mistake_type': 'wrong symbol \"o\": replaced on \"O\"',\n#     'position': 0},\n#    {'mistake_type': 'extra symbol \"s\"', 'position': 4}]}]\n\nspell_checker.correction('Hmelnitskiy', max_mistakes_number_part=.5)\n# [{'word': 'Khmelnytskyi',\n#   'corrections': [{'mistake_type': 'missing symbol \"K\"', 'position': 0},\n#    {'mistake_type': 'wrong symbol \"H\": replaced on \"h\"', 'position': 0},\n#    {'mistake_type': 'wrong symbol \"i\": replaced on \"y\"', 'position': 5},\n#    {'mistake_type': 'missing symbol \"y\"', 'position': 9},\n#    {'mistake_type': 'extra symbol \"y\"', 'position': 10}]}]\n\nspell_checker.correction('Kharkiv')\n# [{'word': 'Kharkiv', 'corrections': []}]\n```\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "",
    "version": "0.0.1",
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8082fd819b7e07faa1a55193fd63858793563276f7c6e907ce3041a841a8aab5",
                "md5": "48fa433e75921756e94cdf05be598998",
                "sha256": "79aedfb101a25c776a9f313f74f544bca58fd67f23b50076f9e0e10a098b4b5a"
            },
            "downloads": -1,
            "filename": "simple_spell_checker-0.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "48fa433e75921756e94cdf05be598998",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9,<4.0",
            "size": 3978,
            "upload_time": "2023-02-03T09:31:19",
            "upload_time_iso_8601": "2023-02-03T09:31:19.839837Z",
            "url": "https://files.pythonhosted.org/packages/80/82/fd819b7e07faa1a55193fd63858793563276f7c6e907ce3041a841a8aab5/simple_spell_checker-0.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a820b8b2e10f835e4e84910c564b41c7eeef84e8a43d36ec6e7f3936b06efec4",
                "md5": "eb0a9b6986f9b2cd545baa19ad46ca1c",
                "sha256": "f918f029376349b540a4a313678150ea1606d235b2346359c4549a23d5e5082c"
            },
            "downloads": -1,
            "filename": "simple_spell_checker-0.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "eb0a9b6986f9b2cd545baa19ad46ca1c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9,<4.0",
            "size": 3598,
            "upload_time": "2023-02-03T09:31:21",
            "upload_time_iso_8601": "2023-02-03T09:31:21.728575Z",
            "url": "https://files.pythonhosted.org/packages/a8/20/b8b2e10f835e4e84910c564b41c7eeef84e8a43d36ec6e7f3936b06efec4/simple_spell_checker-0.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-02-03 09:31:21",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "lcname": "simple-spell-checker"
}
        
Elapsed time: 0.07103s