Commits

Ning Sun committed 999e5fa

server/client complete

  • Participants
  • Parent commits c599ba0

Comments (0)

Files changed (21)

README

-# redday
-
-FIXME: write description
-
-## Usage
-
-FIXME: write
-
-## License
-
-Copyright (C) 2012 FIXME
-
-Distributed under the Eclipse Public License, the same as Clojure.

model/en-token.bin

Binary file removed.

project.clj

-(defproject redday "1.0.0-SNAPSHOT"
-  :description "FIXME: write description"
-  :dependencies [[org.clojure/clojure "1.2.1"]
-                 [slacker "0.6.0-SNAPSHOT"]
-                 [reddit.clj "0.3.2"]
-                 [clojure-opennlp "0.1.7"]])

slacker-client-demo/.gitignore

+/pom.xml
+*jar
+/lib
+/classes
+/native
+/.lein-failures
+/checkouts
+/.lein-deps-sum

slacker-client-demo/README

+# slacker-client-demo
+
+FIXME: write description
+
+## Usage
+
+FIXME: write
+
+## License
+
+Copyright (C) 2012 FIXME
+
+Distributed under the Eclipse Public License, the same as Clojure.

slacker-client-demo/project.clj

+(defproject slacker-client-demo "1.0.0-SNAPSHOT"
+  :description "FIXME: write description"
+  :dependencies [[org.clojure/clojure "1.2.1"]
+                 [slacker "0.6.0-SNAPSHOT"]])
+

slacker-client-demo/src/slacker_client_demo/client.clj

+(ns slacker-client-demo.client
+  (:use [slacker.client]))
+
+(def scp (slackerc-pool "127.0.0.1:6565"))
+
+

slacker-client-demo/src/slacker_client_demo/core.clj

+(ns slacker-client-demo.core
+  (:use [clojure.pprint :only [pprint]])
+  (:use [slacker-client-demo.client])
+  (:use [slacker.client]))
+
+(use-remote 'scp 'redday.api)
+(use-remote 'scp 'redday.stats)
+
+(defn -main [subreddit & args]
+  (let [reddits (top-titles subreddit)
+        words-stats (apply word-count reddits)]
+    (pprint words-stats)))
+

slacker-client-demo/test/slacker_client_demo/test/core.clj

+(ns slacker-client-demo.test.core
+  (:use [slacker-client-demo.core])
+  (:use [clojure.test]))
+
+(deftest replace-me ;; FIXME: write
+  (is false "No tests have been written."))

slacker-server-demo/.lein-deps-sum

+f9e5b8ee173288a90487997e59db59f2d55d2ce9

slacker-server-demo/README

+# redday
+
+FIXME: write description
+
+## Usage
+
+FIXME: write
+
+## License
+
+Copyright (C) 2012 FIXME
+
+Distributed under the Eclipse Public License, the same as Clojure.

slacker-server-demo/model/en-token.bin

Binary file added.

slacker-server-demo/project.clj

+(defproject redday "1.0.0-SNAPSHOT"
+  :description "FIXME: write description"
+  :dependencies [[org.clojure/clojure "1.2.1"]
+                 [slacker "0.6.0-SNAPSHOT"]
+                 [reddit.clj "0.3.2"]
+                 [clojure-opennlp "0.1.7"]])

slacker-server-demo/src/redday/api.clj

+(ns redday.api
+  (:require [reddit.clj.core :as reddit]))
+
+(defn top-titles [subreddit]
+  (let [reddit-client (reddit/login)]
+    (map :title (reddit/reddits reddit-client subreddit))))
+
+(defn user-titles [name]
+  (let [reddit-client (reddit/login)]
+    (map :title
+         (filter #(.startsWith (:name %) "t3")
+                 (reddit/user reddit-client name)))))
+

slacker-server-demo/src/redday/core.clj

+(ns redday.core
+  (:require [redday stats api])
+  (:use [slacker.server])
+  (:use [slacker.interceptors.exectime :only [exectime-stats]]))
+
+(defn -main [& args]
+  (start-slacker-server [(the-ns 'redday.stats)
+                         (the-ns 'redday.api)]
+                        6565
+                        :interceptors exectime-stats))
+

slacker-server-demo/src/redday/stats.clj

+(ns redday.stats
+  (:require [clojure.string :as string])
+  (:require [opennlp.nlp :as nlp]))
+
+(def tokenizer (nlp/make-tokenizer "model/en-token.bin"))
+
+(defn word-count [& sentence]
+  (let [words (mapcat tokenizer (map string/lower-case sentence))]
+    (frequencies words)))

slacker-server-demo/test/redday/test/core.clj

+(ns redday.test.core
+  (:use [redday.core])
+  (:use [clojure.test]))
+
+(deftest replace-me ;; FIXME: write
+  (is false "No tests have been written."))

src/redday/api.clj

-(ns redday.api
-  (:require [reddit.clj.core :as reddit]))
-
-(defn top-titles [subreddit]
-  (let [reddit-client (reddit/login)]
-    (map :title (reddit/reddits reddit-client subreddit))))
-
-(defn user-titles [name]
-  (let [reddit-client (reddit/login)]
-    (map :title
-         (filter #(.startsWith (:name %) "t3")
-                 (reddit/user reddit-client name)))))
-

src/redday/core.clj

-(ns redday.core
-  (:require [redday stats api])
-  (:use [slacker.server])
-  (:use [slacker.interceptors.exectime :only [exectime-stats]]))
-
-(defn -main [& args]
-  (start-slacker-server [(the-ns 'redday.stats)
-                         (the-ns 'redday.api)]
-                        6565
-                        :interceptors exectime-stats))
-

src/redday/stats.clj

-(ns redday.stats
-  (:require [clojure.string :as string])
-  (:require [opennlp.nlp :as nlp]))
-
-(def tokenizer (nlp/make-tokenizer "model/en-token.bin"))
-
-(defn word-count [& sentence]
-  (let [words (mapcat tokenizer (map string/lower-case sentence))]
-    (frequencies words)))

test/redday/test/core.clj

-(ns redday.test.core
-  (:use [redday.core])
-  (:use [clojure.test]))
-
-(deftest replace-me ;; FIXME: write
-  (is false "No tests have been written."))