<commit_before>(ns hellhound.components.transform
  "`transform` component is a really simple component to transofrm
  the incoming data and send the result to the output stream."
  ^{:author "<NAME> (@lxsameer)"}
  (:require
   [manifold.stream     :as s]
   [hellhound.component :as hcomp]))


(defn- transform-fn
  [f]
  (fn [{:keys [input output] :as component} context]
    (s/connect-via input
                   #(s/put! output (f context %))
                   output)
    component))


(defn factory
  "Creates a component with the given `component-name` which transforms
  the input value by applying `f` to it and sending it to the output stream."
  [component-name f
   {::hcomp/name     component-name
    ::hcomp/start-fn (transform-fn f)
    ::hcomp/stop-fn  (fn [component] this)}])
<commit_msg>Minor bug in transoform component, got fixed<commit_after>(ns hellhound.components.transform
  "`transform` component is a really simple component to transofrm
  the incoming data and send the result to the output stream."
  ^{:author "<NAME> (@lxsameer)"}
  (:require
   [manifold.stream     :as s]
   [hellhound.component :as hcomp]))


(defn- transform-fn
  [f]
  (fn [component context]
    (let [input  (hcomp/input component)
          output (hcomp/output component)]
      (s/connect-via input
                     #(s/put! output (f context %))
                     output))
    component))


(defn factory
  "Creates a component with the given `component-name` which transforms
  the input value by applying `f` to it and sending it to the output stream."
  [component-name f]
  {::hcomp/name     component-name
   ::hcomp/start-fn (transform-fn f)
   ::hcomp/stop-fn  (fn [component] component)})

{'fraction_non_alphanumeric': 0.11460151250727167, 'fraction_numerical': 0.0, 'mean_word_length': 2.9631336405529956, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '6949119', 'n_tokens_mistral': 539, 'n_tokens_neox': 518, 'n_words': 183}