       {:size counter
        :height max-path
        :users users
-       :hashtags (vec (into #{} (map :text hashtags)))
+       ;;:tokens tokens
+       :pub-times pub-times
+       :hashtags (mapv #(-> % :text clojure.string/lower-case) hashtags)
        :delays delays}
       (recur
        (if (zip/node loc)

               post-delay (if (t/after? (-> loc zip/node :tweet :created_at) pub-time)
                            (t/interval pub-time (-> loc zip/node :tweet :created_at))
                            (t/interval (-> loc zip/node :tweet :created_at) pub-time))]
           (conj delays (t/in-hours post-delay)))
         delays)
       (zip/next loc)))))


(defn compute-summary [source]
  (let [impact-forest (compute-impact-forest source)
        analytics (map analyze-tree impact-forest)
        sizes (map :size analytics)
        heights (map :height analytics)
        users (frequencies (flatten (map :users analytics)))
        hashtags (frequencies (flatten (map :hashtags analytics)))
        overall-size (reduce + sizes)]
    {:source source
     :articles (count impact-forest)
     :top-users (take 50 (sort-by second > users))
     :hastags (take 50 (sort-by second > hashtags))
     :total-impact overall-size
     :avg-impact (float (/ overall-size (count sizes)))
     :no-reactions (float (/ (count (filter #(< % 1) heights)) (count heights)))

  (pprint (map compute-summary news-accounts))


  (def rand-tree (random-tree))


  (println "\n")



  (def n-freq (get-news-frequencies))


  (-> (mc/find-maps @db "tweets" {:created_at {$gt (t/today)}})
      count
      time)

  (def sum-tagesschau (compute-summary "tagesschau"))

  (def sum-faz (compute-summary "FAZ_NET"))

  (def sum-sz (compute-summary "SZ"))

  (def sum-spon (compute-summary "SPIEGELONLINE"))

  (def sum-welt (compute-summary "welt"))



  (let [faz-hours (->> sum-faz
                       :pub-times
                       flatten
                       (map t/hour)
                       frequencies
                       (sort-by key <))]
    (view (line-chart (keys pub-hours) (vals pub-hours))))


  (let [delays (->>  sum-faz
                     :delays
                     (remove #(= % 0))
                     (remove #(> % 600)))]
    (view (histogram delays :nbins 120)))


  (let [hours-running (t/in-hours (t/interval (t/date-time 2014 7 2) (t/now)))
        dates (take hours-running (p/periodic-seq (t/date-time 2014 7 2) (t/hours 1)))
        tweet-count (map
                     #(mc/count @db
                                "tweets"
                                {:created_at {$gte %
                                              $lt (t/plus % (t/hours 1))}})
                     dates)
        days-since-start (range hours-running)]
    (view (line-chart days-since-start tweet-count)))



  ;; twitter-nlp
  ;; html compression
  )
