Skip to content

Order of file tokenization depends on submission set #3001

Description

@robinmaisch

Bug Description

In Submission.java, a HashSet of the submission files is created as input for the method Language::parse. The iterator of the HashSet class, which determines the order in which the files are tokenized, seems to depend on internal state, resulting in a different file order when I extract a subset of submissions into another directory compared to the complete submission set. Specifically, the token order does not usually correspond to the file order in Submission::files, which seems counterintuitive.

As GreedyStringTiling is implemented to prefer earlier matches (w.r.t. the token list), a different file tokenization order may result in different matching, so we should set a fixed file order for tokenization. I therefore propose to change the Language API to accept Lists of Files instead of Sets, avoiding randomness in file order for tokenization and enabling consistency with the file order in Submission::files.

Find attached two screenshots displaying this behavior: Two comparisons of the same submission pair result in a different matching (118 vs. 120 matches) using the same algorithm, but the submissions are located inside different subsets of the submission set. The resulting average similarity differs by ~0.54 percentage points: 40.172 % vs. 40.715 %.

Image Image

JPlag Version

develop/7.0.0-SNAPSHOT

Operating System

Windows 11

Java Version

Temurin 25

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIssue/PR that involves a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions