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.
- Add new word
- Remove word
- Get auto-completion by providing a given prefix
Add this to build file(build.gradle)
dependencies {
implementation 'io.github.ShqiW:AutoCompletion:0.1.3'
}Add this to pom.xml
<dependency>
<groupId>io.github.ShqiW</groupId>
<artifactId>AutoCompletion</artifactId>
<version>0.1.3</version>
</dependency>// 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" ...]- JDK: 11+
- Gradle: 7.x
- Clone the repository
git clone https://github.com/CS6510-SEA-SP25/hw1-ShqiW.git
cd hw1-ShqiW- Build the project
./gradlew build# Run all tests
./gradlew test
# Generate coverage report
./gradlew jacocoTestRespotGenerate Javadoc
./gradlew javadocRun quality check
# Checkstyle(Coding Style Check)
./gradlew checkstyleMain checksyleTest
# PMD(Static Code Analysis)
./gradlew pmdMain pmdTest
# SpotBugs(Static Code Analysis)
./gradlew spotbugMain spotbugTestTo generate the JAR package, run:
./gradlew jar- 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
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 xylophoDocker image available at shqiwen/ac
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- Github: @ShqiW
- Email: shqiwen@gmail.com
- Project homepage: https://github.com/CS6510-SEA-SP25/hw1-ShqiW
- Maven Central: AutoCompletion on Maven Central
- Docker Hub: https://hub.docker.com/repository/docker/shqiwen/ac