Nasty.Semantic.SRL.Labeler (Nasty v0.3.0)

View Source

Generic coordinator for Semantic Role Labeling.

Orchestrates the SRL pipeline:

  1. Identify predicates (main verbs)
  2. Detect voice (active/passive)
  3. Extract core argument roles
  4. Classify adjunct roles
  5. Build semantic frames

Language-specific patterns are provided via configuration.

Summary

Types

Combined language configuration for SRL.

Functions

Labels semantic roles for all predicates in a sentence.

Labels semantic roles for a single clause.

Types

language_config()

@type language_config() :: %{
  passive_auxiliary?: (Nasty.AST.Token.t() -> boolean()),
  passive_participle?: (Nasty.AST.Token.t() -> boolean()),
  temporal_adverb?: (String.t() -> boolean()),
  preposition_role_map: (%{} -> map())
}

Combined language configuration for SRL.

Includes all callbacks needed for predicate detection, core role mapping, and adjunct classification.

Functions

label(sentence, config, opts \\ [])

@spec label(Nasty.AST.Sentence.t(), language_config(), keyword()) ::
  {:ok, [Nasty.AST.Semantic.Frame.t()]} | {:error, term()}

Labels semantic roles for all predicates in a sentence.

Returns {:ok, frames} where frames is a list of semantic frames, one per predicate in the sentence.

label_clause(clause, config)

Labels semantic roles for a single clause.

Returns a list of frames (typically one per main verb in the clause).