フィルターのクリア

fastText word embedding support package

1 回表示 (過去 30 日間)
Peter Mayhew
Peter Mayhew 2018 年 11 月 24 日
I'm using the Text Analytics Toolbox and the Pretrained fastText word embedding support package. Is it possible for me to add addional words to the pretrained vocabulary?

採用された回答

Peter Mayhew
Peter Mayhew 2018 年 11 月 28 日
To answer my own question, the following example code shows how to add words to the embedding vocabulary. This requires a new embedding object to be created.
>> emb = fastTextWordEmbedding;
>> vocab = emb.Vocabulary;
>> mat = word2vec(emb, vocab);
>> newvocab = [vocab "New Word 1" "New Word 2"];
>> newmat = [mat; randn(2,300)];
>> newemb = wordEmbedding(newvocab, newmat);
In addition, I have confirmed it is possible to use the fastText pretrained 2 Million words (600 billion tokens) rather than the default 1 Million words (16 billion token) which is provided with the MATLAB fastTextWordEmbedding function.
To do this, replace the "wiki-news-300d-1M.vec.zip" file with the alternative pre-trained word vectors file from https://fasttext.cc/docs/en/english-vectors.html
  1 件のコメント
Ismat Mohd Sulaiman
Ismat Mohd Sulaiman 2021 年 7 月 7 日
Thank you for this. I will try it out.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMigrate GUIDE Apps についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by