TextStructure

TextStructure["text"]

generates a nested collection of TextElement objects representing the grammatical structure of natural language text.

TextStructure["text",form]

generates a representation of the type specified by form of the grammatical structure of text.

Details and Options

  • TextStructure[{text1,text2,},] yields a list with the respective results for texti.
  • Possible types of text structure include:
  • "ConstituentTree"nested text elements of phrase structure
    "ConstituentGraphs"graph of phrase structure
    "ConstituentStrings"string representing phrase structure
    "PartsOfSpeech"text elements tagging parts of speech
    "DependencyGraphs"graph of grammatical dependencies
    "DependencyStrings"string representing grammatical dependencies
  • The following option can be given:
  • PerformanceGoalAutomaticfavor algorithms with specific advantages

Examples

open allclose all

Basic Examples  (2)

Display the grammatical structure of a sentence:

Display parts of speech tags:

Scope  (6)

Display the constituent tree of a sentence:

Return the constituent tree as a graph:

Return the constituent tree as a string of nested parentheses:

Return the grammatical dependencies as a graph:

Display the dependency tree as a string of nested brackets:

Display the grammatical structure of several sentences at once:

Options  (1)

PerformanceGoal  (1)

Faster parts of speech tagging can be achieved by using PerformanceGoal->"Speed":

Applications  (1)

Get the text content of a Wikipedia page using WikipediaData:

Extract the first paragraph using TextCases:

Use TextStructure to visualize the grammatical structure of this paragraph:

Wolfram Research (2015), TextStructure, Wolfram Language function, https://reference.wolfram.com/language/ref/TextStructure.html (updated 2019).

Text

Wolfram Research (2015), TextStructure, Wolfram Language function, https://reference.wolfram.com/language/ref/TextStructure.html (updated 2019).

BibTeX

@misc{reference.wolfram_2021_textstructure, author="Wolfram Research", title="{TextStructure}", year="2019", howpublished="\url{https://reference.wolfram.com/language/ref/TextStructure.html}", note=[Accessed: 05-August-2021 ]}

BibLaTeX

@online{reference.wolfram_2021_textstructure, organization={Wolfram Research}, title={TextStructure}, year={2019}, url={https://reference.wolfram.com/language/ref/TextStructure.html}, note=[Accessed: 05-August-2021 ]}

CMS

Wolfram Language. 2015. "TextStructure." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2019. https://reference.wolfram.com/language/ref/TextStructure.html.

APA

Wolfram Language. (2015). TextStructure. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/TextStructure.html