qary package is both a chatbot framework and a working "reference implementation" virtual assistant that actually assists! Most bots manipulate you to make money for their corporate masters. With qary, you can build your bot to protect you and amplify your intelligence and prosocial instincts.
qary package can be installed from PyPi by running:
pip install qary
First retrieve a copy of the source code for
git clone firstname.lastname@example.org:tangibleai/qary cd qary
Then, install and use the
conda python package manager within the Anaconda software package.
A cross-platform package and python environment manager like
conda is especially important if your operating system is not an open standard like Linux.
conda update -n base -c defaults conda conda create -n qaryenv 'python>=3.6.5,<3.8' conda env update -n qaryenv -f environment.yml source activate qaryenv pip install --editable .
$ qary --help usage: bot [-h] [--version] [--name STR] [-p] [-b STR] [-v] [-vv] [words [words ...]]
qary with a single statement/query
You can run bot just like any other command line app, giving it your statement/query as an argument.
$ qary -b glossary -q # -q quiets the logging messages, `-b glossary` loads the glossary bot YOU: what is an allele qary: A variant form of a given gene, a version of a known mutation at the same place as the original unmodified gene within a chromosome.
qary in dialog mode
$ qary [-b <personality1>,<personality2>] ... # ... (logging messages) YOU: When was Barack Obama born? # ... (logging messages) qary: August 4, 1961
qary's probabilistic conversation manager chooses a reply from the possiblities generated by the different personalities:
qa_bots.py): BERT and ALBERT Wikipedia Question Answering (WikiQA reading comprehension tests)
faq_bots.py): answers to frequently asked questions using data/faq/*.yml
glossary_bots.py): definitions from glossary yml files in data/faq/glossary-*.yml
pattern_bots.py): regex patterns and greeting templates
eliza_bots.py): a python port of the ELIZA therapist bot
Configuring default personalities
qary runs with
qa personality. Check out the config file in
$ bot -h to change the default bot personalities loaded for your own custom bot.
qary's hybrid chatbot framework allows you to combine 4 approaches to give you state-of-the-art capability to answer questions and carry on a conversation:
- search: chatterbot, will
- pattern matching and response templates: Alexa, AIML
- generative deep learning: robot-bernie, movie-bot
- grounding: snips
It's all explained in detail at NLP in Action.
Presentations for San Diego Python User Group are in [docs/](/docs/2019-08-22--San Diego Python User Group -- How to Build a Chatbot.odp) and on the web at http://totalgood.org/midata/talks
Contributing pattern for developers
DM @hobs if you'd like to join us for weekly Zoom collaborative-coding sessions.
- Create a fork of the main qary repository on Gitlab.
- Make your changes in a branch named something different from
master, e.g. create a new branch
- Create a merge request.
- Help your fellow contributors out by:
- Follow the PEP-8 style guide.
- Try to include a docstring, at least a single line, in any function, method, or class
- Bonus points for adding a doctest as part of your contribution.
- If you add a new feature, write some quick docs in the README.
- Add your name and attribution to the AUTHORS file.
- Know we are grateful for your contribution! You've made the chatbot world a little better!