The creation background
It has always been a personal dream to generate a cool cloud image at any time.
Long long ago, wrote a simple version: houbb. Making. IO/tools/wordC…
The effect is as follows:
But there are a few small problems:
-
Unable to split words automatically
-
Font size cannot be set based on word frequency
So I walked around Github and found Kumo, an open source tool. Getting started found that it takes more than 10 lines of code to implement a basic cloud map.
This was not very elegant, so it was decided to implement a more easy-to-use version based on Kumo.
word-cloud
Word-cloud is a cloud generation tool designed for Java.
features
-
Minimal API, one line of code does everything
-
Supports custom cloud background
-
Supports Chinese and English word segmentation, transparent to users by default
-
Support pause word filtering, transparent to users by default
-
Supports various user – defined configurations
Change log
Quick start
Maven is introduced into
<dependency>
<groupId>com.github.houbb</groupId>
<artifactId>word-cloud</artifactId>
<version>1.2.2</version>
</dependency>
Copy the code
use
WordCloudHelper.wordCloud("It tells the story of an old, abandoned kingdom called the Holy Nest buried beneath a decaying town called Detmouth. This kingdom was destroyed by the plague and abandoned because of the ancient god of light named Spoke Light, who could spread the plague through her mind. The insects that were destroyed by the plague would be dominated by instinct and lose their mind. \n" +
"The master of this realm, the Pale King, did not sit idly by. He created the container race in the abyss below the nest, exploiting the ability of another ancient power, the Void, to suppress light. One of the chosen vessels was used to seal the plague and was named the Empty Knight. In order to secure the seal, the White King looked for three dream keepers to further consolidate the seal, three dream keepers named as the Watchman - Lulin, mentor - Monomon, the beast - Hera. But then the Pale King disappeared, and the power of the imperfect vessel became weaker and weaker, eventually controlled by the radiant light. The protagonist will travel through the rest of the nest, and in the resting place, with the help of the believers and relatives of the spoke light, the only remaining moths, we have acquired the dream weapon of the spoke light's power, the Dream nail. The dream spike reads the mind of a creature and can break the keeper's protection, entering his dream and killing the keeper. After killing the three dreamkeepers and breaking the seal, the alternative ending is to go to the Temple of the Black Egg in the Crossroads and defeat the Hollow Knight or go to the Godhouse, a new location added in the God Seeker update, and challenge the Pantheon of the Nest.);
Copy the code
Effect:
Support background
With a whale in the background, we can make the text appear in the form of images:
String imagePath = "backgrounds\\whale_small.png";
WordCloudHelper.wordCloud(text, "out_bg.png", imagePath);
Copy the code
The effect is as follows:
Road-Map
-
Default shapes for images.
-
Introducing image background
-
Font optimization by default
-
The image center
Open source
I wrote the gadget for my own amusement, but I felt like I should open source the app.
Because kumo is not open source, there is no such tool.
Open source: github.com/houbb/word-…
If you like, you might as well give a star to encourage the author.
I hope to witness the growth of the most useful cloud mapping tool with you.