Check if word is member of documents
Check if Word Is Member of Document
Create an array of tokenized documents.
documents = tokenizedDocument([ "an example of a short sentence" "a second short sentence"]);
Check for documents containing the word
tf = containsWords(documents,"second")
tf = 2x1 logical array 0 1
documents — Input documents
Input documents, specified as a
words — Words to check
string array | character vector | cell array of character vectors |
Words to check, specified as one of these values:
Cell array of character vectors
words contains multiple words, then the function returns
1 where any of the words appear in the corresponding
flag — Option to ignore case
false) (default) |
Option to ignore case, specified as one of these values:
false) – Treat candidate matches that differ only by letter case as nonmatching.
true) – Treat candidate matches that differ only by letter case as matching.
Introduced in R2022b