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