All Projects → psykhi → wordclouds

psykhi / wordclouds

Licence: Apache-2.0 license
Wordclouds in go

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to wordclouds

National-Petition
청와대 국민청원 분석으로 국민의 생각 알아보기 📈🔬
Stars: ✭ 45 (+9.76%)
Mutual labels:  wordcloud
wordcloud
golang wordcloud
Stars: ✭ 50 (+21.95%)
Mutual labels:  wordcloud
videocloud
Generate word clouds from YouTube videos
Stars: ✭ 14 (-65.85%)
Mutual labels:  wordcloud
WordCloudSharp
☁️ Ported from http://wordcloud.codeplex.com/
Stars: ✭ 49 (+19.51%)
Mutual labels:  wordcloud
asreview-wordcloud
ASReview extension to generate wordcloud from data files.
Stars: ✭ 14 (-65.85%)
Mutual labels:  wordcloud
Wordcloud2.js
Tag cloud/Wordle presentation on 2D canvas or HTML
Stars: ✭ 1,905 (+4546.34%)
Mutual labels:  wordcloud
D3 Cloud
Create word clouds in JavaScript.
Stars: ✭ 3,460 (+8339.02%)
Mutual labels:  wordcloud
WordCloud.jl
word cloud generator in julia
Stars: ✭ 66 (+60.98%)
Mutual labels:  wordcloud
chartjs-chart-wordcloud
Chart.js Word Clouds
Stars: ✭ 34 (-17.07%)
Mutual labels:  wordcloud
FacebookGraphAPI-Examples
Examples for facebook graph api for python
Stars: ✭ 38 (-7.32%)
Mutual labels:  wordcloud
Xiecheng Comment
🌈Xiecheng_Comment多线程Threading爬取携程的丽江古城景点评论并生成词云
Stars: ✭ 23 (-43.9%)
Mutual labels:  wordcloud
JessicaLim8
Profile ReadME! Join my community word cloud!
Stars: ✭ 81 (+97.56%)
Mutual labels:  wordcloud
soan
Social Analysis based on Whatsapp data
Stars: ✭ 106 (+158.54%)
Mutual labels:  wordcloud

Wordclouds in go.

alt text

How to use

wordCounts := map[string]int{"important":42, "noteworthy":30, "meh":3}

w := wordclouds.NewWordcloud(
	wordCounts,
	wordclouds.FontFile("fonts/myfont.ttf"),
	wordclouds.Height(2048),
	wordclouds.Width(2048),
)

img := w.Draw()

Options

  • Output height and width
  • Font: Must be a valid TTF file.
  • Font max,min size
  • Colors
  • Background color
  • Placement : random or circular
  • Masking

Masking

A list of bounding boxes where the algorithm can not place words can be provided.

The Mask function can be used to create such a mask given a file and a masking color.

boxes := wordclouds.Mask(
	conf.Mask.File,
	conf.Width,
	conf.Height,
	conf.Mask.Color,
)

See the example folder for a fully working implementation.

Speed

Most wordclouds should take a few seconds to be generated. A spatial hashmap is used to find potential collisions.

There are two possible placement algorithm choices:

  1. Random: the algorithms randomly tries to place the word anywhere in the image space.
    • If it can't find a spot after 500000 tries, it gives up and moves on to the next word. It's quite slow.
  2. Spiral: the algorithm starts to place the words on concentric circles starting at the center of the image. It is very fast and is the default algorithm

Contributing

Feel free to create pull requests, I'll gladly review them!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].