This local analyzer reports text overlap, not proof of plagiarism or intent. Compare a b c d with a b c e. Their unique word sets share a, b, and c, and the union has five words. This page therefore reports word Jaccard zero point six. The target contains four unique words, so target overlap is three over four, or seventy five percent. Unlike phrase-based Jaccard, this source uses words for that metric. Changing n-gram length from one to two to three leaves those word-set metrics unchanged, while matched target grams decrease from three to two to one. The count bar shows that change. Use the three measures according to their actual definitions, not the forensic title. Stop-word filtering acts on token sets before grams are formed. Compare the red fox with the blue fox. Without filtering, the common words are the and fox; the union is the, red, blue, and fox. Word Jaccard is two over four, or fifty percent, and target overlap is two over three, about sixty six point seven percent. Filtering removes the, leaving one shared word over a union of three, or thirty three point three percent. Target overlap becomes one over two, or fifty percent. The longest common substring uses the raw lowercased character strings instead. In this example its first longest match trims to the, and stays the even when that word is filtered from token analysis. Those outputs measure different things. Repetition separates set similarity from phrase-instance counts. For red fox red fox compared with red fox at two-word grams, the target list is red fox, fox red, and red fox again. Two entries match the source phrase. But both unique word sets are simply red and fox, so word Jaccard is one and target overlap one hundred percent. The two bars show three target gram instances and two matches at the same scale. Diff tabs highlight matching ranges while preserving original characters. JSON and Markdown exports store the selected gram length, stop-word option, computed metrics, longest substring and texts. Reset restores the representative fixture and three-word grams, but preserves the sync-scrolling toggle and existing edit versus diff tab choices. A high overlap score still needs attribution and context.
How does this client-side forensics tool compute Jaccard similarity and locate verbatim n-gram matches between two documents?
This interactive tool executes string operations entirely in the browser using three distinct heuristics: word-token set overlap, contiguous n-gram phrase matching, and character-level longest common substring discovery. When documents are loaded, the script lowercases both inputs, extracts alphanumeric word tokens via regular expressions, and constructs unique vocabulary sets. The displayed Jaccard Similarity Index measures the intersection of those unique word types divided by their total union. In parallel, the tool slides a fixed window of size n across the word sequences to count identical contiguous phrase keys, while an exact dynamic-programming matrix identifies the single longest contiguous character substring common to both texts.
These deterministic metrics measure string surface overlap, not semantic meaning, conceptual novelty, or legal/academic culpability. Common academic boilerplate, shared citations, and disciplinary terminology will elevate the Jaccard index even in legitimate scholarly work. Conversely, light synonym substitution, sentence restructuring, or translation completely evade verbatim n-gram detection despite potential intellectual misappropriation.
Select the 'Representative Case' preset (or click 'Reset Case'). Observe the default n-gram slider set to 3: the tool identifies 14 matching 3-gram sequences, yields a unique token Jaccard similarity of 0.720, and extracts the 103-character longest common substring beginning with 'investigations into academic misconduct...'. Now drag the N-Gram Length slider to 5: because longer exact phrase runs are rarer, the Verbatim N-Gram Matches metric immediately drops from 14 down to 8, while the word-level Jaccard index remains unchanged at 0.720.
The script tokenizes both texts using the regular expression /\b[a-z0-9']+\b/gi, converting all characters to lowercase and preserving start and end character offsets. If 'Filter Stop Words' is enabled, 100 common English grammatical particles and auxiliary verbs are discarded prior to metric calculation.
The Jaccard Similarity metric in this script operates strictly on sets of unique word types rather than n-gram sets or token order: J(A, B) = |A ∩ B| / |A ∪ B|, where A is the set of unique words in the target draft and B is the set of unique words in the reference source. The Target Overlap Ratio similarly measures |A ∩ B| / |A|.
Contiguous n-gram sequences are constructed by stepping an index from 0 to (total tokens - n) across the ordered token array, joining n consecutive tokens with spaces into lookup keys. Matching keys between documents increment the verbatim match counter and supply boundary coordinates to wrap matched spans in <mark> tags within the visual diff viewer.
Independent of word tokens, the engine runs an exact character-level longest common substring (LCS) dynamic programming algorithm over str1 and str2. It populates an (N+1) x (M+1) matrix tracking matching character runs, locating the single longest unbroken verbatim character sequence shared across drafts.