Metadata-Version: 2.1
Name: nlpip
Version: 0.1.6
Summary: A natural language based unix pipeline utility
Author-email: Alan Kang <jania902@gmail.com>
Maintainer-email: Alan Kang <jania902@gmail.com>
License: Copyright (c) 2023 Alan Kang All rights reserved.
        
        Permission is hereby granted, free of charge, to any person obtaining a copy of
        this software and associated documentation files (the "Software"), to deal in
        the Software without restriction, including without limitation the rights to
        use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
        the Software, and to permit persons to whom the Software is furnished to do so,
        subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
        FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
        COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
        IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
        CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
        
Project-URL: Homepage, https://github.com/akngs/nlpip
Project-URL: Bug Reports, https://github.com/akngs/nlpip/issues
Project-URL: Source, https://github.com/akngs/nlpip
Keywords: nlp,llm,chatgpt,openai,unix,pipeline
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: End Users/Desktop
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Topic :: Text Processing
Classifier: Topic :: Text Processing :: General
Requires-Python: >=3.7
Description-Content-Type: text/markdown
Provides-Extra: dev
License-File: LICENSE

# nlpip - A natural language based unix pipeline utility

`nlpip` takes a text written in natural language as input, and performs a
specified command also written in natural language, and then outputs the result
in natural language.

Here's a demo:

<img width="600" src="https://github.com/akngs/nlpip/raw/main/nlpip.svg" alt="screen recording">

## Installation

First, you need to install `nlpip` using `pip`:

    pip install nlpip

Then, set your OpenAI's API key as an environment variable:

    export OPENAI_API_KEY=WRITE_YOUR_KEY_HERE

## How to use

`nlpip` or just `nlp` for short, provides following default commands:

- `keywords`: Extract keywords from input text
- `poem`: Write poem using input text
- `summarize`: Summarize input text
- `sentiment`: Analyze sentiment of input text

For example, if you want summarize `input.txt` and turn it into a poem, you can
run the following command:

    cat input.txt | nlp summarize | nlp poem

## How to create a new command

To create a new command, you just need to create a text file containing the
command in natural language. For example, if you want to create a command that
translates input text into French, you can create a file named
`~/.nlpip/prompts/fr.txt` in with:

    Translate into French

Then, you can run the following command:

    echo Hello | nlp fr

And you will get the following output:

    Bonjour

You may override default commands by creating a file with the same name in
`~/.nlpip/prompts/`.

## Credit

- `nlpip` is inspired by
  [Schillace Laws of Semantic AI](https://learn.microsoft.com/en-us/semantic-kernel/howto/schillacelaws).
