Skip to content

thtkha/fluent-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 

Repository files navigation

Chatbot: A Simple Machine-learning-powered Chatbot

Overview

This project is a simple chatbot that uses TF-IDF vectorization and cosine similarity to answer predefined questions related to Artificial Intelligence and Machine Learning. It now includes trivia and fact-sharing capabilities, as well as enhanced logging for interactions.

Features

  • Predefined Knowledge Base: Responds to questions about AI, machine learning, and related topics.
  • Dynamic Content: Shares random trivia and facts about AI and technology.
  • Interactive CLI: Provides a user-friendly command-line interface.
  • Logging: Logs interactions to a CSV file for future analysis.
  • Graceful Exit: Recognizes user input to end the conversation.

What's New

  • Trivia and Fact Integration: Responds with random trivia or interesting AI-related facts.
  • Enhanced Question Handling: Unrecognized questions now receive a clearer response guiding the user toward valid queries.
  • Logging Support: All interactions are logged with timestamps in a CSV file.

Prerequisites

  • Python 3.10.x
  • Required Libraries:
    • scikit-learn: For TF-IDF and cosine similarity.
    • time: For simulated typing and logging timestamps.
    • csv: For interaction logging.
    • sys: For enhanced CLI interaction. Install dependencies:
pip install scikit-learn

How to Run

  1. Download the script file (chatbot.py).

  2. Navigate to the directory where the script is located.

  3. Run the chatbot script using Python:

    python chatbot.py

Example Usage

General Questions

Chatbot: Ask me something.
User: What is AI?
Chatbot: Artificial Intelligence (AI) refers to machines or software designed to perform tasks that typically require human intelligence, such as decision-making, problem-solving, and language understanding.
Chatbot: Anything else?

Trivia

User: Tell me a trivia.
Chatbot: ELIZA, one of the first chatbots, was created back in the 1960s.
Chatbot: Anything else?

Facts

User: Tell me a fact.
Chatbot: AI-powered language models like GPT-4o can generate human-quality text, write code, and translate languages.
Chatbot: Anything else?

Unrecognized Questions

User: What is quantum computing?
Chatbot: I do not have the answer you seek to that question. Try again with an AI-related question.
Chatbot: Anything else?

Exiting

Chatbot: Anything else?
User: No
Chatbot: Goodbye!

Logging Interactions

All interactions are logged to a CSV file (e.g., log_YYYY-MM-DD_HH-MM-SS.csv) with the following structure:

  • Timestamp
  • User Input
  • Chatbot Response

Known Limitations

  • The chatbot is limited to its predefined knowledge base.
  • Responses to unrelated questions may still not be entirely satisfactory.

About

A simple Python FAQ chatbot for a school project.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages