Skip to content

Instantly share code, notes, and snippets.

View seb231's full-sized avatar

Seb Bailey seb231

  • London, UK
View GitHub Profile
(defn assert! [p msg] (when-not (p) (throw (Exception. (timbre/info (format msg))))))
(defn jumpoffyr-method-average
"Takes in a dataset with historical data, a column name to be averaged,
a name for the average column, and years to start and end averaging for.
Returns a dataset where the column to be averaged contains the averages
for all the years of interest and is named to avg-name."
[historical-data col-to-avg avg-name start-yr-avg end-yr-avg]
(let [hist-earliest-yr (reduce min (ds/column historical-data :year))
hist-latest-yr (reduce max (ds/column historical-data :year))
16-07-19 14:13:21 Sebs-Work-MacBook.local ERROR [witan.models.run-models:148] -
witan.models.run_models.main
...
witan.models.run-models/-main run_models.clj: 151
witan.models.run-models/-main run_models.clj: 157
witan.models.run-models/get-inputs run_models.clj: 147
...
clojure.core/slurp core.clj: 6657 (repeats 2 times)
clojure.core/apply core.clj: 648
...
(def input
[{:sentence "Lorem ipsum dolor sit amet, consectetur adipiscing elit."}
{:sentence "Vestibulum tincidunt leo lectus, ac vulputate quam aliquet a."}
{:sentence "Ut molestie suscipit faucibus."}
{:sentence "Curabitur hendrerit tortor quis sodales consequat."}])
(def splitter
(comp #(map (fn [x] (hash-map :word x)) %)
#(clojure.string/split % #" ")))