我找到了一个在大型维基百科数据集上使用 word2vec 的教程
http://danielfrg.github.io/blog/2013/09/21/word2vec-yhat/
我想构建一个类似于 Daniel 在他的教程中演示的 yhat rest API。
今天我整理了一些我想分析的西类牙报纸文章。我检索数据的网站非常定期地格式化其文章,因此我将 1000 篇文章存储为字符串,例如
"Otros se dan a conocer por la simpleza, como Sonya Cortés,
quien expresó que atesora compartir en familia y gozar de salud.
En el ambiente del reggaeton, Khriz, del dúo Ángel & Khriz,
aprovechará para estrenar su nueva piscina ya que por su agenda
de trabajo no ha podido darse un chapuzón todavía. Mientras,
Daddy Yankee se tomará un descanso con la familia luego de una larga gira."
我对 Python 很满意,并希望使用教程中列出的 python 包装器: https://github.com/danielfrg/word2vec
如何将我的语料库加载到 word2vec 中?现在我有一个字符串数组。
目前我的语料库适合内存。 word2vec 仍然是正确的工具吗?
最佳答案
如果通过
Right now I have an array of strings
你的意思是它已经被标记化了。
sentences = gensim.models.word2vec.LineSentence(path_to_corpus)
model = gensim.models.Word2Vec(sentences, min_count=10, size=500, window=10, sg=1, workers=4)
句子必须是字符串列表,即:
[ ['this', 'is' , 'my', 'first', 'sentence'], ['this', 'is', 'the', 'second']]
关于python - 自然语言处理 : text corpus format for word2vec,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20276264/