Skip to content

edsnlp.pipes.trainable.embeddings.span_pooler.factory

create_component = registry.factory.register('eds.span_pooler', assigns=[], deprecated=[])(SpanPooler) module-attribute [source]

The eds.span_pooler component is a trainable span embedding component. It generates span embeddings from a word embedding component and a span getter. It can be used to train a span classifier, as in eds.span_classifier.

Parameters

PARAMETER DESCRIPTION
nlp

The pipeline object

name

Name of the component

embedding

The word embedding component

TYPE: WordEmbeddingComponent

pooling_mode

How word embeddings are aggregated into a single embedding per span:

  • "max": max pooling
  • "sum": sum pooling
  • "mean": mean pooling
  • "attention": attention pooling, where attention scores are computed using a linear layer followed by a softmax over the tokens in the span.

DEFAULT: mean

hidden_size

The size of the hidden layer. If None, no projection is done and the output of the span pooler is used directly.

TYPE: Optional[int] DEFAULT: None