Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Word Search CLI Tool

Overview

This project is a Java-based (or Kotlin-compatible) command line tool that searches for words in a dictionary file (wordlist.txt) based on a query composed of multiple rules.

Each rule represents a constraint, and all rules are combined using logical AND to filter matching words.

The design is extensible, allowing new rules to be added easily without modifying the core search logic.

Problem Description

The tool reads words from:

wordlist.txt

It then filters words using a word query, where a query consists of one or more rules.

Each rule is provided as a single command-line argument in the format:

key=value

All rules must be satisfied for a word to be included in the output.

Supported Rules

Class Rule

class={isogram|palindrome|semordnilap} isogram → No repeated characters in the word palindrome → Word reads the same forwards and backwards semordnilap → Word whose reverse is a different valid word in the dictionary

Length Rules

maxlength= minlength= maxlength → Maximum allowed length minlength → Minimum allowed length

Pattern Rules

startswith= endswith= containsonly= startswith → Word must start with given prefix endswith → Word must end with given suffix containsonly → Word can only contain given characters

Example Queries

  • Palindromes up to 8 characters class=palindrome maxlength=8
  • Words of exactly 3 letters maxlength=3 minlength=3
  • Words starting with "ba" startswith=ba
  • Words using only specific letters containsonly=abcde
  • Multiple rules combined (AND logic) class=palindrome minlength=4 maxlength=10

How to Run

▶️ Run using Maven

From project root:

mvn clean compile mvn exec:java -Dexec.mainClass=org.wordsearch.Main -Dexec.args="class=palindrome maxlength=8"

▶️ Run using JAR

Build project:

mvn package

Run:

java -cp target/wordsearch-1.0-SNAPSHOT.jar org.wordsearch.Main class=palindrome maxlength=8

About

A Java-based command line tool for searching words in a dictionary file using multiple rule-based queries with extensible design.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages