Arkanjo 0.2
A tool for find code duplicated functions in codebases
Loading...
Searching...
No Matches
big_clone_tailor_evaluator.hpp
Go to the documentation of this file.
1
11#pragma once
12
13#include <cassert>
14#include <iomanip>
15#include <iostream>
16#include <map>
17#include <set>
18#include <string>
19#include <tuple>
20#include <vector>
21
22#include <arkanjo/base/path.hpp>
25
27
28using namespace std;
29
36class BigCloneTailorEvaluator : public CommandBase<BigCloneTailorEvaluator> {
37 private:
38 string CLONE_LABELS_FILE_PATH = "/home/luan/linux/test-duplication-code/parser/bigclonebench/clone_labels.txt";
39 string EXTENSION = ".java";
40 int NUMBER_OF_TYPES = 6;
41 int NOT_CLONE_TYPE_ID = 5;
42 string RECALL_PER_TYPE_PRINT = "Recall Value of each type";
43 double MINIMUM_SIMILARITY_TEMP = 0;
44
46 vector<string> ID_TO_TYPE_LABEL = {
47 "T1",
48 "T2",
49 "ST3",
50 "MT3",
51 "WT3/T4",
52 "Negative",
53 };
54
55 Similarity_Table* similarity_table;
56 map<pair<int, int>, int> id_pair_to_type;
57 vector<int> count_of_samples_by_type;
58
62 void read_clone_labels();
63
69 int path_to_id(Path path);
70
75 vector<tuple<double, int, int>> similar_path_pairs_formated_with_id();
76
83 bool is_relevant_pair(int id0, int id1);
84
90 set<pair<int, int>> filter_similar_id_pairs_only_relevant_ones(
91 vector<pair<int, int>> similar_id_pairs);
92
99 vector<pair<int, int>> filter_similar_path_pairs_by_similarity(
100 vector<tuple<double, int, int>> similar_id_pairs,
101 double minimum_similarity);
102
108 vector<int> build_frequency_corrected_guessed_by_type(
109 vector<pair<int, int>> similar_id_pairs);
110
117 double calc_recall(vector<int> frequency, int type);
118
123 void print_recall_per_type(vector<int> frequency);
124
129 void evaluate(double minimum_similarity);
130
131 public:
133 "Evaluate clone detection results using the BigCloneBench dataset "
134 "methodology. The command compares detected similarities against "
135 "ground truth labels and reports recall metrics per clone type.")
136
137
141 explicit BigCloneTailorEvaluator(Similarity_Table* _similarity_table);
142
143 bool validate(const ParsedOptions& options) override;
144
148 bool run(const ParsedOptions& options) override;
149};
Evaluates clone detection using BigCloneBench methodology.
COMMAND_DESCRIPTION("Evaluate clone detection results using the BigCloneBench dataset " "methodology. The command compares detected similarities against " "ground truth labels and reports recall metrics per clone type.") explicit BigCloneTailorEvaluator(Similarity_Table *_similarity_table)
Constructs evaluator with similarity data.
bool validate(const ParsedOptions &options) override
Validate the arguments already analyzed.
bool run(const ParsedOptions &options) override
Handles BigCloneBench evaluation command.
const CliOption * options() const final
Path manipulation class for tool-specific directory structure.
Definition path.hpp:27
Represents a similarity graph between functions (paths).
Path abstraction for temporary codebase.
Similarity relationships storage and analysis.
Defines utility functions used across all files.