Skip to main content

"An open framework and dataset for building a distributed-agent chatbot based on _Natural Language Processing in Action_."

Project description

Buy Us Tea PyPI version License

qary

The 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 was conceived as part of NLP in Action book, is maintained by an active developer community and is supported by San Diego Python User Group (see talk presentations here and in docs/.

Install

Package install

qary package can be installed from PyPi by running:

pip install qary

Developer install

First retrieve a copy of the source code for qary:

git clone git@gitlab.com: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.0,<3.7'
conda env update -n qaryenv -f environment.yml
source activate qaryenv
pip install --editable .

Usage

$ qary --help
usage: bot [-h] [--version] [--name STR] [-p] [-b STR] [-v] [-vv] [words [words ...]]

Running 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.

Running qary in dialog mode

$ qary [-b <personality1>,<personality2>] ...
# ... (logging messages)
YOU: When was Barack Obama born?
# ... (logging messages)
qary: August 4, 1961

qary personalities

qary's probabilistic conversation manager chooses a reply from the possiblities generated by the different personalities:

  • qa (qa_bots.py): BERT and ALBERT Wikipedia Question Answering (WikiQA reading comprehension tests)
  • faq (faq_bots.py): answers to frequently asked questions using data/faq/*.yml
  • glossary (glossary_bots.py): definitions from glossary yml files in data/faq/glossary-*.yml
  • pattern (pattern_bots.py): regex patterns and greeting templates
  • eliza (eliza_bots.py): a python port of the ELIZA therapist bot

Configuring default personalities

By default, qary runs with qa personality. Check out the config file in qary.ini or $ bot -h to change the default bot personalities loaded for your own custom bot.

Approach

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:

  1. search: chatterbot, will
  2. pattern matching and response templates: Alexa, AIML
  3. generative deep learning: robot-bernie, movie-bot
  4. 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.

  1. Create a fork of the main qary repository on Gitlab.
  2. Make your changes in a branch named something different from master, e.g. create a new branch my-pull-request.
  3. Create a merge request.
  4. 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!

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

qary-0.5.6.tar.gz (2.7 MB view details)

Uploaded Source

Built Distribution

qary-0.5.6-py2.py3-none-any.whl (2.2 MB view details)

Uploaded Python 2 Python 3

File details

Details for the file qary-0.5.6.tar.gz.

File metadata

  • Download URL: qary-0.5.6.tar.gz
  • Upload date:
  • Size: 2.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.1.post20200529 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.7.6

File hashes

Hashes for qary-0.5.6.tar.gz
Algorithm Hash digest
SHA256 7d20f6edd9791ab4b180ca5f4acbac598aa4d234aadf51d0b412ce88bdb45056
MD5 274d8b1a7fea3c7e6a4e02fb703be496
BLAKE2b-256 d5d3c827a74ce6d4d18062bb444190de58b869c4532ae67f93818d6484367a0e

See more details on using hashes here.

Provenance

File details

Details for the file qary-0.5.6-py2.py3-none-any.whl.

File metadata

  • Download URL: qary-0.5.6-py2.py3-none-any.whl
  • Upload date:
  • Size: 2.2 MB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.1.post20200529 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.7.6

File hashes

Hashes for qary-0.5.6-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 2bb3fda92a0a3f187dc4bf6464d665f9e68ec089e49d4b9a1ff3d0f50bb6e90f
MD5 6c8692d43df6a1904b0acf64bdbf072d
BLAKE2b-256 31b0fc71f5d3f62e6332bbe2138d622aed52fae936ee0f9ea486a1df6577bba9

See more details on using hashes here.

Provenance

Supported by

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