Skip to content

Commit 939e8e9

Browse files
author
guoyongzhi
committed
add Chinese stopwords and a Chinese example
1 parent 2c93aaa commit 939e8e9

6 files changed

Lines changed: 1768 additions & 8 deletions

File tree

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "WordCloud"
22
uuid = "6385f0a0-cb03-45b6-9089-4e0acc74b26b"
33
authors = ["guoyongzhi <momoshanghan@163.com>"]
4-
version = "0.4.0"
4+
version = "0.4.1"
55

66
[deps]
77
ColorSchemes = "35d6a980-a343-548e-a6ea-1d62b119f2f4"

examples/中文.jl

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# 中文需要分词,须先配置python环境和安装结巴分词
2+
# ENV["PYTHON"] = ""
3+
# using Pkg
4+
# Pkg.build("PyCall") #build PyCall
5+
6+
# using Conda
7+
# Conda.pip_interop(true)
8+
# Conda.pip("install","jieba") #安装python包:结巴分词
9+
10+
using WordCloud
11+
using PyCall
12+
13+
@pyimport jieba
14+
15+
TheInternationale = "起来,饥寒交迫的奴隶!\n起来,全世界受苦的人!\n满腔的热血已经沸腾,\n要为真理而斗争!\n旧世界打个落花流水,\n奴隶们起来,起来!\n不要说我们一无所有,\n我们要做天下的主人!\n\n这是最后的斗争,\n团结起来到明天,\n英特纳雄耐尔\n就一定要实现!\n这是最后的斗争,\n团结起来到明天,\n英特纳雄耐尔\n就一定要实现!\n\n从来就没有什么救世主,\n也不靠神仙皇帝!\n要创造人类的幸福,\n全靠我们自己!\n我们要夺回劳动果实,\n让思想冲破牢笼!\n快把那炉火烧得通红,\n趁热打铁才能成功!\n\n是谁创造了人类世界?\n是我们劳动群众!\n一切归劳动者所有,\n哪能容得寄生虫?!\n最可恨那些毒蛇猛兽,\n吃尽了我们的血肉!\n一旦把它们消灭干净,\n鲜红的太阳照遍全球!\n"
16+
17+
wc = wordcloud(
18+
processtext(jieba.lcut(TheInternationale)),
19+
colors = "#DE2910",
20+
mask = WordCloud.randommask("#FFDE00", 400),
21+
fillingrate=0.8)|>generate!
22+
println("结果保存在 中文.svg")
23+
paint(wc, "中文.svg")
24+
wc

0 commit comments

Comments
 (0)