Nasty.AST.Semantic.CorefChain (Nasty v0.3.0)

View Source

Coreference chain linking mentions that refer to the same entity.

A chain contains all mentions of an entity throughout a document, along with a representative mention (typically the first proper name or most informative noun phrase).

Summary

Functions

Finds mention at a specific sentence index.

Returns the first mention in the chain.

Returns the last mention in the chain.

Counts mentions in the chain.

Creates a new coreference chain.

Selects the best representative mention from a list.

Types

t()

@type t() :: %Nasty.AST.Semantic.CorefChain{
  entity_type: atom() | nil,
  id: pos_integer(),
  mentions: [Nasty.AST.Semantic.Mention.t()],
  representative: String.t()
}

Functions

find_mention_at(coref_chain, sentence_idx)

@spec find_mention_at(t(), non_neg_integer()) :: [Nasty.AST.Semantic.Mention.t()]

Finds mention at a specific sentence index.

first_mention(coref_chain)

@spec first_mention(t()) :: Nasty.AST.Semantic.Mention.t() | nil

Returns the first mention in the chain.

last_mention(coref_chain)

@spec last_mention(t()) :: Nasty.AST.Semantic.Mention.t() | nil

Returns the last mention in the chain.

mention_count(coref_chain)

@spec mention_count(t()) :: non_neg_integer()

Counts mentions in the chain.

new(id, mentions, representative, opts \\ [])

Creates a new coreference chain.

select_representative(mentions)

@spec select_representative([Nasty.AST.Semantic.Mention.t()]) :: String.t()

Selects the best representative mention from a list.

Preference order:

  1. First proper name
  2. Longest definite NP
  3. First mention