<commit_before>import json, streams, sequtils, sets, algorithm, tables, strutils, parseutils, ospaths
import tree_traversal

import nimx.pathutils
import rod.utils.bin_serializer
import rod.utils.json_deserializer
import rod.component.all_components
import rod.node
import rod.component

export bin_serializer

proc toScalarType[T](j: JsonNode, o: var T) {.inline.} =
    when T is float | float32 | float64:
        o = j.getFNum()
    elif T is int16 | int32 | int64:
        o = T(j.num)
    elif T is bool:
        o = j.bval
    else:
        {.error: "Unknown scalar type".}

proc toComponentType[T](j: JsonNode, o: var T) =
    when T is array:
        for i in 0 .. high(T):
            toScalarType(j[i], o[i])<commit_msg>Relative imports<commit_after>import json, streams, sequtils, sets, algorithm, tables, strutils, parseutils, ospaths
import tree_traversal

import nimx.pathutils
import ../../utils/[ bin_serializer, json_deserializer ]
import ../../node
import ../../component
import ../../component/all_components

export bin_serializer

proc toScalarType[T](j: JsonNode, o: var T) {.inline.} =
    when T is float | float32 | float64:
        o = j.getFNum()
    elif T is int16 | int32 | int64:
        o = T(j.num)
    elif T is bool:
        o = j.bval
    else:
        {.error: "Unknown scalar type".}

proc toComponentType[T](j: JsonNode, o: var T) =
    when T is array:
        for i in 0 .. high(T):
            toScalarType(j[i], o[i])
{'fraction_non_alphanumeric': 0.12114989733059549, 'fraction_numerical': 0.015058179329226557, 'mean_word_length': 2.8372703412073492, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '797371', 'n_tokens_mistral': 509, 'n_tokens_neox': 483, 'n_words': 154}