<commit_before>package com.github.drexler;


import java.io.StringWriter;
import java.nio.file.Files;
import java.nio.file.Paths;

import org.apache.velocity.Template;
import org.apache.velocity.VelocityContext;
import org.apache.velocity.app.VelocityEngine;
import org.apache.velocity.runtime.RuntimeConstants;
import org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader;
import org.json.JSONObject;


public class VTLRunner {
    public static void main(String args[]){
        VelocityEngine ve = new VelocityEngine();
        StringWriter sw = new StringWriter();

        try {
        	
        	ve.setProperty(RuntimeConstants.RESOURCE_LOADER, "classpath");
        	ve.setProperty("classpath.resource.loader.class", ClasspathResourceLoader.class.getName());
        	ve.init();
        	
        	
        	String templatePath = "testtemplate.vm";
            Template t = ve.getTemplate(templatePath);
            
            String jsonFile = new String(Files.readAllBytes(Paths.get("C:\\Repos\\personal\\velson\\Velson\\resources\\sample.json")));
            JSONObject jsonObj = new JSONObject(jsonFile);
            VelocityContext context = new VelocityContext();
            context.put("source", jsonObj);  
            t.merge(context, sw);

        }
        catch(Exception e) {
        	System.out.println(e);
        }

        System.out.println(sw);
    }
}<commit_msg>remove hardcoded paths to resources<commit_after>package com.github.drexler;


import java.io.StringWriter;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;

import org.apache.velocity.Template;
import org.apache.velocity.VelocityContext;
import org.apache.velocity.app.VelocityEngine;
import org.apache.velocity.runtime.RuntimeConstants;
import org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader;
import org.json.JSONObject;


public class VTLRunner {
    public static void main(String args[]){

    	VTLRunner vtl = new VTLRunner();
        VelocityEngine ve = new VelocityEngine();
        StringWriter sw = new StringWriter();

        try {
        	
        	ve.setProperty(RuntimeConstants.RESOURCE_LOADER, "classpath");
        	ve.setProperty("classpath.resource.loader.class", ClasspathResourceLoader.class.getName());
        	ve.init();
        	
        	String templatePath = "testtemplate.vm";
            Template t = ve.getTemplate(templatePath);
            
            String jsonFile = vtl.getFileContents("sample.json");           
            
            JSONObject jsonObj = new JSONObject(jsonFile);
            VelocityContext context = new VelocityContext();
            context.put("source", jsonObj);  
            t.merge(context, sw);

        }
        catch(Exception e) {
        	System.out.println(e);
        }

        System.out.println(sw);
    }
    
    public String getFileContents(String fileName) throws IOException {
    	ClassLoader classLoader = getClass().getClassLoader();
    	File file = new File(classLoader.getResource(fileName).getFile());
    	return new String(Files.readAllBytes(Paths.get(file.getAbsolutePath())));
    }
}
{'fraction_non_alphanumeric': 0.10833859759949463, 'fraction_numerical': 0.0, 'mean_word_length': 2.7882775119617227, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '4995915', 'n_tokens_mistral': 891, 'n_tokens_neox': 873, 'n_words': 163}