<commit_before>-module(nodelua).

-export([load/2, send/2]).
-export([load_core/2, send_core/2]).

-ifdef(TEST).
-include_lib("eunit/include/eunit.hrl").
-endif.

-on_load(init/0).

% This interface is intended to be a simple bridge to lua, no more.

-define(nif_stub, nif_stub_error(?LINE)).
nif_stub_error(Line) ->
    erlang:nif_error({nif_not_loaded,module,?MODULE,line,Line}).

init() ->
  PrivDir = case code:priv_dir(?MODULE) of
                {error, bad_name} ->
                    EbinDir = filename:dirname(code:which(?MODULE)),
                    AppPath = filename:dirname(EbinDir),
                    filename:join(AppPath, "priv");
                Path ->
                    Path
            end,
    NumProcessors = erlang:system_info(logical_processors),<commit_msg>Added a 'start' function for the app.<commit_after>-module(nodelua).

-export([start/2]).
-export([load/2, send/2]).
-export([load_core/2, send_core/2]).

-ifdef(TEST).
-include_lib("eunit/include/eunit.hrl").
-endif.

-on_load(init/0).

% This interface is intended to be a simple bridge to lua, no more.
start(_StartType, _StartArgs) ->
    Script = config(script, undefined),
    {ok, Pid} = lua:start_link(Script), 
    {ok, Pid, []}.

config(Name, Default) ->
    case application:get_env(?MODULE, Name) of
        {ok, Value} -> Value;
        undefined -> Default
    end.

-define(nif_stub, nif_stub_error(?LINE)).
nif_stub_error(Line) ->
    erlang:nif_error({nif_not_loaded,module,?MODULE,line,Line}).

init() ->
  PrivDir = case code:priv_dir(?MODULE) of
                {error, bad_name} ->
                    EbinDir = filename:dirname(code:which(?MODULE)),
                    AppPath = filename:dirname(EbinDir),
                    filename:join(AppPath, "priv");
                Path ->
                    Path
            end,
    NumProcessors = erlang:system_info(logical_processors),
{'fraction_non_alphanumeric': 0.14889123548046462, 'fraction_numerical': 0.005807814149947202, 'mean_word_length': 2.5822306238185253, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, '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': '3167604', 'n_tokens_mistral': 646, 'n_tokens_neox': 626, 'n_words': 116}