MATLAB ヘルプ センター
単語が文書のメンバーであるかどうかの確認
R2022b 以降
tf = containsWords(documents,words)
tf = containsWords(documents,words,IgnoreCase=flag)
tf = containsWords(documents,words) は、documents のいずれかのトークンが words と一致する場合は 1 を返し、そうでない場合は 0 を返します。
tf
documents
words
1
0
例
tf = containsWords(documents,words,IgnoreCase=flag) は、単語を確認する際に大文字と小文字を無視するかどうかも指定します。
flag
すべて折りたたむ
トークン化された文書の配列を作成します。
documents = tokenizedDocument([ "an example of a short sentence" "a second short sentence"]);
文書に "second" という単語が含まれているかどうかを確認します。
"second"
tf = containsWords(documents,"second")
tf = 2×1 logical array 0 1
tokenizedDocument
入力文書。tokenizedDocument 配列として指定します。
pattern
確認する単語。次のいずれかの値として指定します。
string 配列
文字ベクトル
文字ベクトルの cell 配列
pattern 配列
words に複数の単語が含まれる場合、この関数は、対応する文書にいずれかの単語が出現すると、1 を返します。
false
true
大文字小文字の区別を無視するオプション。次のいずれかの値として指定します。
0 (false) – 文字の大文字小文字のみが異なる一致候補を不一致として扱います。
1 (true) – 文字の大文字小文字のみが異なる一致候補を一致として扱います。
データ型: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | logical
single
double
int8
int16
int32
int64
uint8
uint16
uint32
uint64
logical
R2022b で導入
contains | containsNgrams | tokenizedDocument | removeWords | removeStopWords | normalizeWords | replaceWords | doclength | context | replace
contains
containsNgrams
removeWords
removeStopWords
normalizeWords
replaceWords
doclength
context
replace
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の MathWorks のサイトは、お客様の地域からのアクセスが最適化されていません。
南北アメリカ
ヨーロッパ
アジア太平洋地域
最寄りの営業オフィスへのお問い合わせ