NIWA (Artificial Responsive Intelligence Assistant) is a Java-based AI chatbot with a modern Swing GUI. It uses rule-based Natural Language Processing (NLP) through regex pattern matching to understand user input and generate contextual responses.
| Feature | Description |
|---|---|
| ๐ฌ Conversation | Greetings, farewells, small talk |
| ๐ Real-time Clock | Tells the current time |
| ๐ Date Awareness | Tells today's date |
| ๐งฎ Math Solver | Evaluates arithmetic: +, -, *, / |
| ๐ Jokes | 8+ built-in programmer jokes |
| โ Java Q&A | Answers questions about Java/OOP |
| โ Help Menu | Lists all capabilities |
| ๐๏ธ Clear Chat | Clears the conversation with confirmation |
| โ๏ธ Typing Indicator | Simulates NIWA "thinking" |
CodeAlpha_AIChatbot/
โโโ src/
โ โโโ com/codealpha/chatbot/
โ โโโ Main.java โ Entry point
โ โโโ model/
โ โ โโโ Message.java โ Message data model
โ โโโ engine/
โ โ โโโ ChatEngine.java โ NLP brain (intent matching)
โ โโโ gui/
โ โโโ ChatbotGUI.java โ Swing GUI (chat window)
โโโ out/ โ Compiled .class files (auto-generated)
โโโ run.bat โ Windows run script
โโโ run.sh โ Linux/Mac run script
โโโ README.md
- Java 11+ โ Core language
- Java Swing โ GUI framework (JFrame, JPanel, JLabel, JScrollPane)
- Java Regex โ
java.util.regexfor NLP pattern matching - Java Time API โ
java.timefor live clock & date - OOP Principles โ Encapsulation, inner classes, separation of concerns
- JDK 11 or higher installed
javacandjavaavailable in your PATH
run.bat
chmod +x run.sh ./run.sh
# 1. Compile javac -d out -sourcepath src src/com/codealpha/chatbot/Main.java src/com/codealpha/chatbot/model/Message.java src/com/codealpha/chatbot/engine/ChatEngine.java src/com/codealpha/chatbot/gui/ChatbotGUI.java # 2. Run java -cp out com.codealpha.chatbot.Main
- User types a message and presses Enter or clicks Send.
ChatEngine.getResponse(input)is called.- The engine first checks if input is a math expression (regex:
\d+ op \d+). - If not math, the input is matched against 14+ intent categories, each with multiple regex patterns.
- A random response is selected from the matched intent's response pool.
- Special markers (
__TIME__,__DATE__) are resolved dynamically. - If nothing matches, a fallback response is returned.
User: hello
NIWA: Hey! Great to see you. How can I help?
User: what time is it
NIWA: The current time is: 10:35 AM ๐
User: 25 * 4
NIWA: ๐งฎ 25 * 4 = 100
User: tell me a joke
NIWA: Why do programmers prefer dark mode?
Because light attracts bugs! ๐
User: who made you
NIWA: I was created as part of the CodeAlpha Java Internship program! ๐
- Name: [NIHA HAWAS]
- Institution: [SZABIST ISLAMABAD]
- Internship: CodeAlpha โ Java Programming
- GitHub: [https://github.com/nihahawas]
- Linkedin: [https://www.linkedin.com/in/nihahawas45]
This project was built for educational purposes as part of the CodeAlpha Java Internship Program.