qna-builder


Nameqna-builder JSON
Version 0.1.3 PyPI version JSON
download
home_pagehttps://github.com/msamsami/qna-builder
SummarySimilarity-based conversational dialog engine for Python.
upload_time2023-07-13 02:03:21
maintainer
docs_urlNone
authorMehdi Samsami
requires_python>=3.7
license
keywords python qna qnabuilder chat chatbot conversation dialog
VCS
bugtrack_url
requirements scikit-learn
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # QnA Builder

![](https://img.shields.io/badge/version-v0.1.3-green)
![](https://img.shields.io/badge/python-3.7%20%7C%203.8%20%7C%203.9-blue)
![](https://github.com/msamsami/qna-bot/actions/workflows/python-publish.yml/badge.svg)
[![](https://img.shields.io/pypi/v/qna-builder)](https://pypi.org/project/qna-builder/)
![](https://img.shields.io/pypi/dm/qna-builder)

<p>
<img src="https://raw.githubusercontent.com/msamsami/qna-builder/main/docs/logo.jpg" alt="QnA Builder logo" width="200"/>
<br>
</p>

## 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 answers for new inputs.

## Install
The easiest way to install the qna-builder is by using `pip`:
```shell
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:

1. Import `QnABot` class

```python
from qnabuilder import QnABot
```

2. Initialize a bot
```python
bot = QnABot()
```

3. Fit the bot engine to a knowledge base
```python
bot.fit(kb="knowledge_base.json")
```

4. Generate answers
```python
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'`)

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

```python
from qnabuilder import QnAKnowledgeBase

kb = QnAKnowledgeBase('my_knowledge_base.json')
kb.run_editor()
```

Here, you can see a screenshot of the knowledge base editor:

<div style="text-align:center">
<img src="https://raw.githubusercontent.com/msamsami/qna-builder/main/docs/kb_editor.png" alt="QnA Bot Knowledge Base Editor" width="450"/>
</div>

Note that you need to install the optional requirement [streamlit](https://streamlit.io/) to be able to use the
knowledge base editor.

## Tests
To run the tests, install development requirements:
```
pip install -r requirements_dev.txt
```

Then, run pytest:
```
pytest
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/msamsami/qna-builder",
    "name": "qna-builder",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "python,qna,qnabuilder,chat,chatbot,conversation,dialog",
    "author": "Mehdi Samsami",
    "author_email": "mehdisamsami@live.com",
    "download_url": "https://files.pythonhosted.org/packages/15/f6/439bf873040b39bcdc353ab621c6b5e5527f190edbfa0bf8485602688b45/qna-builder-0.1.3.tar.gz",
    "platform": null,
    "description": "# QnA Builder\n\n![](https://img.shields.io/badge/version-v0.1.3-green)\n![](https://img.shields.io/badge/python-3.7%20%7C%203.8%20%7C%203.9-blue)\n![](https://github.com/msamsami/qna-bot/actions/workflows/python-publish.yml/badge.svg)\n[![](https://img.shields.io/pypi/v/qna-builder)](https://pypi.org/project/qna-builder/)\n![](https://img.shields.io/pypi/dm/qna-builder)\n\n<p>\n<img src=\"https://raw.githubusercontent.com/msamsami/qna-builder/main/docs/logo.jpg\" alt=\"QnA Builder logo\" width=\"200\"/>\n<br>\n</p>\n\n## Introduction\n**QnA Builder** is a simple, no-code way to build chatbots in Python. It provides a similarity-based conversational dialog\nengine, **QnA Bot**, which makes it easy to generate automated responses to input questions according to a set of known\nconversations, i.e., question-answer pairs, stored in a ***knowledge base***. QnA Bot relies on a collection of\nquestion-answer pairs to generate answers for new inputs.\n\n## Install\nThe easiest way to install the qna-builder is by using `pip`:\n```shell\npip install qna-builder\n```\nThis library is shipped as an all-in-one module implementation with minimalistic dependencies and requirements.\n\n## Getting started\nA QnA Bot can be set up and used in four simple steps:\n\n1. Import `QnABot` class\n\n```python\nfrom qnabuilder import QnABot\n```\n\n2. Initialize a bot\n```python\nbot = QnABot()\n```\n\n3. Fit the bot engine to a knowledge base\n```python\nbot.fit(kb=\"knowledge_base.json\")\n```\n\n4. Generate answers\n```python\nbot.answer(\"Hey. What's up?\")\n```\n`\"All good. What's up with you?\"`\n\n## Algorithms\nCurrently, QnA Bot engine supports the following algorithms for similarity-based answer generation:\n- TF-IDF Vectorization (`'tfidf'`)\n- Murmurhash3 Vectorization (`'murmurhash'`)\n- Count Vectorization (`'count'`)\n\nSupported similarity metrics are as follows:\n- Cosine similarity (`'cosine'`)\n- Euclidean distance (`'euclidean'`)\n- Manhattan distance (`'manhattan'`)\n\n## Knowledge base editor\nBy calling `run_editor()` method of `QnAKnowledgeBase` class, the knowledge base editor window will open up in\nyour web browser and allows you to edit your knowledge base by adding, removing, or modifying questions/answers.\n\n```python\nfrom qnabuilder import QnAKnowledgeBase\n\nkb = QnAKnowledgeBase('my_knowledge_base.json')\nkb.run_editor()\n```\n\nHere, you can see a screenshot of the knowledge base editor:\n\n<div style=\"text-align:center\">\n<img src=\"https://raw.githubusercontent.com/msamsami/qna-builder/main/docs/kb_editor.png\" alt=\"QnA Bot Knowledge Base Editor\" width=\"450\"/>\n</div>\n\nNote that you need to install the optional requirement [streamlit](https://streamlit.io/) to be able to use the\nknowledge base editor.\n\n## Tests\nTo run the tests, install development requirements:\n```\npip install -r requirements_dev.txt\n```\n\nThen, run pytest:\n```\npytest\n```\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Similarity-based conversational dialog engine for Python.",
    "version": "0.1.3",
    "project_urls": {
        "Homepage": "https://github.com/msamsami/qna-builder"
    },
    "split_keywords": [
        "python",
        "qna",
        "qnabuilder",
        "chat",
        "chatbot",
        "conversation",
        "dialog"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9037c48a0fe15f5fe3a54c5d95c4156dc7b86f18252a5dd22af56058e6446665",
                "md5": "456e9957cfcd8aa7e209eeb5c67faa05",
                "sha256": "617c039298ddf47759a8c7f657c077938348f518f2b3f7f9c58c6f302c0229b0"
            },
            "downloads": -1,
            "filename": "qna_builder-0.1.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "456e9957cfcd8aa7e209eeb5c67faa05",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 6493,
            "upload_time": "2023-07-13T02:03:19",
            "upload_time_iso_8601": "2023-07-13T02:03:19.888004Z",
            "url": "https://files.pythonhosted.org/packages/90/37/c48a0fe15f5fe3a54c5d95c4156dc7b86f18252a5dd22af56058e6446665/qna_builder-0.1.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "15f6439bf873040b39bcdc353ab621c6b5e5527f190edbfa0bf8485602688b45",
                "md5": "26a0f696737900f6dd9744fffcabeaea",
                "sha256": "a5c1c5429a54b91dd24ec85c2463a8cf8cabebd6fba3ec0f634fb1b3747b9ad9"
            },
            "downloads": -1,
            "filename": "qna-builder-0.1.3.tar.gz",
            "has_sig": false,
            "md5_digest": "26a0f696737900f6dd9744fffcabeaea",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 6271,
            "upload_time": "2023-07-13T02:03:21",
            "upload_time_iso_8601": "2023-07-13T02:03:21.319471Z",
            "url": "https://files.pythonhosted.org/packages/15/f6/439bf873040b39bcdc353ab621c6b5e5527f190edbfa0bf8485602688b45/qna-builder-0.1.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-07-13 02:03:21",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "msamsami",
    "github_project": "qna-builder",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "scikit-learn",
            "specs": [
                [
                    "==",
                    "1.0.2"
                ]
            ]
        }
    ],
    "lcname": "qna-builder"
}
        
Elapsed time: 0.10419s