<commit_before>package jules;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

import util.Pair;

public class Categorizer {
	
	public static void main(String[] args){
		String q = "";
		while(!(q = System.console().readLine("Enter a question: ")).equals("q")){
			getCategories(q);
		}
	}

	public static List<Pair<String, Double>> getCategories(String q) {
		String question = q;
		StringBuffer output = new StringBuffer();
		String[] cmdarray = {"bash","-c", "cd ./libshorttext-1.1 && ./demo.py " + q};
		try {
			Process p = Runtime.getRuntime().exec(cmdarray);
		    p.waitFor();
		
		    BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream()));
		 
		    String line = "";
		    String categories = "";
		    String decvals = "";
		    boolean catComming = false;
	    
			while ((line = reader.readLine())!= null) {
				if(catComming){
					categories = line.trim();
					catComming = false;
				} 
				
				if (line.contains(question)){
					catComming = true;
				}
				
				if(line.contains("decval")){
					decvals = line.substring(10).trim();
				}
				output.append(line + "\n");
			}
			System.out.println(output.toString());
			System.out.println(categories);
			System.out.println(decvals);
			
			String[] cats = categories.split("\\s+");
			String[] vals = decvals.split("\\s+");
			List<Pair<String, Double>> prs = new ArrayList<Pair<String, Double>>();
			for(int i = 0; i < cats.length; i++){
				Pair<String, Double> pa = new Pair<String, Double>(cats[i], new BigDecimal(vals[i]).doubleValue());
				prs.add(pa);
			}
			return prs;
		} catch (Exception e) {
			e.printStackTrace();
		}
		return null;<commit_msg>Normalize the values from Categorizer<commit_after>package jules;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

import util.Pair;

public class Categorizer {
	
	public static void main(String[] args){
		String q = "";
		while(!(q = System.console().readLine("Enter a question: ")).equals("q")){
			getCategories(q);
		}
	}

	public static List<Pair<String, Double>> getCategories(String q) {
		String question = q;
		StringBuffer output = new StringBuffer();
		String[] cmdarray = {"bash","-c", "cd ./libshorttext-1.1 && python3 ./demo.py " + q};
		try {
			Process p = Runtime.getRuntime().exec(cmdarray);
		    p.waitFor();
		
		    BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream()));
		 
		    String line = "";
		    String categories = "";
		    String decvals = "";
		    boolean catComming = false;
	    
			while ((line = reader.readLine())!= null) {
				if(catComming){
					categories = line.trim();
					catComming = false;
				} 
				
				if (line.contains(question)){
					catComming = true;
				}
				
				if(line.contains("decval")){
					decvals = line.substring(10).trim();
				}
				output.append(line + "\n");
			}
			System.out.println(output.toString());
			System.out.println(categories);
			System.out.println(decvals);
			
			String[] cats = categories.split("\\s+");
			String[] vals = decvals.split("\\s+");
            List<Double> valDubsAbs = new ArrayList<Double>();
            for (String val : vals) {
                if (!"".equals(val.trim()) &&  !val.trim().isEmpty())
                    valDubsAbs.add(Math.abs(new BigDecimal(val).doubleValue()));
            }

            double maxAbs = Collections.max(valDubsAbs);
            List<Pair<String, Double>> prs = new ArrayList<Pair<String, Double>>();

			for(int i = 0; i < cats.length; i++){
				Pair<String, Double> pa = new Pair<String, Double>(cats[i], ((new BigDecimal(vals[i]).doubleValue())/maxAbs+1)/2);
				prs.add(pa);
			}
			return prs;
		} catch (Exception e) {
			e.printStackTrace();
		}
		return null;
{'fraction_non_alphanumeric': 0.16279656739020695, 'fraction_numerical': 0.003281171125694094, 'mean_word_length': 3.1195426195426195, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2960712', 'n_tokens_mistral': 1486, 'n_tokens_neox': 1245, 'n_words': 274}