Skip to content

Conversation

@tsaglam
Copy link
Member

@tsaglam tsaglam commented Sep 22, 2025

This PR works towards #2595, thus refactoring the frequency analysis functionality. The main changes include moving frequency analysis classes to a new package, introducing a new options structure for frequency analysis, updating the CLI to support these options, and refactoring the application of frequency-based weighting to matches.

Frequency Analysis Refactor and Improvements:

  • Moved all frequency analysis-related classes from the de.jplag.highlightextraction package to a new de.jplag.frequency package, improving code organization and modularity.
  • Introduced the new FrequencyAnalysisOptions record to encapsulate all frequency analysis settings, replacing individual parameters and simplifying configuration.
  • Added FrequencyAnalysis class with a static method to apply frequency-based weighting to matches, centralizing the logic for frequency analysis.
  • Added MatchFrequencyEvaluator class to compute match frequencies based on the selected strategy.

CLI Integration and Option Handling:

  • Updated the CLI (JPlagOptionsBuilder and CliOptions) to use the new FrequencyAnalysisOptions structure, including an option to enable/disable frequency analysis and select strategies via command-line arguments.
  • Added FrequencyStrategyPicocliBindings to support command-line completion and conversion for frequency strategies.

Core Logic and API Updates:

  • Refactored the main JPlag class to use the new frequency analysis API, applying frequency weighting only if enabled in the options.
  • Updated FrequencyDetermination to return the frequency map directly, simplifying its usage.

@tsaglam tsaglam added bug Issue/PR that involves a bug enhancement Issue/PR that involves features, improvements and other changes major Major issue/feature/contribution/change labels Sep 22, 2025
@tsaglam tsaglam changed the base branch from main to develop September 22, 2025 11:00
@sonarqubecloud
Copy link

@tsaglam tsaglam changed the title Frequency analysis Clean-up Frequency Analysis Clean-Up Sep 22, 2025
@sonarqubecloud
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Issue/PR that involves a bug enhancement Issue/PR that involves features, improvements and other changes major Major issue/feature/contribution/change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants