<commit_before>import run_with_scope, defaultbl from require "moon"
import insert from require "table"

local parse_to_table

args = (first, ...)->
  if #{...}>0
    {first, ...}
  else
    first

call = (name, first, ...)=>
  if type(first) == "function"
    insert @_buffer, {:name, value: parse_to_table first, args ...}
  else
    insert @_buffer, {:name, value: args first, ...}

index = (name)=>
  (...) -> call @, name, ...

parse_to_table=(fn)->
  buf={}
  run_with_scope fn, defaultbl {_buffer:buf}, index
  buf

parse_to_table<commit_msg>cleanup<commit_after>import run_with_scope, defaultbl from require "moon"
import insert from require "table"

local parse_to_table

args = (first, ...)->
  if #{...}>0
    {first, ...}
  else
    first

call = (name, first, ...)=>
  if type(first) == "function"
    insert @_buffer, {:name, value: parse_to_table first, args ...}
  else
    insert @_buffer, {:name, value: args first, ...}

index = (name)=>
  (...) -> call @, name, ...

parse_to_table = (fn)->
  buf = {}
  run_with_scope fn, defaultbl {_buffer:buf}, index
  buf

parse_to_table
{'fraction_non_alphanumeric': 0.1809872029250457, 'fraction_numerical': 0.0018281535648994515, 'mean_word_length': 3.1320754716981134, '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': '6399302', 'n_tokens_mistral': 396, 'n_tokens_neox': 391, 'n_words': 106}