GithubHelp home page GithubHelp logo

danerwilliams / pork-chop Goto Github PK

View Code? Open in Web Editor NEW
11.0 4.0 4.0 651 KB

🐷 An AI chat bot written in python

License: MIT License

Python 99.34% Shell 0.66%
python chatterbot aws groupme ai hacktoberfest

pork-chop's Introduction

pork-chop

An AI chat bot

Conversations

We use 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 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 <symbol> - Get stock price information
  • !turn <user> [list] - Turn a user or list number of turns for all users
  • !helpmecook <food> - Get recipe help for cooking a tasty vegan meal with spoonacular api (try cooking manwich)
  • !yt <query> - Get the best-match YouTube video url for your query
  • !reddit <query> - Get the best-match subreddit for your query
  • !word - Display a randomly generated fake word + definition (from the awesome thisworddoesnotexist.com)

Deployment

Pork Chop can be deployed on any server with python3.

Bot Registration

  • Navigate to 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 and pbui/bobbit

Useful Documentation:

Team

This project is maintained by the following person(s) and a bunch of awesome contributors.

Dane Williams Conor Murphy James Heneghan Ben Green

License

MIT License

pork-chop's People

Contributors

antithalian avatar beniaminogreen avatar cnrmrphy avatar danerwilliams avatar dependabot[bot] avatar hyrumo avatar jheneghan16 avatar jmmille avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

pork-chop's Issues

Add requirements.txt

This project does not have a requirements.txt. Adding one would make it epic.

ChatterBot 1.1.0 was yanked from PyPI

Chatterbot 1.1.0 has apparently been yanked from PyPI according to the pip error I got when trying to set up a development environment for pork-chop. Error was as follows:

WARNING: The candidate selected for download or install is a yanked version: 'ChatterBot' candidate (version 1.1.0 at https://files.pythonhosted.org/packages/12/b7/d8a034fbef04cb50fc7a9f5c6b6d27f1db186ffd58f66d7301e16abfd9ca/ChatterBot-1.1.0-py2.py3-none-any.whl#sha256=00df0553f2f69a7927fdeddc217d270b45241e11dd597077ffb4a4ce2a5177b6 (from https://pypi.org/simple/chatterbot/) (requires-python:>=3.4, <4))
Reason for being yanked: <none given>

I'm dropping the version required by requirements.txt down to 1.0.5 and will submit a pull request momentarily.

Command Module: !word

Description

Adds a command to retrieve a word and definition from thisworddoesnotexist.com, which generates words and definitions using a GPT-2 neural network. It's a cool site that shows off what GPT-2 can do, and the words and definitions are funny. Even better, it has a simple JSON API to pull words/definitions from!

Risks

None?

Alternatives

Use some kind of boring real dictionary?

Command Module: Water polo schedule

Description

Display the notre dame men's water polo team game/tournament schedule

Risks

would go out of date

Alternatives

Scrape the team website rather than hardcoding the schedule so that it is always up to date

Command Module: !game

Description

Track water polo game results

Risks

What risks may be associated with adding this module

Alternatives

What alternatives may exist for this module in order to mitigate the risks

Command Module: $TSLA Stock

Description

Get current stock price and % up or down that $TSLA is for the day

Risks

Elon may have said something controversial on twitter today

Alternatives

There is no alternative to buying tesla, it is the only good stonk

Command Module: !yt <search>

Description

Return the best-match youtube link for the message passed.

Risks

the damb algorithm could fuck you over (?)

Alternatives

implement clickbait-based hierarchy for videos

Command Module: !joke

Description

Tells a random joke

Risks

What risks may be associated with adding this module

Alternatives

What alternatives may exist for this module in order to mitigate the risks

Command Module: !clout

Description

Return a link to pork-chop's github repo to give him clout

Risks

naw

Alternatives

Command Module: new github issue module

Description

allows you to open a new module on a github repo with porkchop

Risks

What risks may be associated with adding this module

Alternatives

What alternatives may exist for this module in order to mitigate the risks

Auto Reply mode

Have pork chop automatically reply to a message if the confidence level of his response is high enough (90+%???), even if his name has not been called.

Consider listing this bot on MeBots to expose it to a wider audience

Hey Dane/Conor/James/Ben! Hope you're doing well.

I recently launched an "App Store" of sorts for GroupMe bots, which you can check out at https://mebots.io. Like you, I built a GroupMe bot as a fun project, but became frustrated with the limitations of GroupMe's bot infrastructure. As you know, GroupMe has no straightforward way to manage a bot across multiple groups. The simple system of maintaining a constant bot ID and only running bots in one group places serious limits on how useful GroupMe bots can ever be, and leaves GroupMe lagging behind other platforms like Discord in this area.

So, I developed the bot management and indexing system GroupMe has been missing (and massively upgraded it in recent weeks). MeBots acts as a middleman to the GroupMe API and injects extra fields into the message POST sent from GroupMe, like the bot ID and user token that can be used in the group where the message was sent. All you need is to register your bot and tweak your code to use the received bot ID and token rather than constants. With this minor tweak, anyone will be able to go to https://mebots.io/bot/porkchop and click just a couple buttons to add the bot to their own groups.

I would love to see your work on MeBots, which would no doubt expose your great work to more people! One of my bots that I created as a joke several years ago blew up once I launched it on MeBots and now has over 225 groups and thousands of people using itβ€”I wouldn't be surprised if the same happened to yours, since it's a fairly versatile and publicly appealing bot. I am happy to help with the integration process and anything else that would be useful. Just let me know.

Appreciate the consideration, and have a great week! :)

Serverless Mode (AWS lambda)

Add functionality for running pork chop in a serverless environment such as AWS lambda rather than on a flask server.

imessage compatibility

Add compatibility for using a dedicated mac as a chat server.

  • constantly check the /Users/username/Library/Messages/chat.db file for new messages
  • send imessages with an osa script

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.