<commit_before>package org.editorconfig.netbeans.parser;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.logging.Level;
import java.util.logging.Logger;

public class EditorConfigParser {
  
  private static final Logger LOG = Logger.getLogger(EditorConfigParser.class.getName());

  // https://github.com/editorconfig/editorconfig-core-java/blob/master/src/org/editorconfig/core/EditorConfig.java
  public EditorConfigParser() {
  }
  
  public void parseConfig(URL resource) {
    File file = new File(resource.getFile());
    StringBuilder sb = new StringBuilder();
    String line;
    
    try (
            FileInputStream fis = new FileInputStream(file);
            InputStreamReader isr = new InputStreamReader(fis, "UTF-8");
            BufferedReader br = new BufferedReader(isr)) {
      while ((line = br.readLine()) != null) {
        boolean isInteresting = !(line.startsWith("#") || line.isEmpty());
        
        if (isInteresting) {
          if (line.startsWith("[")) {
            // RegEx
            String regex = line.substring(1, line.lastIndexOf("]"));
            System.out.println("REGEX: " + regex);
            // TODO: Convert RegEx to Java compliant RegEx
          } else {
            // Key / Value
            String[] splitted = line.split("=");
            System.out.println("Key: " + splitted[0]);
            System.out.println("Value: " + splitted[1]);
            // TODO: Save Key / Value pairs together with RegEx in result set
          }
        }
      }
    } catch (IOException ex) {
      LOG.log(Level.SEVERE, "Error reading file: {0}", ex.getMessage());
    }
  }
}<commit_msg>Trimmed values.<commit_after>package org.editorconfig.netbeans.parser;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.logging.Level;
import java.util.logging.Logger;

public class EditorConfigParser {
  
  private static final Logger LOG = Logger.getLogger(EditorConfigParser.class.getName());

  // https://github.com/editorconfig/editorconfig-core-java/blob/master/src/org/editorconfig/core/EditorConfig.java
  public EditorConfigParser() {
  }
  
  public void parseConfig(URL resource) {
    File file = new File(resource.getFile());
    StringBuilder sb = new StringBuilder();
    String line;
    
    try (
            FileInputStream fis = new FileInputStream(file);
            InputStreamReader isr = new InputStreamReader(fis, "UTF-8");
            BufferedReader br = new BufferedReader(isr)) {
      while ((line = br.readLine()) != null) {
        boolean isInteresting = !(line.startsWith("#") || line.isEmpty());
        
        if (isInteresting) {
          if (line.startsWith("[")) {
            // RegEx
            String regex = line.substring(1, line.lastIndexOf("]"));
            System.out.println("REGEX: " + regex);
            // TODO: Convert RegEx to Java compliant RegEx
          } else {
            // Key / Value
            String[] splitted = line.split("=");
            System.out.println("Key: " + splitted[0].trim());
            System.out.println("Value: " + splitted[1].trim());
            // TODO: Save Key / Value pairs together with RegEx in result set
          }
        }
      }
    } catch (IOException ex) {
      LOG.log(Level.SEVERE, "Error reading file: {0}", ex.getMessage());
    }
  }
}
{'fraction_non_alphanumeric': 0.13069139966273188, 'fraction_numerical': 0.002810567734682406, 'mean_word_length': 2.5342601787487586, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '6648766', 'n_tokens_mistral': 1012, 'n_tokens_neox': 1009, 'n_words': 229}