guo-yong-zhi / WordCloud.jl

word cloud generator in julia
GNU General Public License v3.0
109 stars 2 forks source link

how to NOT mutate word array after wordcloud(word, weights)? #4

Closed jquetzalcoatl closed 3 years ago

jquetzalcoatl commented 3 years ago

Is there a flag in wordcloud() to NOT rearrange the word array after its usage?

I have words = ["John", "Peter", "James"] with weights = [1,6,3]

After

wordcloud(words, weights)

words = ["Peter", "James", "John"]

is there a way to leave as it was before running wordcloud?

guo-yong-zhi commented 3 years ago

Would you tell me why you need this feature? Generally speaking, you can get almost everything with the word itself. E.g. getpositions(wc, "Peter")

-------- 原始信息 -------- 发件人: Jaque Tolma @.> 日期: 2021/6/26 上午5:27 (GMT+08:00) 收件人: "guo-yong-zhi/WordCloud.jl" @.> 抄送: Subscribed @.***> 主题: [guo-yong-zhi/WordCloud.jl] how to NOT mutate word array after wordcloud(word, weights)? (#4)

Is there a flag in wordcloud() to NOT rearrange the word array after its usage?

I have words = ["John", "Peter", "James"] with weights = [1,6,3]

After

wordcloud(words, weights)

words = ["Peter", "James", "John"]

is there a way to leave as it was before running wordcloud?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/guo-yong-zhi/WordCloud.jl/issues/4, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ANKI2F6X2VB666PGDIPQO4LTUTYDZANCNFSM47KS65JA.

guo-yong-zhi commented 3 years ago

Sorry, I have misstaken your point. To keep the input array unchanged, you can: wouldcloud(copy(words), copy(weights))

The reason why it's mutative by default is that the array words is auto generated by processtext in many cases, so it's unnecessary to keep it unchanged. Maybe a better balance between efficiency and stability can be achieved.

-------- 原始信息 -------- 发件人: Jaque Tolma @.> 日期: 2021/6/26 上午5:27 (GMT+08:00) 收件人: "guo-yong-zhi/WordCloud.jl" @.> 抄送: Subscribed @.***> 主题: [guo-yong-zhi/WordCloud.jl] how to NOT mutate word array after wordcloud(word, weights)? (#4)

Is there a flag in wordcloud() to NOT rearrange the word array after its usage?

I have words = ["John", "Peter", "James"] with weights = [1,6,3]

After

wordcloud(words, weights)

words = ["Peter", "James", "John"]

is there a way to leave as it was before running wordcloud?

― You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/guo-yong-zhi/WordCloud.jl/issues/4, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ANKI2F6X2VB666PGDIPQO4LTUTYDZANCNFSM47KS65JA.

guo-yong-zhi commented 3 years ago

Fixed in 1d92330452fd846bdeddeb4183193a1b75237847

guo-yong-zhi commented 3 years ago

fixed after v0.7.0