Nasty.Semantic.SRL.Labeler (Nasty v0.3.0)
View SourceGeneric coordinator for Semantic Role Labeling.
Orchestrates the SRL pipeline:
- Identify predicates (main verbs)
- Detect voice (active/passive)
- Extract core argument roles
- Classify adjunct roles
- 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
@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
@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.
@spec label_clause(Nasty.AST.Clause.t(), language_config()) :: [ Nasty.AST.Semantic.Frame.t() ]
Labels semantic roles for a single clause.
Returns a list of frames (typically one per main verb in the clause).