gensim word2vec를 사용하려고합니다. 갈색 코퍼스에 기반한 모델을 훈련 할 수 없습니다. 여기 내 코드가있다.브라운 코퍼스에서 gensim을 어떻게 훈련해야합니까?
from gensim import models
model = models.Word2Vec([sentence for sentence in models.word2vec.BrownCorpus("E:\\nltk_data\\")],workers=4)
model.save("E:\\data.bin")
nltk.download()
을 사용하여 nltk_data를 다운로드했습니다. 아래 오류가 나타납니다.
C:\Python27\lib\site-packages\gensim-0.10.1-py2.7.egg\gensim\models\word2vec.py:401: UserWarning: Cython compilation failed, training will be slow. Do you have Cython installed? `pip install cython`
warnings.warn("Cython compilation failed, training will be slow. Do you have Cython installed? `pip install cython`")
Traceback (most recent call last):
File "E:\eclipse_workspace\Python_files\Test\Test.py", line 8, in <module>
model = models.Word2Vec([sentence for sentence in models.word2vec.BrownCorpus("E:\\nltk_data\\")],workers=4)
File "C:\Python27\lib\site-packages\gensim-0.10.1-py2.7.egg\gensim\models\word2vec.py", line 276, in __init__
self.train(sentences)
File "C:\Python27\lib\site-packages\gensim-0.10.1-py2.7.egg\gensim\models\word2vec.py", line 407, in train
raise RuntimeError("you must first build vocabulary before training the model")
RuntimeError: you must first build vocabulary before training the model
내가 뭘 잘못하고 있니?