Hi, I’m very happy to announce my first julia package WordCloud.jl here. Word cloud (tag cloud or wordle) is a novelty visual representation of text data. The importance of each word is shown with font size or color. WordCloud.jl has the following highlights:
Flexible Any mask, any color, any angle, adjustable filling rate. You can specify the initial position of some words. Or you can pin some words and adjust others, etc.
Fast 100% in Julia and efficient implementation based on Quadtree & gradient optimization. The advantage is more obvious when generating large images.
Exact Words with the same weight have the exact same size. The algorithm will never scale the word to fit the blank.
wc = wordcloud(
process(open(pkgdir(WordCloud)*"/res/alice.txt"), stopwords=WordCloud.stopwords_en ∪ ["said"]),
mask = loadmask(pkgdir(WordCloud)*"/res/alice_mask.png", color="#faeef8"),
colors = :Set1_5,
angles = (0, 90),
fillingrate = 0.7) |> generate!
paint(wc, "alice.png", ratio=0.5, background=outline(wc.mask, color="purple", linewidth=1))
You can install WordCloud.jl with command
import Pkg; Pkg.add("WordCloud"), and see
runexample for more examples.
I am looking forward to your valuable suggestions. Thank you.
Aha, I can reply to bypass the limit of one image.
Is there a way to export SVGs, ideally with clickable links?
Not yet, but relevant information can be obtained through
Haha what a nice coincidence! I was just looking for a tool to make a word cloud for a presentation I will give in two weeks, and this is a nice timely surprise!
Ha ha, I hope it can help you
SVG exporting is supported at v0.4.0 You just need to
paint(wc, "filename.svg") or
paintsvg(wc). While, this feature depends on Luxor v2.8.0 which may be released after Julia 1.6. Therefore, it’s not currently available via Pkg’s update.
I’m looking forward to it. Thank you for your great work.
Very good stuff. Would it be possible for someone to generate a word cloud for the Julia discourse repository?
.html files as inputs. Running
showexample(:juliadoc) in v0.4.0 can show the way to generate word cloud from julia’s html docs. Moreover,
showexample(:fromweb) shows a example that generates a word cloud from online web page.
Awesome Julia! I think this generator is more powerful than many other popular generators in other language ecosystems. Isn’t it?
I have been using it and the functionality is great, wish there were some docs for it though as it appears there are quite a few options to choose from.
@guoyongzhi Thanks for the library, been using it and it is great! For the example in GitHub - guo-yong-zhi/WordCloud-Gallery: A Gallery of WordCloud I get an error ```UndefVarError: randommaskcolor not defined
I updated the gallery before the releasing of the new version of the WordCloud.jl itself, which led to some inconsistencies. I apologize for that. It should work fine now with the WordCloud.jl v0.7.0. Please update it.
As for the documentation, it’s a bit hard for a non-native English speaker like me. I am help wanted.
p.s. There used to be an auto-generated docstrings in the Julia Hub, but it gone later, leaving only Readme. I don’t know why.
I tried the online generator in the repo’s README, but got a mystic pattern like bellow. How should I use it correctly?
I don’t know why
Pango choose that odd font when the random set font is unavailable. You can set a proper font in the
fonts textbox or just set it to empty.