<commit_before>package fi.jyu.ln.luontonurkka.tools;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;

/**
 * Abstract class for handling a file and creating a hash map from it.
 * @author <NAME> on 10.10.2016.
 */
public abstract class Parser {

    protected static BufferedReader buffer = null;

    protected abstract HashMap<String, String> parseFile() throws IOException;

    protected BufferedReader openFile(File f) throws FileNotFoundException {
        buffer = new BufferedReader(new InputStreamReader(new FileInputStream(f)));
        return buffer;
    }

    protected void closeFile() throws IOException {
        if (buffer != null) {
            buffer.close();
        }
    }
}<commit_msg>Parser takes an InputStream from which to read<commit_after>package fi.jyu.ln.luontonurkka.tools;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.HashMap;

/**
 * Abstract class for handling a file and creating a hash map from it.
 * @author <NAME> on 10.10.2016.
 */
public abstract class Parser {

    protected static BufferedReader buffer = null;

    protected abstract HashMap<String, String> parseFile() throws IOException;

    protected BufferedReader openFile(InputStream is) {
        buffer = new BufferedReader(new InputStreamReader(is));
        return buffer;
    }

    protected void closeFile() throws IOException {
        if (buffer != null) {
            buffer.close();
        }
    }
}
{'fraction_non_alphanumeric': 0.09137343927355278, 'fraction_numerical': 0.009080590238365494, 'mean_word_length': 3.6031331592689293, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '7247050', 'n_tokens_mistral': 501, 'n_tokens_neox': 479, 'n_words': 148}