Skip to main content

High-speed conversational dialogue engine

Project description

Flipgenic: High-speed conversational dialogue engine


Maintainability

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


Download files

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

Source Distribution

flipgenic-0.4.0.tar.gz (5.1 kB view hashes)

Uploaded Source

Built Distribution

flipgenic-0.4.0-py3-none-any.whl (17.9 kB view hashes)

Uploaded Python 3

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