allennlp.modules.text_field_embedders.basic_text_field_embedder#

BasicTextFieldEmbedder#

BasicTextFieldEmbedder(
    self,
    token_embedders: Dict[str, allennlp.modules.token_embedders.token_embedder.TokenEmbedder],
) -> None

This is a TextFieldEmbedder that wraps a collection of TokenEmbedder objects. Each TokenEmbedder embeds or encodes the representation output from one allennlp.data.TokenIndexer. As the data produced by a allennlp.data.fields.TextField is a dictionary mapping names to these representations, we take TokenEmbedders with corresponding names. Each TokenEmbedders embeds its input, and the result is concatenated in an arbitrary (but consistent) order.

Registered as a TextFieldEmbedder with name "basic", which is also the default.

Parameters

  • token_embedders : Dict[str, TokenEmbedder], required. A dictionary mapping token embedder names to implementations. These names should match the corresponding indexer used to generate the tensor passed to the TokenEmbedder.

get_output_dim#

BasicTextFieldEmbedder.get_output_dim(self) -> int

Returns the dimension of the vector representing each token in the output of this TextFieldEmbedder. This is not the shape of the returned tensor, but the last element of that shape.