Main Content

ismember

(Removed) Test if word is member of word embedding

ismember has been removed. Use isVocabularyWord instead. For more information, see Compatibility Considerations.

Description

example

tf = ismember(emb,words) returns an array containing logical 1 (true) where the word in words is a member of the word embedding emb. Elsewhere, the array contains logical 0 (false).

Examples

collapse all

Test to determine if words are members of a word embedding.

Load a pretrained word embedding using fastTextWordEmbedding. This function requires Text Analytics Toolbox™ Model for fastText English 16 Billion Token Word Embedding support package. If this support package is not installed, then the function provides a download link.

emb = fastTextWordEmbedding
emb = 

  wordEmbedding with properties:

     Dimension: 300
    Vocabulary: [1×1000000 string]

Test if the words "I", "love", and "fastTextWordEmbedding" are in the word embedding.

words = ["I" "love" "fastTextWordEmbedding"];
tf = ismember(emb,words)
tf =

  1×3 logical array

   1   1   0

Input Arguments

collapse all

Input word embedding, specified as a wordEmbedding object.

Input words, specified as a string vector, character vector, or cell array of character vectors. If you specify words as a character vector, then the function treats the argument as a single word.

Data Types: string | char | cell

Version History

Introduced in R2017b

collapse all

R2023b: ismember has been removed

To update your code, for wordEmbedding object input, change the function name from ismember to isVocabularyWord. You do not need to change the arguments. The syntaxes are equivalent.