From 8222fbe5ae75044efb615f4abb113ad6a74a6734 Mon Sep 17 00:00:00 2001 From: guoyongzhi Date: Mon, 28 Dec 2020 11:29:56 +0800 Subject: [PATCH] fix process arg type --- src/nlp.jl | 2 +- test/runtests.jl | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/nlp.jl b/src/nlp.jl index abe21c1..bd03c8d 100644 --- a/src/nlp.jl +++ b/src/nlp.jl @@ -30,7 +30,7 @@ end # counter # end -function process(counter::Dict{String,Number}; +function process(counter::Dict{String,<:Number}; stopwords=stopwords_en, minlength=2, maxlength=30, minfrequency=0, diff --git a/test/runtests.jl b/test/runtests.jl index 865e354..7e9d74d 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -13,6 +13,7 @@ include("test_lru.jl") end @testset "WordCloud.jl" begin + # @show pwd() img, img_m = WordCloud.rendertext("test", 88.3, color="blue", angle = 20, border=1, returnmask=true) words = [Random.randstring(rand(1:8)) for i in 1:rand(100:1000)] weights = randexp(length(words)) .* 1000 .+ randexp(length(words)) .* 200 .+ rand(20:100, length(words)); @@ -30,5 +31,11 @@ end wordcloud(process("giving a single word is ok. giving several words is ok too"), maskimg=shape(box, 20, 15, 0, color=0.15), filling_rate=0.5, transparentcolor=(1,1,1,0)) #String & small mask placement!(wc) + wc = wordcloud( + process(open("../res/alice.txt"), stopwords=WordCloud.stopwords_en ∪ ["said"]), + mask = loadmask("../res/alice_mask.png", color="#faeef8", backgroundcolor=0.97), + colors = (WordCloud.colorschemes[:Set1_5].colors..., ), + angles = (0, 90), + filling_rate = 0.55); end