Python 混合单元双随机字2矢量嵌入
我正在尝试使用Python的gensim的word2vec实现为语料库构建嵌入。我希望在同一个地方嵌入语料库中的所有单字和双字。Python 混合单元双随机字2矢量嵌入,python,text-mining,gensim,word2vec,Python,Text Mining,Gensim,Word2vec,我正在尝试使用Python的gensim的word2vec实现为语料库构建嵌入。我希望在同一个地方嵌入语料库中的所有单字和双字。 有没有一种方法可以将Unigram和Bigram嵌入到同一个空间中?您可以使用gensim中的短语模型进行嵌入 from gensim.models.phrases import Phrases, Phraser #documents is list is list of tokens from your text bigram = Phrases(documen
有没有一种方法可以将Unigram和Bigram嵌入到同一个空间中?您可以使用gensim中的短语模型进行嵌入
from gensim.models.phrases import Phrases, Phraser
#documents is list is list of tokens from your text
bigram = Phrases(documents, min_count=2)
trigram = Phrases(bigram[documents], min_count=1)