Skip to content

Latest commit

 

History

History
80 lines (53 loc) · 1.55 KB

README.md

File metadata and controls

80 lines (53 loc) · 1.55 KB
Thomas

Thomas the Chatbot

Demo

Installation

Python 3.9+ is required

This package can be installed from PyPi with:

pip install thomasthechatbot

CLI

Type ttc to begin talking to Thomas.

How does Thomas work?

I wrote a medium article to explain how Thomas works.

Usage

Basic Usage

from ttc import Chatbot, Context, download_nltk_data

# Only needs to be run once (can be removed after first run)
download_nltk_data()

# Creating the context
ctx = Context()

# Initializing the chatbot
chatbot = Chatbot()

talk = True

while talk:
    msg = input("You: ")

    if msg == "s":
        talk = False
    else:
        # Getting the response
        resp = chatbot.respond(ctx, msg)

        # Saving the response to the context
        ctx.save_resp(resp)

        print(f"Thomas: {resp}")

# Saving the chatbot data
chatbot.save_data()

Configurations

chatbot = Chatbot(
    path="brain",
    learn=False,
    min_score=0.5,
    score_threshold=0.5,
    mesh_association=0.5,
)

Contributing

Open to contributions, please create an issue if you want to do so.

Formatting

Black, isort and Prettier are used for formatting