High-speed conversational dialogue engine
Project description
What is it?
Flipgenic is a Python package which helps you in creating chatbots which respond using a database of known conversations. It learns how to talk based on messages it receives, or messages from a dataset which are pre-trained into it.
How do I use it?
Here is a very basic example:
# python -m pip install flipgenic
# python -m spacy download en_core_web_md
from flipgenic import Responder
# Create and connect to database
# This can take a while to load the spaCy models
responder = Responder('/path/to/data/folder/')
# Initialize the database with a single response
responder.learn_response('Hello', 'Hi!')
response = None
while True:
text = input('> ')
if response:
# Learn the input as a response to the previous output
responder.learn_response(response, text)
# Generate a response
response, distance = responder.get_response(text)
print(response, f'({distance})')
For more, see ReadTheDocs.
How does it work?
Input messages (well, a 300-dimensional vector representation of them) are stored along with any learned responses to that text. If someone inputs the first message again, the stored response will be found and re-used.
Input messages are converted to a 300-dimensional vector using SpaCy. Then, this vector is used to query the closest match from an NGT index containing the vectors of previously-learned messages. Each object ID from the index corresponds to one or more known responses, stored in a basic SQLite database. The most common response is selected, or one at random if there is no mode.
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
Built Distribution
Hashes for flipgenic-0.5.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3f7cbb91ec00bdec6cbdf4ffd44a2482839daf1b53be4eddac6207edc2079567 |
|
MD5 | 894a40562c5de17f0e5196ba5269f99d |
|
BLAKE2b-256 | 84573812317013537c3d0842c4119c7e9fd52fc8837c7d46af47fb9b52daea81 |