Skip to content

justaarju/java-dictionary-project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Java Dictionary Application

Overview

This project is a command-line dictionary application developed in Java. It allows users to search for words and retrieve definitions along with their associated parts of speech. The program supports multiple query options and demonstrates efficient data organization and retrieval.


Features

  • Keyword-based dictionary search
  • Filtering by part of speech (e.g., noun, verb)
  • Removal of duplicate definitions using a distinct option
  • Reverse ordering of results using a reverse option
  • Command-based interaction (!help, !q)
  • Input validation with clear error messaging

Project Structure

The application is organized into four primary components:

  • DictionaryData.java Defines dictionary entries using an enum. Each entry contains a keyword, part of speech, and definition stored as separate fields.

  • DictionaryEntry.java Represents a single dictionary entry, encapsulating part of speech and definition.

  • Dictionary.java Responsible for loading data into a HashMap, where each keyword maps to a collection of definitions.

  • DictionaryApp.java Handles user interaction, input parsing, search execution, and output formatting.


Data Structures and Design Decisions

A HashMap<String, ArrayList<DictionaryEntry>> is used as the primary data structure.

This design was chosen to:

  • Enable constant-time lookup (O(1)) for search operations
  • Efficiently map each keyword to multiple definitions
  • Improve scalability compared to linear search structures such as ArrayList

The program follows object-oriented design principles including encapsulation and separation of responsibilities across classes.


How to Run

  1. Compile the program:

    javac *.java
  2. Run the application:

    java DictionaryApp

Example Usage

Search [1]: book
Search [2]: book noun
Search [3]: book noun distinct
Search [4]: book noun distinct reverse

Future Improvements

  • Refactor large methods into smaller, modular components
  • Enhance input handling for additional edge cases
  • Improve code documentation and inline comments
  • Load dictionary data from external sources (e.g., files or databases)
  • Develop a graphical user interface (GUI)

Technologies Used

  • Java
  • HashMap
  • ArrayList
  • Enum-based data modeling

Development Notes

This project was completed as part of a data structures and software design assignment.

Conceptual understanding, debugging, and refinement were supported in part by AI-based tools (such as DeepSeek and similar assistants), particularly for improving explanations, validating design decisions, and enhancing code clarity. All implementation and final integration were completed independently.


Author

Aarzu Karki

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages