Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

nihahawas/CodeAlpha_AIChatbot

Repository files navigation

NIWA โ€” AI Chatbot ๐Ÿค–

CodeAlpha Java Internship โ€” Task 3

image

๐Ÿ“‹ Project Overview

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.


โœจ Features

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"

๐Ÿ—๏ธ Project Structure

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

๐Ÿ› ๏ธ Technologies Used

  • Java 11+ โ€” Core language
  • Java Swing โ€” GUI framework (JFrame, JPanel, JLabel, JScrollPane)
  • Java Regex โ€” java.util.regex for NLP pattern matching
  • Java Time API โ€” java.time for live clock & date
  • OOP Principles โ€” Encapsulation, inner classes, separation of concerns

๐Ÿš€ How to Run

Prerequisites

  • JDK 11 or higher installed
  • javac and java available in your PATH

Windows

run.bat

Linux / Mac

chmod +x run.sh
./run.sh

Manual (any OS)

# 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

๐Ÿง  How the NLP Works

  1. User types a message and presses Enter or clicks Send.
  2. ChatEngine.getResponse(input) is called.
  3. The engine first checks if input is a math expression (regex: \d+ op \d+).
  4. If not math, the input is matched against 14+ intent categories, each with multiple regex patterns.
  5. A random response is selected from the matched intent's response pool.
  6. Special markers (__TIME__, __DATE__) are resolved dynamically.
  7. If nothing matches, a fallback response is returned.

๐Ÿ’ฌ Example Conversations

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! ๐ŸŽ“

๐Ÿ‘ค Author


๐Ÿ“œ License

This project was built for educational purposes as part of the CodeAlpha Java Internship Program.

About

AI Chatbot built with Java Swing - CodeAlpha Internship

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

Contributors

AltStyle ใซใ‚ˆใฃใฆๅค‰ๆ›ใ•ใ‚ŒใŸใƒšใƒผใ‚ธ (->ใ‚ชใƒชใ‚ธใƒŠใƒซ) /