Created
March 16, 2010 21:47
-
-
Save devn/334570 to your computer and use it in GitHub Desktop.
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
| (ns irc-parser | |
| (:use clojure.contrib.duck-streams | |
| clojure.contrib.str-utils | |
| clojure.contrib.seq-utils)) | |
| (def dates (file-seq (java.io.File. "/Users/defn/git/clojure-irc"))) | |
| (defn parse-irc-log | |
| "Gets rid of all the junk in the irc log groupings and gives us a list of strings which is the content found in the channel." | |
| [logfile] | |
| (remove empty? | |
| (map #((rest second (re-find #"^[^<]*<[^>]*>\s(.*)$" %))) | |
| (line-seq (reader logfile))))) | |
| (def parsed (map parse-irc-log (rest dates))) | |
| (defn find-lines | |
| [text] | |
| (remove empty? (map | |
| (fn [d] (filter #(< 0 (.indexOf % text)) d)) | |
| parsed))) | |
| ;(time (def zm (map (fn [l] (map #(re-find #"zipmap" %) l)) parsed))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment