Skip to content

Instantly share code, notes, and snippets.

@mountain
mountain / ldaschema.clj
Created March 4, 2014 04:23
save lda schema
(def lda (second (get-model "model")))
(spit "2014.sch" (clojure.string/join "\n" (map #(clojure.string/join ";" %) (map vec (vec (.getTopWords lda 12))))))
@mountain
mountain / corpus_utilities.clj
Created February 25, 2014 06:47
corpus utilities
(use 'clojure.java.io)
(use 'com.guokr.nlp.seg)
(def corpus-root "/path/to/directory")
(def corpus-dir (clojure.java.io/file corpus-root))
(def corpus-files (file-seq corpus-dir))
(def corpus-writer (writer (str corpus-root "/corpus.txt")))
(defn line-by-line [wrtr lhdl] (fn [file] (with-open [rdr (reader file)] (doseq [line (line-seq rdr)] (.write wrtr (str (lhdl line) "\n"))))))
@mountain
mountain / antinode
Created June 12, 2012 00:51
Shell wrapper for node.js antinode static server
#!/bin/bash
#
# A wrapper for runner
#
CUR="${BASH_SOURCE[0]}";
if([ -h "${CUR}" ]) then
while([ -h "${CUR}" ]) do CUR=`readlink -m "${CUR}"`; done
fi
pushd . > /dev/null
cd `dirname ${CUR}` > /dev/null
@mountain
mountain / bind-events-with-bean-qwery-bonzo-but-without-ender.coffee
Created November 30, 2011 16:47
How to bind events in bean? With qwery and bonzo but without ender
###
csmain.coffee
link for this section:
http://playground.wahlque.org/tutorials/coffeescript/004-webworkers/
###
define [
'underscore',
'domReady',
'qwery',