<commit_before>package com.github.aliakhtar.ezGss.transform;

import com.github.aliakhtar.ezGss.io.Reader;
import com.github.aliakhtar.ezGss.util.Logging;
import com.steadystate.css.parser.CSSOMParser;
import org.w3c.css.sac.InputSource;
import org.w3c.dom.css.CSSStyleSheet;

import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Collection;
import java.util.logging.Logger;

public class Transformer
{
    private final Logger log = Logging.get(this);

    private final String sourcePath;
    private final CSSOMParser parser = new CSSOMParser();
    private final CSSStyleSheet styleSheet;

    public Transformer(String sourcePath)
            throws IOException
    {
        this.sourcePath = sourcePath;

        Reader reader = new Reader();

        InputStreamReader streamReader = reader.getStreamReader(sourcePath);
        styleSheet = parser.parseStyleSheet( new InputSource(streamReader), null, null);

    }


    public Collection<String> getRawClasses()
    {
        return null;
    }
}<commit_msg>Reading raw classes in Transformer.java<commit_after>package com.github.aliakhtar.ezGss.transform;

import com.github.aliakhtar.ezGss.io.Reader;
import com.github.aliakhtar.ezGss.util.Logging;
import com.steadystate.css.parser.CSSOMParser;
import org.w3c.css.sac.InputSource;
import org.w3c.dom.css.CSSRule;
import org.w3c.dom.css.CSSRuleList;
import org.w3c.dom.css.CSSStyleRule;
import org.w3c.dom.css.CSSStyleSheet;

import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.logging.Logger;

public class Transformer
{
    private final Logger log = Logging.get(this);

    private final String sourcePath;
    private final Set<String> rawClasses;

    public Transformer(String sourcePath)
            throws IOException
    {
        this.sourcePath = sourcePath;

        Reader reader = new Reader();

        InputStreamReader streamReader = reader.getStreamReader(sourcePath);

        CSSOMParser parser = new CSSOMParser();
        CSSStyleSheet styleSheet =
                parser.parseStyleSheet( new InputSource(streamReader), null, null);

        rawClasses = parse(styleSheet);
        streamReader.close();
    }

    private Set<String> parse(CSSStyleSheet styleSheet)
    {
        CSSRuleList ruleList = styleSheet.getCssRules();
        Set<String> classes = new HashSet<>( ruleList.getLength() );

        for (int i = 0; i < ruleList.getLength(); i++)
        {
            CSSRule rule = ruleList.item(i);
            if (! (rule instanceof CSSStyleRule))
                continue;

            CSSStyleRule cssRule = (CSSStyleRule) rule;
            String selector = cssRule.getSelectorText().toLowerCase().trim();
            if (! selector.startsWith("."))
                continue;

            classes.add(selector);
        }

        return classes;
    }


    public Collection<String> getRawClasses()
    {
        return rawClasses;
    }
}
{'fraction_non_alphanumeric': 0.09760105159382189, 'fraction_numerical': 0.0026289845547157412, 'mean_word_length': 3.06951871657754, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 9, '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': '16613', 'n_tokens_mistral': 916, 'n_tokens_neox': 874, 'n_words': 192}