$ show jplag/JPlag
JPlag is a mature source-code plagiarism detection engine delivered as a Java library, a picocli-based CLI, and an embedded Vue.js report viewer. In production it parses submissions into language-specific token streams (via ANTLR, JavaCC, or custom parsers), compares token sequences pairwise using greedy string tiling with rolling hashes, merges fragmented matches, applies frequency-based weighting, optionally clusters submissions, and writes a .jplag ZIP report containing JSON models consumed by the viewer. The CLI can also start a local HTTP server to browse results. Architecturally it is a multi-module Maven project: core contains the comparison pipeline and reporting; language-api and language-antlr-utils define a plugin SPI for adding languages; languages/* provides 20+ modules; cli assembles the executable; report-viewer is an npm workspace with model/parser/ui-components packages. Key entry points are de.jplag.cli.CLI and de.jplag.JPlag.run(). External dependencies include ANTLR, picocli, Jackson, JGraphT, Apache Commons Math, and the Vue/TypeScript ecosystem. Although primarily an application, it embeds research-grade components such as spectral and agglomerative clustering with Bayesian optimization, token-sequence normalization, and match-frequency weighting, and it is backed by academic publications. It is not a data pipeline; the inputs are source-code submissions and the output is a similarity report. The repository is actively maintained with extensive CI, end-to-end gold-standard tests, and dependabot, though some language grammars lag language evolution and a few deprecated APIs remain.
The LLM identified 5 files worth highlighting for reuse:
Implements a rolling hash table for token subsequences, enabling O(n) candidate generation for greedy string tiling. The algorithm is self-contained and can be extracted for any sequence similarity or duplicate-detection problem.
Provides a declarative framework for mapping ANTLR parse-tree contexts to domain tokens, reducing listener boilerplate across language modules. This pattern is reusable for building new ANTLR-based language frontends outside JPlag.
A self-contained Bayesian optimization routine used to select clustering parameters. It is generic enough to be reused for any black-box optimization problem where evaluations are expensive.
A generic CSV writer with configurable separator, line ending, and quoting behavior, decoupled from JPlag domain objects. Can be extracted as a standalone serialization utility for tabular data.
A minimal HTTP routing tree for the embedded report-viewer server, supporting static files, aliases, and fallbacks without an external web framework. Reusable for lightweight embedded HTTP servers in other tools.