The project implements a basic chatbot in Java.
The implementation mimics the Model-View-Controller (MVC) pattern at a high level.
- View: The ChatCommandPromptInterface class encapsulates the View features, exposing a command-prompt interface for end users to input their queries.
- Controller: The classes under the controller package provide the Controller features. The QueryProcessor class acts as the Facade for the controller layer.
- Model: The classes under the model package provide the Model features, encapsulating the chat templates data and providing interface methods for the Controller layer to retrieve and operate on the underlying data.
In real-world implementation, the design may incorporate frameworks like SpringBoot, EJBs and hosted a web application to a) achieve non-functional requirements like scalability and availability; and b) exploit built-in features of the framework for managing thread pooling, transaction management, etc. However, this sample implementation intentionally uses only Core Java for simplicity.
- The project was implemented using Eclipse IDE Version: 2025-06 (4.36.0) Build id: 20250605-1316.
JDK version used for development is Java SE v21.
If needing to import the project into IDE, it is strongly recommended to use the same version of IDE and Java versions as specified above.
- Copy the deployables, from under the dist directory, to a local location, say C:/basic_chatbot_java. The resultant directory structure must be as below.
C: |-- basic_chatbot_java |-- basic_chatbot.jar |-- chat_templates |-- finance.properties |-- hr.properties |-- tech.properties
- Open a command prompt and navigate to the C:/basic_chatbot_java directory.
- Execute the command "java -version" to check the Java version. Make sure the java version on path is version 21.
java version "21.0.8" 2025-07-15 LTS Java(TM) SE Runtime Environment (build 21.0.8+12-LTS-250) Java HotSpot(TM) 64-Bit Server VM (build 21.0.8+12-LTS-250, mixed mode, sharing)
- Execute the below command to start the chatbot program.
java -jar C:/basic_chatbot_java/basic_chatbot.jar uk.ac.essex.mscai.module1.chatbot.view.ChatCommandPromptInterface
- What are the working hours?
- What the social responsibility policy of the organisation?
- How does the organisation handle its social responsibility?
- What is the frequency of pay reviews?
- Does the company offer any employee benifits?
- What is the standard work week look like?
- What is the number of employees in the organisation?
- What tech stack is used for product development?
- Is there a tech strategy?
- What process should I follow if I need a new software installed?
- The model employs a greedy search approach while finding the best template match. Within the uk.ac.essex.mscai.module1.chatbot.controller.QueryProcessor class, the processing workflow sequentially invokes finance, HR and engineering department-specific query handlers. The workflow greedily ends the search on first match instead of completing search across all departments and deriving the best match.
This behaviour is evident when testing with the following two input queries:
- What the social responsibility policy of the organisation?
- How does the organisation handle its social responsibility?
When searching with the first input, the workflow identifies the template key "expense.policy", under the Finance department, as the correct match. This is due to the matching of the word "policy" within the input query. A search with the second input string above, which avoids the word "policy" in the input, correctly identifies the template key "social.responsibility" under HR department. The workflow can be improved by introducing parallelisation to search across all departments and then carrying out the match frequency comparisons against the entire dataset.