Similarity-based conversational dialog engine for Python.
Project description
QnA Bot
Introduction
QnA Builder is a simple, no code way to build chatbots in Python. It provides a similarity-based conversational dialog engine, QnA Bot, which makes it easy to generate automated responses to input questions according to a set of known conversations, i.e., question-answer pairs, stored in a knowledge base. QnA Bot relies on a collection of question-answer pairs to generate (predict) answers for new inputs.
Install
The easiest way to install the qna-builder is by using pip
:
pip install qna-builder
This library is shipped as an all-in-one module implementation with minimalistic dependencies and requirements.
Getting started
A QnA Bot can be set up and used in four simple steps:
- Import
QnABot
class
from qnabuilder import QnABot
- Initialize a bot
bot = QnABot()
- Fit the bot engine to a knowledge base
bot.fit(kb="knowledge_base.json")
- Generate answers
bot.answer("Hey. What's up?")
"All good. What's up with you?"
Algorithms
Currently, QnA Bot engine supports the following algorithms for similarity-based answer generation:
- TF-IDF Vectorization (
'tfidf'
) - Murmurhash3 Vectorization (
'murmurhash'
) - Count Vectorization (
'count'
)
Supported similarity metrics are as follows:
- Cosine similarity (
'cosine'
) - Euclidean distance (
'euclidean'
) - Manhattan distance (
'manhattan'
) - Haversine distance (
'haversine'
)
Knowledge base editor
By calling run_editor()
method of QnAKnowledgeBase
class, the knowledge base editor window will open up in
your web browser and allows you to edit your knowledge base by adding, removing, or modifying questions/answers.
from qnabuilder import QnAKnowledgeBase
kb = QnAKnowledgeBase('my_knowledge_base.json')
kb.run_editor()
Here, you can see a screenshot of the knowledge base editor:
Note that you need to install the optional requirement streamlit to be able to use the knowledge base editor.
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
File details
Details for the file qna-builder-0.1.1.tar.gz
.
File metadata
- Download URL: qna-builder-0.1.1.tar.gz
- Upload date:
- Size: 5.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 436520b965a125acf6ca9185f3e0b8b0247f25b17dc4d2cd6e07e14aad2feee5 |
|
MD5 | 067ad86b09ab2552ae2d3059ca0aed85 |
|
BLAKE2b-256 | 281632e8760e547e7e03d7095bbadf4ea0fbaac32d6521278c21f2a4e327975a |
File details
Details for the file qna_builder-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: qna_builder-0.1.1-py3-none-any.whl
- Upload date:
- Size: 6.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7154afce45fc8c95635ad5434774139c646451f61b8f41f17b577c2f19aa6bc2 |
|
MD5 | efb0e6021aaff017860a79562bb54224 |
|
BLAKE2b-256 | 24d2ec0823f601d21f2be9c544ed736d00ee7aea4803588161400b56b51f4166 |