My fork of Karthikeyan Singaravelan clj-wordcloud
Find a file
2018-03-24 14:56:22 +05:30
doc Initial commit with the API and files 2018-03-22 00:25:30 +05:30
examples Fix examples 2018-03-24 14:56:22 +05:30
src/clj_wordcloud Add support for custom bitmaps and docs 2018-03-22 21:45:38 +05:30
test/clj_wordcloud Add support for custom bitmaps and docs 2018-03-22 21:45:38 +05:30
.gitignore Initial commit with the API and files 2018-03-22 00:25:30 +05:30
.travis.yml Drop JDK 7 testing due to UnsupportedClassVersionError 2018-03-22 00:30:37 +05:30
CHANGELOG.md Release v0.0.1 2018-03-22 21:47:35 +05:30
CONTRIBUTING.md Add support for custom bitmaps and docs 2018-03-22 21:45:38 +05:30
LICENSE Initial commit with the API and files 2018-03-22 00:25:30 +05:30
project.clj Back to snapshot 2018-03-22 22:14:10 +05:30
README.md Fix examples 2018-03-24 14:56:22 +05:30

clj-wordcloud Clojars Project Build Status

A simple clojure wrapper around kumo to generate wordcloud

Leiningen

[xtreak/clj-wordcloud "0.0.1"]

Example

Given a map of element and the frequency the following image is generated. More examples/examples.clj.

Circle

(ns examples
  (:require [clj-wordcloud.core :refer :all]))

(def programming-languages ["Clojure" "Haskell" "Go" "Rust" "Scala" "Python" "Perl"
                            "Ruby" "Smalltalk" "PHP" "Java" "JavaScript"
                            "C" "C++" "Lisp" "Scheme" "Typescript" "D" "R" "Brainfuck" "Elixir"
                            "Erlang" "C#" "BASIC" "Logo" "Alice" "Dart" "Purescript" "Prolog"
                            "Ada" "F#" "Julia" "Kotlin" "Swift" "Delphi"])

(let [frequency-map (zipmap programming-languages (shuffle (range 300)))
      word-cloud    (word-cloud frequency-map
                                {:dimension  {:width  600
                                              :height 600}
                                 :background {:type  :circle
                                              :size  300
                                              :color "0x000000"}
                                 :font       {:type       "Calibre"
                                              :weight     :plain
                                              :scale-type :linear
                                              :x-scale    20
                                              :y-scale    20
                                              :padding    5}})]
  (write-to-file word-cloud "example_circle.png"))

Sample

Bitmaps

(ns examples
  (:require [clj-wordcloud.core :refer :all]))

(let [frequency-map (zipmap (range 100 150) (shuffle (range 300)))
      word-cloud    (word-cloud frequency-map
                                {:dimension  {:width  600
                                              :height 600}
                                 :background {:type   :pixel
                                              :size   300
                                              :color  "0x000000"
                                              :bitmap "examples/backgrounds/haskell_1.bmp"}
                                 :font       {:type       "Calibre"
                                              :weight     :plain
                                              :scale-type :linear
                                              :x-scale    20
                                              :y-scale    20
                                              :padding    5}})]
  (write-to-file word-cloud "example_haskell.png"))

Sample

TODO

  • API parity with Kumo
  • clojure.spec for docs and validation
  • Cool examples
  • Better tests

Contributing

Contributions are welcome. Please refer to CONTRIBUTING.md.

Stability

This library is still in early development phase and the API is subject to change. API design comments are welcome.

Thanks

Thanks to @kennycason for kumo without which this library is not possible

License

Copyright © 2018 Karthikeyan S

Distributed under the MIT License