Commits

Miki Tebeka  committed 73f8317

Thanks

  • Participants
  • Parent commits 89a26f8

Comments (0)

Files changed (1)

File src/clj2010.clj

     :map (fn [record] 
             (map (fn [tok] [tok 1]) 
                  (filter ok-word? (tokenize (:text record)))))
-    :reduce (fn [key values] (reduce + values))
+    :reduce (fn [key values] (sum values))
     :text true
     :max 100
-    :outfile "words"
-    :count 100})
+    :outfile "words"})
+
+(defn get-thanked [text]
+  (and (re-find #"(?i)thank" text)
+       (re-find #"[a-zA-Z0-9_-`'|]+:" text)))
+
+(def thanks {
+  :map (fn [record]
+             (if-let [user (get-thanked (:text record))]
+               [[(fix-user user) 1]]
+               []))
+  :reduce (fn [key values] (sum values))
+  :text true
+  :max 100
+  :outfile "thanks"})
 
 (def *jobs* [numlines numusers active words])