Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
A sample of Clojure and lucene-gosen
(ns lucene_gosen_test.core (:gen-class))
(import java.util.Collections)
(defn -main [& args]
(println (first args))
(with-open [reader (new (first args))]
(let [
analyzer (new org.apache.lucene.analysis.ja.JapaneseAnalyzer org.apache.lucene.util.Version/LUCENE_35 Collections/EMPTY_SET Collections/EMPTY_SET Collections/EMPTY_SET "/home/haruyama/work/solr/dic/solr/conf/dic")
ts (.tokenStream analyzer "dummy" reader)
termAtt (.getAttribute ts org.apache.lucene.analysis.tokenattributes.CharTermAttribute)
posAtt (.getAttribute ts org.apache.lucene.analysis.ja.tokenAttributes.PartOfSpeechAttribute)
(while (.incrementToken ts)
(println (.toString termAtt))
(println (.getPartOfSpeech posAtt))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment