<commit_before>(ns clara.rules.compiler
  "The Clara rules compiler, translating raw data structures into compiled versions and functions. 
   Most users should use only the clara.rules namespace."
  (:use clara.rules.memory
        clojure.pprint
        clojure.java.io)
  (:require [clojure.reflect :as reflect]
            [clojure.core.reducers :as r]
            [clojure.set :as s]
            [clara.rules.engine :as eng]
            [clojure.string :as string]))

(def ^:private reflector
  "For some reason (bug?) the default reflector doesn't use the
  Clojure dynamic class loader, which prevents reflecting on
  `defrecords`.  Work around by supplying our own which does."
  (clojure.reflect.JavaReflector. (clojure.lang.RT/baseLoader)))

;; This technique borrowed from Prismatic's schema library.
(defn compiling-cljs?
  "Return true if we are currently generating cljs code.  Useful because cljx does not
         provide a hook for conditional macro expansion."
  []
  (boolean
   (when-let [n (find-ns 'cljs.analyzer)]
     (when-let [v (ns-resolve n '*cljs-file*)]
       @v))))

(defn get-namespace-info 
  "Get metadata about the given namespace."
  [namespace]<commit_msg>- Changed the ClassLoader passed to the JavaReflector in clara.rules.compiler to be a new DynamicClassLoader via clojure.lang.RT/makeClassLoader, to allow for dynamically added types to be reflected on, even if the compile-time "base" loader for clara is not a DynamicClassLoader<commit_after>(ns clara.rules.compiler
  "The Clara rules compiler, translating raw data structures into compiled versions and functions. 
   Most users should use only the clara.rules namespace."
  (:use clara.rules.memory
        clojure.pprint
        clojure.java.io)
  (:require [clojure.reflect :as reflect]
            [clojure.core.reducers :as r]
            [clojure.set :as s]
            [clara.rules.engine :as eng]
            [clojure.string :as string]))

(def ^:private reflector
  "For some reason (bug?) the default reflector doesn't use the
   Clojure dynamic class loader, which prevents reflecting on
  `defrecords`.  Work around by supplying our own which does."
  (clojure.reflect.JavaReflector. (clojure.lang.RT/makeClassLoader)))

;; This technique borrowed from Prismatic's schema library.
(defn compiling-cljs?
  "Return true if we are currently generating cljs code.  Useful because cljx does not
         provide a hook for conditional macro expansion."
  []
  (boolean
   (when-let [n (find-ns 'cljs.analyzer)]
     (when-let [v (ns-resolve n '*cljs-file*)]
       @v))))

(defn get-namespace-info 
  "Get metadata about the given namespace."
  [namespace]
{'fraction_non_alphanumeric': 0.09285714285714286, 'fraction_numerical': 0.0, 'mean_word_length': 3.2988691437802906, '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': '2127628', 'n_tokens_mistral': 810, 'n_tokens_neox': 776, 'n_words': 287}