pytypos


Namepytypos JSON
Version 1.4.0 PyPI version JSON
download
home_pagehttps://github.com/PApostol/pytypos
SummaryTypo and spelling checker
upload_time2023-08-05 13:52:43
maintainerPApostol
docs_urlNone
authorPApostol
requires_python~=3.7
licenseMIT
keywords typo spell check
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ## Pytypos

[![PyPI version](https://badge.fury.io/py/pytypos.svg)](https://badge.fury.io/py/pytypos)
[![Downloads](https://static.pepy.tech/personalized-badge/pytypos?period=month&units=international_system&left_color=grey&right_color=yellowgreen&left_text=total%20downloads)](https://pepy.tech/project/pytypos)
[![PyPI - Downloads](https://img.shields.io/pypi/dm/pytypos)](https://pypi.org/project/pytypos/)
[![](https://img.shields.io/badge/python-3.7+-blue.svg)](https://www.python.org/downloads/)
[![Code style: blue](https://img.shields.io/badge/code%20style-blue-blue.svg)](https://blue.readthedocs.io/)
[![License](https://img.shields.io/badge/License-MIT-blue)](#license "Go to license section")
[![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](https://github.com/PApostol/spark-submit/issues)

### Description
Pytypos is a typo and spelling checker used to identify spelling mistakes in comments of a various programming languages,
such as Python, Java, C++, C#, Matlab, and others. In addition, it can check other text-oriented files such as MD, RST, TXT, or similar.

Spell checking uses dictionaries installed on the host computer.
The dictionary language can be defined in the `Pytypos` object with `dictionary='de'` for German, for instance.
For installation and management of dictionaries, see the documentation of [pyenchant](https://pyenchant.github.io/pyenchant/).
To list available dictionary languages on the host system, print `pytypos.available_languages()`.

### Installation
The easiest way to install is using `pip`:

`pip install pytypos`

To install from source:
```
git clone https://github.com/PApostol/pytypos.git
cd pytypos
python setup.py install
```

For usage details check `help(pytypos)`.

### Usage Examples
The below will recursively scan `my/path/project/` for comments (i.e. `# this is a comment`) in Python files:
```
from pytypos import Pytypos
prj = Pytypos(target='my/path/project/', match_identifier='#', file_extension='py', recursive=True, suggestions=False)
prj.find_typos()
print(prj.typo_list)
print(prj.typo_details)
```
`Pytypos.typo_list` stores a list of all possible typos found.

`Pytypos.typo_details` stores a dictionary with the following structure:

If `suggestions == False` (default):
```
{'file1': ['typo1', 'typo2'],
 'file2': ['typo1', 'typo2']
}
```

If `suggestions == True`:
```
{'file1': [{'typo1': ['suggestion1a', 'suggestion1b'],
            'typo2': ['suggestion2a', 'suggestion2b']
           },
 'file2': [{'typo1': ['suggestion1a', 'suggestion1b'],
            'typo2': ['suggestion2a', 'suggestion2b']
           }
}
```
The above can be nicely printed on stdout with Python's built-in [pprint](https://docs.python.org/3/library/pprint.html).

#### Other Examples
```
# recursively scan "foo/bar/" for any text in RST files and give suggestions, but skip file "foo/UPDATE.rst" and exclude the words "repos" and "GitHub"
Pytypos(target='foo/bar/', match_identifier='', file_extension='rst', recursive=True, suggestions=True, exclude_file_list=['foo/UPDATE.rst'], exclude_word_list=['repos', 'GitHub'])

# scan the "a/b/c.java" Java file for comments (i.e. "// this is a comment") and give suggestions with a french dictionary, but exclude words found in "exclusions.txt"
Pytypos(target='a/b/c.java', match_identifier='//', dictionary='fr', suggestions=True, exclude_word_file='exclusions.txt')
```

#### Testing

You can do some simple testing after cloning the repo.

Note any additional requirements for running the tests: `pip install -r tests/requirements.txt`

`python tests/run_integration_test.py`

#### Additional methods

`pytypos.Pytypos.fix_typos()`: Fixes typos found in-between spaces with the most likely replacement

`pytypos.Pytypos.add_to_dictionary()`: Adds custom word list to dictionary

`pytypos.Pytypos.add_to_exclusions()`: Removes custom word list from dictionary

`pytypos.Pytypos.replace_word()`: Replaces words in dictionary

### License

Released under [MIT](/LICENSE) by [@PApostol](https://github.com/PApostol)

- You can freely modify and reuse.
- The original license must be included with copies of this software.
- Please link back to this repo if you use a significant portion the source code.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/PApostol/pytypos",
    "name": "pytypos",
    "maintainer": "PApostol",
    "docs_url": null,
    "requires_python": "~=3.7",
    "maintainer_email": "",
    "keywords": "typo,spell,check",
    "author": "PApostol",
    "author_email": "foo@bar.com",
    "download_url": "https://files.pythonhosted.org/packages/35/58/0f60e55e788dfe8da71387cdc5bce8fd85b4fbf839e07d50ec04fe159a94/pytypos-1.4.0.tar.gz",
    "platform": "any",
    "description": "## Pytypos\r\n\r\n[![PyPI version](https://badge.fury.io/py/pytypos.svg)](https://badge.fury.io/py/pytypos)\r\n[![Downloads](https://static.pepy.tech/personalized-badge/pytypos?period=month&units=international_system&left_color=grey&right_color=yellowgreen&left_text=total%20downloads)](https://pepy.tech/project/pytypos)\r\n[![PyPI - Downloads](https://img.shields.io/pypi/dm/pytypos)](https://pypi.org/project/pytypos/)\r\n[![](https://img.shields.io/badge/python-3.7+-blue.svg)](https://www.python.org/downloads/)\r\n[![Code style: blue](https://img.shields.io/badge/code%20style-blue-blue.svg)](https://blue.readthedocs.io/)\r\n[![License](https://img.shields.io/badge/License-MIT-blue)](#license \"Go to license section\")\r\n[![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](https://github.com/PApostol/spark-submit/issues)\r\n\r\n### Description\r\nPytypos is a typo and spelling checker used to identify spelling mistakes in comments of a various programming languages,\r\nsuch as Python, Java, C++, C#, Matlab, and others. In addition, it can check other text-oriented files such as MD, RST, TXT, or similar.\r\n\r\nSpell checking uses dictionaries installed on the host computer.\r\nThe dictionary language can be defined in the `Pytypos` object with `dictionary='de'` for German, for instance.\r\nFor installation and management of dictionaries, see the documentation of [pyenchant](https://pyenchant.github.io/pyenchant/).\r\nTo list available dictionary languages on the host system, print `pytypos.available_languages()`.\r\n\r\n### Installation\r\nThe easiest way to install is using `pip`:\r\n\r\n`pip install pytypos`\r\n\r\nTo install from source:\r\n```\r\ngit clone https://github.com/PApostol/pytypos.git\r\ncd pytypos\r\npython setup.py install\r\n```\r\n\r\nFor usage details check `help(pytypos)`.\r\n\r\n### Usage Examples\r\nThe below will recursively scan `my/path/project/` for comments (i.e. `# this is a comment`) in Python files:\r\n```\r\nfrom pytypos import Pytypos\r\nprj = Pytypos(target='my/path/project/', match_identifier='#', file_extension='py', recursive=True, suggestions=False)\r\nprj.find_typos()\r\nprint(prj.typo_list)\r\nprint(prj.typo_details)\r\n```\r\n`Pytypos.typo_list` stores a list of all possible typos found.\r\n\r\n`Pytypos.typo_details` stores a dictionary with the following structure:\r\n\r\nIf `suggestions == False` (default):\r\n```\r\n{'file1': ['typo1', 'typo2'],\r\n 'file2': ['typo1', 'typo2']\r\n}\r\n```\r\n\r\nIf `suggestions == True`:\r\n```\r\n{'file1': [{'typo1': ['suggestion1a', 'suggestion1b'],\r\n            'typo2': ['suggestion2a', 'suggestion2b']\r\n           },\r\n 'file2': [{'typo1': ['suggestion1a', 'suggestion1b'],\r\n            'typo2': ['suggestion2a', 'suggestion2b']\r\n           }\r\n}\r\n```\r\nThe above can be nicely printed on stdout with Python's built-in [pprint](https://docs.python.org/3/library/pprint.html).\r\n\r\n#### Other Examples\r\n```\r\n# recursively scan \"foo/bar/\" for any text in RST files and give suggestions, but skip file \"foo/UPDATE.rst\" and exclude the words \"repos\" and \"GitHub\"\r\nPytypos(target='foo/bar/', match_identifier='', file_extension='rst', recursive=True, suggestions=True, exclude_file_list=['foo/UPDATE.rst'], exclude_word_list=['repos', 'GitHub'])\r\n\r\n# scan the \"a/b/c.java\" Java file for comments (i.e. \"// this is a comment\") and give suggestions with a french dictionary, but exclude words found in \"exclusions.txt\"\r\nPytypos(target='a/b/c.java', match_identifier='//', dictionary='fr', suggestions=True, exclude_word_file='exclusions.txt')\r\n```\r\n\r\n#### Testing\r\n\r\nYou can do some simple testing after cloning the repo.\r\n\r\nNote any additional requirements for running the tests: `pip install -r tests/requirements.txt`\r\n\r\n`python tests/run_integration_test.py`\r\n\r\n#### Additional methods\r\n\r\n`pytypos.Pytypos.fix_typos()`: Fixes typos found in-between spaces with the most likely replacement\r\n\r\n`pytypos.Pytypos.add_to_dictionary()`: Adds custom word list to dictionary\r\n\r\n`pytypos.Pytypos.add_to_exclusions()`: Removes custom word list from dictionary\r\n\r\n`pytypos.Pytypos.replace_word()`: Replaces words in dictionary\r\n\r\n### License\r\n\r\nReleased under [MIT](/LICENSE) by [@PApostol](https://github.com/PApostol)\r\n\r\n- You can freely modify and reuse.\r\n- The original license must be included with copies of this software.\r\n- Please link back to this repo if you use a significant portion the source code.\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Typo and spelling checker",
    "version": "1.4.0",
    "project_urls": {
        "Homepage": "https://github.com/PApostol/pytypos"
    },
    "split_keywords": [
        "typo",
        "spell",
        "check"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "35580f60e55e788dfe8da71387cdc5bce8fd85b4fbf839e07d50ec04fe159a94",
                "md5": "73ab133a44478f4aa4651ebdeb9114a3",
                "sha256": "e34bd070c0517597c7c223fc976dc9978747d9de869e535c6a4ca122ed418b7b"
            },
            "downloads": -1,
            "filename": "pytypos-1.4.0.tar.gz",
            "has_sig": false,
            "md5_digest": "73ab133a44478f4aa4651ebdeb9114a3",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "~=3.7",
            "size": 7670,
            "upload_time": "2023-08-05T13:52:43",
            "upload_time_iso_8601": "2023-08-05T13:52:43.363802Z",
            "url": "https://files.pythonhosted.org/packages/35/58/0f60e55e788dfe8da71387cdc5bce8fd85b4fbf839e07d50ec04fe159a94/pytypos-1.4.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-08-05 13:52:43",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "PApostol",
    "github_project": "pytypos",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "pytypos"
}
        
Elapsed time: 0.09560s