Clojure Jieba
The Clojure version of Jieba (https://github.com/fxsjy/jieba).
Installation
Leiningen
[com.huaban/clj-jb "0.1.0-SNAPSHOT"]
Gradle
compile "com.huaban:clj-jb:0.1.0-SNAPSHOT"
Maven
<dependency>
<groupId>com.huaban</groupId>
<artifactId>clj-jb</artifactId>
<version>0.1.0-SNAPSHOT</version>
</dependency>
Usage
Require it first:
(ns ...
(:require [com.huaban/clj :as jb]))
(jb/split "ζζζζθε·²οΌζ²‘δ»δΉζζγ")
; => [{:word "ζζ", :start 0, :end 2, :type "n"} {:word "ζζ", :start 2, :end 4, :type "n"} {:word "θε·²", :start 4, :end 6, :type "y"} {:word "οΌ", :start 6, :end 7, :type ""} {:word "δ»δΉ", :start 8, :end 10, :type "r"} {:word "沑δ»δΉ", :start 7, :end 10, :type "l"} {:word "ζζ", :start 10, :end 12, :type "n"} {:word "γ", :start 12, :end 13, :type ""}]
(jb/split-all ["ζζζζθε·²οΌζ²‘δ»δΉζζγ" "ζε»θ±η£η½ιιθ±η£"])
; => [[{:word "ζζ", :start 0, :end 2, :type "n"} {:word "ζζ", :start 2, :end 4, :type "n"} {:word "θε·²", :start 4, :end 6, :type "y"} {:word "οΌ", :start 6, :end 7, :type ""} {:word "δ»δΉ", :start 8, :end 10, :type "r"} {:word "沑δ»δΉ", :start 7, :end 10, :type "l"} {:word "ζζ", :start 10, :end 12, :type "n"} {:word "γ", :start 12, :end 13, :type ""}] [{:word "ζ", :start 0, :end 1, :type "r"} {:word "ε»", :start 1, :end 2, :type "v"} {:word "θ±η£", :start 2, :end 4, :type "n"} {:word "η½", :start 4, :end 5, :type "n"} {:word "ιι", :start 5, :end 7, :type "v"} {:word "θ±η£", :start 7, :end 9, :type "n"}]]
Thanks To
- @fxsjy: This guy created the Jieba original version.
- @piaolingxue: He made the Java version of Jieba which
clj-jb
depended on.
Contribute
You're welcome to fork and push requests!