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 is the file that I stored output result data that I got from web scrapping.
I'm not really sure what I need to fix here.
Thank you in advance !
__init__() is the class constructor for Word2Vec, it is possible that when you instantiated the class with
gensim.models.Word2Vec(), that the parameter
documents is not actually necessary
try this instead:
model = gensim.models.Word2Vec( size=150, window=10, min_count=2, workers=10)
Looks like that model doesn't take the keyword parameter
documents on initialization. I think you could try either of these in replacement of your
corpus_file = 'userDataFile.txt'
sentences = # your iterable of sentences here
Depending on the format of what you're working with