Skip to main content

JanexBot - Question-Answer Chatbot

JanexBot is a simple prototype chatbot that interacts with users by asking and answering questions based on a provided database of questions and answers. The chatbot utilizes spaCy for natural language processing and similarity calculations.

Getting Started

Follow these instructions to set up and use JanexBot:

Prerequisites

  • Python 3.x
  • Required Python libraries: spacy, numpy

Installation

  1. Clone or download this repository to your local machine.

  2. Install the required Python libraries:

    pip install spacy numpy
    

    Download the spaCy language model (English) by running:

    python -m spacy download en_core_web_sm
    

Create your chatbot script

from JanexBot import *

def main():
    chatbot = JanexBot("database.json", "en_core_web_sm")
    question = chatbot.ask_question(None)
    print(f"Chatbot: {question}")
    while True:
        answer = input("You: ")
        IsQuestion = chatbot.CheckForQuestion(answer)
        if IsQuestion:
            answer = chatbot.give_answer(answer)
            print(f"Chatbot: {answer}")
        else:
            question = chatbot.ask_question(answer)
            print(f"Chatbot: {question}")
            chatbot.save_answer(answer)

if __name__ == "__main__":
    main()

Usage

Place your question-answer data in a JSON file named database.json in the same directory as the script.

Run the chatbot script.

The chatbot will start interacting with you. It will provide prompts and respond to your input.

When asked a question, you can answer, and the chatbot will try to find the most relevant question based on your answer.

You can exit the chatbot by interrupting the script (e.g., pressing Ctrl+C).

Data Format

Ensure your database.json file follows this format:

{
  "prompts": [
    {
      "question": "What is the capital of France?",
      "question_vectors": [0.1, 0.2, 0.3, ...],
      "answers": ["The capital of France is Paris."]
    },
    // Add more prompts as needed
  ]
}

Notes

The provided code is a prototype.

Metadata

Release files for JanexBot 0.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for JanexBot 0.0.4
File Size Uploaded Provenance Actions
JanexBot-0.0.4.tar.gz 5.4 kB Without provenance Details for JanexBot-0.0.4.tar.gz

Release files / JanexBot-0.0.4.tar.gz

Download URL JanexBot-0.0.4.tar.gz
Size 5.4 kB
Tags Source
SHA-256 checksum
How to use checksums
7f7395fe047ec9f705ba8157efc5000e0f5d63376c495fc4a9d6674974045079
BLAKE2b-256 checksum
How to use checksums
31c340e01a20f6d22cc53d6a5ce05326ba765749b91972641bda010c39fefc19
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.2

Security for JanexBot 0.0.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.4 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page