Skip to content

Commit

Permalink
basic NLP support
Browse files Browse the repository at this point in the history
  • Loading branch information
guoyongzhi committed Aug 25, 2020
1 parent ff6d046 commit af1649a
Show file tree
Hide file tree
Showing 13 changed files with 4,106 additions and 63 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "WordCloud"
uuid = "6385f0a0-cb03-45b6-9089-4e0acc74b26b"
authors = ["guoyongzhi <[email protected]>"]
version = "0.1.1"
version = "0.2.0"

[deps]
ColorSchemes = "35d6a980-a343-548e-a6ea-1d62b119f2f4"
Expand Down
29 changes: 22 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# WordCloud
wordcloud in Julia
---
![wordcloud](res/guxiang.png)

* [x] 排序 & 预放置
* [x] 基于四叉树碰撞检测
Expand All @@ -18,14 +17,25 @@ wordcloud in Julia
]add WordCloud
using WordCloud
texts = "天地玄黄宇宙洪荒日月盈昃辰宿列张寒来暑往秋收冬藏闰余成岁律吕调阳云腾致雨露结为霜金生丽水玉出昆冈剑号巨阙珠称夜光果珍李柰菜重芥姜海咸河淡鳞潜羽翔龙师火帝鸟官人皇始制文字乃服衣裳推位让国有虞陶唐吊民伐罪周发殷汤坐朝问道垂拱平章"
texts = [string(c) for c in texts];
weights = rand(length(texts)) .^ 2 .* 100 .+ 30;
wc = wordcloud(texts, weights, filling_rate=0.45)
texts = [string(c) for c in texts]
weights = rand(length(texts)) .^ 2 .* 100 .+ 30
wc = wordcloud(texts, weights)
generate(wc)
paint(wc, "wordcloud.png")
paint(wc, "qianziwen.png")
```
# More Complex Usage
```julia
wc = wordcloud(
process(open("res/alice.txt"), stopwords=WordCloud.stopwords_en ["said"]),
maskimg = loadmask("res/alice_mask.png", color="#faeef8"),
colors = (WordCloud.colorschemes[:Set1_5].colors..., ),
angles = (0, 90),
filling_rate = 0.6) |> generate
paint(wc, "alice.png")
```
![wordcloud](res/alice.png)

# 训练过程
# Visualization of Training
![training](res/training.gif)
***
linux添加中文字体
Expand All @@ -34,4 +44,9 @@ linux添加中文字体
配置ffmpeg环境
> add /mnt/lustre/share/ffmpeg-4.2.1/lib to ENV["LD_LIBRARY_PATH"]
> add /mnt/lustre/share/ffmpeg-4.2.1/bin to ENV["PATH"]
> add /mnt/lustre/share/ffmpeg-4.2.1/bin to ENV["PATH"]
***
# other wordcloud
> [word_cloud](https://github.com/amueller/word_cloud)
> [d3-cloud](https://github.com/jasondavies/d3-cloud)
> [wordcloud](https://github.com/timdream/wordcloud)
3,378 changes: 3,378 additions & 0 deletions res/alice.txt

Large diffs are not rendered by default.

358 changes: 358 additions & 0 deletions res/alice_license.txt

Large diffs are not rendered by default.

Binary file added res/alice_mask.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
192 changes: 192 additions & 0 deletions res/stopwords_en.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
a
about
above
after
again
against
all
also
am
an
and
any
are
aren't
as
at
be
because
been
before
being
below
between
both
but
by
can
can't
cannot
com
could
couldn't
did
didn't
do
does
doesn't
doing
don't
down
during
each
else
ever
few
for
from
further
get
had
hadn't
has
hasn't
have
haven't
having
he
he'd
he'll
he's
hence
her
here
here's
hers
herself
him
himself
his
how
how's
however
http
i
i'd
i'll
i'm
i've
if
in
into
is
isn't
it
it's
its
itself
just
k
let's
like
me
more
most
mustn't
my
myself
no
nor
not
of
off
on
once
only
or
other
otherwise
ought
our
ours
ourselves
out
over
own
r
same
shall
shan't
she
she'd
she'll
she's
should
shouldn't
since
so
some
such
than
that
that's
the
their
theirs
them
themselves
then
there
there's
therefore
these
they
they'd
they'll
they're
they've
this
those
through
to
too
under
until
up
very
was
wasn't
we
we'd
we'll
we're
we've
were
weren't
what
what's
when
when's
where
where's
which
while
who
who's
whom
why
why's
with
won't
would
wouldn't
www
you
you'd
you'll
you're
you've
your
yours
yourself
yourselves
7 changes: 4 additions & 3 deletions src/WordCloud.jl
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
module WordCloud
export wordcloud, shape, ellipse, box, paint, loadmaskimg
export record, parsecolor, train!, Momentum, placement!, generate, generate_animation,imageof,bitor拉人个人
export wordcloud, shape, ellipse, box, paint, loadmask
export record, parsecolor, train!, Momentum, placement!, generate, generate_animation, imageof, bitor, process
include("qtree.jl")
include("rendering.jl")
include("nlp.jl")
using .Render
using .QTree
using .NLP
include("train.jl")
include("interface.jl")
include("strategy.jl")
Expand Down
Loading

0 comments on commit af1649a

Please sign in to comment.