<commit_before>package miner;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;

import database.DownloadedFile;
import database.FileHandler;
import parser.Signature;

public class Scorer {
	private ArrayList<Result> results;

	public ArrayList<Result> getResults() {
		return results;
	}

	public static void main(String[] args) throws Exception {
		// testing
		String inputContent = new String(Files.readAllBytes(Paths.get("input.java")), "UTF-8");
		FileHandler fileHandler = new FileHandler("Files");
		Scorer scorer = new Scorer(inputContent, fileHandler.readAllDownloadedFiles(),
				fileHandler.readFile("Boa_output.txt"));
		ArrayList<Result> results = scorer.getResults();
		fileHandler.writeAllResults(results);
		// Print the top 10 recommended results
		int top = 10;<commit_msg>Added test on scoring system<commit_after>package miner;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;

import database.DownloadedFile;
import database.FileHandler;
import parser.Signature;

public class Scorer {
	private ArrayList<Result> results;

	public ArrayList<Result> getResults() {
		return results;
	}

	private static void testScoringSystem() throws IOException {
		String inputContent = new String(Files.readAllBytes(Paths.get("input.java")), "UTF-8");
		Scorer scorer = new Scorer("", new ArrayList<DownloadedFile>(), "_,_,_,_,_,_,_");
		String content = new String(Files.readAllBytes(Paths.get("input2.java")), "UTF-8");

		Signature inputSignature = new Signature(inputContent);
		Signature outputSignature = new Signature(content, inputSignature.getClassName());

		double score = scorer.calculateScore(inputSignature, outputSignature);
		System.out.println(score);
		System.exit(0);
	}
	
	public static void main(String[] args) throws Exception {
		// Uncomment the following line to test the scoring system on two files
		// testScoringSystem();

		// testing
		String inputContent = new String(Files.readAllBytes(Paths.get("input.java")), "UTF-8");
		FileHandler fileHandler = new FileHandler("Files");
		Scorer scorer = new Scorer(inputContent, fileHandler.readAllDownloadedFiles(),
				fileHandler.readFile("Boa_output.txt"));
		ArrayList<Result> results = scorer.getResults();
		fileHandler.writeAllResults(results);
		// Print the top 10 recommended results
		int top = 10;
{'fraction_non_alphanumeric': 0.11624441132637854, 'fraction_numerical': 0.005216095380029807, 'mean_word_length': 5.548780487804878, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 5, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4893367', 'n_tokens_mistral': 817, 'n_tokens_neox': 771, 'n_words': 199}