Read word embedding from file
reads the pretrained word embedding stored in text file or zip file
emb = readWordEmbedding(
filename. The input file must be a text file with UTF-8
encoding in either the word2vec or GloVe text embedding format, or a zip file
containing a text file of this format.
If the word embedding file contains duplicate words, then the software uses the word vector corresponding to the last duplicate entry.
Read Word Embedding from Text File
Read the example word embedding. This model was derived by analyzing text from Wikipedia.
filename = "exampleWordEmbedding.vec"; emb = readWordEmbedding(filename)
emb = wordEmbedding with properties: Dimension: 50 Vocabulary: ["utc" "first" "new" "two" "time" ... ]
Explore the word embedding using
king = word2vec(emb,"king"); man = word2vec(emb,"man"); woman = word2vec(emb,"woman"); word = vec2word(emb,king - man + woman)
word = "queen"
filename — Name of file
string scalar | character vector
Name of the file, specified as a string scalar or character vector.