<commit_before>-module(etoma_behavior).

-export([payload/0]).

-export([stationary/4,
         circular/4,
         linear/4]).

-record(payload, {speed, omega, theta}).

payload() -> #payload{}.

stationary(_Id, X, Y, P) -> {X, Y, P}.

circular(_Id, X, Y, P = #payload{speed = S, omega = O, theta = T}) ->
  {
    X + S * math:cos(T),
    Y + S * math:sin(T),
    P#payload{theta = T + O}
  }.

linear(Id, X, Y, P) ->
  circular(Id, X, Y, P#payload{omega = 0}).<commit_msg>Add composition, uniform walk<commit_after>-module(etoma_behavior).

-export([payload/0]).

-export([stationary/4,
         circular/4,
         linear/4,
         uniform_walk/4,
         compose/2
        ]).

-record(payload, {speed = 0,
                  omega = 0,
                  theta = 0,
                  pos_noise = 0}).

payload() -> #payload{}.

stationary(_Id, X, Y, P) -> {X, Y, P}.

circular(_Id, X, Y, P = #payload{speed = S, omega = O, theta = T}) ->
  {
    linear_x(X, S, T),
    linear_y(Y, S, T),
    P#payload{theta = T + O}
  }.

linear(_Id, X, Y, P = #payload{speed = S, theta = T}) ->
  {
    linear_x(X, S, T),
    linear_y(Y, S, T),
    P
  }.

uniform_walk(_Id, X, Y, P = #payload{pos_noise = N}) ->
  {
    X + math:sqrt(N) * uniform_noise(),
    Y + math:sqrt(N) * uniform_noise(),
    P
  }.

compose(B1, B2) ->
  fun(Id, X, Y, P) ->
      {X1, Y1, P1} = B1(Id, X, Y, P),
      B2(Id, X1, Y1, P1)
  end.

linear_x(X, S, T) ->
  X + S * math:cos(T).

linear_y(Y, S, T) ->
  Y + S * math:sin(T).

uniform_noise() ->
  random:uniform() - 0.5.
{'fraction_non_alphanumeric': 0.21059431524547803, 'fraction_numerical': 0.01744186046511628, 'mean_word_length': 2.1612244897959183, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 17, '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': '2210323', 'n_tokens_mistral': 682, 'n_tokens_neox': 652, 'n_words': 153}