Nasty.Semantic.CoreferenceResolution behaviour (Nasty v0.3.0)
View SourceBehaviour for language-agnostic coreference resolution.
Coreference resolution identifies when different expressions in text refer to the same entity (e.g., "Mary" and "she" referring to the same person).
Summary
Callbacks
Returns resolution algorithms supported by this implementation.
Resolves coreferences in a document.
Types
@type options() :: keyword()
Callbacks
@callback algorithms() :: [atom()]
Returns resolution algorithms supported by this implementation.
@callback resolve(document :: Nasty.AST.Document.t(), opts :: options()) :: {:ok, Nasty.AST.Document.t()} | {:error, term()}
Resolves coreferences in a document.
Identifies coreference chains linking mentions that refer to the same entity.
Parameters
document- Document AST to processopts- Resolution options:algorithm- Resolution algorithm (:rule_based,:statistical):max_distance- Maximum sentence distance for coreference
Returns
{:ok, document}- Document withcoref_chainspopulated{:error, reason}- Resolution error
Examples
iex> doc = parse("Mary loves her cat. She feeds it daily.")
iex> {:ok, resolved} = Resolver.resolve(doc)
iex> resolved.coref_chains
[
%CorefChain{mentions: [mention1, mention2], entity_type: :person},
%CorefChain{mentions: [mention3, mention4], entity_type: :animal}
]