Nasty.Semantic.Coreference.Neural.E2EResolver (Nasty v0.3.0)

View Source

End-to-end coreference resolver using span-based models.

Performs joint mention detection and coreference resolution without requiring a separate mention detection stage.

Workflow

  1. Encode document with BiLSTM
  2. Enumerate and score candidate spans
  3. Prune to top-K spans (mentions)
  4. Score pairwise coreference between spans
  5. Build coreference chains using clustering

Example

# Load trained models
{:ok, models, params, vocab} = E2ETrainer.load_models("priv/models/en/e2e_coref")

# Resolve coreferences
{:ok, document} = E2EResolver.resolve(document, models, params, vocab)

# Access chains
chains = document.coref_chains

Summary

Functions

Resolve coreferences using end-to-end span model.

Resolve with automatic model loading.

Types

Functions

resolve(document, models, params, vocab, opts \\ [])

@spec resolve(Nasty.AST.Document.t(), models(), params(), map(), keyword()) ::
  {:ok, Nasty.AST.Document.t()} | {:error, term()}

Resolve coreferences using end-to-end span model.

Parameters

  • document - Document to resolve
  • models - Trained e2e models
  • params - Model parameters
  • vocab - Vocabulary map
  • opts - Resolution options

Options

  • :max_span_length - Maximum span length (default: 10)
  • :top_k_spans - Top K spans to keep (default: 50)
  • :min_span_score - Minimum span score threshold (default: 0.5)
  • :min_coref_score - Minimum coreference score threshold (default: 0.5)

Returns

  • {:ok, document} - Document with coreference chains
  • {:error, reason} - Resolution error

resolve_auto(document, model_path, opts \\ [])

@spec resolve_auto(Nasty.AST.Document.t(), Path.t(), keyword()) ::
  {:ok, Nasty.AST.Document.t()} | {:error, term()}

Resolve with automatic model loading.

Convenience function that loads models from disk if path is provided.

Parameters

  • document - Document to resolve
  • model_path - Path to saved models
  • opts - Resolution options

Returns

  • {:ok, document} - Document with coreference chains
  • {:error, reason} - Resolution error