This project is a high-performance text simplification tool built with Java 25 and Virtual Threads (Project Loom). It demonstrates modern concurrency patterns by using StructuredTaskScope to process text files in parallel, replacing complex words with simpler alternatives based on GloVe word embeddings and the Google 1000 most common words list.
Matthew McCarthy (G00373167)
- Virtual Threads & Structured Concurrency: Leverages Java's latest concurrent APIs (
StructuredTaskScope) for high-throughput, non-blocking I/O operations. - Word Embeddings: Uses pre-trained GloVe vectors to calculate semantic similarity and find the best simple synonyms.
- Parallel Processing: Simplifies large text files efficiently by processing lines concurrently while maintaining output order.
- Vector Similarity: Implements Cosine Similarity to mathematically determine the closeness of word meanings.
- Plug-and-Play: Includes necessary embedding data and word lists for immediate execution.
- Java Development Kit (JDK) 25 (or a recent EA build supporting the latest preview features).
- The
--enable-previewflag must be used during both compilation and execution.
git clone https://github.com/your-username/OOP-Project.git
cd OOP-ProjectCompile the source code, enabling preview features for virtual threads:
mkdir -p bin
javac -d bin --enable-preview --release 25 src/ie/atu/sw/*.javaExecute the compiled bytecode. You can start the interactive runner directly:
java --enable-preview -cp bin ie.atu.sw.RunnerOnce running, follow the on-screen menu:
- Specify Embeddings File: Enter
embeddings.txt(included). - Specify Google 1000 File: Enter
google-1000.txt(included). - Specify Text File: Enter the path to your input text (e.g.,
test.txt). - Specify Output File: Enter the desired output path (e.g.,
out.txt). - Execute: Watch the simplification happen in parallel!
Runner: The interactive CLI entry point.TextProcessor: The core engine that orchestrates parallel line processing using virtual threads.FileProcessor: An abstract base class handling safe, sequential I/O operations.MapGoogle1000: Manages the mapping between complex words and their simple equivalents.SimilarityCalculator: Performs the vector math (cosine similarity).GloVEEmbeddingsLoader: Efficiently loads high-dimensional vector data into concurrent maps.
Developed for the Object Oriented Programming module at ATU. Improvements have been made after submission.