TextSummarize

This functionality requires an external account »

TextSummarize[text]

generates a summary of text.

TextSummarize[text, spec]

summarizes the text according to the specification spec.

TextSummarize[texttopic,spec]

summarizes the part of text matching topic.

Details and Options

  • TextSummarize is used to condense textual information.
  • TextSummarize requires external service authentication, billing and internet connectivity.
  • Long strings are first split into smaller chunks, summarized independently (AKA mapped) and then combined (AKA reduced).
  • Possible values for text are:
  • "string"a plain string
    File["path"]individual file
    URL["url"]the text representation of "url"
    CloudObject[]a cloud object
    LocalObject[]a local object
    SemanticSearchIndex[]semantically indexed text
    {obj1,obj2,}list of objects
  • The topic specification is a free-form string. It can be used to select specific portions of text.
  • Generating a summary from a SemanticSearchIndex[] requires a topic specification.
  • Possible values for spec are:
  • "BulletPoints"summary of text presented as concise, key points
    {"BulletPoints",n}summary of text in n key points
    "Description"paraphrased text in condensed form (default)
    "Extracts"key sentences from text
    "Keywords"keywords from text in order of importance
    "KeywordSummary"keywords from text in order of appearance
    "OneLineSummary"extremely condensed abstract
    "Rewrite"short version of text with the same style
    "Title"possible title for text
    "Topics"main topics in text
  • Additionally, custom values for spec can be specified using:
  • promptcustom specification description
    {promptmap,promptreduce}separate prompts for the map and reduce parts
  • The prompti support the following values:
  • LLMPrompt["name"]repository prompt
    StringTemplate[]templated text
    TemplateObject[]template for creating text
  • TextSummarize supports the following options:
  • InsertionFunctionAutomaticfunction or format to apply before inserting expressions
    CombinerFunctionStringJoinfunction to apply to combine pieces within a prompt
    AuthenticationAutomaticexplicit user ID and API key
    LLMEvaluator$LLMEvaluatorLLM configuration to use
    Method Automaticmethod details
  • The default InsertionFunction is TextString on a single chunk and StringRiffle[#, "\n\n"]& on a list of chunks.
  • Detailed options can be given using Method<|opt1val1|>. Possible values for opti are:
  • "ContextWindow"maximal length of the text chunks
    "ContextPadding"minimal overlap between chunks
    "SplitPattern"Automaticwhere to split long strings
  • The automatic "SplitPattern" tries to split text in paragraphs, newlines and words to create chunks smaller than "ContextWindow".
  • TextSummarize uses machine learning. Its methods, training sets and biases included therein may change and yield varied results in different versions of the Wolfram Language.

Examples

open allclose all

Basic Examples  (2)

Summarize the contents of a file:

Find the main keywords describing a piece of text:

Scope  (14)

Input Types  (5)

Summarize a string:

Summarize a file:

Summarize a URL:

Summarize a list of objects:

Summarize results from a semantic :

Summary Specification  (8)

Provide a succinct description of the text content:

Rewrite the text in a condensed form:

Invent a title for the provided text:

Summarize the text in a single sentence:

Find the main keywords to describe the text content:

Find the main keywords in the order they appear in the text:

Summarize the specified text by extracting the key sentences:

Summarize the specified text using a bullet point list:

Specify the length of the list:

Topic Specification  (1)

Summarize the whole text:

Summarize only the part of the text matching a topic:

Options  (1)

Method  (1)

Long string with no newlines will be automatically split at whitespaces:

Define a custom split pattern to divide the chapters:

Compute the summary using the new text chunks:

Possible Issues  (1)

Summarizing from a SemanticSearchIndex only works when a topic is specified:

Wolfram Research (2024), TextSummarize, Wolfram Language function, https://reference.wolfram.com/language/ref/TextSummarize.html (updated 2024).

Text

Wolfram Research (2024), TextSummarize, Wolfram Language function, https://reference.wolfram.com/language/ref/TextSummarize.html (updated 2024).

CMS

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

APA

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

BibTeX

@misc{reference.wolfram_2024_textsummarize, author="Wolfram Research", title="{TextSummarize}", year="2024", howpublished="\url{https://reference.wolfram.com/language/ref/TextSummarize.html}", note=[Accessed: 22-November-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_textsummarize, organization={Wolfram Research}, title={TextSummarize}, year={2024}, url={https://reference.wolfram.com/language/ref/TextSummarize.html}, note=[Accessed: 22-November-2024 ]}