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

View Source

Extracts events from documents using semantic role labeling and temporal expressions.

Events are identified by trigger verbs or nominalizations, with participants extracted from semantic roles and temporal information from date/time expressions.

Examples

iex> {:ok, events} = EventExtractor.extract(document)
{:ok, [
  %Event{
    type: :business_acquisition,
    trigger: %Token{text: "acquired"},
    participants: %{agent: google, patient: youtube},
    time: "October 2006"
  },
  ...
]}

Summary

Functions

Extracts events from a document.

Functions

extract(document, opts \\ [])

@spec extract(
  Nasty.AST.Document.t(),
  keyword()
) :: {:ok, [Nasty.AST.Event.t()]}

Extracts events from a document.

Options

  • :min_confidence - Minimum confidence threshold (default: 0.5)
  • :max_events - Maximum events to return (default: unlimited)
  • :event_types - List of event types to extract (default: all)

Examples

iex> EventExtractor.extract(document, min_confidence: 0.7)
{:ok, [%Event{confidence: 0.9}, ...]}