Skip to content

ShqiW/AutoCompletion-library-with-Docker

Repository files navigation

Java Auto Completion Library

Introduction

The auto-completion library (ACL) has a set of English words (alpha words, i.e., words that contain characters only no symbols and/or numbers) that are used to provide possible auto-completions. This library are based on Trie data structure.

Function

  • Add new word
  • Remove word
  • Get auto-completion by providing a given prefix

Installation

Gradle

Add this to build file(build.gradle)

dependencies {
    implementation 'io.github.ShqiW:AutoCompletion:0.1.3'
}

Maven

Add this to pom.xml

<dependency>
    <groupId>io.github.ShqiW</groupId>
    <artifactId>AutoCompletion</artifactId>
    <version>0.1.3</version>
</dependency>

Quick Start

// import library
import autocomplete.AutoCompletion;

// Create an instance
AutoComplete autoComplete = new AutoComplete();

// Add words
autoComplete.addWord("hello");
autoComplete.addWord("help");

// Get completions
List<String> completions = autoComplete.autoComplete("hel");
// Returns: ["hello", "help" ...]

Development Guide

Prerequisites

  • JDK: 11+
  • Gradle: 7.x

Build from github repo

  1. Clone the repository
git clone https://github.com/CS6510-SEA-SP25/hw1-ShqiW.git
cd hw1-ShqiW
  1. Build the project
./gradlew build

Run test

# Run all tests
./gradlew test 

# Generate coverage report
./gradlew jacocoTestRespot

Generate Documentation

Generate Javadoc

./gradlew javadoc

Code quality check

Run quality check

# Checkstyle(Coding Style Check)
./gradlew checkstyleMain checksyleTest

# PMD(Static Code Analysis)
./gradlew pmdMain pmdTest

# SpotBugs(Static Code Analysis)
./gradlew spotbugMain spotbugTest

Generate JAR package

To generate the JAR package, run:

./gradlew jar

Find Reports

  • Jacoco test coverage: build/reports/jacoco/test/html/index.html
  • Checkstyle: build/reports/checkstyle
  • PMD: build/reports/pmd
  • SpotBugs: build/reports/spotbugs
  • Javadoc: build/doc/javadoc/autocomplete

Auto-Complete CLI

CLI Usage

The application supports the following command line options:

java -jar ac.jar [options] <input>

Options:
  --help                   Display help information
  --version                Display version information
  --dictionary|-d <file>   Use custom dictionary file
  --union|-u               Combine custom dictionary with built-in dictionary

# Example
# Basic usage
java -jar ac.jar xylopho

# Using custom dictionary
java -jar ac.jar --dictionary dict.txt xylopho

# Using custom dictionary combined with built-in
java -jar ac.jar --dictionary dict.txt --union xylopho

Docker Usage

Docker image available at shqiwen/ac

Running with Docker

docker pull shqiwen/ac:latest
docker run shqiwen/ac xylopho

# With custom dictionary:
docker run -v $(pwd):/data shqiwen/ac --dictionary /data/dict.txt xylopho

# With union option:
docker run -v $(pwd):/data shqiwen/ac --dictionary /data/dict.txt --union xylopho

Author

Shenqian Wen

Links

About

CS6510 homework3

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors