Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

个股相关词云展示有问题 #1

Open
shaoshoutianheyu opened this issue Feb 12, 2019 · 2 comments
Open

个股相关词云展示有问题 #1

shaoshoutianheyu opened this issue Feb 12, 2019 · 2 comments

Comments

@shaoshoutianheyu
Copy link

shaoshoutianheyu commented Feb 12, 2019

感谢大家,我发现词云展示有点问题,不知道什么原因?
是因为代码如下:
def wordcloudResult(request): return render(request,"wordcloudResult.html")

词云的数据需要单独计算出来吗?
@LinLidi 希望给予回复

@LinLidi
Copy link
Owner

LinLidi commented Feb 13, 2019

Hi,@shaoshoutianheyu ,感谢关注,词云的模型采用纯粹的word2vec进行模型预测,因此没有对数据进行持久化存储,且词云图在官方的echarts插件中已经被移除,需要通过pyecharts来做单独渲染,一个临时的解决办法,代码如下:

import gensim
from pyecharts import WordCloud
sentences = gensim.models.word2vec.LineSentence('segwords_m.txt')
model = gensim.models.Word2Vec(sentences, size=200)
model.save("segwords_m.model")
model = gensim.models.word2vec.Word2Vec.load("segwords_m.model")
word = model.most_similar('股票名称',topn=10)
name = []
value = []
for i in word:
name.append(i[0])
value.append(i[1])
wordcloud = WordCloud(width=1300, height=620)
wordcloud.add("", name, value, word_size_range=[20, 100])
wordcloud.render()

祝好

@haddiss
Copy link

haddiss commented Apr 24, 2019

为什么我运行起来超级卡呢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants