Nasty.Language.English.Summarizer (Nasty v0.3.0)

View Source

Extractive text summarization for English.

This module provides English-specific configuration for the generic extractive summarization algorithm. It implements the callbacks required by Nasty.Operations.Summarization.Extractive and delegates the actual summarization logic to that generic module.

Examples

iex> document = parse("The cat sat on the mat. The dog ran in the park. ...")
iex> summary = Summarizer.summarize(document, ratio: 0.3)
[%Sentence{}, ...]

iex> summary = Summarizer.summarize(document, max_sentences: 3, method: :mmr)
[%Sentence{}, ...]

Summary

Functions

Summarizes a document by extracting important sentences.

Functions

summarize(document, opts \\ [])

@spec summarize(
  Nasty.AST.Document.t(),
  keyword()
) :: [Nasty.AST.Sentence.t()]

Summarizes a document by extracting important sentences.

Options

  • :ratio - Compression ratio (0.0 to 1.0), default 0.3
  • :max_sentences - Maximum number of sentences in summary
  • :min_sentence_length - Minimum sentence length (in tokens)
  • :method - Selection method: :greedy or :mmr (default: :greedy)
  • :mmr_lambda - MMR diversity parameter, 0-1 (default: 0.5)

Returns a list of selected sentences in document order.