Skip to main content

Corrects the spelling and grammar of your text using ChatGPT.

Project description

Grammatical

Pink Bubble Tea with cute eyes and smile, using a typewriter, digital art

Corrects the spelling and grammar of your text using ChatGPT.

Motivation

I have been using this CLI tool internally for a while now. It is not only good at correcting spelling and grammar in your text, but it is also excellent at simplifying complex technical language. Additionally, it perfectly complements Grammarly.

Install

python3 -m pip install grammatical

Usage

This tool requires access to the OpenAI API. It utilizes the gpt-3.5-turbo model. When the spelling and grammar have been corrected, the resulting text will be automatically copied to the clipboard.

Usage: grammatical [OPTIONS]

  Corrects the spelling and grammar of your text using ChatGPT.

Options:
  --text TEXT               Text input for grammar correction
                            If --text flag is used, a prompt will be displayed to enter the text.
                            By default, the most recent text from the clipboard will be used.

  --api_key TEXT            OpenAI API Key
                            By default, key from the OPENAI_API_KEY env var will be used.

  --tone TEXT               Tone of the grammar correction  [default: "social media"]
                            This can be tuned in based on the context of the text.
                            E.g. "formal/informal setting", "academia", "reddit", etc.

  --simplify                Simplify the text

  -i, --input_format TEXT   Specify the input format  [default: text]
                            Useful when working with files like LaTeX, Markdown.

  -o, --output_format TEXT  Specify the output format  [default: text]
                            Useful when working with files like LaTeX, Markdown.

  --help                    Show this message and exit.

Example

Using the defaults:

[09:34][~] # Text in clipboard: I walk to the store and I bought milk
[09:34][~] grammatical
Modified Text:
"I walked to the store and bought milk."
Text copied to clipboard.
[09:34][~]

With options:

[14:39][~] # Text in clipboard: This tool does need access to [OpenAI's API](https://openai.com/pricing). It uses the `gpt-3.5-turbo` model.
[14:40][~] grammatical --tone "documentation" -i "markdown" -o "markdown"
Modified Text:
 This tool requires access to [OpenAI's API](https://openai.com/pricing), utilizing the `gpt-3.5-turbo` model.
Text copied to clipboard.
[14:40][~]

My MacOS Workflow

For my macOS workflow, I have created a new Application in Automator that runs "Grammatical" for convenience. I have also dragged it to the Dock.

Here is the AppleScript that I am using:

tell application "Terminal"
    activate
    do script "grammatical"
end tell

If you are mostly concerned with the defaults, I highly recommend doing this.

License

Under MIT License. The logo is made using Midjourney and licensed under CC BY-NC 4.0.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

grammatical-0.2.1-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file grammatical-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: grammatical-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 5.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.9

File hashes

Hashes for grammatical-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6c7c12fbce1df7c0c7e9ff499b08bd1df641ab56ca94de9dc2db8f2dbd5948e7
MD5 b89a4a3a68f24654e172d1c39d403a6c
BLAKE2b-256 978832fb0e5247eabed7886a327fa39b037a1f937496688fc644d311dd5607b6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page