({{, (RefLink[TextContents, paclet:ref/TextContents])[text] 
gives a dataset of information about entities, dates, quantities and other content-related elements found in text.}, {, (RefLink[TextContents, paclet:ref/TextContents])[text,form]
searches for cases of the type form.}, {, (RefLink[TextContents, paclet:ref/TextContents])[text,{(Subscript[form, 1]),(Subscript[form, 2]),…}]
searches for cases of types (Subscript[form, 1]), (Subscript[form, 2]), …}, {, (RefLink[TextContents, paclet:ref/TextContents])[text,forms,props]
includes the property props for each object in the dataset produced.}})

OpenersNotesSection(Spacer1)Details and Options

In (RefLink[TextContents, paclet:ref/TextContents])[text,…], text can be a string, a file with plain text represented by (RefLink[File, paclet:ref/File])[…], a (RefLink[ContentObject, paclet:ref/ContentObject]) expression or a list of these text objects.

(RefLink[TextContents, paclet:ref/TextContents])[{(Subscript[text, 1]),(Subscript[text, 2]),…},…] gives cases for each (Subscript[text, i]).

Identification type form can be:

Possible choices for the property prop include:

The following options can be given:

OpenersPrimaryExamplesSection(Spacer1)Examples  (4)

OpenersExampleSection0(Spacer1)Basic Examples  (1)

Find entities in a text:

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)"]

Only get the results for locations:

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"]

Only get the results for locations and quantities:

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"}]

Get interpretations for all cases:

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]

Get a specified set of properties for entities:

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"}]

OpenersExampleSection1(Spacer1)Options  (2)

OpenersExampleSubsection0(Spacer1)AcceptanceThreshold  (1)

By default, all the detected entities have an estimated probability higher than 0.5:

TextContents[ExampleData[{"Text","JFKInaugural"}]]

Get only the entities that are highly probable to be correct by setting a high (RefLink[AcceptanceThreshold, paclet:ref/AcceptanceThreshold]):

TextContents[ExampleData[{"Text","JFKInaugural"}],AcceptanceThreshold->0.9]

OpenersExampleSubsection1(Spacer1)VerifyInterpretation  (1)

By default, some entities cannot be interpreted, either because they are not correct or because they are not yet in the knowledgebase:

TextContents["We visited Toulouse and Foix in Midi-Pyrénées in France.",{"String","Interpretation"}]

Use (RefLink[VerifyInterpretation, paclet:ref/VerifyInterpretation]) to filter out the entities that cannot be interpreted:

TextContents["We visited Toulouse and Foix in Midi-Pyrénées in France.",{"String","Interpretation"},VerifyInterpretation->True]

OpenersExampleSection2(Spacer1)Properties & Relations  (1)

(RefLink[TextContents, paclet:ref/TextContents]) handles the same types as (RefLink[TextPosition, paclet:ref/TextPosition]) and (RefLink[TextCases, paclet:ref/TextCases]) and always identify the same substrings as these functions for a given type:

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"]

A dataset that is similar to the output of (RefLink[TextContents, paclet:ref/TextContents]) can be obtained using (RefLink[TextCases, paclet:ref/TextCases]):

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|>]]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[TextCases, paclet:ref/TextCases])  ▪  (RefLink[TextPosition, paclet:ref/TextPosition])  ▪  (RefLink[TextSearch, paclet:ref/TextSearch])  ▪  (RefLink[FindTextualAnswer, paclet:ref/FindTextualAnswer])  ▪  (RefLink[TextStructure, paclet:ref/TextStructure])  ▪  (RefLink[ImageContents, paclet:ref/ImageContents])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Text Analysis, paclet:guide/TextAnalysis])}, {▪(RefLinkPlain[Text Manipulation, paclet:guide/ProcessingTextualData])}, {▪(RefLinkPlain[Text Content Types, paclet:guide/TextContentTypes])}})}})