得到"__init __()得到了意外的关键字参数'document'".python中的此错误,我正在使用Word2Vec和gensim [英] Getting "__init__() got an unexpected keyword argument 'document'" this error in python I'm working with Word2Vec and gensim

查看:88
本文介绍了得到"__init __()得到了意外的关键字参数'document'".python中的此错误,我正在使用Word2Vec和gensim的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Word2vec和gensim进行项目开发,

I'm working on project using Word2vec and gensim,

model = gensim.models.Word2Vec(
    documents = 'userDataFile.txt',
    size=150,
    window=10,
    min_count=2,
    workers=10)
model = gensim.model.Word2Vec.load("word2vec.model")
model.train(documents, total_examples=len(documents), epochs=10)
model.save("word2vec.model")

这是我目前拥有的零件代码,我在下面收到此错误

this is the part code that I have at the moment, and I'm getting this error below

Traceback (most recent call last):
File "C:\Users\User\Desktop\InstaSubProject\templates\HashtagData.py", line

37, in <module>
workers=10)
TypeError: __init__() got an unexpected keyword argument 'documents'

UserDataFile.txt 是我存储从网络抓取中获得的输出结果数据的文件.

UserDataFile.txt is the file that I stored output result data that I got from web scraping.

我不确定我需要在这里解决什么.

I'm not really sure what I need to fix here.

提前谢谢!

推荐答案

年份是2021年,如果出于同样的原因来到这里,那是因为在 size 参数.

The year is 2021 and if you're here for the same reason I am, it's because you're getting the same error on the size parameter.

您需要改用 vector_size .

这篇关于得到"__init __()得到了意外的关键字参数'document'".python中的此错误,我正在使用Word2Vec和gensim的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆