Skip to content

Commit

Permalink
can now build a uberjar containing only the web client
Browse files Browse the repository at this point in the history
  • Loading branch information
gariepyalex committed Dec 24, 2015
1 parent 097d42d commit 56e5e48
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 16 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ pom.xml.asc
/report/*.aux
/report/*.log
/report/*.out
/report/*.pdf

# emacs
*~
Expand Down
11 changes: 6 additions & 5 deletions project.clj
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
[cheshire "5.5.0"]
[http-kit "2.1.18"]
[hiccup "1.0.5"]
[compojure "1.4.0" :exclusions [joda-time]]
[ring/ring-defaults "0.1.5"]
[edu.stanford.nlp/stanford-corenlp "3.5.2"]]
:resource-paths ["resources" "lib/stanford-corenlp-models-current.jar"]
[compojure "1.4.0"]
[ring/ring-defaults "0.1.5"]]
:resource-paths ["resources"]
:main ^:skip-aot reddit-nlp.web
:test-paths ["test"]
:target-path "target/%s"
:profiles {:uberjar {:aot :all}})
:profiles {:dev {:dependencies [[edu.stanford.nlp/stanford-corenlp "3.5.2"]]
:resource-paths ["lib/stanford-corenlp-models-current.jar"]}
:uberjar {:aot [reddit-nlp.web]}})
9 changes: 8 additions & 1 deletion src/reddit_nlp/core.clj
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
(ns reddit-nlp.core
(:require [reddit-nlp.reddit :as reddit]
[reddit-nlp.stanford-nlp-wrapper :as nlp]
[reddit-nlp.duckduckgo :as ddgo]))
[reddit-nlp.duckduckgo :as ddgo]
[reddit-nlp.dataset :as dataset]))

(defn- count-or-two
[elements]
Expand All @@ -26,3 +27,9 @@
:sentiment (comments-average-sentiment (reddit/flatten-comments (reddit/comments-of-post post)))
:topics (ddgo/structured-instant-answers (nlp/analyze-named-entities (reddit/title-of-post post)))
}))))

;; The simplest way to run this is with 'lein run -m reddit-nlp.core subreddit-name'
(defn -main
[subreddit & args]
(dataset/create-webdataset! subreddit (cards subreddit 20))
(println "dataset has been created"))
12 changes: 2 additions & 10 deletions src/reddit_nlp/dataset.clj
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
(ns reddit-nlp.dataset
(:require [clojure.java.io :as io]
[reddit-nlp.reddit :as reddit]
[reddit-nlp.core :as core]))
[reddit-nlp.reddit :as reddit]))

(def dataset-base-dir "resources/dataset/")

Expand Down Expand Up @@ -42,15 +41,8 @@

(defn webdataset
[subreddit]
(let [file (io/file (io/resource (str "webdataset/" subreddit)))]
(let [file (io/resource (str "webdataset/" subreddit))]
(if file
(read-string (slurp file))
{:cards []})))

;; The simplest way to run this is with 'lein run -m reddit-nlp.dataset subreddit-name'
(defn -main
[subreddit & args]
;; (let [posts (reddit/hot-posts-of-subreddit subreddit)]
;; (create-dataset! posts))
(create-webdataset! subreddit (core/cards subreddit 20))
(println "dataset has been created"))
4 changes: 4 additions & 0 deletions src/reddit_nlp/web.clj
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
(ns reddit-nlp.web
(:gen-class)
(:require [reddit-nlp.dataset :as dataset]
[org.httpkit.server :as httpkit]
[hiccup.page :as hiccup]
Expand All @@ -18,6 +19,9 @@

(def subreddits ["news"
"worldnews"
"justintrudeau"
"Pets"
"comicbookmovies"
"johncena"])

(defn color-picker-generator
Expand Down

0 comments on commit 56e5e48

Please sign in to comment.