neuralset.extractors.text.SpacyEmbedding

pydantic model neuralset.extractors.text.SpacyEmbedding[source][source]

Get word embedding from spacy.

Parameters:
  • model_name (str) – Explicit spacy model name (e.g. "en_core_web_sm"). Mutually exclusive with language.

  • language (str) – Language name or ISO code (e.g. "english", "fr"). Resolved to a default spacy model via get_spacy_model(). Mutually exclusive with model_name. If neither is set, language is read from events.

Fields:
field event_types: Literal['Word'] = 'Word'[source]
requirements: ClassVar[tuple[str, ...]] = ('rapidfuzz', 'rapidfuzz', 'spacy>=3.8.2')[source]
field model_name: str = ''[source]
field language: str = ''[source]
prepare(obj: DataFrame | Sequence[Event] | Sequence[Segment]) → None[source][source]

Pre-compute and cache extractor data for a collection of events.

This method triggers _get_data on every matching event so that expensive computation (e.g. model inference) is done once and cached. It then calls the extractor on a single event to populate the output shape, which is needed when allow_missing=True.

Call prepare before using the extractor in a dataloader.

Parameters:

obj (DataFrame or sequence of Event or sequence of Segment) – The structure containing the events. When calling prepare on several objects, prefer passing a list of events or segments over a DataFrame to avoid redundant conversion overhead.

get_embedding(text: str, language: str = '') → ndarray[source][source]