Skip to content

Sumio0/WordReplacer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

✨ WordReplacer - Java Capstone Project (COMS W3134)

This project is the Final Capstone for the course COMS W3134: Data Structures in Java at Columbia University.
It is a command-line Java application that performs word replacements in a text file, using efficient data structures and graph-based cycle detection.


πŸ” Features Overview

βœ… Global Word Replacement

  • Load word β†’ replacement rules from file
  • Supports transitive replacement chains
  • Detects and rejects replacement cycles

🌳 Data Structure Options

  • BSTreeMap – Binary Search Tree Map
  • RBTreeMap – Red-Black Tree Map
  • MyHashMap – Custom HashMap

βš™οΈ Command-Line Interface

  • Validate all arguments and input files
  • Use Java's StringBuilder for efficient output
  • Exit gracefully with error messages on failure

πŸ“‚ Usage Example

java WordReplacer inputs/input1.txt inputs/replacements1.txt bst

Where:

  • input1.txt: the original text
  • replacements1.txt: word replacement rules
  • bst: the data structure (bst, rbt, or hash)

πŸ“„ Sample Input / Output

Text:

Alice will meet Bob at the supermarket.

Rules:

Alice -> Jennifer
supermarket -> diner

Output:

Jennifer will meet Bob at the diner.

⏱️ Performance Evaluation

Run with large input (e.g. warandpeace.txt):

time java WordReplacer warandpeace.txt warandpeace_replacements.txt hash > /dev/null

Repeat with all three data structures and record average timings.


πŸ“ File Structure

Final/
β”œβ”€β”€ src/               # Core source code and data structures
β”œβ”€β”€ inputs/            # Test cases and replacement files
β”œβ”€β”€ WordReplacer/      # Main executable class
β”œβ”€β”€ sampledata/        # Large-scale test files
β”œβ”€β”€ readme.txt         # Report with timing and analysis
β”œβ”€β”€ Capstone-WordReplacer.pdf  # Project specification

πŸ§‘β€πŸ’» Author

Developed by Fan Yi (Sumio0)
Columbia University - Fall 2024

About

Java CLI app for global word replacement with cycle detection and custom data structures.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages