Skip to content

Extraction

actantial.extract.extract_actants(input_text, backend, prompt_template, actor_labels=None, object_labels=None, **template_kwargs)

Extract actantial roles from a text using an LLM backend.

Renders the prompt template with the input text and optional label constraints, then passes the result to the backend for generation. Central function of the pipeline, called by the runner for each text.

Parameters:

Name Type Description Default
input_text str

The text to annotate.

required
backend LLMBackend

An initialised LLMBackend instance.

required
prompt_template Template

A Jinja2 template that accepts a text variable at minimum. For closed-set annotation, the template can also accept actor_labels and object_labels.

required
actor_labels Optional[list]

Predefined list of actor labels for closed-set annotation. Only used if the template supports this variable.

None
object_labels Optional[list]

Predefined list of object labels for closed-set annotation. Only used if the template supports this variable.

None

Returns:

Type Description
str

The raw text output from the backend, typically a JSON string mapping each actant role to its extracted value.