word2vec_训练模型

from gensim.models import Word2Vec
from gensim.models.word2vec import LineSentence # 原始的训练语料转化成一个sentence的迭代器,每一次迭代返回的sentence是一个word(utf8格式)的列表
def vctor_word():
# wiki_news = open('wiki.zh.jian.seg.txt', 'r',encoding='utf-8')
wiki_news = open('weibo_content.txt', 'r', encoding='utf-8')
sentences=LineSentence(wiki_news)
model=Word2Vec(sentences,sg=0,size=100,window=5,min_count=5,workers=9)
model.save('zhiwiki_news.word2vec')
vctor_word()
上一篇:Redis可视化工具Redis Desktop Manager使用


下一篇:hdu 4968 最大最小gpa