How to use word2vec with the documents

2 ビュー (過去 30 日間)
Saugata Bose
Saugata Bose 2019 年 9 月 18 日
回答済み: Christopher Creutzig 2020 年 3 月 9 日
Hi
I would like to use word2vec embedding with the documents. The examples I have seen so far have shown how to use word2vec embeddings with the words like this following:
A = word2vec(emb,Vocabulary)
But if I would like to use the word2vec embedding with the documents, is there any possible way to do this? And is it possible to use the output of the word2vec with the doc2sequence?
Because my ultimate goal is to converting a document to a format like this:
embeddingDimension-by-sequenceLength-by-1
Would you please enlighten me in this regard?

回答 (1 件)

Christopher Creutzig
Christopher Creutzig 2020 年 3 月 9 日
doc2sequence is actually the tool to use to run word2vec on a document, plus padding the output to a common length if desired – the latter is important for some deep learning applications. Check the second example in the doc2sequence documentation.
To get a single dim-by-length array, you will need to take the result and get the first (and only, for a single document input) cell:
c = doc2sequence(emb, document);
c{1}

カテゴリ

Help Center および File ExchangeAgriculture についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by