<commit_before>(ns yaml.core
 (:refer-clojure :exclude [load])
 (:require [clojure.java.io :as io]
           [yaml.reader :refer [parse-string load]]
           [yaml.writer :refer [generate-string dump]]))

(defn- safe-read
  "Try and read a file. If it does not exist then return nil rather
   than an exception"
  [f]
  (when (.exists (io/file f))
    (slurp f)))

(defn from-file
  "Reads a YAML file and returns the decoded result"
  ([f]
    (from-file f false))
  ([f keywords]
  (when-let [contents (safe-read f)]
    (parse-string contents keywords))))
<commit_msg>Update core.clj<commit_after>(ns yaml.core
 (:refer-clojure :exclude [load])
 (:require [clojure.java.io :as io]
           [yaml.reader :refer [parse-string]]
           [yaml.writer :refer [generate-string dump]]))

(defn- safe-read
  "Try and read a file. If it does not exist then return nil rather
   than an exception"
  [f]
  (when (.exists (io/file f))
    (slurp f)))

(defn from-file
  "Reads a YAML file and returns the decoded result"
  ([f]
    (from-file f false))
  ([f keywords]
  (when-let [contents (safe-read f)]
    (parse-string contents keywords))))

{'fraction_non_alphanumeric': 0.14210985178727115, 'fraction_numerical': 0.0, 'mean_word_length': 3.0709219858156027, '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': '1828569', 'n_tokens_mistral': 408, 'n_tokens_neox': 395, 'n_words': 134}