得到"__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
.