Main Content

doc2cell

文書から string ベクトルの cell 配列への変換

説明

C = doc2cell(documents) は、tokenizedDocument 配列を cell 配列に変換します。C のエントリは、各文書内の対応する単語が格納された string 配列になります。

すべて折りたたむ

tokenizedDocument 配列を string ベクトルの cell 配列に変換します。

documents = tokenizedDocument([ ...
    "an example of a short sentence" ...
    "a second short sentence"])
documents = 
  1x2 tokenizedDocument:

    6 tokens: an example of a short sentence
    4 tokens: a second short sentence

C = doc2cell(documents)
C=1×2 cell array
    {["an"    "example"    "of"    "a"    "short"    "sentence"]}    {["a"    "second"    "short"    "sentence"]}

cell 配列の最初の要素を表示します。

C{1}
ans = 1x6 string
    "an"    "example"    "of"    "a"    "short"    "sentence"

入力引数

すべて折りたたむ

入力文書。tokenizedDocument 配列として指定します。

出力引数

すべて折りたたむ

string ベクトルの cell 配列を出力します。C の各要素は、対応する文書の単語が格納された string ベクトルになります。

バージョン履歴

R2017b で導入