Skip to content

Commit

Permalink
set random font by language
Browse files Browse the repository at this point in the history
  • Loading branch information
guo-yong-zhi committed Jul 4, 2024
1 parent 21831e2 commit c527f7a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 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.13.4"
version = "0.13.5"

[deps]
ColorSchemes = "35d6a980-a343-548e-a6ea-1d62b119f2f4"
Expand Down
2 changes: 1 addition & 1 deletion src/textprocessing.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module TextProcessing
export countwords, processtext, html2text, STOPWORDS, casemerge!, rescaleweights, settokenizer!, setlemmatizer!, setstopwords!
export countwords, processtext, html2text, STOPWORDS, casemerge!, rescaleweights, settokenizer!, setlemmatizer!, setstopwords!, detect_language

using StopWords
using LanguageIdentification
Expand Down
4 changes: 2 additions & 2 deletions src/wc-class.jl
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ wordcloud(wordsweights::Tuple; kargs...) = wordcloud(wordsweights...; kargs...)
wordcloud(counter::AbstractDict; kargs...) = wordcloud(keys(counter) |> collect, values(counter) |> collect; kargs...)
wordcloud(counter::AbstractVector{<:Union{Pair,Tuple,AbstractVector}}; kargs...) = wordcloud(first.(counter), [v[2] for v in counter]; kargs...)
function wordcloud(text; language=:auto, stopwords=:auto, stopwords_extra=nothing, maxnum=500, kargs...)
language = detect_language(text, language)
wordcloud(processtext(text, language=language, stopwords=stopwords, stopwords_extra=stopwords_extra, maxnum=maxnum); language=language, kargs...)
end
wordcloud(words, weight::Number; kargs...) = wordcloud(words, repeat([weight], length(words)); kargs...)
Expand Down Expand Up @@ -249,8 +250,7 @@ function getstylescheme(words, weights; colors=:auto, angles=:auto, mask=:auto,
Render.recolor!(mask, maskcolor) # tobitmap后有杂色 https://github.com/JuliaGraphics/Luxor.jl/issues/160
end
end
lang = language in DEFAULTSYMBOLS ? "" : language
fonts in DEFAULTSYMBOLS && (fonts = randomfonts(lang))
fonts in DEFAULTSYMBOLS && (fonts = randomfonts(detect_language(words, language)))
fonts = Iterators.take(iter_expand(fonts), length(words)) |> collect
colors, angles, mask, svgmask, fonts, transparent
end
Expand Down

2 comments on commit c527f7a

@guo-yong-zhi
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register()

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/110448

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.13.5 -m "<description of version>" c527f7a68ee8ea4cbc776d751ee77b17de78a03d
git push origin v0.13.5

Please sign in to comment.