High-speed conversational dialogue engine
Project description
What is it?
Flipgenic is a library for creating simple chatbots. A Flipgenic bot starts with an empty mind and learns how to communicate over time by reusing messages it has seen in previous conversations. It does not write anything original.
Here is an example from its use in Axyn:
Flipgenic is focused on fast reply times and a simple API. Chatterbot, a more well-known library, has additional features such as custom filters and logic adapters.
How do I use it?
Here is a 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.text, f'({distance})')
For more, see ReadTheDocs.
How does it work?
- Upon calling
get_response
, the input is converted to a 300-dimensional vector. The vector embeddings for each word are provided by SpaCy; calculating the mean gives a single vector representing the whole text. - A closest match is found by searching the vectors of previously seen messages. An NGT index improves performance.
- The search result corresponds to one or more known responses. These responses are stored in an SQLite database.
- We select a matching response at random. The same response might have been learned more than once, giving it a higher chance of selection.
- Along with the selected response, the distance between the input vector and the search result is returned as a confidence heuristic.
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
flipgenic-2.2.1.tar.gz
(16.9 kB
view details)
Built Distribution
flipgenic-2.2.1-py3-none-any.whl
(17.5 kB
view details)
File details
Details for the file flipgenic-2.2.1.tar.gz
.
File metadata
- Download URL: flipgenic-2.2.1.tar.gz
- Upload date:
- Size: 16.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.7.11
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d977f0a39792ae15614791f2b8742c8bcf41425fc6cf4e80258c052737f33eef |
|
MD5 | 2bd31bc03c7625aaca9263b9ed8fd6f7 |
|
BLAKE2b-256 | 5913231d089ba10400b80b8bf3f04e89a3cabdb67c71e9d2b5cf1c07ea9bc4fb |
File details
Details for the file flipgenic-2.2.1-py3-none-any.whl
.
File metadata
- Download URL: flipgenic-2.2.1-py3-none-any.whl
- Upload date:
- Size: 17.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.7.11
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 799cd2808f0ae1c00ac654232865da86e14fb14b7ac79fa9a085ed47c90d0579 |
|
MD5 | a5ddb2a245c83aba9059dde7ad64c867 |
|
BLAKE2b-256 | 6a318f2b3493a705836a0c9c816b05fbd24104e3016f01745825fe8cac7ebd8a |