From 75fd08e1dc65086da7355dab24c3448d99aacce2 Mon Sep 17 00:00:00 2001 From: Ryan Boldi Date: Tue, 2 Aug 2022 09:33:05 -0400 Subject: [PATCH] fixed scrabble score bug --- src/propeller/problems/data_creation.cljc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/propeller/problems/data_creation.cljc b/src/propeller/problems/data_creation.cljc index b08e8ed..84a278d 100644 --- a/src/propeller/problems/data_creation.cljc +++ b/src/propeller/problems/data_creation.cljc @@ -1,7 +1,8 @@ (ns propeller.problems.data-creation (:require [psb2.core :as psb2] [clojure.data.csv :as csv] - [clojure.java.io :as io])) + [clojure.java.io :as io] + [clojure.string :as s])) (defn generate-data [problem train-or-test] (let [train-and-test-data (psb2/fetch-examples "data" problem 200 1000) @@ -94,8 +95,9 @@ (defn scrabble-score-read-data-formatted [problem train-or-test] (apply list (with-open [reader (io/reader (str "picked/" problem "-" train-or-test ".csv"))] (let [csv-data (csv/read-csv reader)] + (prn {:csv-data csv-data}) (mapv zipmap (->> (first csv-data) ;; First row is the header (map keyword) ;; Drop if you want string keys instead repeat) - (map (fn [elem] (list (first elem) (read-string (second elem)))) (rest csv-data))))))) \ No newline at end of file + (map (fn [elem] (list (s/replace (first elem) "\\n" "\n") (read-string (second elem)))) (rest csv-data))))))) \ No newline at end of file