grammarbot-py
Grammar Bot provides spelling and grammar check. Signup for an API key at https://www.grammarbot.io/ for increased usage limits. The API still works with no key, but the daily usage limit is lower.
Installation
pip install grammarbot
Usage
See the example below
# import the client library
from grammarbot import GrammarBotClient
# Creating the client
# ===================
client = GrammarBotClient()
# or, signup for an API Key to get higher usage limits here: https://www.grammarbot.io/
client = GrammarBotClient(api_key='my_api_key_here') # GrammarBotClient(api_key=my_api_key_here)
# you can even set the base URI to a different server
client = GrammarBotClient(base_uri='http://backup.grammarbot.io:80')
# Analyzing the text
# ==================
# There is only one method to perform the analysis, viz. GrammarBotClient.check
# method.
text = 'I cant remember how to go their'
# check the text, returns GrammarBotApiResponse object
res = client.check(text) # GrammarBotApiResponse(matches=[GrammarBotMatch(offset=2, length=4, rule={'CANT'}, category={'TYPOS'}), GrammarBotMatch(offset=26, length=5, rule={'CONFUSION_RULE'}, category={'TYPOS'})])
# Inspecting the GrammarBotApiResponse object
# ===========================================
# check detected language
res.detected_language # "en-US"
# check if the result is incomplete
res.result_is_incomplete # False
# see the suggestions / corrections suggested by the GrammarBot API
# returns a list of GrammarBotMatch objects describing each replacement
res.matches # [GrammarBotMatch(offset=2, length=4, rule={'CANT'}, category={'TYPOS'}), GrammarBotMatch(offset=26, length=5, rule={'CONFUSION_RULE'}, category={'TYPOS'})]
# Inspecting the GrammarBotMatch object
# =====================================
match0 = match[0] # GrammarBotMatch(offset=2, length=4, rule={'CANT'}, category={'TYPOS'})
# get replacement information
match0.replacement_offset # 2
match0.replacement_length # 4
# get suggested replacements
match0.replacements # ["can't", 'cannot']
# get list of possible correct sentences after applying the replacements
match0.corrections # ["I can't remember how to go their", 'I cannot remember how to go their']
# get the rules, type and category information of the match
match0.rule # 'CANT'
match0.category # 'TYPOS'
match0.type # 'Other'
# getting a friendly message regarding the replacement suggestion
match0.message # 'Did you mean "can\'t" or "cannot"?'
# Getting even more information
# =============================
# if the information provided by the class properties is not enough, you can
# always access the complete original JSON response from GrammarBotApiResponse
# object
res.raw_json
API docs
You can see the API documentation here: https://grammarbot-py.readthedocs.io/en/latest/
Metadata
Release files for grammarbot 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| grammarbot-0.2.0.tar.gz | 4.9 kB | Without provenance | Details for grammarbot-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| grammarbot-0.2.0-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details for grammarbot-0.2.0-py2.py3-none-any.whl |
Total release size: 9.8 kB
Release files / grammarbot-0.2.0.tar.gz
| Download URL | grammarbot-0.2.0.tar.gz |
|---|---|
| Size | 4.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7fbce072aaac5b678777f04631af00ba0a952616e42f7da69fd91e4ce4e89a4d
|
|
BLAKE2b-256 checksum How to use checksums |
5f62194900baeab7282c891bae578fec075e717473f693073a530d3c95719bfb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.1
|
Release files / grammarbot-0.2.0-py2.py3-none-any.whl
| Download URL | grammarbot-0.2.0-py2.py3-none-any.whl |
|---|---|
| Size | 4.8 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
31a28bcff28acf182f875100d9877cf59fe0255855ffea25aff4d1ae8fbca9ac
|
|
BLAKE2b-256 checksum How to use checksums |
50725eecde9948c24561c01677b8ee0573b3ba13432ce2b040f6cba911d2f18d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.1
|
Security for grammarbot 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.