TextContents[text]
text 中に見付かった,実体,日付,数量,その他の,内容に関連した要素についての情報のデータ集合を与える.
TextContents[text,form]
タイプ form の例を検索する.
TextContents[text,{form1,form2,…}]
タイプ form1, form2, …の例を検索する.
TextContents[text,forms,props]
生成されたデータ集合内の各オブジェクトの特性 props を含む.
TextContents
テキストのコンテンツタイプのリスト »TextContents[text]
text 中に見付かった,実体,日付,数量,その他の,内容に関連した要素についての情報のデータ集合を与える.
TextContents[text,form]
タイプ form の例を検索する.
TextContents[text,{form1,form2,…}]
タイプ form1, form2, …の例を検索する.
TextContents[text,forms,props]
生成されたデータ集合内の各オブジェクトの特性 props を含む.
詳細とオプション
- TextContents[text,…]の text は,文字列,File[…]で表されるテキストファイル,ContentObject式,あるいはこれらのテキストオブジェクトのリストでよい.
- TextContents[{text1,text2,…},…]は,各 textiの例を与える.
- 識別タイプ form には以下がある.
-
"type" 任意のテキストのコンテンツタイプ(例:"Noun","City") Entity[…,…] テキストのコンテンツタイプの特定の実体 form1|form2|… 任意の formiにマッチするフォーム Containing[outer,inner] タイプ inner を含むタイプ outer のフォーム Verbatim["string"] 厳密にマッチされる特定の文字列 pattern マッチされる文字列パターン Automatic 実体,日付,数量,およびその他のコンテンツに関連した要素 - 次は,特性 props の可能な選択肢である.
-
"String" 識別されたテキスト文字列(デフォルト) "Position" text 中の文字列の始点と終点の位置 "Probability" 識別が正しいという推定の確率 "Type" コンテンツタイプ(実体タイプ等) "Interpretation" 識別された文字列の標準的な解釈 "Snippet" 識別された文字列前後のテキストの断片 "HighlightedSnippet" 識別された文字列がハイライトされた,テキストの断片 All 上記の全特性 {prop1,prop2,…} 特性指定のリスト - 次は,使用可能なオプションである.
-
AcceptanceThreshold Automatic 識別を許容する最低確率 TargetDevice "CPU" 実体検出にCPUまたはGPUの計算を使うべきかどうか VerifyInterpretation False 解釈可能性をチェックするべきかどうか
例題
すべて開く すべて閉じる例 (1)
TextContents["The flag of Italy is green, white and red. Since 1861, the capital is Rome, which also serves as the capital of the Lazio region. With 2,872,800 residents in 1,285 km2 (496.1 sq mi)"]TextContents["The flag of Italy is green, white and red. Since 1861, the capital is Rome, which also serves as the capital of the Lazio region. With 2,872,800 residents in 1,285 km2 (496.1 sq mi)", "Location"]TextContents["The flag of Italy is green, white and red. Since 1861, the capital is Rome, which also serves as the capital of the Lazio region. With 2,872,800 residents in 1,285 km2 (496.1 sq mi)", {"Location", "Quantity"}]TextContents["The flag of Italy is green, white and red. Since 1861, the capital is Rome, which also serves as the capital of the Lazio region. With 2,872,800 residents in 1,285 km2 (496.1 sq mi)", {"Location", "Quantity"}, All]TextContents["The flag of Italy is green, white and red. Since 1861, the capital is Rome, which also serves as the capital of the Lazio region. With 2,872,800 residents in 1,285 km2 (496.1 sq mi)", Automatic, {"HighlightedSnippet", "Interpretation"}]オプション (2)
AcceptanceThreshold (1)
デフォルトで,検出された実体の推定確率は,すべて0.5より上である:
TextContents[ExampleData[{"Text", "JFKInaugural"}]]AcceptanceThresholdを高くして,ほぼ確実に正しい実体だけを得る:
TextContents[ExampleData[{"Text", "JFKInaugural"}], AcceptanceThreshold -> 0.9]VerifyInterpretation (1)
デフォルトで,実体の中には,正しくないあるいはまだ知識ベースに収録されていないという理由で解釈できないものがある:
TextContents["We visited Toulouse and Auterive in Midi-Pyrénées in France.", Automatic, {"String", "Interpretation"}]VerifyInterpretationを使って解釈できない実体を除外する:
TextContents["We visited Toulouse and Auterive in Midi-Pyrénées in France.", Automatic, {"String", "Interpretation"}, VerifyInterpretation -> True]特性と関係 (1)
TextContentsはTextPositionやTextCasesと同じタイプを扱い,指定されたタイプについて,常にこれらの関数と同じ部分文字列を識別する:
TextContents["Boston, Worcester, and Springfield are the largest cities in Massachusetts.", "City"]TextCases["Boston, Worcester, and Springfield are the largest cities in Massachusetts.", "City"]TextPosition["Boston, Worcester, and Springfield are the largest cities in Massachusetts.", "City"]TextCasesを使ってTextContentsの出力に似たデータ集合を得ることができる:
Dataset@TextCases["Boston, Worcester, and Springfield are the largest cities in Massachusetts.", "City" -> Identity]Dataset@TextCases["Boston, Worcester, and Springfield are the largest cities in Massachusetts.", "City" -> Function[<|"City" -> Last[#Interpretation][[1]], "State" -> Last[#Interpretation][[2]], "Country" -> Last[#Interpretation][[3]], "Position" -> #Position, "HighlightedSnippet" -> #HighlightedSnippet|>]]おもしろい例題 (1)
月についての英語版のウィキペディアのページのテキストをロードする:
moon = WikipediaData["Moon"];Snippet[moon, 5]contents = TextContents[moon, VerifyInterpretation -> True]counts = ReverseSort@CountsBy[contents, #Type&]WordCloud[counts]Normal[Select[contents, #Type === "Person"&][[All, "String"]]]persons = Normal[Select[contents, #Type === "Person"&][[All, "Interpretation"]]]WordCloud[Counts[Flatten@EntityValue[persons, EntityProperty["Person", "Occupation"]]]]関連するガイド
-
▪
- テキスト解析 ▪
- テキストの操作 ▪
- 自然言語処理 ▪
- テキストコンテンツタイプ
テキスト
Wolfram Research (2019), TextContents, Wolfram言語関数, https://reference.wolfram.com/language/ref/TextContents.html.
CMS
Wolfram Language. 2019. "TextContents." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/TextContents.html.
APA
Wolfram Language. (2019). TextContents. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/TextContents.html
BibTeX
@misc{reference.wolfram_2026_textcontents, author="Wolfram Research", title="{TextContents}", year="2019", howpublished="\url{https://reference.wolfram.com/language/ref/TextContents.html}", note=[Accessed: 03-November-2026]}
BibLaTeX
@online{reference.wolfram_2026_textcontents, organization={Wolfram Research}, title={TextContents}, year={2019}, url={https://reference.wolfram.com/language/ref/TextContents.html}, note=[Accessed: 03-November-2026]}