Skip to content

FS1512/python-basic-rule-based-chatbot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 

Repository files navigation

Rule-Based Chatbot (Python: Control Flow & NLP Basics)

This is a simple, command-line chatbot built purely using if-elif-else statements in Python. The project demonstrates fundamental programming concepts like control flow, loops, and basic string manipulation necessary for Natural Language Processing (NLP).

The chatbot simulates a conversation by matching keywords in the user's input to trigger predefined responses.

🛠️ Requirements

* Python 3.x (No external libraries required beyond the standard `re` module).

🚀 How to Run

1. Save the Script: Save the code as `rule_based_chatbot.py`.
2. Run in Terminal: Execute the script from your terminal:

python rule_based_chatbot.py

Interaction

The chatbot will greet you and wait for your input.

  • Exit: Type quit or bye to end the conversation.
  • Keywords: The bot responds to simple keywords like: hello, hi, how are you, python, help, and your name.

🧠 Key Concepts Demonstrated

  • Control Flow: Uses a long if-elif-else chain to determine the appropriate response based on the user's keywords.
  • Continuous Loop: A while True loop keeps the conversation running indefinitely until an exit command is given.
  • String Normalization: The process_input function converts input to lowercase and removes punctuation (re module), a crucial first step in any NLP pipeline.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages