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 scraping.
I'm not really sure what I need to fix here.
Thank you in advance !
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.
You need to use vector_size
instead.
Use vector_size instead of sizestrong text
# creating a word to vector model
model_w2v = gensim.models.Word2Vec(
tokenize_data,
vector_size=200)
__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)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With