<commit_before>;; Generate a random list of atoms of each type to compare against our
;; original experiments for consistency and representativeness

(ns atom-finder.questions.random-examples
  (:require
   [atom-finder.util :refer :all]
   [atom-finder.constants :refer :all]
   [atom-finder.atom-patch :refer :all]
   [atom-finder.classifier :refer :all]
   [clojure.pprint :refer [pprint]]
   [clojure.set :as set]
   [schema.core :as s]
   [swiss.arrows :refer :all]
   [clojure.data.csv :as csv]
   [clojure.string :as str]
   )
  (:import
   [org.eclipse.cdt.core.dom.ast IASTNode]
   )
  )

(->>
 "~/opt/src/linux"
 expand-home
 c-files
 (take 50000)
 shuffle
 (take 10000)
 (def random-c-files)
 time-mins
 )

(quote
(->>
 random-c-files
 (pap (constantly (now)))
 (map parse-file)
 (mapcat
  (fn [root]
    (for [[name atms] (find-all-atoms root)
          atm atms]
      {:file (str/replace-first (.getFilePath root) #".*linux/" "")
       :line (start-line atm)
       :type name
       :atom atm})))
 shuffle
 (def random-atoms)<commit_msg>quote test code<commit_after>;; Generate a random list of atoms of each type to compare against our
;; original experiments for consistency and representativeness

(ns atom-finder.questions.random-examples
  (:require
   [atom-finder.util :refer :all]
   [atom-finder.constants :refer :all]
   [atom-finder.atom-patch :refer :all]
   [atom-finder.classifier :refer :all]
   [clojure.pprint :refer [pprint]]
   [clojure.set :as set]
   [schema.core :as s]
   [swiss.arrows :refer :all]
   [clojure.data.csv :as csv]
   [clojure.string :as str]
   )
  (:import
   [org.eclipse.cdt.core.dom.ast IASTNode]
   )
  )

'((->>
 "~/opt/src/linux"
 expand-home
 c-files
 (take 50000)
 shuffle
 (take 10000)
 (def random-c-files)
 time-mins
 ))

(quote
(->>
 random-c-files
 (pap (constantly (now)))
 (map parse-file)
 (mapcat
  (fn [root]
    (for [[name atms] (find-all-atoms root)
          atm atms]
      {:file (str/replace-first (.getFilePath root) #".*linux/" "")
       :line (start-line atm)
       :type name
       :atom atm})))
 shuffle
 (def random-atoms)
{'fraction_non_alphanumeric': 0.15300805305542398, 'fraction_numerical': 0.009474182851729039, 'mean_word_length': 3.053742802303263, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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': '244520', 'n_tokens_mistral': 810, 'n_tokens_neox': 790, 'n_words': 199}