Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/danerwilliams/pork-chop

🐷 An AI chat bot written in python
https://github.com/danerwilliams/pork-chop

ai aws chatterbot groupme hacktoberfest python

Last synced: 10 days ago
JSON representation

🐷 An AI chat bot written in python

Awesome Lists containing this project

README

        

# pork-chop

> An AI chat bot



## Conversations

We use [ChatterBot](https://github.com/gunthercox/ChatterBot), a machine learning conversational dialog engine to power Pork Chop's conversations.

### Training

Pork Chop has a few options for training:
* Train with csv data - The success and training time with this is dependent on the size and quality of the data you provide it. For reference, a 70,000 message file we trained pork chop with took around 10 minutes on a AWS EC2 t3.micro VM. See [example_training.csv](./example_training.csv) for reference.
* Train with english corpus - Train with the small english corpus provided by ChatterBot
* Train with Ubuntu corpus - This is a huge data set which will take a long time to download and train

## Command Modules

Pork chop will respond to the following command modules:
* !example - Template module
* !usage - Display modules and their use
* !joke - Display a random joke.
* !kanye - Display a random Kanye West quote.
* !stonks \ - Get stock price information
* !turn \ [list] - Turn a user or list number of turns for all users
* !helpmecook \ - Get recipe help for cooking a tasty vegan meal with spoonacular api (try cooking manwich)
* !yt \ - Get the best-match YouTube video url for your query
* !reddit \ - Get the best-match subreddit for your query
* !word - Display a randomly generated fake word + definition (from the awesome [thisworddoesnotexist.com](https://thisworddoesnotexist.com))

## Deployment

Pork Chop can be deployed on any server with python3.

### Bot Registration

* Navigate to [dev.groupme.com/bots](https://dev.groupme.com/bots)
* Click the orange button labeled "create bot"
* Choose the groupchat you would like pork chop to live in
* For the callback URL, enter the ip or domain of the server Pork Chop will be run on with the extension /bot as this is where the flask handler is set to.
* If you are running pork chop on serverless mode set up the callback URL appropriate to you AWS Lambda function
* You can leave Avatar URL blank or set it to your desired image

### Server

* `git clone https://github.com/danerwilliams/pork-chop.git` Clone pork-chop
* `cd pork-chop` enter pork-chop directory
* `pip3 install -r requirements.txt` install pork-chop's python3 dependencies
* Set environment variables for secrets:
- `$EDITOR .env` record environment variables to a file with text editor of choice, minimum need to set BOT_ID (use .env.example for reference)
- `export $(grep -v '^#' .env)` set environment variables from .env file
* OR use .secrets json formatted file for secrets:
- `$EDITOR .secrets` record secrets to file with text editor of choice, minimum need to set BOT_ID (use .secrets.example for reference)
* `sudo ./pork-chop.py -d` deploy pork chop on port 80 (you can add `&> /dev/null &` to ignore output and run in background)

## Flags

`./pork-chop.py -h`

```
usage: pork-chop [-h] [-c CORES] [-t TRAIN [TRAIN ...]] [-d] [-u] [-e]
[-n NAME]

optional arguments:
-h, --help show this help message and exit
-c CORES, --cores CORES
Number of CPU cores to use
-t TRAIN [TRAIN ...], --train TRAIN [TRAIN ...]
Train bot from csv data files
-d, --deploy Deploy bot with flask on port 80 (requires sudo)
-u, --ubuntu Train bot from ubuntu corpus
-e, --english Train bot from english corpus
-n NAME, --name NAME Change Pork Chop's name from default
```

## References

Inspired by [ginglis13/shortstop](https://github.com/ginglis13/shortstop) and [pbui/bobbit](https://github.com/pbui/bobbit)

Useful Documentation:
* [ChatterBot](https://chatterbot.readthedocs.io/en/stable/)
* [Flask](https://flask.palletsprojects.com/en/1.1.x/quickstart/)
* [GroupMe](https://dev.groupme.com/tutorials/bots)

## Team

This project is maintained by the following person(s) and a bunch of [awesome contributors](https://github.com/danerwilliams/pork-chop/graphs/contributors).

[](https://github.com/danerwilliams) | [](https://github.com/cnrmrphy) | [](https://github.com/jheneghan16) | [](https://github.com/beniaminogreen) |
--- | --- | --- | --- |
[Dane Williams](https://github.com/danerwilliams) | [Conor Murphy](https://github.com/cnrmrphy) | [James Heneghan](https://github.com/jheneghan16) | [Ben Green](https://github.com/beniaminogreen) |

## License

[MIT License](https://github.com/danerwilliams/pork-chop/blob/master/LICENSE)