<commit_before>-module(erlcfg).
-export([
        new/0,
        new/1
    ]).
-include("erlcfg.hrl").

new() ->
    {ok, erlcfg_data:new(erlcfg_node:new())}.

new(FileName) ->
    {ok, Binary} = file:read_file(FileName),
    String = binary_to_list(Binary),
    {ok, TokenList, _LineCount} = erlcfg_lexer:string(String),
    {ok, Ast} = erlcfg_parser:parse(TokenList),
    InterpState = erlcfg_interp:eval(Ast),
    {ok, erlcfg_data:new(InterpState#interp.node)}.<commit_msg>Define erlcfg:check/1<commit_after>-module(erlcfg).
-export([
        new/0,
        new/1,
        check/1
    ]).
-include("erlcfg.hrl").

new() ->
    {ok, erlcfg_data:new(erlcfg_node:new())}.

new(FileName) ->
    {ok, Binary} = file:read_file(FileName),
    String = binary_to_list(Binary),
    {ok, TokenList, _LineCount} = erlcfg_lexer:string(String),
    {ok, Ast} = erlcfg_parser:parse(TokenList),
    InterpState = erlcfg_interp:eval(Ast),
    {ok, erlcfg_data:new(InterpState#interp.node)}.

check(FileName) ->
    {ok, Binary} = file:read_file(FileName),
    String = binary_to_list(Binary),
    {ok, TokenList, _LineCount} = erlcfg_schema_lexer:string(String),
    {ok, Ast} = erlcfg_schema_parser:parse(TokenList),
    Ast.
{'fraction_non_alphanumeric': 0.16982687551525144, 'fraction_numerical': 0.00494641384995878, 'mean_word_length': 3.91497975708502, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 8, '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': '1147621', 'n_tokens_mistral': 486, 'n_tokens_neox': 470, 'n_words': 65}