Created
September 7, 2014 15:01
-
-
Save zwang/ef7a08aae2ba44386c8a to your computer and use it in GitHub Desktop.
convert a file with word on each line to a json array. (pick only the first 2000 words)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn convert [](with-open [rdr (reader "/Users/zhaowang/workspace/clojure/labrepl/data/words")] | |
(doseq [line (take 2000 (line-seq rdr))] | |
(writeToFile (str "\"" line "\"" ","))))) | |
(defn writeToFile [line] | |
(with-open [wrtr (writer "test.json" :append true)] | |
(.write wrtr line))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment